@singapore-editor/lsp 0.1.1 → 0.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +37 -10
- package/dist/capabilities.d.ts.map +1 -1
- package/dist/capabilities.js +1 -2
- package/dist/capabilities.js.map +1 -1
- package/dist/client.d.ts +4 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +124 -46
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/performanceDiagnostics.js +1 -2
- package/dist/performanceDiagnostics.js.map +1 -1
- package/dist/positions.d.ts.map +1 -1
- package/dist/positions.js +1 -2
- package/dist/positions.js.map +1 -1
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +1 -2
- package/dist/protocol.js.map +1 -1
- package/dist/semanticTokens.js +1 -2
- package/dist/semanticTokens.js.map +1 -1
- package/dist/transports.d.ts.map +1 -1
- package/dist/transports.js +36 -8
- package/dist/transports.js.map +1 -1
- package/dist/types.d.ts +18 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/workspace.d.ts +14 -3
- package/dist/workspace.d.ts.map +1 -1
- package/dist/workspace.js +109 -29
- package/dist/workspace.js.map +1 -1
- package/dist/workspaceFactory.js +1 -2
- package/dist/workspaceFactory.js.map +1 -1
- package/package.json +23 -5
package/dist/workspace.js
CHANGED
|
@@ -1,12 +1,44 @@
|
|
|
1
1
|
import { registerDefaultLspWorkspaceFactory } from "./workspaceFactory.js";
|
|
2
|
-
|
|
2
|
+
// src/workspace.ts
|
|
3
3
|
var LspWorkspace = class {
|
|
4
4
|
attachments = /* @__PURE__ */ new Map();
|
|
5
5
|
documentsByUri = /* @__PURE__ */ new Map();
|
|
6
6
|
versionsByUri = /* @__PURE__ */ new Map();
|
|
7
7
|
client = null;
|
|
8
|
+
sourceReadiness = /* @__PURE__ */ new Map();
|
|
9
|
+
registerDocumentSource(registration) {
|
|
10
|
+
const entries = this.sourceReadiness.get(registration.uri) ?? /* @__PURE__ */ new Set();
|
|
11
|
+
entries.add(registration);
|
|
12
|
+
this.sourceReadiness.set(registration.uri, entries);
|
|
13
|
+
return () => {
|
|
14
|
+
entries.delete(registration);
|
|
15
|
+
if (entries.size === 0) this.sourceReadiness.delete(registration.uri);
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
prepareDocumentRequest(uri, signal) {
|
|
19
|
+
const entries = this.sourceReadiness.get(uri);
|
|
20
|
+
if (!entries?.size) return { kind: "unmanaged" };
|
|
21
|
+
const groups = /* @__PURE__ */ new Map();
|
|
22
|
+
for (const entry of entries) {
|
|
23
|
+
const prepared = entry.prepare();
|
|
24
|
+
if (prepared instanceof Promise) prepared.catch(() => void 0);
|
|
25
|
+
const peers = groups.get(entry.runtimeSessionId) ?? [];
|
|
26
|
+
peers.push(prepared);
|
|
27
|
+
groups.set(entry.runtimeSessionId, peers);
|
|
28
|
+
}
|
|
29
|
+
const reads = Array.from(groups.values(), currentSourcePeer);
|
|
30
|
+
if (reads.every((read) => read !== null)) return {
|
|
31
|
+
kind: "ready",
|
|
32
|
+
read: requireCurrentSource(reads)
|
|
33
|
+
};
|
|
34
|
+
const ready = Promise.all(Array.from(groups.values(), waitForSourcePeer)).then(requireCurrentSource);
|
|
35
|
+
return {
|
|
36
|
+
kind: "pending",
|
|
37
|
+
ready: signal ? waitForSourceSignal(ready, signal) : ready
|
|
38
|
+
};
|
|
39
|
+
}
|
|
8
40
|
get documents() {
|
|
9
|
-
return Array.from(this.documentsByUri.values()
|
|
41
|
+
return Array.from(this.documentsByUri.values(), cloneDocument);
|
|
10
42
|
}
|
|
11
43
|
attachClient(client) {
|
|
12
44
|
this.client = client;
|
|
@@ -23,12 +55,12 @@ var LspWorkspace = class {
|
|
|
23
55
|
sourceSegment: options.sourceSegment,
|
|
24
56
|
textSnapshot: options.textSnapshot,
|
|
25
57
|
uri: options.uri,
|
|
26
|
-
version: this.
|
|
58
|
+
version: this.nextVersion(options.uri, 1)
|
|
27
59
|
};
|
|
28
|
-
this.documentsByUri.set(options.uri, document);
|
|
29
|
-
const result = this.attachDocument(document, options.onDocumentTransition);
|
|
30
60
|
this.client?.didOpenDocument(cloneDocument(document));
|
|
31
|
-
|
|
61
|
+
this.versionsByUri.set(options.uri, document.version);
|
|
62
|
+
this.documentsByUri.set(options.uri, document);
|
|
63
|
+
return this.attachDocument(document, options.onDocumentTransition);
|
|
32
64
|
}
|
|
33
65
|
updateDocumentSnapshot(uri, options) {
|
|
34
66
|
const document = this.requireDocument(uri);
|
|
@@ -37,18 +69,23 @@ var LspWorkspace = class {
|
|
|
37
69
|
if (sameSourceTuple(document, options)) return adoptDuplicateSource(document, options);
|
|
38
70
|
if (options.logicalRevisionCount === 0) throw new Error("A new LSP document source requires a positive logical revision count.");
|
|
39
71
|
assertForwardSourcePoint(document, options);
|
|
40
|
-
const nextVersion = this.
|
|
72
|
+
const nextVersion = this.nextVersion(uri, options.logicalRevisionCount);
|
|
41
73
|
const previousSnapshot = documentSnapshot(document);
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
74
|
+
const nextDocument = {
|
|
75
|
+
...document,
|
|
76
|
+
textSnapshot: options.textSnapshot,
|
|
77
|
+
lineStarts: options.lineStarts,
|
|
78
|
+
sourceLogicalRevisionCount: options.logicalRevisionCount,
|
|
79
|
+
sourceRevision: options.sourceRevision,
|
|
80
|
+
sourceSegment: options.sourceSegment,
|
|
81
|
+
version: nextVersion
|
|
82
|
+
};
|
|
83
|
+
this.client?.didChangeDocument(cloneDocument(nextDocument), {
|
|
49
84
|
edits: options.edits ?? [],
|
|
50
85
|
previousSnapshot
|
|
51
86
|
});
|
|
87
|
+
Object.assign(document, nextDocument);
|
|
88
|
+
this.versionsByUri.set(uri, nextVersion);
|
|
52
89
|
return cloneDocument(document);
|
|
53
90
|
}
|
|
54
91
|
adoptUnchangedDocumentSource(uri, options) {
|
|
@@ -70,21 +107,25 @@ var LspWorkspace = class {
|
|
|
70
107
|
assertTransitionTargetAvailable(this.documentsByUri.get(options.uri), document, options.uri);
|
|
71
108
|
assertTransitionSourcePoint(document, options);
|
|
72
109
|
if (document.sourceSegment === options.sourceSegment) throw new Error("An LSP document URI transition requires a rotated source segment.");
|
|
73
|
-
const nextVersion = this.
|
|
110
|
+
const nextVersion = this.nextVersion(options.uri, 1);
|
|
74
111
|
const previousDocument = cloneDocument(document);
|
|
112
|
+
const nextState = {
|
|
113
|
+
uri: options.uri,
|
|
114
|
+
languageId: options.languageId,
|
|
115
|
+
textSnapshot: options.textSnapshot,
|
|
116
|
+
lineStarts: options.lineStarts,
|
|
117
|
+
sourceLogicalRevisionCount: 0,
|
|
118
|
+
sourceRevision: options.sourceRevision,
|
|
119
|
+
sourceSegment: options.sourceSegment,
|
|
120
|
+
version: nextVersion
|
|
121
|
+
};
|
|
122
|
+
const nextDocument = cloneDocument(nextState);
|
|
75
123
|
this.client?.didCloseDocument(previousDocument);
|
|
124
|
+
this.client?.didOpenDocument(nextDocument);
|
|
76
125
|
this.documentsByUri.delete(document.uri);
|
|
77
|
-
document
|
|
78
|
-
|
|
79
|
-
document.textSnapshot = options.textSnapshot;
|
|
80
|
-
document.lineStarts = options.lineStarts;
|
|
81
|
-
document.sourceLogicalRevisionCount = 0;
|
|
82
|
-
document.sourceRevision = options.sourceRevision;
|
|
83
|
-
document.sourceSegment = options.sourceSegment;
|
|
84
|
-
document.version = nextVersion;
|
|
126
|
+
Object.assign(document, nextState);
|
|
127
|
+
this.versionsByUri.set(options.uri, nextVersion);
|
|
85
128
|
this.documentsByUri.set(options.uri, document);
|
|
86
|
-
const nextDocument = cloneDocument(document);
|
|
87
|
-
this.client?.didOpenDocument(nextDocument);
|
|
88
129
|
this.notifyTransitionedAttachments(document, options.sourceTextVersion);
|
|
89
130
|
return {
|
|
90
131
|
document: nextDocument,
|
|
@@ -100,6 +141,17 @@ var LspWorkspace = class {
|
|
|
100
141
|
this.client?.didCloseDocument(cloneDocument(record.document));
|
|
101
142
|
}
|
|
102
143
|
saveDocument(uri) {
|
|
144
|
+
const ready = this.prepareDocumentRequest(uri);
|
|
145
|
+
if (ready.kind === "pending") return ready.ready.then((read) => this.savePreparedDocument(read));
|
|
146
|
+
if (ready.kind === "ready") this.savePreparedDocument(ready.read);
|
|
147
|
+
else this.saveAcceptedDocument(uri);
|
|
148
|
+
return Promise.resolve();
|
|
149
|
+
}
|
|
150
|
+
savePreparedDocument(read) {
|
|
151
|
+
if (!read.isCurrent()) throw new DOMException("Language-server save source was retired", "AbortError");
|
|
152
|
+
this.client?.didSaveDocument(read.document);
|
|
153
|
+
}
|
|
154
|
+
saveAcceptedDocument(uri) {
|
|
103
155
|
const document = this.documentsByUri.get(uri);
|
|
104
156
|
if (!document) return;
|
|
105
157
|
this.client?.didSaveDocument(cloneDocument(document));
|
|
@@ -152,10 +204,9 @@ var LspWorkspace = class {
|
|
|
152
204
|
for (const record of this.attachments.values()) if (record.document === document) return true;
|
|
153
205
|
return false;
|
|
154
206
|
}
|
|
155
|
-
|
|
207
|
+
nextVersion(uri, count) {
|
|
156
208
|
const version = (this.versionsByUri.get(uri) ?? -1) + count;
|
|
157
209
|
if (!Number.isSafeInteger(version) || version < 0) throw new RangeError(`LSP document version exceeds the safe integer range: ${uri}`);
|
|
158
|
-
this.versionsByUri.set(uri, version);
|
|
159
210
|
return version;
|
|
160
211
|
}
|
|
161
212
|
requireDocument(uri) {
|
|
@@ -169,13 +220,43 @@ var LspWorkspace = class {
|
|
|
169
220
|
throw new Error("LSP workspace document attachment is closed or belongs to another workspace.");
|
|
170
221
|
}
|
|
171
222
|
};
|
|
223
|
+
function currentSourcePeer(peers) {
|
|
224
|
+
return peers.find((read) => !(read instanceof Promise) && read.isCurrent()) ?? null;
|
|
225
|
+
}
|
|
226
|
+
async function waitForSourcePeer(peers) {
|
|
227
|
+
const results = await Promise.allSettled(peers);
|
|
228
|
+
const accepted = results.find((result) => result.status === "fulfilled" && result.value.isCurrent());
|
|
229
|
+
if (accepted) return accepted.value;
|
|
230
|
+
const rejected = results.find((result) => result.status === "rejected");
|
|
231
|
+
if (rejected?.status === "rejected") throw rejected.reason;
|
|
232
|
+
throw new DOMException("Language-server source interest was retired", "AbortError");
|
|
233
|
+
}
|
|
234
|
+
function requireCurrentSource(reads) {
|
|
235
|
+
const first = reads[0];
|
|
236
|
+
const isCurrent = () => reads.every((read) => read !== null && read.isCurrent());
|
|
237
|
+
if (!first || !isCurrent()) throw new DOMException("Language-server source was superseded", "AbortError");
|
|
238
|
+
return {
|
|
239
|
+
document: first.document,
|
|
240
|
+
isCurrent
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
function waitForSourceSignal(ready, signal) {
|
|
244
|
+
return new Promise((resolve, reject) => {
|
|
245
|
+
const abort = () => reject(signal.reason);
|
|
246
|
+
if (signal.aborted) abort();
|
|
247
|
+
else signal.addEventListener("abort", abort, { once: true });
|
|
248
|
+
ready.then(resolve, reject).finally(() => signal.removeEventListener("abort", abort));
|
|
249
|
+
});
|
|
250
|
+
}
|
|
172
251
|
function cloneDocument(document) {
|
|
173
252
|
return {
|
|
174
253
|
uri: document.uri,
|
|
175
254
|
languageId: document.languageId,
|
|
176
255
|
version: document.version,
|
|
177
256
|
textSnapshot: document.textSnapshot,
|
|
178
|
-
lineStarts: document.lineStarts
|
|
257
|
+
lineStarts: document.lineStarts,
|
|
258
|
+
sourceRevision: document.sourceRevision,
|
|
259
|
+
sourceSegment: document.sourceSegment
|
|
179
260
|
};
|
|
180
261
|
}
|
|
181
262
|
function documentSnapshot(document) {
|
|
@@ -242,7 +323,6 @@ function arrayRowForOffset(lineStarts, offset) {
|
|
|
242
323
|
return row;
|
|
243
324
|
}
|
|
244
325
|
registerDefaultLspWorkspaceFactory(() => new LspWorkspace());
|
|
245
|
-
//#endregion
|
|
246
326
|
export { LspWorkspace, arrayLspLineStarts };
|
|
247
327
|
|
|
248
328
|
//# sourceMappingURL=workspace.js.map
|
package/dist/workspace.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace.js","names":[],"sources":["../src/workspace.ts"],"sourcesContent":["import type * as lsp from 'vscode-languageserver-protocol'\nimport type {\n LspDocument,\n LspDocumentOpenSnapshotOptions,\n LspDocumentOpenSnapshotResult,\n LspDocumentTransitionOptions,\n LspDocumentTransitionNotification,\n LspDocumentTransitionResult,\n LspLineStarts,\n LspTextDocumentSnapshot,\n LspTextSnapshot,\n LspWorkspaceDocumentAttachment,\n LspWorkspaceSnapshotEditOptions,\n LspWorkspaceSyncTarget,\n LspWorkspaceUnchangedSourceOptions,\n} from './types'\nimport { registerDefaultLspWorkspaceFactory } from './workspaceFactory'\n\ntype MutableLspDocument = {\n languageId: string\n lineStarts: LspLineStarts\n sourceLogicalRevisionCount: number\n sourceRevision: number\n sourceSegment: object\n textSnapshot: LspTextSnapshot\n uri: lsp.DocumentUri\n version: number\n}\n\ntype WorkspaceDocumentAttachmentRecord = {\n readonly document: MutableLspDocument\n readonly onDocumentTransition?: (transition: LspDocumentTransitionNotification) => void\n}\n\nexport class LspWorkspace {\n private readonly attachments = new Map<\n LspWorkspaceDocumentAttachment,\n WorkspaceDocumentAttachmentRecord\n >()\n private readonly documentsByUri = new Map<lsp.DocumentUri, MutableLspDocument>()\n private readonly versionsByUri = new Map<lsp.DocumentUri, number>()\n private client: LspWorkspaceSyncTarget | null = null\n\n public get documents(): readonly LspDocument[] {\n return Array.from(this.documentsByUri.values()).map(cloneDocument)\n }\n\n public attachClient(client: LspWorkspaceSyncTarget): void {\n this.client = client\n }\n\n public openDocumentSnapshot(\n options: LspDocumentOpenSnapshotOptions,\n ): LspDocumentOpenSnapshotResult {\n assertSourceRevision(options.sourceRevision)\n const open = this.documentsByUri.get(options.uri)\n if (open) return this.attachOpenDocument(open, options)\n\n const document: MutableLspDocument = {\n languageId: options.languageId,\n lineStarts: options.lineStarts,\n sourceLogicalRevisionCount: 0,\n sourceRevision: options.sourceRevision,\n sourceSegment: options.sourceSegment,\n textSnapshot: options.textSnapshot,\n uri: options.uri,\n version: this.advanceVersion(options.uri, 1),\n }\n this.documentsByUri.set(options.uri, document)\n const result = this.attachDocument(document, options.onDocumentTransition)\n this.client?.didOpenDocument(cloneDocument(document))\n return result\n }\n\n public updateDocumentSnapshot(\n uri: lsp.DocumentUri,\n options: LspWorkspaceSnapshotEditOptions,\n ): LspDocument {\n const document = this.requireDocument(uri)\n assertLogicalRevisionCount(options.logicalRevisionCount)\n assertSourceRevision(options.sourceRevision)\n if (sameSourceTuple(document, options)) return adoptDuplicateSource(document, options)\n if (options.logicalRevisionCount === 0) {\n throw new Error('A new LSP document source requires a positive logical revision count.')\n }\n assertForwardSourcePoint(document, options)\n\n const nextVersion = this.advanceVersion(uri, options.logicalRevisionCount)\n const previousSnapshot = documentSnapshot(document)\n document.textSnapshot = options.textSnapshot\n document.lineStarts = options.lineStarts\n document.sourceLogicalRevisionCount = options.logicalRevisionCount\n document.sourceRevision = options.sourceRevision\n document.sourceSegment = options.sourceSegment\n document.version = nextVersion\n this.client?.didChangeDocument(cloneDocument(document), {\n edits: options.edits ?? [],\n previousSnapshot,\n })\n return cloneDocument(document)\n }\n\n public adoptUnchangedDocumentSource(\n uri: lsp.DocumentUri,\n options: LspWorkspaceUnchangedSourceOptions,\n ): LspDocument {\n const document = this.requireDocument(uri)\n assertSourceRevision(options.sourceRevision)\n if (options.textSnapshot !== document.textSnapshot) {\n throw new Error('An unchanged LSP source must retain the exact workspace text snapshot.')\n }\n if (sameSourceTuple(document, options)) return cloneDocument(document)\n assertForwardSourcePoint(document, options)\n\n document.sourceRevision = options.sourceRevision\n document.sourceSegment = options.sourceSegment\n document.sourceLogicalRevisionCount = 0\n return cloneDocument(document)\n }\n\n public transitionDocumentUri(\n attachment: LspWorkspaceDocumentAttachment,\n options: LspDocumentTransitionOptions,\n ): LspDocumentTransitionResult {\n const record = this.requireAttachment(attachment)\n const document = record.document\n if (document.uri === options.uri) return this.adoptCompletedTransition(document, options)\n\n assertSourceRevision(options.sourceRevision)\n assertSourceTextVersion(options.sourceTextVersion)\n assertTransitionTargetAvailable(this.documentsByUri.get(options.uri), document, options.uri)\n assertTransitionSourcePoint(document, options)\n if (document.sourceSegment === options.sourceSegment) {\n throw new Error('An LSP document URI transition requires a rotated source segment.')\n }\n\n const nextVersion = this.advanceVersion(options.uri, 1)\n const previousDocument = cloneDocument(document)\n this.client?.didCloseDocument(previousDocument)\n this.documentsByUri.delete(document.uri)\n document.uri = options.uri\n document.languageId = options.languageId\n document.textSnapshot = options.textSnapshot\n document.lineStarts = options.lineStarts\n document.sourceLogicalRevisionCount = 0\n document.sourceRevision = options.sourceRevision\n document.sourceSegment = options.sourceSegment\n document.version = nextVersion\n this.documentsByUri.set(options.uri, document)\n\n const nextDocument = cloneDocument(document)\n this.client?.didOpenDocument(nextDocument)\n this.notifyTransitionedAttachments(document, options.sourceTextVersion)\n return { document: nextDocument, previousDocument }\n }\n\n public closeDocument(attachment: LspWorkspaceDocumentAttachment): void {\n const record = this.attachments.get(attachment)\n if (!record) return\n\n this.attachments.delete(attachment)\n if (this.hasAttachment(record.document)) return\n\n this.documentsByUri.delete(record.document.uri)\n this.client?.didCloseDocument(cloneDocument(record.document))\n }\n\n public saveDocument(uri: lsp.DocumentUri): void {\n const document = this.documentsByUri.get(uri)\n if (!document) return\n this.client?.didSaveDocument(cloneDocument(document))\n }\n\n public getDocument(uri: lsp.DocumentUri): LspDocument | null {\n const document = this.documentsByUri.get(uri)\n return document ? cloneDocument(document) : null\n }\n\n public connected(): void {\n for (const document of this.documentsByUri.values()) {\n this.client?.didOpenDocument(cloneDocument(document))\n }\n }\n\n public disconnected(): void {\n return\n }\n\n private attachOpenDocument(\n document: MutableLspDocument,\n options: LspDocumentOpenSnapshotOptions,\n ): LspDocumentOpenSnapshotResult {\n if (document.languageId !== options.languageId) {\n throw new Error(\n `LSP document open as ${document.languageId}, reopened as ${options.languageId}: ${options.uri}`,\n )\n }\n if (!sameSourceTuple(document, options) || document.textSnapshot !== options.textSnapshot) {\n throw new Error('A second LSP document attachment must adopt the exact shared source point.')\n }\n return this.attachDocument(document, options.onDocumentTransition)\n }\n\n private attachDocument(\n document: MutableLspDocument,\n onDocumentTransition: ((transition: LspDocumentTransitionNotification) => void) | undefined,\n ): LspDocumentOpenSnapshotResult {\n const attachment = Object.freeze({}) as LspWorkspaceDocumentAttachment\n this.attachments.set(attachment, { document, onDocumentTransition })\n return { attachment, document: cloneDocument(document) }\n }\n\n private adoptCompletedTransition(\n document: MutableLspDocument,\n options: LspDocumentTransitionOptions,\n ): LspDocumentTransitionResult {\n if (document.languageId !== options.languageId) {\n throw new Error('An adopted LSP URI transition must retain the shared language identifier.')\n }\n if (document.textSnapshot !== options.textSnapshot || !sameSourceTuple(document, options)) {\n throw new Error('An adopted LSP URI transition must retain the exact shared source point.')\n }\n\n const current = cloneDocument(document)\n return { document: current, previousDocument: current }\n }\n\n private notifyTransitionedAttachments(\n document: MutableLspDocument,\n sourceTextVersion: number,\n ): void {\n for (const record of this.attachments.values()) {\n if (record.document !== document) continue\n record.onDocumentTransition?.({\n document: cloneDocument(document),\n sourceRevision: document.sourceRevision,\n sourceSegment: document.sourceSegment,\n sourceTextVersion,\n })\n }\n }\n\n private hasAttachment(document: MutableLspDocument): boolean {\n for (const record of this.attachments.values()) {\n if (record.document === document) return true\n }\n return false\n }\n\n private advanceVersion(uri: lsp.DocumentUri, count: number): number {\n const version = (this.versionsByUri.get(uri) ?? -1) + count\n if (!Number.isSafeInteger(version) || version < 0) {\n throw new RangeError(`LSP document version exceeds the safe integer range: ${uri}`)\n }\n this.versionsByUri.set(uri, version)\n return version\n }\n\n private requireDocument(uri: lsp.DocumentUri): MutableLspDocument {\n const document = this.documentsByUri.get(uri)\n if (document) return document\n throw new Error(`LSP document is not open: ${uri}`)\n }\n\n private requireAttachment(\n attachment: LspWorkspaceDocumentAttachment,\n ): WorkspaceDocumentAttachmentRecord {\n const record = this.attachments.get(attachment)\n if (record) return record\n throw new Error('LSP workspace document attachment is closed or belongs to another workspace.')\n }\n}\n\nfunction cloneDocument(document: MutableLspDocument): LspDocument {\n return {\n uri: document.uri,\n languageId: document.languageId,\n version: document.version,\n textSnapshot: document.textSnapshot,\n lineStarts: document.lineStarts,\n }\n}\n\nfunction documentSnapshot(document: MutableLspDocument): LspTextDocumentSnapshot {\n return {\n textSnapshot: document.textSnapshot,\n lineStarts: document.lineStarts,\n }\n}\n\nfunction sameSourceTuple(\n document: MutableLspDocument,\n source: { readonly sourceRevision: number; readonly sourceSegment: object },\n): boolean {\n return (\n document.sourceRevision === source.sourceRevision &&\n document.sourceSegment === source.sourceSegment\n )\n}\n\nfunction adoptDuplicateSource(\n document: MutableLspDocument,\n options: LspWorkspaceSnapshotEditOptions,\n): LspDocument {\n if (document.textSnapshot !== options.textSnapshot) {\n throw new Error('A duplicate LSP source tuple must retain the exact text snapshot.')\n }\n if (\n options.logicalRevisionCount !== 0 &&\n options.logicalRevisionCount !== document.sourceLogicalRevisionCount\n ) {\n throw new Error('A duplicate LSP source tuple must retain its logical revision count.')\n }\n return cloneDocument(document)\n}\n\nfunction assertForwardSourcePoint(\n document: MutableLspDocument,\n source: { readonly sourceRevision: number; readonly sourceSegment: object },\n): void {\n if (document.sourceSegment !== source.sourceSegment) return\n if (source.sourceRevision > document.sourceRevision) return\n throw new Error('An LSP source revision must advance within one source segment.')\n}\n\nfunction assertLogicalRevisionCount(count: number): void {\n if (Number.isSafeInteger(count) && count >= 0) return\n throw new RangeError('logicalRevisionCount must be a safe non-negative integer.')\n}\n\nfunction assertSourceRevision(revision: number): void {\n if (Number.isSafeInteger(revision) && revision >= 0) return\n throw new RangeError('sourceRevision must be a safe non-negative integer.')\n}\n\nfunction assertSourceTextVersion(version: number): void {\n if (Number.isSafeInteger(version) && version >= 0) return\n throw new RangeError('sourceTextVersion must be a safe non-negative integer.')\n}\n\nfunction assertTransitionTargetAvailable(\n target: MutableLspDocument | undefined,\n source: MutableLspDocument,\n uri: lsp.DocumentUri,\n): void {\n if (!target || target === source) return\n throw new Error(`LSP document URI transition target is already open: ${uri}`)\n}\n\nfunction assertTransitionSourcePoint(\n document: MutableLspDocument,\n options: LspDocumentTransitionOptions,\n): void {\n if (document.textSnapshot !== options.textSnapshot) {\n throw new Error('An LSP document URI transition must retain the exact synchronized snapshot.')\n }\n if (document.sourceRevision === options.sourceRevision) return\n throw new Error('An LSP document URI transition must retain the synchronized source revision.')\n}\n\nexport function arrayLspLineStarts(lineStarts: readonly number[]): LspLineStarts {\n return {\n length: lineStarts.length,\n at: (index) => lineStarts[index],\n indexForOffset: (offset) => arrayRowForOffset(lineStarts, offset),\n toArray: () => lineStarts,\n }\n}\n\nfunction arrayRowForOffset(lineStarts: readonly number[], offset: number): number {\n let low = 0\n let high = lineStarts.length - 1\n let row = 0\n while (low <= high) {\n const middle = (low + high) >> 1\n if ((lineStarts[middle] ?? 0) <= offset) {\n row = middle\n low = middle + 1\n continue\n }\n high = middle - 1\n }\n return row\n}\n\nregisterDefaultLspWorkspaceFactory(() => new LspWorkspace())\n"],"mappings":";;AAkCA,IAAa,eAAb,MAA0B;CACxB,8BAA+B,IAAI,IAGjC;CACF,iCAAkC,IAAI,IAAyC;CAC/E,gCAAiC,IAAI,IAA6B;CAClE,SAAgD;CAEhD,IAAW,YAAoC;EAC7C,OAAO,MAAM,KAAK,KAAK,eAAe,OAAO,CAAC,CAAC,CAAC,IAAI,aAAa;CACnE;CAEA,aAAoB,QAAsC;EACxD,KAAK,SAAS;CAChB;CAEA,qBACE,SAC+B;EAC/B,qBAAqB,QAAQ,cAAc;EAC3C,MAAM,OAAO,KAAK,eAAe,IAAI,QAAQ,GAAG;EAChD,IAAI,MAAM,OAAO,KAAK,mBAAmB,MAAM,OAAO;EAEtD,MAAM,WAA+B;GACnC,YAAY,QAAQ;GACpB,YAAY,QAAQ;GACpB,4BAA4B;GAC5B,gBAAgB,QAAQ;GACxB,eAAe,QAAQ;GACv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P,UACA,SACM;CACN,IAAI,SAAS,iBAAiB,QAAQ,cACpC,MAAM,IAAI,MAAM,6EAA6E;CAE/F,IAAI,SAAS,mBAAmB,QAAQ,gBAAgB;CACxD,MAAM,IAAI,MAAM,8EAA8E;AAChG;AAEA,SAAgB,mBAAmB,YAA8C;CAC/E,OAAO;EACL,QAAQ,WAAW;EACnB,KAAK,UAAU,WAAW;EAC1B,iBAAiB,WAAW,kBAAkB,YAAY,MAAM;EAChE,eAAe;CACjB;AACF;AAEA,SAAS,kBAAkB,YAA+B,QAAwB;CAChF,IAAI,MAAM;CACV,IAAI,OAAO,WAAW,SAAS;CAC/B,IAAI,MAAM;CACV,OAAO,OAAO,MAAM;EAClB,MAAM,SAAU,MAAM,QAAS;EAC/B,KAAK,WAAW,WAAW,MAAM,QAAQ;GACvC,MAAM;GACN,MAAM,SAAS;GACf;EACF;EACA,OAAO,SAAS;CAClB;CACA,OAAO;AACT;AAEA,yCAAyC,IAAI,aAAa,CAAC"}
|
package/dist/workspaceFactory.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/workspaceFactory.ts
|
|
2
2
|
var defaultWorkspaceFactory = null;
|
|
3
3
|
function createDefaultLspWorkspace() {
|
|
4
4
|
if (defaultWorkspaceFactory) return defaultWorkspaceFactory();
|
|
@@ -7,7 +7,6 @@ function createDefaultLspWorkspace() {
|
|
|
7
7
|
function registerDefaultLspWorkspaceFactory(factory) {
|
|
8
8
|
defaultWorkspaceFactory = factory;
|
|
9
9
|
}
|
|
10
|
-
//#endregion
|
|
11
10
|
export { createDefaultLspWorkspace, registerDefaultLspWorkspaceFactory };
|
|
12
11
|
|
|
13
12
|
//# sourceMappingURL=workspaceFactory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspaceFactory.js","names":[],"sources":["../src/workspaceFactory.ts"],"
|
|
1
|
+
{"version":3,"file":"workspaceFactory.js","names":[],"sources":["../src/workspaceFactory.ts"],"mappings":";AAEA,IAAI,0BAAsD;AAE1D,SAAgB,4BAAgD;CAC9D,IAAI,yBAAyB,OAAO,wBAAwB;CAC5D,MAAM,IAAI,MAAM,kDAAkD;AACpE;AAEA,SAAgB,mCAAmC,SAAoC;CACrF,0BAA0B;AAC5B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@singapore-editor/lsp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.11",
|
|
4
|
+
"description": "A Language Server Protocol client with WebSocket and worker transports.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"browser",
|
|
7
|
+
"editor",
|
|
8
|
+
"json-rpc",
|
|
9
|
+
"lsp",
|
|
10
|
+
"singapore",
|
|
11
|
+
"typescript"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://singapore.shaulavo.dev/docs/reference/api/lsp/overview/",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/ShaulLavo/singapore/issues"
|
|
16
|
+
},
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/ShaulLavo/singapore.git"
|
|
21
|
+
},
|
|
4
22
|
"files": [
|
|
5
23
|
"README.md",
|
|
6
24
|
"dist"
|
|
@@ -26,12 +44,13 @@
|
|
|
26
44
|
},
|
|
27
45
|
"publishConfig": {
|
|
28
46
|
"access": "public",
|
|
47
|
+
"provenance": true,
|
|
29
48
|
"registry": "https://registry.npmjs.org/"
|
|
30
49
|
},
|
|
31
50
|
"scripts": {
|
|
32
51
|
"build": "bun ../../scripts/build-package.ts",
|
|
33
52
|
"test": "vitest run",
|
|
34
|
-
"typecheck": "
|
|
53
|
+
"typecheck": "tsc --noEmit",
|
|
35
54
|
"lint": "oxlint .",
|
|
36
55
|
"format": "oxfmt --write .",
|
|
37
56
|
"format:check": "oxfmt --check ."
|
|
@@ -41,11 +60,10 @@
|
|
|
41
60
|
},
|
|
42
61
|
"devDependencies": {
|
|
43
62
|
"@types/node": "^26.6.3",
|
|
44
|
-
"@typescript/native-preview": "7.0.0-dev.20260707.2",
|
|
45
63
|
"happy-dom": "^20.14.5",
|
|
46
64
|
"oxfmt": "0.70.0",
|
|
47
65
|
"oxlint": "1.85.0",
|
|
48
|
-
"typescript": "
|
|
49
|
-
"vitest": "
|
|
66
|
+
"typescript": "7.0.2",
|
|
67
|
+
"vitest": "5.0.2"
|
|
50
68
|
}
|
|
51
69
|
}
|