@singapore-editor/lsp 0.1.1
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/README.md +26 -0
- package/dist/capabilities.d.ts +24 -0
- package/dist/capabilities.d.ts.map +1 -0
- package/dist/capabilities.js +191 -0
- package/dist/capabilities.js.map +1 -0
- package/dist/client.d.ts +92 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +391 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/performanceDiagnostics.d.ts +5 -0
- package/dist/performanceDiagnostics.d.ts.map +1 -0
- package/dist/performanceDiagnostics.js +64 -0
- package/dist/performanceDiagnostics.js.map +1 -0
- package/dist/positions.d.ts +17 -0
- package/dist/positions.d.ts.map +1 -0
- package/dist/positions.js +268 -0
- package/dist/positions.js.map +1 -0
- package/dist/protocol.d.ts +53 -0
- package/dist/protocol.d.ts.map +1 -0
- package/dist/protocol.js +95 -0
- package/dist/protocol.js.map +1 -0
- package/dist/semanticTokens.d.ts +77 -0
- package/dist/semanticTokens.d.ts.map +1 -0
- package/dist/semanticTokens.js +94 -0
- package/dist/semanticTokens.js.map +1 -0
- package/dist/transports.d.ts +54 -0
- package/dist/transports.d.ts.map +1 -0
- package/dist/transports.js +200 -0
- package/dist/transports.js.map +1 -0
- package/dist/types.d.ts +129 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +0 -0
- package/dist/workspace.d.ts +29 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/workspace.js +248 -0
- package/dist/workspace.js.map +1 -0
- package/dist/workspaceFactory.d.ts +4 -0
- package/dist/workspaceFactory.d.ts.map +1 -0
- package/dist/workspaceFactory.js +13 -0
- package/dist/workspaceFactory.js.map +1 -0
- package/package.json +51 -0
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import { registerDefaultLspWorkspaceFactory } from "./workspaceFactory.js";
|
|
2
|
+
//#region src/workspace.ts
|
|
3
|
+
var LspWorkspace = class {
|
|
4
|
+
attachments = /* @__PURE__ */ new Map();
|
|
5
|
+
documentsByUri = /* @__PURE__ */ new Map();
|
|
6
|
+
versionsByUri = /* @__PURE__ */ new Map();
|
|
7
|
+
client = null;
|
|
8
|
+
get documents() {
|
|
9
|
+
return Array.from(this.documentsByUri.values()).map(cloneDocument);
|
|
10
|
+
}
|
|
11
|
+
attachClient(client) {
|
|
12
|
+
this.client = client;
|
|
13
|
+
}
|
|
14
|
+
openDocumentSnapshot(options) {
|
|
15
|
+
assertSourceRevision(options.sourceRevision);
|
|
16
|
+
const open = this.documentsByUri.get(options.uri);
|
|
17
|
+
if (open) return this.attachOpenDocument(open, options);
|
|
18
|
+
const document = {
|
|
19
|
+
languageId: options.languageId,
|
|
20
|
+
lineStarts: options.lineStarts,
|
|
21
|
+
sourceLogicalRevisionCount: 0,
|
|
22
|
+
sourceRevision: options.sourceRevision,
|
|
23
|
+
sourceSegment: options.sourceSegment,
|
|
24
|
+
textSnapshot: options.textSnapshot,
|
|
25
|
+
uri: options.uri,
|
|
26
|
+
version: this.advanceVersion(options.uri, 1)
|
|
27
|
+
};
|
|
28
|
+
this.documentsByUri.set(options.uri, document);
|
|
29
|
+
const result = this.attachDocument(document, options.onDocumentTransition);
|
|
30
|
+
this.client?.didOpenDocument(cloneDocument(document));
|
|
31
|
+
return result;
|
|
32
|
+
}
|
|
33
|
+
updateDocumentSnapshot(uri, options) {
|
|
34
|
+
const document = this.requireDocument(uri);
|
|
35
|
+
assertLogicalRevisionCount(options.logicalRevisionCount);
|
|
36
|
+
assertSourceRevision(options.sourceRevision);
|
|
37
|
+
if (sameSourceTuple(document, options)) return adoptDuplicateSource(document, options);
|
|
38
|
+
if (options.logicalRevisionCount === 0) throw new Error("A new LSP document source requires a positive logical revision count.");
|
|
39
|
+
assertForwardSourcePoint(document, options);
|
|
40
|
+
const nextVersion = this.advanceVersion(uri, options.logicalRevisionCount);
|
|
41
|
+
const previousSnapshot = documentSnapshot(document);
|
|
42
|
+
document.textSnapshot = options.textSnapshot;
|
|
43
|
+
document.lineStarts = options.lineStarts;
|
|
44
|
+
document.sourceLogicalRevisionCount = options.logicalRevisionCount;
|
|
45
|
+
document.sourceRevision = options.sourceRevision;
|
|
46
|
+
document.sourceSegment = options.sourceSegment;
|
|
47
|
+
document.version = nextVersion;
|
|
48
|
+
this.client?.didChangeDocument(cloneDocument(document), {
|
|
49
|
+
edits: options.edits ?? [],
|
|
50
|
+
previousSnapshot
|
|
51
|
+
});
|
|
52
|
+
return cloneDocument(document);
|
|
53
|
+
}
|
|
54
|
+
adoptUnchangedDocumentSource(uri, options) {
|
|
55
|
+
const document = this.requireDocument(uri);
|
|
56
|
+
assertSourceRevision(options.sourceRevision);
|
|
57
|
+
if (options.textSnapshot !== document.textSnapshot) throw new Error("An unchanged LSP source must retain the exact workspace text snapshot.");
|
|
58
|
+
if (sameSourceTuple(document, options)) return cloneDocument(document);
|
|
59
|
+
assertForwardSourcePoint(document, options);
|
|
60
|
+
document.sourceRevision = options.sourceRevision;
|
|
61
|
+
document.sourceSegment = options.sourceSegment;
|
|
62
|
+
document.sourceLogicalRevisionCount = 0;
|
|
63
|
+
return cloneDocument(document);
|
|
64
|
+
}
|
|
65
|
+
transitionDocumentUri(attachment, options) {
|
|
66
|
+
const document = this.requireAttachment(attachment).document;
|
|
67
|
+
if (document.uri === options.uri) return this.adoptCompletedTransition(document, options);
|
|
68
|
+
assertSourceRevision(options.sourceRevision);
|
|
69
|
+
assertSourceTextVersion(options.sourceTextVersion);
|
|
70
|
+
assertTransitionTargetAvailable(this.documentsByUri.get(options.uri), document, options.uri);
|
|
71
|
+
assertTransitionSourcePoint(document, options);
|
|
72
|
+
if (document.sourceSegment === options.sourceSegment) throw new Error("An LSP document URI transition requires a rotated source segment.");
|
|
73
|
+
const nextVersion = this.advanceVersion(options.uri, 1);
|
|
74
|
+
const previousDocument = cloneDocument(document);
|
|
75
|
+
this.client?.didCloseDocument(previousDocument);
|
|
76
|
+
this.documentsByUri.delete(document.uri);
|
|
77
|
+
document.uri = options.uri;
|
|
78
|
+
document.languageId = options.languageId;
|
|
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;
|
|
85
|
+
this.documentsByUri.set(options.uri, document);
|
|
86
|
+
const nextDocument = cloneDocument(document);
|
|
87
|
+
this.client?.didOpenDocument(nextDocument);
|
|
88
|
+
this.notifyTransitionedAttachments(document, options.sourceTextVersion);
|
|
89
|
+
return {
|
|
90
|
+
document: nextDocument,
|
|
91
|
+
previousDocument
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
closeDocument(attachment) {
|
|
95
|
+
const record = this.attachments.get(attachment);
|
|
96
|
+
if (!record) return;
|
|
97
|
+
this.attachments.delete(attachment);
|
|
98
|
+
if (this.hasAttachment(record.document)) return;
|
|
99
|
+
this.documentsByUri.delete(record.document.uri);
|
|
100
|
+
this.client?.didCloseDocument(cloneDocument(record.document));
|
|
101
|
+
}
|
|
102
|
+
saveDocument(uri) {
|
|
103
|
+
const document = this.documentsByUri.get(uri);
|
|
104
|
+
if (!document) return;
|
|
105
|
+
this.client?.didSaveDocument(cloneDocument(document));
|
|
106
|
+
}
|
|
107
|
+
getDocument(uri) {
|
|
108
|
+
const document = this.documentsByUri.get(uri);
|
|
109
|
+
return document ? cloneDocument(document) : null;
|
|
110
|
+
}
|
|
111
|
+
connected() {
|
|
112
|
+
for (const document of this.documentsByUri.values()) this.client?.didOpenDocument(cloneDocument(document));
|
|
113
|
+
}
|
|
114
|
+
disconnected() {}
|
|
115
|
+
attachOpenDocument(document, options) {
|
|
116
|
+
if (document.languageId !== options.languageId) throw new Error(`LSP document open as ${document.languageId}, reopened as ${options.languageId}: ${options.uri}`);
|
|
117
|
+
if (!sameSourceTuple(document, options) || document.textSnapshot !== options.textSnapshot) throw new Error("A second LSP document attachment must adopt the exact shared source point.");
|
|
118
|
+
return this.attachDocument(document, options.onDocumentTransition);
|
|
119
|
+
}
|
|
120
|
+
attachDocument(document, onDocumentTransition) {
|
|
121
|
+
const attachment = Object.freeze({});
|
|
122
|
+
this.attachments.set(attachment, {
|
|
123
|
+
document,
|
|
124
|
+
onDocumentTransition
|
|
125
|
+
});
|
|
126
|
+
return {
|
|
127
|
+
attachment,
|
|
128
|
+
document: cloneDocument(document)
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
adoptCompletedTransition(document, options) {
|
|
132
|
+
if (document.languageId !== options.languageId) throw new Error("An adopted LSP URI transition must retain the shared language identifier.");
|
|
133
|
+
if (document.textSnapshot !== options.textSnapshot || !sameSourceTuple(document, options)) throw new Error("An adopted LSP URI transition must retain the exact shared source point.");
|
|
134
|
+
const current = cloneDocument(document);
|
|
135
|
+
return {
|
|
136
|
+
document: current,
|
|
137
|
+
previousDocument: current
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
notifyTransitionedAttachments(document, sourceTextVersion) {
|
|
141
|
+
for (const record of this.attachments.values()) {
|
|
142
|
+
if (record.document !== document) continue;
|
|
143
|
+
record.onDocumentTransition?.({
|
|
144
|
+
document: cloneDocument(document),
|
|
145
|
+
sourceRevision: document.sourceRevision,
|
|
146
|
+
sourceSegment: document.sourceSegment,
|
|
147
|
+
sourceTextVersion
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
hasAttachment(document) {
|
|
152
|
+
for (const record of this.attachments.values()) if (record.document === document) return true;
|
|
153
|
+
return false;
|
|
154
|
+
}
|
|
155
|
+
advanceVersion(uri, count) {
|
|
156
|
+
const version = (this.versionsByUri.get(uri) ?? -1) + count;
|
|
157
|
+
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
|
+
return version;
|
|
160
|
+
}
|
|
161
|
+
requireDocument(uri) {
|
|
162
|
+
const document = this.documentsByUri.get(uri);
|
|
163
|
+
if (document) return document;
|
|
164
|
+
throw new Error(`LSP document is not open: ${uri}`);
|
|
165
|
+
}
|
|
166
|
+
requireAttachment(attachment) {
|
|
167
|
+
const record = this.attachments.get(attachment);
|
|
168
|
+
if (record) return record;
|
|
169
|
+
throw new Error("LSP workspace document attachment is closed or belongs to another workspace.");
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
function cloneDocument(document) {
|
|
173
|
+
return {
|
|
174
|
+
uri: document.uri,
|
|
175
|
+
languageId: document.languageId,
|
|
176
|
+
version: document.version,
|
|
177
|
+
textSnapshot: document.textSnapshot,
|
|
178
|
+
lineStarts: document.lineStarts
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
function documentSnapshot(document) {
|
|
182
|
+
return {
|
|
183
|
+
textSnapshot: document.textSnapshot,
|
|
184
|
+
lineStarts: document.lineStarts
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
function sameSourceTuple(document, source) {
|
|
188
|
+
return document.sourceRevision === source.sourceRevision && document.sourceSegment === source.sourceSegment;
|
|
189
|
+
}
|
|
190
|
+
function adoptDuplicateSource(document, options) {
|
|
191
|
+
if (document.textSnapshot !== options.textSnapshot) throw new Error("A duplicate LSP source tuple must retain the exact text snapshot.");
|
|
192
|
+
if (options.logicalRevisionCount !== 0 && options.logicalRevisionCount !== document.sourceLogicalRevisionCount) throw new Error("A duplicate LSP source tuple must retain its logical revision count.");
|
|
193
|
+
return cloneDocument(document);
|
|
194
|
+
}
|
|
195
|
+
function assertForwardSourcePoint(document, source) {
|
|
196
|
+
if (document.sourceSegment !== source.sourceSegment) return;
|
|
197
|
+
if (source.sourceRevision > document.sourceRevision) return;
|
|
198
|
+
throw new Error("An LSP source revision must advance within one source segment.");
|
|
199
|
+
}
|
|
200
|
+
function assertLogicalRevisionCount(count) {
|
|
201
|
+
if (Number.isSafeInteger(count) && count >= 0) return;
|
|
202
|
+
throw new RangeError("logicalRevisionCount must be a safe non-negative integer.");
|
|
203
|
+
}
|
|
204
|
+
function assertSourceRevision(revision) {
|
|
205
|
+
if (Number.isSafeInteger(revision) && revision >= 0) return;
|
|
206
|
+
throw new RangeError("sourceRevision must be a safe non-negative integer.");
|
|
207
|
+
}
|
|
208
|
+
function assertSourceTextVersion(version) {
|
|
209
|
+
if (Number.isSafeInteger(version) && version >= 0) return;
|
|
210
|
+
throw new RangeError("sourceTextVersion must be a safe non-negative integer.");
|
|
211
|
+
}
|
|
212
|
+
function assertTransitionTargetAvailable(target, source, uri) {
|
|
213
|
+
if (!target || target === source) return;
|
|
214
|
+
throw new Error(`LSP document URI transition target is already open: ${uri}`);
|
|
215
|
+
}
|
|
216
|
+
function assertTransitionSourcePoint(document, options) {
|
|
217
|
+
if (document.textSnapshot !== options.textSnapshot) throw new Error("An LSP document URI transition must retain the exact synchronized snapshot.");
|
|
218
|
+
if (document.sourceRevision === options.sourceRevision) return;
|
|
219
|
+
throw new Error("An LSP document URI transition must retain the synchronized source revision.");
|
|
220
|
+
}
|
|
221
|
+
function arrayLspLineStarts(lineStarts) {
|
|
222
|
+
return {
|
|
223
|
+
length: lineStarts.length,
|
|
224
|
+
at: (index) => lineStarts[index],
|
|
225
|
+
indexForOffset: (offset) => arrayRowForOffset(lineStarts, offset),
|
|
226
|
+
toArray: () => lineStarts
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
function arrayRowForOffset(lineStarts, offset) {
|
|
230
|
+
let low = 0;
|
|
231
|
+
let high = lineStarts.length - 1;
|
|
232
|
+
let row = 0;
|
|
233
|
+
while (low <= high) {
|
|
234
|
+
const middle = low + high >> 1;
|
|
235
|
+
if ((lineStarts[middle] ?? 0) <= offset) {
|
|
236
|
+
row = middle;
|
|
237
|
+
low = middle + 1;
|
|
238
|
+
continue;
|
|
239
|
+
}
|
|
240
|
+
high = middle - 1;
|
|
241
|
+
}
|
|
242
|
+
return row;
|
|
243
|
+
}
|
|
244
|
+
registerDefaultLspWorkspaceFactory(() => new LspWorkspace());
|
|
245
|
+
//#endregion
|
|
246
|
+
export { LspWorkspace, arrayLspLineStarts };
|
|
247
|
+
|
|
248
|
+
//# sourceMappingURL=workspace.js.map
|
|
@@ -0,0 +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,QAA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AS;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"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { LspClientWorkspace, LspWorkspaceFactory } from './types';
|
|
2
|
+
export declare function createDefaultLspWorkspace(): LspClientWorkspace;
|
|
3
|
+
export declare function registerDefaultLspWorkspaceFactory(factory: LspWorkspaceFactory): void;
|
|
4
|
+
//# sourceMappingURL=workspaceFactory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspaceFactory.d.ts","sourceRoot":"","sources":["../src/workspaceFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAItE,wBAAgB,yBAAyB,IAAI,kBAAkB,CAG9D;AAED,wBAAgB,kCAAkC,CAAC,OAAO,EAAE,mBAAmB,GAAG,IAAI,CAErF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/workspaceFactory.ts
|
|
2
|
+
var defaultWorkspaceFactory = null;
|
|
3
|
+
function createDefaultLspWorkspace() {
|
|
4
|
+
if (defaultWorkspaceFactory) return defaultWorkspaceFactory();
|
|
5
|
+
throw new Error("Default LSP workspace factory was not registered");
|
|
6
|
+
}
|
|
7
|
+
function registerDefaultLspWorkspaceFactory(factory) {
|
|
8
|
+
defaultWorkspaceFactory = factory;
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { createDefaultLspWorkspace, registerDefaultLspWorkspaceFactory };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=workspaceFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspaceFactory.js","names":[],"sources":["../src/workspaceFactory.ts"],"sourcesContent":["import type { LspClientWorkspace, LspWorkspaceFactory } from './types'\n\nlet defaultWorkspaceFactory: LspWorkspaceFactory | null = null\n\nexport function createDefaultLspWorkspace(): LspClientWorkspace {\n if (defaultWorkspaceFactory) return defaultWorkspaceFactory()\n throw new Error('Default LSP workspace factory was not registered')\n}\n\nexport function registerDefaultLspWorkspaceFactory(factory: LspWorkspaceFactory): void {\n defaultWorkspaceFactory = factory\n}\n"],"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
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@singapore-editor/lsp",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"files": [
|
|
5
|
+
"README.md",
|
|
6
|
+
"dist"
|
|
7
|
+
],
|
|
8
|
+
"type": "module",
|
|
9
|
+
"sideEffects": false,
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js",
|
|
14
|
+
"default": "./dist/index.js"
|
|
15
|
+
},
|
|
16
|
+
"./positions": {
|
|
17
|
+
"types": "./dist/positions.d.ts",
|
|
18
|
+
"import": "./dist/positions.js",
|
|
19
|
+
"default": "./dist/positions.js"
|
|
20
|
+
},
|
|
21
|
+
"./types": {
|
|
22
|
+
"types": "./dist/types.d.ts",
|
|
23
|
+
"import": "./dist/types.js",
|
|
24
|
+
"default": "./dist/types.js"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public",
|
|
29
|
+
"registry": "https://registry.npmjs.org/"
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "bun ../../scripts/build-package.ts",
|
|
33
|
+
"test": "vitest run",
|
|
34
|
+
"typecheck": "tsgo --noEmit",
|
|
35
|
+
"lint": "oxlint .",
|
|
36
|
+
"format": "oxfmt --write .",
|
|
37
|
+
"format:check": "oxfmt --check ."
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"vscode-languageserver-protocol": "^3.18.4"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@types/node": "^26.6.3",
|
|
44
|
+
"@typescript/native-preview": "7.0.0-dev.20260707.2",
|
|
45
|
+
"happy-dom": "^20.14.5",
|
|
46
|
+
"oxfmt": "0.70.0",
|
|
47
|
+
"oxlint": "1.85.0",
|
|
48
|
+
"typescript": "~6.0.3",
|
|
49
|
+
"vitest": "^5.0.2"
|
|
50
|
+
}
|
|
51
|
+
}
|