@adecore/lsp 0.0.1 → 0.17.0-beta.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/LICENSE +110 -0
- package/README.md +33 -0
- package/dist/connection.d.ts +50 -0
- package/dist/connection.js +290 -0
- package/dist/document.d.ts +60 -0
- package/dist/document.js +282 -0
- package/dist/edits.d.ts +18 -0
- package/dist/edits.js +161 -0
- package/dist/file-operations.d.ts +5 -0
- package/dist/file-operations.js +23 -0
- package/dist/glob.d.ts +1 -0
- package/dist/glob.js +67 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +10 -0
- package/dist/protocol.d.ts +470 -0
- package/dist/protocol.js +1 -0
- package/dist/service.d.ts +53 -0
- package/dist/service.js +1 -0
- package/dist/session.d.ts +78 -0
- package/dist/session.js +528 -0
- package/dist/test-transport.d.ts +33 -0
- package/dist/test-transport.js +72 -0
- package/dist/testing.d.ts +33 -0
- package/dist/testing.js +72 -0
- package/dist/transport.d.ts +27 -0
- package/dist/transport.js +258 -0
- package/dist/uris.d.ts +2 -0
- package/dist/uris.js +28 -0
- package/dist/vue.d.ts +6 -0
- package/dist/vue.js +86 -0
- package/dist/watched-files.d.ts +3 -0
- package/dist/watched-files.js +41 -0
- package/package.json +36 -3
- package/src/connection.ts +310 -0
- package/src/document.ts +357 -0
- package/src/edits.ts +182 -0
- package/src/file-operations.ts +30 -0
- package/src/glob.ts +60 -0
- package/src/index.ts +30 -0
- package/src/protocol.ts +479 -0
- package/src/service.ts +109 -0
- package/src/session.ts +613 -0
- package/src/test-transport.ts +92 -0
- package/src/testing.ts +105 -0
- package/src/transport.ts +290 -0
- package/src/uris.ts +29 -0
- package/src/vue.ts +93 -0
- package/src/watched-files.ts +49 -0
|
@@ -0,0 +1,470 @@
|
|
|
1
|
+
export interface Disposable {
|
|
2
|
+
dispose(): void;
|
|
3
|
+
}
|
|
4
|
+
export type RequestId = number | string;
|
|
5
|
+
export interface RpcRequest {
|
|
6
|
+
jsonrpc: '2.0';
|
|
7
|
+
id: RequestId;
|
|
8
|
+
method: string;
|
|
9
|
+
params?: unknown;
|
|
10
|
+
}
|
|
11
|
+
export interface RpcNotification {
|
|
12
|
+
jsonrpc: '2.0';
|
|
13
|
+
method: string;
|
|
14
|
+
params?: unknown;
|
|
15
|
+
}
|
|
16
|
+
export interface RpcResponse {
|
|
17
|
+
jsonrpc: '2.0';
|
|
18
|
+
id: RequestId | null;
|
|
19
|
+
result?: unknown;
|
|
20
|
+
error?: {
|
|
21
|
+
code: number;
|
|
22
|
+
message: string;
|
|
23
|
+
data?: unknown;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export type RpcMessage = RpcRequest | RpcNotification | RpcResponse;
|
|
27
|
+
export interface LspTransport {
|
|
28
|
+
send(message: RpcMessage): void | Promise<void>;
|
|
29
|
+
onMessage(listener: (message: unknown) => void): Disposable;
|
|
30
|
+
onClose(listener: (error?: Error) => void): Disposable;
|
|
31
|
+
close(): void | Promise<void>;
|
|
32
|
+
}
|
|
33
|
+
export interface RequestOptions {
|
|
34
|
+
signal?: AbortSignal;
|
|
35
|
+
timeoutMs?: number;
|
|
36
|
+
}
|
|
37
|
+
export interface DocumentRequestOptions extends RequestOptions {
|
|
38
|
+
cancelPrevious?: boolean;
|
|
39
|
+
}
|
|
40
|
+
export interface Position {
|
|
41
|
+
line: number;
|
|
42
|
+
character: number;
|
|
43
|
+
}
|
|
44
|
+
export interface Range {
|
|
45
|
+
start: Position;
|
|
46
|
+
end: Position;
|
|
47
|
+
}
|
|
48
|
+
export interface Location {
|
|
49
|
+
uri: string;
|
|
50
|
+
range: Range;
|
|
51
|
+
}
|
|
52
|
+
export interface LocationLink {
|
|
53
|
+
originSelectionRange?: Range;
|
|
54
|
+
targetUri: string;
|
|
55
|
+
targetRange: Range;
|
|
56
|
+
targetSelectionRange: Range;
|
|
57
|
+
}
|
|
58
|
+
export type NavigationResult = Location | Location[] | LocationLink[] | null;
|
|
59
|
+
export interface TextEdit {
|
|
60
|
+
range: Range;
|
|
61
|
+
newText: string;
|
|
62
|
+
annotationId?: string;
|
|
63
|
+
}
|
|
64
|
+
export interface ContentChange {
|
|
65
|
+
range?: Range;
|
|
66
|
+
text: string;
|
|
67
|
+
}
|
|
68
|
+
export interface InsertReplaceEdit {
|
|
69
|
+
newText: string;
|
|
70
|
+
insert: Range;
|
|
71
|
+
replace: Range;
|
|
72
|
+
}
|
|
73
|
+
export interface MarkupContent {
|
|
74
|
+
kind: 'plaintext' | 'markdown';
|
|
75
|
+
value: string;
|
|
76
|
+
}
|
|
77
|
+
export type MarkedString = string | {
|
|
78
|
+
language: string;
|
|
79
|
+
value: string;
|
|
80
|
+
};
|
|
81
|
+
export interface Command {
|
|
82
|
+
title: string;
|
|
83
|
+
command: string;
|
|
84
|
+
arguments?: unknown[];
|
|
85
|
+
}
|
|
86
|
+
export interface Diagnostic {
|
|
87
|
+
range: Range;
|
|
88
|
+
message: string;
|
|
89
|
+
severity?: 1 | 2 | 3 | 4;
|
|
90
|
+
code?: number | string;
|
|
91
|
+
codeDescription?: {
|
|
92
|
+
href: string;
|
|
93
|
+
};
|
|
94
|
+
source?: string;
|
|
95
|
+
tags?: number[];
|
|
96
|
+
relatedInformation?: {
|
|
97
|
+
location: Location;
|
|
98
|
+
message: string;
|
|
99
|
+
}[];
|
|
100
|
+
data?: unknown;
|
|
101
|
+
}
|
|
102
|
+
export interface PublishDiagnosticsParams {
|
|
103
|
+
uri: string;
|
|
104
|
+
version?: number;
|
|
105
|
+
diagnostics: Diagnostic[];
|
|
106
|
+
}
|
|
107
|
+
export interface CompletionContext {
|
|
108
|
+
triggerKind: 1 | 2 | 3;
|
|
109
|
+
triggerCharacter?: string;
|
|
110
|
+
}
|
|
111
|
+
export interface CompletionItem {
|
|
112
|
+
label: string;
|
|
113
|
+
labelDetails?: {
|
|
114
|
+
detail?: string;
|
|
115
|
+
description?: string;
|
|
116
|
+
};
|
|
117
|
+
kind?: number;
|
|
118
|
+
tags?: number[];
|
|
119
|
+
detail?: string;
|
|
120
|
+
documentation?: string | MarkupContent;
|
|
121
|
+
deprecated?: boolean;
|
|
122
|
+
preselect?: boolean;
|
|
123
|
+
sortText?: string;
|
|
124
|
+
filterText?: string;
|
|
125
|
+
insertText?: string;
|
|
126
|
+
insertTextFormat?: 1 | 2;
|
|
127
|
+
insertTextMode?: 1 | 2;
|
|
128
|
+
textEdit?: TextEdit | InsertReplaceEdit;
|
|
129
|
+
textEditText?: string;
|
|
130
|
+
additionalTextEdits?: TextEdit[];
|
|
131
|
+
commitCharacters?: string[];
|
|
132
|
+
command?: Command;
|
|
133
|
+
data?: unknown;
|
|
134
|
+
[extension: string]: unknown;
|
|
135
|
+
}
|
|
136
|
+
export interface CompletionList {
|
|
137
|
+
isIncomplete: boolean;
|
|
138
|
+
items: CompletionItem[];
|
|
139
|
+
itemDefaults?: {
|
|
140
|
+
commitCharacters?: string[];
|
|
141
|
+
editRange?: Range | {
|
|
142
|
+
insert: Range;
|
|
143
|
+
replace: Range;
|
|
144
|
+
};
|
|
145
|
+
insertTextFormat?: 1 | 2;
|
|
146
|
+
insertTextMode?: 1 | 2;
|
|
147
|
+
data?: unknown;
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
export type CompletionResult = CompletionItem[] | CompletionList | null;
|
|
151
|
+
export interface Hover {
|
|
152
|
+
contents: MarkupContent | MarkedString | MarkedString[];
|
|
153
|
+
range?: Range;
|
|
154
|
+
}
|
|
155
|
+
export interface DocumentHighlight {
|
|
156
|
+
range: Range;
|
|
157
|
+
kind?: 1 | 2 | 3;
|
|
158
|
+
}
|
|
159
|
+
export type SymbolKind = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26;
|
|
160
|
+
export interface DocumentSymbol {
|
|
161
|
+
name: string;
|
|
162
|
+
detail?: string;
|
|
163
|
+
kind: SymbolKind;
|
|
164
|
+
tags?: 1[];
|
|
165
|
+
deprecated?: boolean;
|
|
166
|
+
range: Range;
|
|
167
|
+
selectionRange: Range;
|
|
168
|
+
children?: DocumentSymbol[];
|
|
169
|
+
}
|
|
170
|
+
export interface SymbolInformation {
|
|
171
|
+
name: string;
|
|
172
|
+
kind: SymbolKind;
|
|
173
|
+
tags?: 1[];
|
|
174
|
+
deprecated?: boolean;
|
|
175
|
+
location: Location;
|
|
176
|
+
containerName?: string;
|
|
177
|
+
}
|
|
178
|
+
export interface WorkspaceSymbol {
|
|
179
|
+
name: string;
|
|
180
|
+
kind: SymbolKind;
|
|
181
|
+
tags?: 1[];
|
|
182
|
+
containerName?: string;
|
|
183
|
+
location: Location | {
|
|
184
|
+
uri: string;
|
|
185
|
+
};
|
|
186
|
+
data?: unknown;
|
|
187
|
+
}
|
|
188
|
+
export type DocumentSymbolResult = DocumentSymbol[] | SymbolInformation[] | null;
|
|
189
|
+
export type WorkspaceSymbolResult = SymbolInformation[] | WorkspaceSymbol[] | null;
|
|
190
|
+
export interface ParameterInformation {
|
|
191
|
+
label: string | [number, number];
|
|
192
|
+
documentation?: string | MarkupContent;
|
|
193
|
+
}
|
|
194
|
+
export interface SignatureInformation {
|
|
195
|
+
label: string;
|
|
196
|
+
documentation?: string | MarkupContent;
|
|
197
|
+
parameters?: ParameterInformation[];
|
|
198
|
+
activeParameter?: number;
|
|
199
|
+
}
|
|
200
|
+
export interface SignatureHelp {
|
|
201
|
+
signatures: SignatureInformation[];
|
|
202
|
+
activeSignature?: number;
|
|
203
|
+
activeParameter?: number;
|
|
204
|
+
}
|
|
205
|
+
export interface SignatureHelpContext {
|
|
206
|
+
triggerKind: 1 | 2 | 3;
|
|
207
|
+
triggerCharacter?: string;
|
|
208
|
+
isRetrigger: boolean;
|
|
209
|
+
activeSignatureHelp?: SignatureHelp;
|
|
210
|
+
}
|
|
211
|
+
export type PrepareRenameResult = Range | {
|
|
212
|
+
range: Range;
|
|
213
|
+
placeholder: string;
|
|
214
|
+
} | {
|
|
215
|
+
defaultBehavior: boolean;
|
|
216
|
+
} | null;
|
|
217
|
+
export interface TextDocumentEdit {
|
|
218
|
+
textDocument: {
|
|
219
|
+
uri: string;
|
|
220
|
+
version: number | null;
|
|
221
|
+
};
|
|
222
|
+
edits: TextEdit[];
|
|
223
|
+
}
|
|
224
|
+
export interface CreateFile {
|
|
225
|
+
kind: 'create';
|
|
226
|
+
uri: string;
|
|
227
|
+
options?: {
|
|
228
|
+
overwrite?: boolean;
|
|
229
|
+
ignoreIfExists?: boolean;
|
|
230
|
+
};
|
|
231
|
+
annotationId?: string;
|
|
232
|
+
}
|
|
233
|
+
export interface RenameFile {
|
|
234
|
+
kind: 'rename';
|
|
235
|
+
oldUri: string;
|
|
236
|
+
newUri: string;
|
|
237
|
+
options?: {
|
|
238
|
+
overwrite?: boolean;
|
|
239
|
+
ignoreIfExists?: boolean;
|
|
240
|
+
};
|
|
241
|
+
annotationId?: string;
|
|
242
|
+
}
|
|
243
|
+
export interface DeleteFile {
|
|
244
|
+
kind: 'delete';
|
|
245
|
+
uri: string;
|
|
246
|
+
options?: {
|
|
247
|
+
recursive?: boolean;
|
|
248
|
+
ignoreIfNotExists?: boolean;
|
|
249
|
+
};
|
|
250
|
+
annotationId?: string;
|
|
251
|
+
}
|
|
252
|
+
export interface WorkspaceEdit {
|
|
253
|
+
changes?: Record<string, TextEdit[]>;
|
|
254
|
+
documentChanges?: (TextDocumentEdit | CreateFile | RenameFile | DeleteFile)[];
|
|
255
|
+
changeAnnotations?: Record<string, {
|
|
256
|
+
label: string;
|
|
257
|
+
needsConfirmation?: boolean;
|
|
258
|
+
description?: string;
|
|
259
|
+
}>;
|
|
260
|
+
}
|
|
261
|
+
export interface FileRename {
|
|
262
|
+
oldUri: string;
|
|
263
|
+
newUri: string;
|
|
264
|
+
}
|
|
265
|
+
export interface FileOperationFilter {
|
|
266
|
+
scheme?: string;
|
|
267
|
+
pattern: {
|
|
268
|
+
glob: string;
|
|
269
|
+
matches?: 'file' | 'folder';
|
|
270
|
+
options?: {
|
|
271
|
+
ignoreCase?: boolean;
|
|
272
|
+
};
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
export interface ApplyWorkspaceEditParams {
|
|
276
|
+
label?: string;
|
|
277
|
+
edit: WorkspaceEdit;
|
|
278
|
+
}
|
|
279
|
+
export interface ApplyWorkspaceEditResult {
|
|
280
|
+
applied: boolean;
|
|
281
|
+
failureReason?: string;
|
|
282
|
+
failedChange?: number;
|
|
283
|
+
}
|
|
284
|
+
export interface CodeAction {
|
|
285
|
+
title: string;
|
|
286
|
+
kind?: string;
|
|
287
|
+
diagnostics?: Diagnostic[];
|
|
288
|
+
isPreferred?: boolean;
|
|
289
|
+
disabled?: {
|
|
290
|
+
reason: string;
|
|
291
|
+
};
|
|
292
|
+
edit?: WorkspaceEdit;
|
|
293
|
+
command?: Command;
|
|
294
|
+
data?: unknown;
|
|
295
|
+
[extension: string]: unknown;
|
|
296
|
+
}
|
|
297
|
+
export interface CodeActionContext {
|
|
298
|
+
diagnostics: Diagnostic[];
|
|
299
|
+
only?: string[];
|
|
300
|
+
triggerKind?: 1 | 2;
|
|
301
|
+
}
|
|
302
|
+
export interface FormattingOptions {
|
|
303
|
+
tabSize: number;
|
|
304
|
+
insertSpaces: boolean;
|
|
305
|
+
trimTrailingWhitespace?: boolean;
|
|
306
|
+
insertFinalNewline?: boolean;
|
|
307
|
+
trimFinalNewlines?: boolean;
|
|
308
|
+
[key: string]: boolean | number | string | undefined;
|
|
309
|
+
}
|
|
310
|
+
export interface SemanticTokens {
|
|
311
|
+
resultId?: string;
|
|
312
|
+
data: number[];
|
|
313
|
+
}
|
|
314
|
+
export interface SemanticTokensDelta {
|
|
315
|
+
resultId?: string;
|
|
316
|
+
edits: {
|
|
317
|
+
start: number;
|
|
318
|
+
deleteCount: number;
|
|
319
|
+
data?: number[];
|
|
320
|
+
}[];
|
|
321
|
+
}
|
|
322
|
+
export interface SemanticTokensLegend {
|
|
323
|
+
tokenTypes: string[];
|
|
324
|
+
tokenModifiers: string[];
|
|
325
|
+
}
|
|
326
|
+
export interface InlayHintLabelPart {
|
|
327
|
+
value: string;
|
|
328
|
+
tooltip?: string | MarkupContent;
|
|
329
|
+
location?: Location;
|
|
330
|
+
command?: Command;
|
|
331
|
+
}
|
|
332
|
+
export interface InlayHint {
|
|
333
|
+
position: Position;
|
|
334
|
+
label: string | InlayHintLabelPart[];
|
|
335
|
+
kind?: 1 | 2;
|
|
336
|
+
textEdits?: TextEdit[];
|
|
337
|
+
tooltip?: string | MarkupContent;
|
|
338
|
+
paddingLeft?: boolean;
|
|
339
|
+
paddingRight?: boolean;
|
|
340
|
+
data?: unknown;
|
|
341
|
+
[extension: string]: unknown;
|
|
342
|
+
}
|
|
343
|
+
export interface FoldingRange {
|
|
344
|
+
startLine: number;
|
|
345
|
+
startCharacter?: number;
|
|
346
|
+
endLine: number;
|
|
347
|
+
endCharacter?: number;
|
|
348
|
+
kind?: string;
|
|
349
|
+
collapsedText?: string;
|
|
350
|
+
}
|
|
351
|
+
export interface SelectionRange {
|
|
352
|
+
range: Range;
|
|
353
|
+
parent?: SelectionRange;
|
|
354
|
+
}
|
|
355
|
+
export interface CodeLens {
|
|
356
|
+
range: Range;
|
|
357
|
+
command?: Command;
|
|
358
|
+
data?: unknown;
|
|
359
|
+
}
|
|
360
|
+
export type DocumentDiagnosticReport = {
|
|
361
|
+
kind: 'full';
|
|
362
|
+
resultId?: string;
|
|
363
|
+
items: Diagnostic[];
|
|
364
|
+
relatedDocuments?: Record<string, DocumentDiagnosticReport>;
|
|
365
|
+
} | {
|
|
366
|
+
kind: 'unchanged';
|
|
367
|
+
resultId: string;
|
|
368
|
+
relatedDocuments?: Record<string, DocumentDiagnosticReport>;
|
|
369
|
+
};
|
|
370
|
+
export interface DocumentFilter {
|
|
371
|
+
language?: string;
|
|
372
|
+
scheme?: string;
|
|
373
|
+
pattern?: string;
|
|
374
|
+
}
|
|
375
|
+
export interface FileSystemWatcher {
|
|
376
|
+
globPattern: string | {
|
|
377
|
+
baseUri: string | WorkspaceFolder;
|
|
378
|
+
pattern: string;
|
|
379
|
+
};
|
|
380
|
+
kind?: number;
|
|
381
|
+
}
|
|
382
|
+
export interface FileEvent {
|
|
383
|
+
uri: string;
|
|
384
|
+
type: 1 | 2 | 3;
|
|
385
|
+
}
|
|
386
|
+
export interface Registration {
|
|
387
|
+
id: string;
|
|
388
|
+
method: string;
|
|
389
|
+
registerOptions?: ProviderOptions;
|
|
390
|
+
}
|
|
391
|
+
export interface ProviderOptions {
|
|
392
|
+
documentSelector?: DocumentFilter[] | null;
|
|
393
|
+
resolveProvider?: boolean;
|
|
394
|
+
prepareProvider?: boolean;
|
|
395
|
+
triggerCharacters?: string[];
|
|
396
|
+
retriggerCharacters?: string[];
|
|
397
|
+
commands?: string[];
|
|
398
|
+
watchers?: FileSystemWatcher[];
|
|
399
|
+
codeActionKinds?: string[];
|
|
400
|
+
legend?: SemanticTokensLegend;
|
|
401
|
+
filters?: FileOperationFilter[];
|
|
402
|
+
range?: boolean | object;
|
|
403
|
+
full?: boolean | {
|
|
404
|
+
delta?: boolean;
|
|
405
|
+
};
|
|
406
|
+
[option: string]: unknown;
|
|
407
|
+
}
|
|
408
|
+
export interface TextDocumentSyncOptions {
|
|
409
|
+
openClose?: boolean;
|
|
410
|
+
change?: 0 | 1 | 2;
|
|
411
|
+
willSave?: boolean;
|
|
412
|
+
willSaveWaitUntil?: boolean;
|
|
413
|
+
save?: boolean | {
|
|
414
|
+
includeText?: boolean;
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
export interface ServerCapabilities {
|
|
418
|
+
positionEncoding?: string;
|
|
419
|
+
textDocumentSync?: 0 | 1 | 2 | TextDocumentSyncOptions;
|
|
420
|
+
completionProvider?: ProviderOptions;
|
|
421
|
+
hoverProvider?: boolean | ProviderOptions;
|
|
422
|
+
signatureHelpProvider?: ProviderOptions;
|
|
423
|
+
definitionProvider?: boolean | ProviderOptions;
|
|
424
|
+
declarationProvider?: boolean | ProviderOptions;
|
|
425
|
+
typeDefinitionProvider?: boolean | ProviderOptions;
|
|
426
|
+
implementationProvider?: boolean | ProviderOptions;
|
|
427
|
+
referencesProvider?: boolean | ProviderOptions;
|
|
428
|
+
documentHighlightProvider?: boolean | ProviderOptions;
|
|
429
|
+
documentSymbolProvider?: boolean | ProviderOptions;
|
|
430
|
+
workspaceSymbolProvider?: boolean | ProviderOptions;
|
|
431
|
+
renameProvider?: boolean | ProviderOptions;
|
|
432
|
+
codeActionProvider?: boolean | ProviderOptions;
|
|
433
|
+
codeLensProvider?: ProviderOptions;
|
|
434
|
+
executeCommandProvider?: ProviderOptions;
|
|
435
|
+
documentFormattingProvider?: boolean | ProviderOptions;
|
|
436
|
+
documentRangeFormattingProvider?: boolean | ProviderOptions;
|
|
437
|
+
foldingRangeProvider?: boolean | ProviderOptions;
|
|
438
|
+
selectionRangeProvider?: boolean | ProviderOptions;
|
|
439
|
+
semanticTokensProvider?: ProviderOptions & {
|
|
440
|
+
legend: SemanticTokensLegend;
|
|
441
|
+
};
|
|
442
|
+
inlayHintProvider?: boolean | ProviderOptions;
|
|
443
|
+
diagnosticProvider?: ProviderOptions;
|
|
444
|
+
[capability: string]: unknown;
|
|
445
|
+
}
|
|
446
|
+
export interface InitializeResult {
|
|
447
|
+
capabilities: ServerCapabilities;
|
|
448
|
+
serverInfo?: {
|
|
449
|
+
name: string;
|
|
450
|
+
version?: string;
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
export interface WorkspaceFolder {
|
|
454
|
+
uri: string;
|
|
455
|
+
name: string;
|
|
456
|
+
}
|
|
457
|
+
export interface DocumentItem {
|
|
458
|
+
uri: string;
|
|
459
|
+
languageId: string;
|
|
460
|
+
text: string;
|
|
461
|
+
version?: number;
|
|
462
|
+
}
|
|
463
|
+
export interface ConfigurationItem {
|
|
464
|
+
scopeUri?: string;
|
|
465
|
+
section?: string;
|
|
466
|
+
}
|
|
467
|
+
export interface ProgressParams {
|
|
468
|
+
token: string | number;
|
|
469
|
+
value: unknown;
|
|
470
|
+
}
|
package/dist/protocol.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { CodeAction, CodeActionContext, CodeLens, Command, CompletionContext, CompletionItem, CompletionResult, ContentChange, Diagnostic, Disposable, DocumentHighlight, DocumentSymbolResult, FoldingRange, FormattingOptions, Hover, InlayHint, Location, NavigationResult, Position, PrepareRenameResult, ProviderOptions, Range, SelectionRange, SemanticTokens, SemanticTokensDelta, SignatureHelp, SignatureHelpContext, TextEdit, WorkspaceEdit, WorkspaceSymbolResult } from './protocol.ts';
|
|
2
|
+
export interface LanguageDocument {
|
|
3
|
+
uri: string;
|
|
4
|
+
languageId: string;
|
|
5
|
+
text: string;
|
|
6
|
+
}
|
|
7
|
+
export interface LanguageRequestOptions {
|
|
8
|
+
signal?: AbortSignal;
|
|
9
|
+
parallel?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface DiagnosticsReport {
|
|
12
|
+
uri: string;
|
|
13
|
+
source: string;
|
|
14
|
+
version?: number;
|
|
15
|
+
diagnostics: Diagnostic[];
|
|
16
|
+
}
|
|
17
|
+
export interface LanguageService {
|
|
18
|
+
openDocument(document: LanguageDocument): Promise<void>;
|
|
19
|
+
changeDocument(uri: string, changes: readonly ContentChange[]): Promise<void>;
|
|
20
|
+
closeDocument(uri: string): Promise<void>;
|
|
21
|
+
supports(method: string, uri: string): boolean;
|
|
22
|
+
providerOptions(method: string, uri: string): ProviderOptions | undefined;
|
|
23
|
+
onProvidersChanged(listener: (uri: string) => void): Disposable;
|
|
24
|
+
onDiagnostics(listener: (report: DiagnosticsReport) => void): Disposable;
|
|
25
|
+
completion(uri: string, position: Position, context?: CompletionContext, options?: LanguageRequestOptions): Promise<CompletionResult>;
|
|
26
|
+
resolveCompletion(uri: string, item: CompletionItem, options?: LanguageRequestOptions): Promise<CompletionItem>;
|
|
27
|
+
hover(uri: string, position: Position, options?: LanguageRequestOptions): Promise<Hover | null>;
|
|
28
|
+
signatureHelp(uri: string, position: Position, context?: SignatureHelpContext, options?: LanguageRequestOptions): Promise<SignatureHelp | null>;
|
|
29
|
+
definition(uri: string, position: Position, options?: LanguageRequestOptions): Promise<NavigationResult>;
|
|
30
|
+
declaration(uri: string, position: Position, options?: LanguageRequestOptions): Promise<NavigationResult>;
|
|
31
|
+
typeDefinition(uri: string, position: Position, options?: LanguageRequestOptions): Promise<NavigationResult>;
|
|
32
|
+
implementation(uri: string, position: Position, options?: LanguageRequestOptions): Promise<NavigationResult>;
|
|
33
|
+
references(uri: string, position: Position, includeDeclaration?: boolean, options?: LanguageRequestOptions): Promise<Location[] | null>;
|
|
34
|
+
documentHighlights(uri: string, position: Position, options?: LanguageRequestOptions): Promise<DocumentHighlight[] | null>;
|
|
35
|
+
documentSymbols(uri: string, options?: LanguageRequestOptions): Promise<DocumentSymbolResult>;
|
|
36
|
+
prepareRename(uri: string, position: Position, options?: LanguageRequestOptions): Promise<PrepareRenameResult>;
|
|
37
|
+
rename(uri: string, position: Position, newName: string, options?: LanguageRequestOptions): Promise<WorkspaceEdit | null>;
|
|
38
|
+
codeActions(uri: string, range: Range, context?: CodeActionContext, options?: LanguageRequestOptions): Promise<(CodeAction | Command)[] | null>;
|
|
39
|
+
resolveCodeAction(uri: string, action: CodeAction, options?: LanguageRequestOptions): Promise<CodeAction>;
|
|
40
|
+
executeCommand(uri: string, command: Command, options?: LanguageRequestOptions): Promise<unknown>;
|
|
41
|
+
formatting(uri: string, formatting: FormattingOptions, options?: LanguageRequestOptions): Promise<TextEdit[] | null>;
|
|
42
|
+
rangeFormatting(uri: string, range: Range, formatting: FormattingOptions, options?: LanguageRequestOptions): Promise<TextEdit[] | null>;
|
|
43
|
+
semanticTokens(uri: string, options?: LanguageRequestOptions): Promise<SemanticTokens | null>;
|
|
44
|
+
semanticTokensDelta(uri: string, previousResultId: string, options?: LanguageRequestOptions): Promise<SemanticTokens | SemanticTokensDelta | null>;
|
|
45
|
+
semanticTokensRange(uri: string, range: Range, options?: LanguageRequestOptions): Promise<SemanticTokens | null>;
|
|
46
|
+
inlayHints(uri: string, range: Range, options?: LanguageRequestOptions): Promise<InlayHint[] | null>;
|
|
47
|
+
resolveInlayHint(uri: string, hint: InlayHint, options?: LanguageRequestOptions): Promise<InlayHint>;
|
|
48
|
+
workspaceSymbols(uri: string, query: string, options?: LanguageRequestOptions): Promise<WorkspaceSymbolResult>;
|
|
49
|
+
foldingRanges(uri: string, options?: LanguageRequestOptions): Promise<FoldingRange[] | null>;
|
|
50
|
+
selectionRanges(uri: string, positions: readonly Position[], options?: LanguageRequestOptions): Promise<SelectionRange[] | null>;
|
|
51
|
+
codeLenses(uri: string, options?: LanguageRequestOptions): Promise<CodeLens[] | null>;
|
|
52
|
+
resolveCodeLens(uri: string, lens: CodeLens, options?: LanguageRequestOptions): Promise<CodeLens>;
|
|
53
|
+
}
|
package/dist/service.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { JsonRpcConnection, type RequestHandler } from './connection.ts';
|
|
2
|
+
import { LspDocument } from './document.ts';
|
|
3
|
+
import { type RenamedFile } from './file-operations.ts';
|
|
4
|
+
import type { ApplyWorkspaceEditParams, ApplyWorkspaceEditResult, Command, ConfigurationItem, Disposable, DocumentItem, FileEvent, FileOperationFilter, FileSystemWatcher, InitializeResult, LspTransport, ProgressParams, ProviderOptions, PublishDiagnosticsParams, RequestOptions, ServerCapabilities, TextDocumentSyncOptions, WorkspaceEdit, WorkspaceFolder, WorkspaceSymbol, WorkspaceSymbolResult } from './protocol.ts';
|
|
5
|
+
export type SessionState = 'new' | 'initializing' | 'ready' | 'closing' | 'closed';
|
|
6
|
+
export interface LspSessionOptions {
|
|
7
|
+
rootUri?: string | null;
|
|
8
|
+
workspaceFolders?: WorkspaceFolder[];
|
|
9
|
+
initializationOptions?: unknown;
|
|
10
|
+
configuration?: Record<string, unknown>;
|
|
11
|
+
clientInfo?: {
|
|
12
|
+
name: string;
|
|
13
|
+
version?: string;
|
|
14
|
+
};
|
|
15
|
+
timeoutMs?: number;
|
|
16
|
+
snippetSupport?: boolean;
|
|
17
|
+
onConfiguration?: (item: ConfigurationItem) => unknown | Promise<unknown>;
|
|
18
|
+
onApplyEdit?: (params: ApplyWorkspaceEditParams) => ApplyWorkspaceEditResult | Promise<ApplyWorkspaceEditResult>;
|
|
19
|
+
onShowMessage?: (params: {
|
|
20
|
+
type: number;
|
|
21
|
+
message: string;
|
|
22
|
+
actions?: {
|
|
23
|
+
title: string;
|
|
24
|
+
}[];
|
|
25
|
+
}) => {
|
|
26
|
+
title: string;
|
|
27
|
+
} | null | Promise<{
|
|
28
|
+
title: string;
|
|
29
|
+
} | null>;
|
|
30
|
+
}
|
|
31
|
+
export declare class LspSession {
|
|
32
|
+
readonly connection: JsonRpcConnection;
|
|
33
|
+
readonly options: LspSessionOptions;
|
|
34
|
+
serverInfo?: InitializeResult['serverInfo'];
|
|
35
|
+
private phase;
|
|
36
|
+
private initialized?;
|
|
37
|
+
private shutdownPromise?;
|
|
38
|
+
private serverCapabilities;
|
|
39
|
+
private readonly registrations;
|
|
40
|
+
private readonly documents;
|
|
41
|
+
private readonly diagnosticListeners;
|
|
42
|
+
private readonly capabilityListeners;
|
|
43
|
+
private configuration;
|
|
44
|
+
constructor(transport: LspTransport, options?: LspSessionOptions);
|
|
45
|
+
get state(): SessionState;
|
|
46
|
+
get capabilities(): Readonly<ServerCapabilities>;
|
|
47
|
+
get workspaceFolders(): WorkspaceFolder[] | null;
|
|
48
|
+
get syncOptions(): TextDocumentSyncOptions;
|
|
49
|
+
initialize(): Promise<InitializeResult>;
|
|
50
|
+
openDocument(item: DocumentItem): LspDocument;
|
|
51
|
+
getDocument(uri: string): LspDocument | undefined;
|
|
52
|
+
providerOptions(method: string, document?: Pick<DocumentItem, 'uri' | 'languageId'>): ProviderOptions | undefined;
|
|
53
|
+
supports(method: string, document?: Pick<DocumentItem, 'uri' | 'languageId'>): boolean;
|
|
54
|
+
request<T = unknown>(method: string, params?: unknown, options?: RequestOptions): Promise<T>;
|
|
55
|
+
notify(method: string, params?: unknown): Promise<void>;
|
|
56
|
+
executeCommand<T = unknown>(command: Command | string, args?: unknown[], options?: RequestOptions): Promise<T>;
|
|
57
|
+
workspaceSymbols(query: string, options?: RequestOptions): Promise<WorkspaceSymbolResult>;
|
|
58
|
+
resolveWorkspaceSymbol(symbol: WorkspaceSymbol, options?: RequestOptions): Promise<WorkspaceSymbol>;
|
|
59
|
+
setConfiguration(settings: Record<string, unknown>): Promise<void>;
|
|
60
|
+
onRequest(method: string, handler: RequestHandler): Disposable;
|
|
61
|
+
onNotification(method: string, listener: (params: unknown) => void | Promise<void>): Disposable;
|
|
62
|
+
onError(listener: (error: Error) => void): Disposable;
|
|
63
|
+
onProgress(listener: (params: ProgressParams) => void): Disposable;
|
|
64
|
+
onDiagnostics(listener: (params: PublishDiagnosticsParams) => void): Disposable;
|
|
65
|
+
watchedFiles(): FileSystemWatcher[];
|
|
66
|
+
didChangeWatchedFiles(changes: readonly FileEvent[]): Promise<void>;
|
|
67
|
+
fileOperationFilters(operation: 'willRename' | 'didRename'): FileOperationFilter[];
|
|
68
|
+
willRenameFiles(files: readonly RenamedFile[], options?: RequestOptions): Promise<WorkspaceEdit | null>;
|
|
69
|
+
didRenameFiles(files: readonly RenamedFile[]): Promise<void>;
|
|
70
|
+
onCapabilitiesChanged(listener: () => void): Disposable;
|
|
71
|
+
shutdown(): Promise<void>;
|
|
72
|
+
forgetDocument(document: LspDocument): void;
|
|
73
|
+
private assertReady;
|
|
74
|
+
private stop;
|
|
75
|
+
private readConfiguration;
|
|
76
|
+
private emitDiagnostics;
|
|
77
|
+
private emitCapabilities;
|
|
78
|
+
}
|