@opensumi/sumi 2.12.1-next-079c1930

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.
Files changed (37) hide show
  1. package/README.md +1 -0
  2. package/build.ts +18 -0
  3. package/index.d.ts +5 -0
  4. package/manifest.json +414 -0
  5. package/package.json +18 -0
  6. package/sumi-browser.d.ts +273 -0
  7. package/sumi-worker/sumi-worker.d.ts +2788 -0
  8. package/sumi-worker/worker.command.d.ts +86 -0
  9. package/sumi-worker/worker.comments.d.ts +273 -0
  10. package/sumi-worker/worker.doc.d.ts +356 -0
  11. package/sumi-worker/worker.editor.d.ts +725 -0
  12. package/sumi-worker/worker.extensions.d.ts +63 -0
  13. package/sumi-worker/worker.language.d.ts +2220 -0
  14. package/sumi-worker/worker.window.d.ts +318 -0
  15. package/sumi-worker.d.ts +7 -0
  16. package/sumi.d.ts +822 -0
  17. package/vscode/typings/vscode.authentication.d.ts +231 -0
  18. package/vscode/typings/vscode.command.d.ts +86 -0
  19. package/vscode/typings/vscode.comments.d.ts +292 -0
  20. package/vscode/typings/vscode.d.ts +3789 -0
  21. package/vscode/typings/vscode.debug.d.ts +684 -0
  22. package/vscode/typings/vscode.doc.d.ts +272 -0
  23. package/vscode/typings/vscode.editor.d.ts +1017 -0
  24. package/vscode/typings/vscode.env.d.ts +153 -0
  25. package/vscode/typings/vscode.extension.d.ts +67 -0
  26. package/vscode/typings/vscode.language.d.ts +2630 -0
  27. package/vscode/typings/vscode.message.d.ts +195 -0
  28. package/vscode/typings/vscode.proposed.d.ts +662 -0
  29. package/vscode/typings/vscode.quickpick.d.ts +491 -0
  30. package/vscode/typings/vscode.scm.d.ts +254 -0
  31. package/vscode/typings/vscode.tasks.d.ts +676 -0
  32. package/vscode/typings/vscode.theme.d.ts +370 -0
  33. package/vscode/typings/vscode.window.d.ts +870 -0
  34. package/vscode/typings/vscode.workspace.d.ts +664 -0
  35. package/vscode/typings-pending/vscode.d.ts +27 -0
  36. package/vscode/typings-pending/vscode.proposed.d.ts +3 -0
  37. package/vscode.d.ts +23 -0
@@ -0,0 +1,2220 @@
1
+ declare module 'sumi-worker' {
2
+ export namespace languages {
3
+ /**
4
+ * Compute the match between a document [selector](#DocumentSelector) and a document. Values
5
+ * greater than zero mean the selector matches the document.
6
+ *
7
+ * A match is computed according to these rules:
8
+ * 1. When [`DocumentSelector`](#DocumentSelector) is an array, compute the match for each contained `DocumentFilter` or language identifier and take the maximum value.
9
+ * 2. A string will be desugared to become the `language`-part of a [`DocumentFilter`](#DocumentFilter), so `"fooLang"` is like `{ language: "fooLang" }`.
10
+ * 3. A [`DocumentFilter`](#DocumentFilter) will be matched against the document by comparing its parts with the document. The following rules apply:
11
+ * 1. When the `DocumentFilter` is empty (`{}`) the result is `0`
12
+ * 2. When `scheme`, `language`, or `pattern` are defined but one doesn’t match, the result is `0`
13
+ * 3. Matching against `*` gives a score of `5`, matching via equality or via a glob-pattern gives a score of `10`
14
+ * 4. The result is the maximum value of each match
15
+ *
16
+ * Samples:
17
+ * ```js
18
+ * // default document from disk (file-scheme)
19
+ * doc.uri; //'file:///my/file.js'
20
+ * doc.languageId; // 'javascript'
21
+ * match('javascript', doc); // 10;
22
+ * match({language: 'javascript'}, doc); // 10;
23
+ * match({language: 'javascript', scheme: 'file'}, doc); // 10;
24
+ * match('*', doc); // 5
25
+ * match('fooLang', doc); // 0
26
+ * match(['fooLang', '*'], doc); // 5
27
+ *
28
+ * // virtual document, e.g. from git-index
29
+ * doc.uri; // 'git:/my/file.js'
30
+ * doc.languageId; // 'javascript'
31
+ * match('javascript', doc); // 10;
32
+ * match({language: 'javascript', scheme: 'git'}, doc); // 10;
33
+ * match('*', doc); // 5
34
+ * ```
35
+ *
36
+ * @param selector A document selector.
37
+ * @param document A text document.
38
+ * @return A number `>0` when the selector matches and `0` when the selector does not match.
39
+ */
40
+ export function match(selector: DocumentSelector, document: TextDocument): number;
41
+
42
+ /**
43
+ * Register a completion provider.
44
+ *
45
+ * Multiple providers can be registered for a language. In that case providers are sorted
46
+ * by their [score](#languages.match) and groups of equal score are sequentially asked for
47
+ * completion items. The process stops when one or many providers of a group return a
48
+ * result. A failing provider (rejected promise or exception) will not fail the whole
49
+ * operation.
50
+ *
51
+ * @param selector A selector that defines the documents this provider is applicable to.
52
+ * @param provider A completion provider.
53
+ * @param triggerCharacters Trigger completion when the user types one of the characters, like `.` or `:`.
54
+ * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
55
+ */
56
+ export function registerCompletionItemProvider(selector: DocumentSelector, provider: CompletionItemProvider, ...triggerCharacters: string[]): Disposable;
57
+ /**
58
+ * Register a code lens provider.
59
+ *
60
+ * Multiple providers can be registered for a language. In that case providers are asked in
61
+ * parallel and the results are merged. A failing provider (rejected promise or exception) will
62
+ * not cause a failure of the whole operation.
63
+ *
64
+ * @param selector A selector that defines the documents this provider is applicable to.
65
+ * @param provider A code lens provider.
66
+ * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
67
+ */
68
+ export function registerCodeLensProvider(selector: DocumentSelector, provider: CodeLensProvider): Disposable;
69
+
70
+ /**
71
+ * Register a definition provider.
72
+ *
73
+ * Multiple providers can be registered for a language. In that case providers are asked in
74
+ * parallel and the results are merged. A failing provider (rejected promise or exception) will
75
+ * not cause a failure of the whole operation.
76
+ *
77
+ * @param selector A selector that defines the documents this provider is applicable to.
78
+ * @param provider A definition provider.
79
+ * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
80
+ */
81
+ export function registerDefinitionProvider(selector: DocumentSelector, provider: DefinitionProvider): Disposable;
82
+ /**
83
+ * Register a type definition provider.
84
+ *
85
+ * Multiple providers can be registered for a language. In that case providers are asked in
86
+ * parallel and the results are merged. A failing provider (rejected promise or exception) will
87
+ * not cause a failure of the whole operation.
88
+ *
89
+ * @param selector A selector that defines the documents this provider is applicable to.
90
+ * @param provider A type definition provider.
91
+ * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
92
+ */
93
+ export function registerTypeDefinitionProvider(selector: DocumentSelector, provider: TypeDefinitionProvider): Disposable;
94
+ /**
95
+ * Register a hover provider.
96
+ *
97
+ * Multiple providers can be registered for a language. In that case providers are asked in
98
+ * parallel and the results are merged. A failing provider (rejected promise or exception) will
99
+ * not cause a failure of the whole operation.
100
+ *
101
+ * @param selector A selector that defines the documents this provider is applicable to.
102
+ * @param provider A hover provider.
103
+ * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
104
+ */
105
+ export function registerHoverProvider(selector: DocumentSelector, provider: HoverProvider): Disposable;
106
+ /**
107
+ * Register a declaration provider.
108
+ *
109
+ * Multiple providers can be registered for a language. In that case providers are asked in
110
+ * parallel and the results are merged. A failing provider (rejected promise or exception) will
111
+ * not cause a failure of the whole operation.
112
+ *
113
+ * @param selector A selector that defines the documents this provider is applicable to.
114
+ * @param provider A declaration provider.
115
+ * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
116
+ */
117
+ export function registerDeclarationProvider(selector: DocumentSelector, provider: DeclarationProvider): Disposable;
118
+ /**
119
+ * Register a document highlight provider.
120
+ *
121
+ * Multiple providers can be registered for a language. In that case providers are sorted
122
+ * by their [score](#languages.match) and groups sequentially asked for document highlights.
123
+ * The process stops when a provider returns a `non-falsy` or `non-failure` result.
124
+ *
125
+ * @param selector A selector that defines the documents this provider is applicable to.
126
+ * @param provider A document highlight provider.
127
+ * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
128
+ */
129
+ export function registerDocumentHighlightProvider(selector: DocumentSelector, provider: DocumentHighlightProvider): Disposable;
130
+ /**
131
+ * Register a reference provider.
132
+ *
133
+ * Multiple providers can be registered for a language. In that case providers are asked in
134
+ * parallel and the results are merged. A failing provider (rejected promise or exception) will
135
+ * not cause a failure of the whole operation.
136
+ *
137
+ * @param selector A selector that defines the documents this provider is applicable to.
138
+ * @param provider A reference provider.
139
+ * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
140
+ */
141
+ export function registerReferenceProvider(selector: DocumentSelector, provider: ReferenceProvider): Disposable;
142
+ /**
143
+ * Register a formatting provider for a document range.
144
+ *
145
+ * *Note:* A document range provider is also a [document formatter](#DocumentFormattingEditProvider)
146
+ * which means there is no need to [register](#languages.registerDocumentFormattingEditProvider) a document
147
+ * formatter when also registering a range provider.
148
+ *
149
+ * Multiple providers can be registered for a language. In that case providers are sorted
150
+ * by their [score](#languages.match) and the best-matching provider is used. Failure
151
+ * of the selected provider will cause a failure of the whole operation.
152
+ *
153
+ * @param selector A selector that defines the documents this provider is applicable to.
154
+ * @param provider A document range formatting edit provider.
155
+ * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
156
+ */
157
+ export function registerDocumentRangeFormattingEditProvider(selector: DocumentSelector, provider: DocumentRangeFormattingEditProvider): Disposable;
158
+ /**
159
+ * Register a formatting provider that works on type. The provider is active when the user enables the setting `editor.formatOnType`.
160
+ *
161
+ * Multiple providers can be registered for a language. In that case providers are sorted
162
+ * by their [score](#languages.match) and the best-matching provider is used. Failure
163
+ * of the selected provider will cause a failure of the whole operation.
164
+ *
165
+ * @param selector A selector that defines the documents this provider is applicable to.
166
+ * @param provider An on type formatting edit provider.
167
+ * @param firstTriggerCharacter A character on which formatting should be triggered, like `}`.
168
+ * @param moreTriggerCharacter More trigger characters.
169
+ * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
170
+ */
171
+ export function registerOnTypeFormattingEditProvider(selector: DocumentSelector, provider: OnTypeFormattingEditProvider, firstTriggerCharacter: string, ...moreTriggerCharacter: string[]): Disposable;
172
+ /**
173
+ * Register a document link provider.
174
+ *
175
+ * Multiple providers can be registered for a language. In that case providers are asked in
176
+ * parallel and the results are merged. A failing provider (rejected promise or exception) will
177
+ * not cause a failure of the whole operation.
178
+ *
179
+ * @param selector A selector that defines the documents this provider is applicable to.
180
+ * @param provider A document link provider.
181
+ * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
182
+ */
183
+ export function registerDocumentLinkProvider(selector: DocumentSelector, provider: DocumentLinkProvider): Disposable;
184
+ /**
185
+ * Register a color provider.
186
+ *
187
+ * Multiple providers can be registered for a language. In that case providers are asked in
188
+ * parallel and the results are merged. A failing provider (rejected promise or exception) will
189
+ * not cause a failure of the whole operation.
190
+ *
191
+ * @param selector A selector that defines the documents this provider is applicable to.
192
+ * @param provider A color provider.
193
+ * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
194
+ */
195
+ export function registerColorProvider(selector: DocumentSelector, provider: DocumentColorProvider): Disposable;
196
+
197
+ /**
198
+ * Register a folding range provider.
199
+ *
200
+ * Multiple providers can be registered for a language. In that case providers are asked in
201
+ * parallel and the results are merged.
202
+ * If multiple folding ranges start at the same position, only the range of the first registered provider is used.
203
+ * If a folding range overlaps with an other range that has a smaller position, it is also ignored.
204
+ *
205
+ * A failing provider (rejected promise or exception) will
206
+ * not cause a failure of the whole operation.
207
+ *
208
+ * @param selector A selector that defines the documents this provider is applicable to.
209
+ * @param provider A folding range provider.
210
+ * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
211
+ */
212
+ export function registerFoldingRangeProvider(selector: DocumentSelector, provider: FoldingRangeProvider): Disposable;
213
+ /**
214
+ * Set a [language configuration](#LanguageConfiguration) for a language.
215
+ *
216
+ * @param language A language identifier like `typescript`.
217
+ * @param configuration Language configuration.
218
+ * @return A [disposable](#Disposable) that unsets this configuration.
219
+ */
220
+ export function setLanguageConfiguration(language: string, configuration: LanguageConfiguration): Disposable;
221
+
222
+ /**
223
+ * Return the identifiers of all known languages.
224
+ * @return Promise resolving to an array of identifier strings.
225
+ */
226
+ export function getLanguages(): Thenable<string[]>;
227
+
228
+ /**
229
+ * Set (and change) the [language](#TextDocument.languageId) that is associated
230
+ * with the given document.
231
+ *
232
+ * *Note* that calling this function will trigger the [`onDidCloseTextDocument`](#workspace.onDidCloseTextDocument) event
233
+ * followed by the [`onDidOpenTextDocument`](#workspace.onDidOpenTextDocument) event.
234
+ *
235
+ * @param document The document which language is to be changed
236
+ * @param languageId The new language identifier.
237
+ * @returns A thenable that resolves with the updated document.
238
+ */
239
+ export function setTextDocumentLanguage(document: TextDocument, languageId: string): Thenable<TextDocument>;
240
+
241
+ /**
242
+ * An [event](#Event) which fires when the global set of diagnostics changes. This is
243
+ * newly added and removed diagnostics.
244
+ */
245
+ export const onDidChangeDiagnostics: Event<DiagnosticChangeEvent>;
246
+
247
+ /**
248
+ * Get all diagnostics for a given resource. *Note* that this includes diagnostics from
249
+ * all extensions but *not yet* from the task framework.
250
+ *
251
+ * @param resource A resource
252
+ * @returns An array of [diagnostics](#Diagnostic) objects or an empty array.
253
+ */
254
+ export function getDiagnostics(resource: Uri): Diagnostic[];
255
+
256
+ /**
257
+ * Get all diagnostics. *Note* that this includes diagnostics from
258
+ * all extensions but *not yet* from the task framework.
259
+ *
260
+ * @returns An array of uri-diagnostics tuples or an empty array.
261
+ */
262
+ export function getDiagnostics(): [Uri, Diagnostic[]][];
263
+
264
+ /**
265
+ * Create a diagnostics collection.
266
+ *
267
+ * @param name The [name](#DiagnosticCollection.name) of the collection.
268
+ * @return A new diagnostic collection.
269
+ */
270
+ export function createDiagnosticCollection(name?: string): DiagnosticCollection;
271
+
272
+ /**
273
+ * Register a code action provider.
274
+ *
275
+ * Multiple providers can be registered for a language. In that case providers are asked in
276
+ * parallel and the results are merged. A failing provider (rejected promise or exception) will
277
+ * not cause a failure of the whole operation.
278
+ *
279
+ * @param selector A selector that defines the documents this provider is applicable to.
280
+ * @param provider A code action provider.
281
+ * @param metadata Metadata about the kind of code actions the provider providers.
282
+ * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
283
+ */
284
+ export function registerCodeActionsProvider(selector: DocumentSelector, provider: CodeActionProvider, metadata?: CodeActionProviderMetadata): Disposable;
285
+
286
+ /**
287
+ * Register an implementation provider.
288
+ *
289
+ * Multiple providers can be registered for a language. In that case providers are asked in
290
+ * parallel and the results are merged. A failing provider (rejected promise or exception) will
291
+ * not cause a failure of the whole operation.
292
+ *
293
+ * @param selector A selector that defines the documents this provider is applicable to.
294
+ * @param provider An implementation provider.
295
+ * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
296
+ */
297
+ export function registerImplementationProvider(selector: DocumentSelector, provider: ImplementationProvider): Disposable;
298
+
299
+ /**
300
+ * Register a document symbol provider.
301
+ *
302
+ * Multiple providers can be registered for a language. In that case providers are asked in
303
+ * parallel and the results are merged. A failing provider (rejected promise or exception) will
304
+ * not cause a failure of the whole operation.
305
+ *
306
+ * @param selector A selector that defines the documents this provider is applicable to.
307
+ * @param provider A document symbol provider.
308
+ * @param metaData metadata about the provider
309
+ * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
310
+ */
311
+ export function registerDocumentSymbolProvider(selector: DocumentSelector, provider: DocumentSymbolProvider, metaData?: DocumentSymbolProviderMetadata): Disposable;
312
+
313
+ /**
314
+ * Register a workspace symbol provider.
315
+ *
316
+ * Multiple providers can be registered. In that case providers are asked in parallel and
317
+ * the results are merged. A failing provider (rejected promise or exception) will not cause
318
+ * a failure of the whole operation.
319
+ *
320
+ * @param provider A workspace symbol provider.
321
+ * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
322
+ */
323
+ export function registerWorkspaceSymbolProvider(provider: WorkspaceSymbolProvider): Disposable;
324
+
325
+ /**
326
+ * Register a rename provider.
327
+ *
328
+ * Multiple providers can be registered for a language. In that case providers are sorted
329
+ * by their [score](#languages.match) and the best-matching provider is used. Failure
330
+ * of the selected provider will cause a failure of the whole operation.
331
+ *
332
+ * @param selector A selector that defines the documents this provider is applicable to.
333
+ * @param provider A rename provider.
334
+ * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
335
+ */
336
+ export function registerRenameProvider(selector: DocumentSelector, provider: RenameProvider): Disposable;
337
+
338
+ /**
339
+ * Register a formatting provider for a document.
340
+ *
341
+ * Multiple providers can be registered for a language. In that case providers are sorted
342
+ * by their [score](#languages.match) and the best-matching provider is used. Failure
343
+ * of the selected provider will cause a failure of the whole operation.
344
+ *
345
+ * @param selector A selector that defines the documents this provider is applicable to.
346
+ * @param provider A document formatting edit provider.
347
+ * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
348
+ */
349
+ export function registerDocumentFormattingEditProvider(selector: DocumentSelector, provider: DocumentFormattingEditProvider): Disposable;
350
+
351
+ /**
352
+ * Register a signature help provider.
353
+ *
354
+ * Multiple providers can be registered for a language. In that case providers are sorted
355
+ * by their [score](#languages.match) and called sequentially until a provider returns a
356
+ * valid result.
357
+ *
358
+ * @param selector A selector that defines the documents this provider is applicable to.
359
+ * @param provider A signature help provider.
360
+ * @param triggerCharacters Trigger signature help when the user types one of the characters, like `,` or `(`.
361
+ * @param metadata Information about the provider.
362
+ * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
363
+ */
364
+ export function registerSignatureHelpProvider(selector: DocumentSelector, provider: SignatureHelpProvider, ...triggerCharacters: string[]): Disposable;
365
+ export function registerSignatureHelpProvider(selector: DocumentSelector, provider: SignatureHelpProvider, metadata: SignatureHelpProviderMetadata): Disposable;
366
+
367
+ /**
368
+ * Register a selection range provider.
369
+ *
370
+ * Multiple providers can be registered for a language. In that case providers are asked in
371
+ * parallel and the results are merged. A failing provider (rejected promise or exception) will
372
+ * not cause a failure of the whole operation.
373
+ *
374
+ * @param selector A selector that defines the documents this provider is applicable to.
375
+ * @param provider A selection range provider.
376
+ * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
377
+ */
378
+ export function registerSelectionRangeProvider(selector: DocumentSelector, provider: SelectionRangeProvider): Disposable;
379
+ }
380
+
381
+ /**
382
+ * A code action represents a change that can be performed in code, e.g. to fix a problem or
383
+ * to refactor code.
384
+ *
385
+ * A CodeAction must set either [`edit`](#CodeAction.edit) and/or a [`command`](#CodeAction.command). If both are supplied, the `edit` is applied first, then the command is executed.
386
+ */
387
+ export class CodeAction {
388
+
389
+ /**
390
+ * A short, human-readable, title for this code action.
391
+ */
392
+ title: string;
393
+
394
+ /**
395
+ * A [workspace edit](#WorkspaceEdit) this code action performs.
396
+ */
397
+ edit?: WorkspaceEdit;
398
+
399
+ /**
400
+ * [Diagnostics](#Diagnostic) that this code action resolves.
401
+ */
402
+ diagnostics?: Diagnostic[];
403
+
404
+ /**
405
+ * A [command](#Command) this code action executes.
406
+ */
407
+ command?: Command;
408
+
409
+ /**
410
+ * [Kind](#CodeActionKind) of the code action.
411
+ *
412
+ * Used to filter code actions.
413
+ */
414
+ kind?: CodeActionKind;
415
+
416
+ /**
417
+ * Marks this as a preferred action. Preferred actions are used by the `auto fix` command and can be targeted
418
+ * by keybindings.
419
+ *
420
+ * A quick fix should be marked preferred if it properly addresses the underlying error.
421
+ * A refactoring should be marked preferred if it is the most reasonable choice of actions to take.
422
+ */
423
+ isPreferred?: boolean;
424
+
425
+ /**
426
+ * Creates a new code action.
427
+ *
428
+ * A code action must have at least a [title](#CodeAction.title) and [edits](#CodeAction.edit)
429
+ * and/or a [command](#CodeAction.command).
430
+ *
431
+ * @param title The title of the code action.
432
+ * @param kind The kind of the code action.
433
+ */
434
+ constructor(title: string, kind?: CodeActionKind);
435
+ }
436
+
437
+ /**
438
+ * Kind of a code action.
439
+ *
440
+ * Kinds are a hierarchical list of identifiers separated by `.`, e.g. `"refactor.extract.function"`.
441
+ *
442
+ * Code action kinds are used by VS Code for UI elements such as the refactoring context menu. Users
443
+ * can also trigger code actions with a specific kind with the `editor.action.codeAction` command.
444
+ */
445
+ export class CodeActionKind {
446
+ /**
447
+ * Empty kind.
448
+ */
449
+ static readonly Empty: CodeActionKind;
450
+
451
+ /**
452
+ * Base kind for quickfix actions: `quickfix`.
453
+ *
454
+ * Quick fix actions address a problem in the code and are shown in the normal code action context menu.
455
+ */
456
+ static readonly QuickFix: CodeActionKind;
457
+
458
+ /**
459
+ * Base kind for refactoring actions: `refactor`
460
+ *
461
+ * Refactoring actions are shown in the refactoring context menu.
462
+ */
463
+ static readonly Refactor: CodeActionKind;
464
+
465
+ /**
466
+ * Base kind for refactoring extraction actions: `refactor.extract`
467
+ *
468
+ * Example extract actions:
469
+ *
470
+ * - Extract method
471
+ * - Extract function
472
+ * - Extract variable
473
+ * - Extract interface from class
474
+ * - ...
475
+ */
476
+ static readonly RefactorExtract: CodeActionKind;
477
+
478
+ /**
479
+ * Base kind for refactoring inline actions: `refactor.inline`
480
+ *
481
+ * Example inline actions:
482
+ *
483
+ * - Inline function
484
+ * - Inline variable
485
+ * - Inline constant
486
+ * - ...
487
+ */
488
+ static readonly RefactorInline: CodeActionKind;
489
+
490
+ /**
491
+ * Base kind for refactoring rewrite actions: `refactor.rewrite`
492
+ *
493
+ * Example rewrite actions:
494
+ *
495
+ * - Convert JavaScript function to class
496
+ * - Add or remove parameter
497
+ * - Encapsulate field
498
+ * - Make method static
499
+ * - Move method to base class
500
+ * - ...
501
+ */
502
+ static readonly RefactorRewrite: CodeActionKind;
503
+
504
+ /**
505
+ * Base kind for source actions: `source`
506
+ *
507
+ * Source code actions apply to the entire file and can be run on save
508
+ * using `editor.codeActionsOnSave`. They also are shown in `source` context menu.
509
+ */
510
+ static readonly Source: CodeActionKind;
511
+
512
+ /**
513
+ * Base kind for an organize imports source action: `source.organizeImports`.
514
+ */
515
+ static readonly SourceOrganizeImports: CodeActionKind;
516
+
517
+ /**
518
+ * Base kind for auto-fix source actions: `source.fixAll`.
519
+ *
520
+ * Fix all actions automatically fix errors that have a clear fix that do not require user input.
521
+ * They should not suppress errors or perform unsafe fixes such as generating new types or classes.
522
+ */
523
+ static readonly SourceFixAll: CodeActionKind;
524
+
525
+ private constructor(value: string);
526
+
527
+ /**
528
+ * String value of the kind, e.g. `"refactor.extract.function"`.
529
+ */
530
+ readonly value: string;
531
+
532
+ /**
533
+ * Create a new kind by appending a more specific selector to the current kind.
534
+ *
535
+ * Does not modify the current kind.
536
+ */
537
+ append(parts: string): CodeActionKind;
538
+
539
+ /**
540
+ * Checks if this code action kind intersects `other`.
541
+ *
542
+ * The kind `"refactor.extract"` for example intersects `refactor`, `"refactor.extract"` and ``"refactor.extract.function"`,
543
+ * but not `"unicorn.refactor.extract"`, or `"refactor.extractAll"`.
544
+ *
545
+ * @param other Kind to check.
546
+ */
547
+ intersects(other: CodeActionKind): boolean;
548
+
549
+ /**
550
+ * Checks if `other` is a sub-kind of this `CodeActionKind`.
551
+ *
552
+ * The kind `"refactor.extract"` for example contains `"refactor.extract"` and ``"refactor.extract.function"`,
553
+ * but not `"unicorn.refactor.extract"`, or `"refactor.extractAll"` or `refactor`.
554
+ *
555
+ * @param other Kind to check.
556
+ */
557
+ contains(other: CodeActionKind): boolean;
558
+ }
559
+ export class CodeLens {
560
+
561
+ /**
562
+ * The range in which this code lens is valid. Should only span a single line.
563
+ */
564
+ range: Range;
565
+
566
+ /**
567
+ * The command this code lens represents.
568
+ */
569
+ command?: Command;
570
+
571
+ /**
572
+ * `true` when there is a command associated.
573
+ */
574
+ readonly isResolved: boolean;
575
+
576
+ /**
577
+ * Creates a new code lens object.
578
+ *
579
+ * @param range The range to which this code lens applies.
580
+ * @param command The command associated to this code lens.
581
+ */
582
+ constructor(range: Range, command?: Command);
583
+ }
584
+ /**
585
+ * A hover represents additional information for a symbol or word. Hovers are
586
+ * rendered in a tooltip-like widget.
587
+ */
588
+ export class Hover {
589
+
590
+ /**
591
+ * The contents of this hover.
592
+ */
593
+ contents: MarkedString[];
594
+
595
+ /**
596
+ * The range to which this hover applies. When missing, the
597
+ * editor will use the range at the current position or the
598
+ * current position itself.
599
+ */
600
+ range?: Range;
601
+
602
+ /**
603
+ * Creates a new hover object.
604
+ *
605
+ * @param contents The contents of the hover.
606
+ * @param range The range to which the hover applies.
607
+ */
608
+ constructor(contents: MarkedString | MarkedString[], range?: Range);
609
+ }
610
+ /**
611
+ * Contains additional diagnostic information about the context in which
612
+ * a [code action](#CodeActionProvider.provideCodeActions) is run.
613
+ */
614
+ export interface CodeActionContext {
615
+ /**
616
+ * An array of diagnostics.
617
+ */
618
+ readonly diagnostics: ReadonlyArray<Diagnostic>;
619
+
620
+ /**
621
+ * Requested kind of actions to return.
622
+ *
623
+ * Actions not of this kind are filtered out before being shown by the lightbulb.
624
+ */
625
+ readonly only?: CodeActionKind;
626
+ }
627
+ /**
628
+ * The code action interface defines the contract between extensions and
629
+ * the [light bulb](https://code.visualstudio.com/docs/editor/editingevolved#_code-action) feature.
630
+ *
631
+ * A code action can be any command that is [known](#commands.getCommands) to the system.
632
+ */
633
+ export interface CodeActionProvider {
634
+ /**
635
+ * Provide commands for the given document and range.
636
+ *
637
+ * @param document The document in which the command was invoked.
638
+ * @param range The selector or range for which the command was invoked. This will always be a selection if
639
+ * there is a currently active editor.
640
+ * @param context Context carrying additional information.
641
+ * @param token A cancellation token.
642
+ * @return An array of commands, quick fixes, or refactorings or a thenable of such. The lack of a result can be
643
+ * signaled by returning `undefined`, `null`, or an empty array.
644
+ */
645
+ provideCodeActions(document: TextDocument, range: Range | Selection, context: CodeActionContext, token: CancellationToken): ProviderResult<(Command | CodeAction)[]>;
646
+ }
647
+
648
+ /**
649
+ * Metadata about the type of code actions that a [CodeActionProvider](#CodeActionProvider) providers
650
+ */
651
+ export interface CodeActionProviderMetadata {
652
+ /**
653
+ * [CodeActionKinds](#CodeActionKind) that this provider may return.
654
+ *
655
+ * The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the provider
656
+ * may list our every specific kind they provide, such as `CodeActionKind.Refactor.Extract.append('function`)`
657
+ */
658
+ readonly providedCodeActionKinds?: ReadonlyArray<CodeActionKind>;
659
+ }
660
+
661
+ /**
662
+ * A code lens represents a [command](#Command) that should be shown along with
663
+ * source text, like the number of references, a way to run tests, etc.
664
+ *
665
+ * A code lens is _unresolved_ when no command is associated to it. For performance
666
+ * reasons the creation of a code lens and resolving should be done to two stages.
667
+ *
668
+ * @see [CodeLensProvider.provideCodeLenses](#CodeLensProvider.provideCodeLenses)
669
+ * @see [CodeLensProvider.resolveCodeLens](#CodeLensProvider.resolveCodeLens)
670
+ */
671
+
672
+ /**
673
+ * A code lens provider adds [commands](#Command) to source text. The commands will be shown
674
+ * as dedicated horizontal lines in between the source text.
675
+ */
676
+ export interface CodeLensProvider<T extends CodeLens = CodeLens> {
677
+
678
+ /**
679
+ * An optional event to signal that the code lenses from this provider have changed.
680
+ */
681
+ onDidChangeCodeLenses?: Event<void>;
682
+
683
+ /**
684
+ * Compute a list of [lenses](#CodeLens). This call should return as fast as possible and if
685
+ * computing the commands is expensive implementors should only return code lens objects with the
686
+ * range set and implement [resolve](#CodeLensProvider.resolveCodeLens).
687
+ *
688
+ * @param document The document in which the command was invoked.
689
+ * @param token A cancellation token.
690
+ * @return An array of code lenses or a thenable that resolves to such. The lack of a result can be
691
+ * signaled by returning `undefined`, `null`, or an empty array.
692
+ */
693
+ provideCodeLenses(document: TextDocument, token: CancellationToken): ProviderResult<T[]>;
694
+
695
+ /**
696
+ * This function will be called for each visible code lens, usually when scrolling and after
697
+ * calls to [compute](#CodeLensProvider.provideCodeLenses)-lenses.
698
+ *
699
+ * @param codeLens code lens that must be resolved.
700
+ * @param token A cancellation token.
701
+ * @return The given, resolved code lens or thenable that resolves to such.
702
+ */
703
+ resolveCodeLens?(codeLens: T, token: CancellationToken): ProviderResult<T>;
704
+ }
705
+
706
+ /**
707
+ * The hover provider interface defines the contract between extensions and
708
+ * the [hover](https://code.visualstudio.com/docs/editor/intellisense)-feature.
709
+ */
710
+ export interface HoverProvider {
711
+
712
+ /**
713
+ * Provide a hover for the given position and document. Multiple hovers at the same
714
+ * position will be merged by the editor. A hover can have a range which defaults
715
+ * to the word range at the position when omitted.
716
+ *
717
+ * @param document The document in which the command was invoked.
718
+ * @param position The position at which the command was invoked.
719
+ * @param token A cancellation token.
720
+ * @return A hover or a thenable that resolves to such. The lack of a result can be
721
+ * signaled by returning `undefined` or `null`.
722
+ */
723
+ provideHover(document: TextDocument, position: Position, token: CancellationToken): ProviderResult<Hover>;
724
+ }
725
+
726
+ /**
727
+ * A document highlight kind.
728
+ */
729
+ export enum DocumentHighlightKind {
730
+
731
+ /**
732
+ * A textual occurrence.
733
+ */
734
+ Text = 0,
735
+
736
+ /**
737
+ * Read-access of a symbol, like reading a variable.
738
+ */
739
+ Read = 1,
740
+
741
+ /**
742
+ * Write-access of a symbol, like writing to a variable.
743
+ */
744
+ Write = 2,
745
+ }
746
+
747
+ /**
748
+ * A document highlight is a range inside a text document which deserves
749
+ * special attention. Usually a document highlight is visualized by changing
750
+ * the background color of its range.
751
+ */
752
+ export class DocumentHighlight {
753
+
754
+ /**
755
+ * The range this highlight applies to.
756
+ */
757
+ range: Range;
758
+
759
+ /**
760
+ * The highlight kind, default is [text](#DocumentHighlightKind.Text).
761
+ */
762
+ kind?: DocumentHighlightKind;
763
+
764
+ /**
765
+ * Creates a new document highlight object.
766
+ *
767
+ * @param range The range the highlight applies to.
768
+ * @param kind The highlight kind, default is [text](#DocumentHighlightKind.Text).
769
+ */
770
+ constructor(range: Range, kind?: DocumentHighlightKind);
771
+ }
772
+ /**
773
+ * The document highlight provider interface defines the contract between extensions and
774
+ * the word-highlight-feature.
775
+ */
776
+ export interface DocumentHighlightProvider {
777
+
778
+ /**
779
+ * Provide a set of document highlights, like all occurrences of a variable or
780
+ * all exit-points of a function.
781
+ *
782
+ * @param document The document in which the command was invoked.
783
+ * @param position The position at which the command was invoked.
784
+ * @param token A cancellation token.
785
+ * @return An array of document highlights or a thenable that resolves to such. The lack of a result can be
786
+ * signaled by returning `undefined`, `null`, or an empty array.
787
+ */
788
+ provideDocumentHighlights(document: TextDocument, position: Position, token: CancellationToken): ProviderResult<DocumentHighlight[]>;
789
+ }
790
+ /**
791
+ * A completion item represents a text snippet that is proposed to complete text that is being typed.
792
+ *
793
+ * It is sufficient to create a completion item from just a [label](#CompletionItem.label). In that
794
+ * case the completion item will replace the [word](#TextDocument.getWordRangeAtPosition)
795
+ * until the cursor with the given label or [insertText](#CompletionItem.insertText). Otherwise the
796
+ * given [edit](#CompletionItem.textEdit) is used.
797
+ *
798
+ * When selecting a completion item in the editor its defined or synthesized text edit will be applied
799
+ * to *all* cursors/selections whereas [additionalTextEdits](#CompletionItem.additionalTextEdits) will be
800
+ * applied as provided.
801
+ *
802
+ * @see [CompletionItemProvider.provideCompletionItems](#CompletionItemProvider.provideCompletionItems)
803
+ * @see [CompletionItemProvider.resolveCompletionItem](#CompletionItemProvider.resolveCompletionItem)
804
+ * @寻壑
805
+ */
806
+ export class CompletionItem {
807
+
808
+ /**
809
+ * The label of this completion item. By default
810
+ * this is also the text that is inserted when selecting
811
+ * this completion.
812
+ */
813
+ label: string;
814
+
815
+ /**
816
+ * The kind of this completion item. Based on the kind
817
+ * an icon is chosen by the editor.
818
+ */
819
+ kind?: CompletionItemKind;
820
+
821
+ /**
822
+ * A human-readable string with additional information
823
+ * about this item, like type or symbol information.
824
+ */
825
+ detail?: string;
826
+
827
+ /**
828
+ * A human-readable string that represents a doc-comment.
829
+ */
830
+ documentation?: string | MarkdownString;
831
+
832
+ /**
833
+ * A string that should be used when comparing this item
834
+ * with other items. When `falsy` the [label](#CompletionItem.label)
835
+ * is used.
836
+ */
837
+ sortText?: string;
838
+
839
+ /**
840
+ * A string that should be used when filtering a set of
841
+ * completion items. When `falsy` the [label](#CompletionItem.label)
842
+ * is used.
843
+ */
844
+ filterText?: string;
845
+
846
+ /**
847
+ * Select this item when showing. *Note* that only one completion item can be selected and
848
+ * that the editor decides which item that is. The rule is that the *first* item of those
849
+ * that match best is selected.
850
+ */
851
+ preselect?: boolean;
852
+
853
+ /**
854
+ * A string or snippet that should be inserted in a document when selecting
855
+ * this completion. When `falsy` the [label](#CompletionItem.label)
856
+ * is used.
857
+ */
858
+ insertText?: string | SnippetString;
859
+
860
+ /**
861
+ * A range of text that should be replaced by this completion item.
862
+ *
863
+ * Defaults to a range from the start of the [current word](#TextDocument.getWordRangeAtPosition) to the
864
+ * current position.
865
+ *
866
+ * *Note:* The range must be a [single line](#Range.isSingleLine) and it must
867
+ * [contain](#Range.contains) the position at which completion has been [requested](#CompletionItemProvider.provideCompletionItems).
868
+ */
869
+ range?: Range;
870
+
871
+ /**
872
+ * An optional set of characters that when pressed while this completion is active will accept it first and
873
+ * then type that character. *Note* that all commit characters should have `length=1` and that superfluous
874
+ * characters will be ignored.
875
+ */
876
+ commitCharacters?: string[];
877
+
878
+ /**
879
+ * Keep whitespace of the [insertText](#CompletionItem.insertText) as is. By default, the editor adjusts leading
880
+ * whitespace of new lines so that they match the indentation of the line for which the item is accepted - setting
881
+ * this to `true` will prevent that.
882
+ */
883
+ keepWhitespace?: boolean;
884
+
885
+ /**
886
+ * @deprecated Use `CompletionItem.insertText` and `CompletionItem.range` instead.
887
+ *
888
+ * ~~An [edit](#TextEdit) which is applied to a document when selecting
889
+ * this completion. When an edit is provided the value of
890
+ * [insertText](#CompletionItem.insertText) is ignored.~~
891
+ *
892
+ * ~~The [range](#Range) of the edit must be single-line and on the same
893
+ * line completions were [requested](#CompletionItemProvider.provideCompletionItems) at.~~
894
+ */
895
+ textEdit?: TextEdit;
896
+
897
+ /**
898
+ * An optional array of additional [text edits](#TextEdit) that are applied when
899
+ * selecting this completion. Edits must not overlap with the main [edit](#CompletionItem.textEdit)
900
+ * nor with themselves.
901
+ */
902
+ additionalTextEdits?: TextEdit[];
903
+
904
+ /**
905
+ * An optional [command](#Command) that is executed *after* inserting this completion. *Note* that
906
+ * additional modifications to the current document should be described with the
907
+ * [additionalTextEdits](#CompletionItem.additionalTextEdits)-property.
908
+ */
909
+ command?: Command;
910
+
911
+ /**
912
+ * Creates a new completion item.
913
+ *
914
+ * Completion items must have at least a [label](#CompletionItem.label) which then
915
+ * will be used as insert text as well as for sorting and filtering.
916
+ *
917
+ * @param label The label of the completion.
918
+ * @param kind The [kind](#CompletionItemKind) of the completion.
919
+ */
920
+ constructor(label: string, kind?: CompletionItemKind);
921
+ }
922
+
923
+ /**
924
+ * Represents a collection of [completion items](#CompletionItem) to be presented
925
+ * in the editor.
926
+ * @寻壑
927
+ */
928
+ export class CompletionList {
929
+
930
+ /**
931
+ * This list is not complete. Further typing should result in recomputing
932
+ * this list.
933
+ */
934
+ isIncomplete?: boolean;
935
+
936
+ /**
937
+ * The completion items.
938
+ */
939
+ items: CompletionItem[];
940
+
941
+ /**
942
+ * Creates a new completion list.
943
+ *
944
+ * @param items The completion items.
945
+ * @param isIncomplete The list is not complete.
946
+ */
947
+ constructor(items?: CompletionItem[], isIncomplete?: boolean);
948
+ }
949
+ /**
950
+ * A document link is a range in a text document that links to an internal or external resource, like another
951
+ * text document or a web site.
952
+ * @木农
953
+ */
954
+ export class DocumentLink {
955
+
956
+ /**
957
+ * The range this link applies to.
958
+ */
959
+ range: Range;
960
+
961
+ /**
962
+ * The uri this link points to.
963
+ */
964
+ target?: Uri;
965
+
966
+ /**
967
+ * The tooltip text when you hover over this link.
968
+ *
969
+ * If a tooltip is provided, is will be displayed in a string that includes instructions on how to
970
+ * trigger the link, such as `{0} (ctrl + click)`. The specific instructions vary depending on OS,
971
+ * user settings, and localization.
972
+ */
973
+ tooltip?: string;
974
+
975
+ /**
976
+ * Creates a new document link.
977
+ *
978
+ * @param range The range the document link applies to. Must not be empty.
979
+ * @param target The uri the document link points to.
980
+ */
981
+ constructor(range: Range, target?: Uri);
982
+ }
983
+
984
+ /**
985
+ * The document link provider defines the contract between extensions and feature of showing
986
+ * links in the editor.
987
+ */
988
+ export interface DocumentLinkProvider {
989
+
990
+ /**
991
+ * Provide links for the given document. Note that the editor ships with a default provider that detects
992
+ * `http(s)` and `file` links.
993
+ *
994
+ * @param document The document in which the command was invoked.
995
+ * @param token A cancellation token.
996
+ * @return An array of [document links](#DocumentLink) or a thenable that resolves to such. The lack of a result
997
+ * can be signaled by returning `undefined`, `null`, or an empty array.
998
+ */
999
+ provideDocumentLinks(document: TextDocument, token: CancellationToken): ProviderResult<DocumentLink[]>;
1000
+
1001
+ /**
1002
+ * Given a link fill in its [target](#DocumentLink.target). This method is called when an incomplete
1003
+ * link is selected in the UI. Providers can implement this method and return incomplete links
1004
+ * (without target) from the [`provideDocumentLinks`](#DocumentLinkProvider.provideDocumentLinks) method which
1005
+ * often helps to improve performance.
1006
+ *
1007
+ * @param link The link that is to be resolved.
1008
+ * @param token A cancellation token.
1009
+ */
1010
+ resolveDocumentLink?(link: DocumentLink, token: CancellationToken): ProviderResult<DocumentLink>;
1011
+ }
1012
+
1013
+ /**
1014
+ * The document color provider defines the contract between extensions and feature of
1015
+ * picking and modifying colors in the editor.
1016
+ */
1017
+ export interface DocumentColorProvider {
1018
+
1019
+ /**
1020
+ * Provide colors for the given document.
1021
+ *
1022
+ * @param document The document in which the command was invoked.
1023
+ * @param token A cancellation token.
1024
+ * @return An array of [color information](#ColorInformation) or a thenable that resolves to such. The lack of a result
1025
+ * can be signaled by returning `undefined`, `null`, or an empty array.
1026
+ */
1027
+ provideDocumentColors(document: TextDocument, token: CancellationToken): ProviderResult<ColorInformation[]>;
1028
+
1029
+ /**
1030
+ * Provide [representations](#ColorPresentation) for a color.
1031
+ *
1032
+ * @param color The color to show and insert.
1033
+ * @param context A context object with additional information
1034
+ * @param token A cancellation token.
1035
+ * @return An array of color presentations or a thenable that resolves to such. The lack of a result
1036
+ * can be signaled by returning `undefined`, `null`, or an empty array.
1037
+ */
1038
+ provideColorPresentations(color: Color, context: { document: TextDocument, range: Range }, token: CancellationToken): ProviderResult<ColorPresentation[]>;
1039
+ }
1040
+
1041
+ /**
1042
+ * A line based folding range. To be valid, start and end line must be bigger than zero and smaller than the number of lines in the document.
1043
+ * Invalid ranges will be ignored.
1044
+ */
1045
+ export class FoldingRange {
1046
+
1047
+ /**
1048
+ * The zero-based start line of the range to fold. The folded area starts after the line's last character.
1049
+ * To be valid, the end must be zero or larger and smaller than the number of lines in the document.
1050
+ */
1051
+ start: number;
1052
+
1053
+ /**
1054
+ * The zero-based end line of the range to fold. The folded area ends with the line's last character.
1055
+ * To be valid, the end must be zero or larger and smaller than the number of lines in the document.
1056
+ */
1057
+ end: number;
1058
+
1059
+ /**
1060
+ * Describes the [Kind](#FoldingRangeKind) of the folding range such as [Comment](#FoldingRangeKind.Comment) or
1061
+ * [Region](#FoldingRangeKind.Region). The kind is used to categorize folding ranges and used by commands
1062
+ * like 'Fold all comments'. See
1063
+ * [FoldingRangeKind](#FoldingRangeKind) for an enumeration of all kinds.
1064
+ * If not set, the range is originated from a syntax element.
1065
+ */
1066
+ kind?: FoldingRangeKind;
1067
+
1068
+ /**
1069
+ * Creates a new folding range.
1070
+ *
1071
+ * @param start The start line of the folded range.
1072
+ * @param end The end line of the folded range.
1073
+ * @param kind The kind of the folding range.
1074
+ */
1075
+ constructor(start: number, end: number, kind?: FoldingRangeKind);
1076
+ }
1077
+
1078
+ /**
1079
+ * An enumeration of specific folding range kinds. The kind is an optional field of a [FoldingRange](#FoldingRange)
1080
+ * and is used to distinguish specific folding ranges such as ranges originated from comments. The kind is used by commands like
1081
+ * `Fold all comments` or `Fold all regions`.
1082
+ * If the kind is not set on the range, the range originated from a syntax element other than comments, imports or region markers.
1083
+ */
1084
+ export enum FoldingRangeKind {
1085
+ /**
1086
+ * Kind for folding range representing a comment.
1087
+ */
1088
+ Comment = 1,
1089
+ /**
1090
+ * Kind for folding range representing a import.
1091
+ */
1092
+ Imports = 2,
1093
+ /**
1094
+ * Kind for folding range representing regions originating from folding markers like `#region` and `#endregion`.
1095
+ */
1096
+ Region = 3,
1097
+ }
1098
+
1099
+ /**
1100
+ * Folding context (for future use)
1101
+ */
1102
+ // tslint:disable-next-line:no-empty-interface
1103
+ export interface FoldingContext {
1104
+ }
1105
+
1106
+ /**
1107
+ * The folding range provider interface defines the contract between extensions and
1108
+ * [Folding](https://code.visualstudio.com/docs/editor/codebasics#_folding) in the editor.
1109
+ */
1110
+ export interface FoldingRangeProvider {
1111
+ /**
1112
+ * Returns a list of folding ranges or null and undefined if the provider
1113
+ * does not want to participate or was cancelled.
1114
+ * @param document The document in which the command was invoked.
1115
+ * @param context Additional context information (for future use)
1116
+ * @param token A cancellation token.
1117
+ */
1118
+ provideFoldingRanges(document: TextDocument, context: FoldingContext, token: CancellationToken): ProviderResult<FoldingRange[]>;
1119
+ }
1120
+ /**
1121
+ * Describes what to do with the indentation when pressing Enter.
1122
+ */
1123
+ export enum IndentAction {
1124
+ /**
1125
+ * Insert new line and copy the previous line's indentation.
1126
+ */
1127
+ None = 0,
1128
+ /**
1129
+ * Insert new line and indent once (relative to the previous line's indentation).
1130
+ */
1131
+ Indent = 1,
1132
+ /**
1133
+ * Insert two new lines:
1134
+ * - the first one indented which will hold the cursor
1135
+ * - the second one at the same indentation level
1136
+ */
1137
+ IndentOutdent = 2,
1138
+ /**
1139
+ * Insert new line and outdent once (relative to the previous line's indentation).
1140
+ */
1141
+ Outdent = 3,
1142
+ }
1143
+ export interface LanguageConfiguration {
1144
+ /**
1145
+ * The language's comment settings.
1146
+ */
1147
+ comments?: CommentRule;
1148
+ /**
1149
+ * The language's brackets.
1150
+ * This configuration implicitly affects pressing Enter around these brackets.
1151
+ */
1152
+ brackets?: CharacterPair[];
1153
+ /**
1154
+ * The language's word definition.
1155
+ * If the language supports Unicode identifiers (e.g. JavaScript), it is preferable
1156
+ * to provide a word definition that uses exclusion of known separators.
1157
+ * e.g.: A regex that matches anything except known separators (and dot is allowed to occur in a floating point number):
1158
+ * /(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g
1159
+ */
1160
+ wordPattern?: RegExp;
1161
+ /**
1162
+ * The language's indentation settings.
1163
+ */
1164
+ indentationRules?: IndentationRule;
1165
+ /**
1166
+ * The language's rules to be evaluated when pressing Enter.
1167
+ */
1168
+ onEnterRules?: OnEnterRule[];
1169
+
1170
+ /**
1171
+ * **Deprecated** Do not use.
1172
+ *
1173
+ * @deprecated Will be replaced by a better API soon.
1174
+ */
1175
+ __electricCharacterSupport?: {
1176
+ /**
1177
+ * This property is deprecated and will be **ignored** from
1178
+ * the editor.
1179
+ * @deprecated
1180
+ */
1181
+ brackets?: any;
1182
+ /**
1183
+ * This property is deprecated and not fully supported anymore by
1184
+ * the editor (scope and lineStart are ignored).
1185
+ * Use the autoClosingPairs property in the language configuration file instead.
1186
+ * @deprecated
1187
+ */
1188
+ docComment?: {
1189
+ scope: string;
1190
+ open: string;
1191
+ lineStart: string;
1192
+ close?: string;
1193
+ };
1194
+ };
1195
+
1196
+ /**
1197
+ * **Deprecated** Do not use.
1198
+ *
1199
+ * @deprecated * Use the autoClosingPairs property in the language configuration file instead.
1200
+ */
1201
+ __characterPairSupport?: {
1202
+ autoClosingPairs: {
1203
+ open: string;
1204
+ close: string;
1205
+ notIn?: string[];
1206
+ }[];
1207
+ };
1208
+ }
1209
+ /**
1210
+ * Represents a location inside a resource, such as a line
1211
+ * inside a text file.
1212
+ */
1213
+ export class Location {
1214
+
1215
+ /**
1216
+ * The resource identifier of this location.
1217
+ */
1218
+ uri: Uri;
1219
+
1220
+ /**
1221
+ * The document range of this location.
1222
+ */
1223
+ range: Range;
1224
+
1225
+ /**
1226
+ * Creates a new location object.
1227
+ *
1228
+ * @param uri The resource identifier.
1229
+ * @param rangeOrPosition The range or position. Positions will be converted to an empty range.
1230
+ */
1231
+ constructor(uri: Uri, rangeOrPosition: Range | Position);
1232
+ }
1233
+
1234
+ /**
1235
+ * Represents the connection of two locations. Provides additional metadata over normal [locations](#Location),
1236
+ * including an origin range.
1237
+ */
1238
+ export interface LocationLink {
1239
+ /**
1240
+ * Span of the origin of this link.
1241
+ *
1242
+ * Used as the underlined span for mouse definition hover. Defaults to the word range at
1243
+ * the definition position.
1244
+ */
1245
+ originSelectionRange?: Range;
1246
+
1247
+ /**
1248
+ * The target resource identifier of this link.
1249
+ */
1250
+ targetUri: Uri;
1251
+
1252
+ /**
1253
+ * The full target range of this link.
1254
+ */
1255
+ targetRange: Range;
1256
+
1257
+ /**
1258
+ * The span of this link.
1259
+ */
1260
+ targetSelectionRange?: Range;
1261
+ }
1262
+ /**
1263
+ * The MarkdownString represents human-readable text that supports formatting via the
1264
+ * markdown syntax. Standard markdown is supported, also tables, but no embedded html.
1265
+ *
1266
+ * When created with `supportThemeIcons` then rendering of [theme icons](#ThemeIcon) via
1267
+ * the `$(<name>)`-syntax is supported.
1268
+ */
1269
+ export class MarkdownString {
1270
+
1271
+ /**
1272
+ * The markdown string.
1273
+ */
1274
+ value: string;
1275
+
1276
+ /**
1277
+ * Indicates that this markdown string is from a trusted source. Only *trusted*
1278
+ * markdown supports links that execute commands, e.g. `[Run it](command:myCommandId)`.
1279
+ */
1280
+ isTrusted?: boolean;
1281
+
1282
+ /**
1283
+ * Indicates that this markdown string can contain [ThemeIcons](#ThemeIcon), e.g. `$(zap)`.
1284
+ */
1285
+ readonly supportThemeIcons?: boolean;
1286
+
1287
+ /**
1288
+ * Creates a new markdown string with the given value.
1289
+ *
1290
+ * @param value Optional, initial value.
1291
+ * @param supportThemeIcons Optional, Specifies whether [ThemeIcons](#ThemeIcon) are supported within the [`MarkdownString`](#MarkdownString).
1292
+ */
1293
+ constructor(value?: string, supportThemeIcons?: boolean);
1294
+
1295
+ /**
1296
+ * Appends and escapes the given string to this markdown string.
1297
+ * @param value Plain text.
1298
+ */
1299
+ appendText(value: string): MarkdownString;
1300
+
1301
+ /**
1302
+ * Appends the given string 'as is' to this markdown string. When [`supportThemeIcons`](#MarkdownString.supportThemeIcons) is `true`, [ThemeIcons](#ThemeIcon) in the `value` will be iconified.
1303
+ * @param value Markdown string.
1304
+ */
1305
+ appendMarkdown(value: string): MarkdownString;
1306
+
1307
+ /**
1308
+ * Appends the given string as codeblock using the provided language.
1309
+ * @param value A code snippet.
1310
+ * @param language An optional [language identifier](#languages.getLanguages).
1311
+ */
1312
+ appendCodeblock(value: string, language?: string): MarkdownString;
1313
+ }
1314
+
1315
+ /**
1316
+ * ~~MarkedString can be used to render human readable text. It is either a markdown string
1317
+ * or a code-block that provides a language and a code snippet. Note that
1318
+ * markdown strings will be sanitized - that means html will be escaped.~~
1319
+ *
1320
+ * @deprecated This type is deprecated, please use [`MarkdownString`](#MarkdownString) instead.
1321
+ */
1322
+ export type MarkedString = MarkdownString | string | { language: string; value: string };
1323
+ /**
1324
+ * Represents a line and character position, such as
1325
+ * the position of the cursor.
1326
+ *
1327
+ * Position objects are __immutable__. Use the [with](#Position.with) or
1328
+ * [translate](#Position.translate) methods to derive new positions
1329
+ * from an existing position.
1330
+ */
1331
+ export class Position {
1332
+
1333
+ /**
1334
+ * The zero-based line value.
1335
+ */
1336
+ readonly line: number;
1337
+
1338
+ /**
1339
+ * The zero-based character value.
1340
+ */
1341
+ readonly character: number;
1342
+
1343
+ /**
1344
+ * @param line A zero-based line value.
1345
+ * @param character A zero-based character value.
1346
+ */
1347
+ constructor(line: number, character: number);
1348
+
1349
+ /**
1350
+ * Check if this position is before `other`.
1351
+ *
1352
+ * @param other A position.
1353
+ * @return `true` if position is on a smaller line
1354
+ * or on the same line on a smaller character.
1355
+ */
1356
+ isBefore(other: Position): boolean;
1357
+
1358
+ /**
1359
+ * Check if this position is before or equal to `other`.
1360
+ *
1361
+ * @param other A position.
1362
+ * @return `true` if position is on a smaller line
1363
+ * or on the same line on a smaller or equal character.
1364
+ */
1365
+ isBeforeOrEqual(other: Position): boolean;
1366
+
1367
+ /**
1368
+ * Check if this position is after `other`.
1369
+ *
1370
+ * @param other A position.
1371
+ * @return `true` if position is on a greater line
1372
+ * or on the same line on a greater character.
1373
+ */
1374
+ isAfter(other: Position): boolean;
1375
+
1376
+ /**
1377
+ * Check if this position is after or equal to `other`.
1378
+ *
1379
+ * @param other A position.
1380
+ * @return `true` if position is on a greater line
1381
+ * or on the same line on a greater or equal character.
1382
+ */
1383
+ isAfterOrEqual(other: Position): boolean;
1384
+
1385
+ /**
1386
+ * Check if this position is equal to `other`.
1387
+ *
1388
+ * @param other A position.
1389
+ * @return `true` if the line and character of the given position are equal to
1390
+ * the line and character of this position.
1391
+ */
1392
+ isEqual(other: Position): boolean;
1393
+
1394
+ /**
1395
+ * Compare this to `other`.
1396
+ *
1397
+ * @param other A position.
1398
+ * @return A number smaller than zero if this position is before the given position,
1399
+ * a number greater than zero if this position is after the given position, or zero when
1400
+ * this and the given position are equal.
1401
+ */
1402
+ compareTo(other: Position): number;
1403
+
1404
+ /**
1405
+ * Create a new position relative to this position.
1406
+ *
1407
+ * @param lineDelta Delta value for the line value, default is `0`.
1408
+ * @param characterDelta Delta value for the character value, default is `0`.
1409
+ * @return A position which line and character is the sum of the current line and
1410
+ * character and the corresponding deltas.
1411
+ */
1412
+ translate(lineDelta?: number, characterDelta?: number): Position;
1413
+
1414
+ /**
1415
+ * Derived a new position relative to this position.
1416
+ *
1417
+ * @param change An object that describes a delta to this position.
1418
+ * @return A position that reflects the given delta. Will return `this` position if the change
1419
+ * is not changing anything.
1420
+ */
1421
+ translate(change: { lineDelta?: number; characterDelta?: number; }): Position;
1422
+
1423
+ /**
1424
+ * Create a new position derived from this position.
1425
+ *
1426
+ * @param line Value that should be used as line value, default is the [existing value](#Position.line)
1427
+ * @param character Value that should be used as character value, default is the [existing value](#Position.character)
1428
+ * @return A position where line and character are replaced by the given values.
1429
+ */
1430
+ with(line?: number, character?: number): Position;
1431
+
1432
+ /**
1433
+ * Derived a new position from this position.
1434
+ *
1435
+ * @param change An object that describes a change to this position.
1436
+ * @return A position that reflects the given change. Will return `this` position if the change
1437
+ * is not changing anything.
1438
+ */
1439
+ with(change: { line?: number; character?: number; }): Position;
1440
+ }
1441
+
1442
+ /**
1443
+ * A range represents an ordered pair of two positions.
1444
+ * It is guaranteed that [start](#Range.start).isBeforeOrEqual([end](#Range.end))
1445
+ *
1446
+ * Range objects are __immutable__. Use the [with](#Range.with),
1447
+ * [intersection](#Range.intersection), or [union](#Range.union) methods
1448
+ * to derive new ranges from an existing range.
1449
+ */
1450
+ export class Range {
1451
+
1452
+ /**
1453
+ * The start position. It is before or equal to [end](#Range.end).
1454
+ */
1455
+ readonly start: Position;
1456
+
1457
+ /**
1458
+ * The end position. It is after or equal to [start](#Range.start).
1459
+ */
1460
+ readonly end: Position;
1461
+
1462
+ /**
1463
+ * Create a new range from two positions. If `start` is not
1464
+ * before or equal to `end`, the values will be swapped.
1465
+ *
1466
+ * @param start A position.
1467
+ * @param end A position.
1468
+ */
1469
+ constructor(start: Position, end: Position);
1470
+
1471
+ /**
1472
+ * Create a new range from number coordinates. It is a shorter equivalent of
1473
+ * using `new Range(new Position(startLine, startCharacter), new Position(endLine, endCharacter))`
1474
+ *
1475
+ * @param startLine A zero-based line value.
1476
+ * @param startCharacter A zero-based character value.
1477
+ * @param endLine A zero-based line value.
1478
+ * @param endCharacter A zero-based character value.
1479
+ */
1480
+ constructor(startLine: number, startCharacter: number, endLine: number, endCharacter: number);
1481
+
1482
+ /**
1483
+ * `true` if `start` and `end` are equal.
1484
+ */
1485
+ isEmpty: boolean;
1486
+
1487
+ /**
1488
+ * `true` if `start.line` and `end.line` are equal.
1489
+ */
1490
+ isSingleLine: boolean;
1491
+
1492
+ /**
1493
+ * Check if a position or a range is contained in this range.
1494
+ *
1495
+ * @param positionOrRange A position or a range.
1496
+ * @return `true` if the position or range is inside or equal
1497
+ * to this range.
1498
+ */
1499
+ contains(positionOrRange: Position | Range): boolean;
1500
+
1501
+ /**
1502
+ * Check if `other` equals this range.
1503
+ *
1504
+ * @param other A range.
1505
+ * @return `true` when start and end are [equal](#Position.isEqual) to
1506
+ * start and end of this range.
1507
+ */
1508
+ isEqual(other: Range): boolean;
1509
+
1510
+ /**
1511
+ * Intersect `range` with this range and returns a new range or `undefined`
1512
+ * if the ranges have no overlap.
1513
+ *
1514
+ * @param range A range.
1515
+ * @return A range of the greater start and smaller end positions. Will
1516
+ * return undefined when there is no overlap.
1517
+ */
1518
+ intersection(range: Range): Range | undefined;
1519
+
1520
+ /**
1521
+ * Compute the union of `other` with this range.
1522
+ *
1523
+ * @param other A range.
1524
+ * @return A range of smaller start position and the greater end position.
1525
+ */
1526
+ union(other: Range): Range;
1527
+
1528
+ /**
1529
+ * Derived a new range from this range.
1530
+ *
1531
+ * @param start A position that should be used as start. The default value is the [current start](#Range.start).
1532
+ * @param end A position that should be used as end. The default value is the [current end](#Range.end).
1533
+ * @return A range derived from this range with the given start and end position.
1534
+ * If start and end are not different `this` range will be returned.
1535
+ */
1536
+ with(start?: Position, end?: Position): Range;
1537
+
1538
+ /**
1539
+ * Derived a new range from this range.
1540
+ *
1541
+ * @param change An object that describes a change to this range.
1542
+ * @return A range that reflects the given change. Will return `this` range if the change
1543
+ * is not changing anything.
1544
+ */
1545
+ with(change: { start?: Position, end?: Position }): Range;
1546
+ }
1547
+ /**
1548
+ * A relative pattern is a helper to construct glob patterns that are matched
1549
+ * relatively to a base path. The base path can either be an absolute file path
1550
+ * or a [workspace folder](#WorkspaceFolder).
1551
+ */
1552
+ export class RelativePattern {
1553
+
1554
+ /**
1555
+ * A base file path to which this pattern will be matched against relatively.
1556
+ */
1557
+ base: string;
1558
+
1559
+ /**
1560
+ * A file glob pattern like `*.{ts,js}` that will be matched on file paths
1561
+ * relative to the base path.
1562
+ *
1563
+ * Example: Given a base of `/home/work/folder` and a file path of `/home/work/folder/index.js`,
1564
+ * the file glob pattern will match on `index.js`.
1565
+ */
1566
+ pattern: string;
1567
+
1568
+ /**
1569
+ * Creates a new relative pattern object with a base path and pattern to match. This pattern
1570
+ * will be matched on file paths relative to the base path.
1571
+ *
1572
+ * @param base A base file path to which this pattern will be matched against relatively.
1573
+ * @param pattern A file glob pattern like `*.{ts,js}` that will be matched on file paths
1574
+ * relative to the base path.
1575
+ */
1576
+ constructor(base: WorkspaceFolder | string, pattern: string)
1577
+ }
1578
+
1579
+ /**
1580
+ * A file glob pattern to match file paths against. This can either be a glob pattern string
1581
+ * (like `**​/*.{ts,js}` or `*.{ts,js}`) or a [relative pattern](#RelativePattern).
1582
+ *
1583
+ * Glob patterns can have the following syntax:
1584
+ * * `*` to match one or more characters in a path segment
1585
+ * * `?` to match on one character in a path segment
1586
+ * * `**` to match any number of path segments, including none
1587
+ * * `{}` to group conditions (e.g. `**​/*.{ts,js}` matches all TypeScript and JavaScript files)
1588
+ * * `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …)
1589
+ * * `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`)
1590
+ *
1591
+ * Note: a backslash (`\`) is not valid within a glob pattern. If you have an existing file
1592
+ * path to match against, consider to use the [relative pattern](#RelativePattern) support
1593
+ * that takes care of converting any backslash into slash. Otherwise, make sure to convert
1594
+ * any backslash to slash when creating the glob pattern.
1595
+ */
1596
+ export type GlobPattern = string | RelativePattern;
1597
+
1598
+ /**
1599
+ * A document filter denotes a document by different properties like
1600
+ * the [language](#TextDocument.languageId), the [scheme](#Uri.scheme) of
1601
+ * its resource, or a glob-pattern that is applied to the [path](#TextDocument.fileName).
1602
+ *
1603
+ * @sample A language filter that applies to typescript files on disk: `{ language: 'typescript', scheme: 'file' }`
1604
+ * @sample A language filter that applies to all package.json paths: `{ language: 'json', scheme: 'untitled', pattern: '**​/package.json' }`
1605
+ */
1606
+ export interface DocumentFilter {
1607
+
1608
+ /**
1609
+ * A language id, like `typescript`.
1610
+ */
1611
+ language?: string;
1612
+
1613
+ /**
1614
+ * A Uri [scheme](#Uri.scheme), like `file` or `untitled`.
1615
+ */
1616
+ scheme?: string;
1617
+
1618
+ /**
1619
+ * A [glob pattern](#GlobPattern) that is matched on the absolute path of the document. Use a [relative pattern](#RelativePattern)
1620
+ * to filter documents to a [workspace folder](#WorkspaceFolder).
1621
+ */
1622
+ pattern?: GlobPattern;
1623
+ }
1624
+
1625
+ /**
1626
+ * A language selector is the combination of one or many language identifiers
1627
+ * and [language filters](#DocumentFilter).
1628
+ *
1629
+ * *Note* that a document selector that is just a language identifier selects *all*
1630
+ * documents, even those that are not saved on disk. Only use such selectors when
1631
+ * a feature works without further context, e.g. without the need to resolve related
1632
+ * 'files'.
1633
+ *
1634
+ * @sample `let sel:DocumentSelector = { scheme: 'file', language: 'typescript' }`;
1635
+ */
1636
+ export type DocumentSelector = DocumentFilter | string | Array<DocumentFilter | string>;
1637
+
1638
+ /**
1639
+ * A provider result represents the values a provider, like the [`HoverProvider`](#HoverProvider),
1640
+ * may return. For once this is the actual result type `T`, like `Hover`, or a thenable that resolves
1641
+ * to that type `T`. In addition, `null` and `undefined` can be returned - either directly or from a
1642
+ * thenable.
1643
+ *
1644
+ * The snippets below are all valid implementations of the [`HoverProvider`](#HoverProvider):
1645
+ *
1646
+ * ```ts
1647
+ * let a: HoverProvider = {
1648
+ * provideHover(doc, pos, token): ProviderResult<Hover> {
1649
+ * return new Hover('Hello World');
1650
+ * }
1651
+ * }
1652
+ *
1653
+ * let b: HoverProvider = {
1654
+ * provideHover(doc, pos, token): ProviderResult<Hover> {
1655
+ * return new Promise(resolve => {
1656
+ * resolve(new Hover('Hello World'));
1657
+ * });
1658
+ * }
1659
+ * }
1660
+ *
1661
+ * let c: HoverProvider = {
1662
+ * provideHover(doc, pos, token): ProviderResult<Hover> {
1663
+ * return; // undefined
1664
+ * }
1665
+ * }
1666
+ * ```
1667
+ */
1668
+ export type ProviderResult<T> = T | undefined | null | Thenable<T | undefined | null>;
1669
+
1670
+ /**
1671
+ * Information about where a symbol is defined.
1672
+ *
1673
+ * Provides additional metadata over normal [location](#Location) definitions, including the range of
1674
+ * the defining symbol
1675
+ */
1676
+ export type DefinitionLink = LocationLink;
1677
+
1678
+ /**
1679
+ * The definition of a symbol represented as one or many [locations](#Location).
1680
+ * For most programming languages there is only one location at which a symbol is
1681
+ * defined.
1682
+ */
1683
+ export type Definition = Location | Location[];
1684
+
1685
+ /**
1686
+ * The definition provider interface defines the contract between extensions and
1687
+ * the [go to definition](https://code.visualstudio.com/docs/editor/editingevolved#_go-to-definition)
1688
+ * and peek definition features.
1689
+ */
1690
+ export interface DefinitionProvider {
1691
+
1692
+ /**
1693
+ * Provide the definition of the symbol at the given position and document.
1694
+ *
1695
+ * @param document The document in which the command was invoked.
1696
+ * @param position The position at which the command was invoked.
1697
+ * @param token A cancellation token.
1698
+ * @return A definition or a thenable that resolves to such. The lack of a result can be
1699
+ * signaled by returning `undefined` or `null`.
1700
+ */
1701
+ provideDefinition(document: TextDocument, position: Position, token: CancellationToken): ProviderResult<Definition | DefinitionLink[]>;
1702
+ }
1703
+
1704
+ /**
1705
+ * The implementation provider interface defines the contract between extensions and
1706
+ * the go to implementation feature.
1707
+ */
1708
+ export interface ImplementationProvider {
1709
+
1710
+ /**
1711
+ * Provide the implementations of the symbol at the given position and document.
1712
+ *
1713
+ * @param document The document in which the command was invoked.
1714
+ * @param position The position at which the command was invoked.
1715
+ * @param token A cancellation token.
1716
+ * @return A definition or a thenable that resolves to such. The lack of a result can be
1717
+ * signaled by returning `undefined` or `null`.
1718
+ */
1719
+ provideImplementation(document: TextDocument, position: Position, token: CancellationToken): ProviderResult<Definition | DefinitionLink[]>;
1720
+ }
1721
+
1722
+ /**
1723
+ * The type definition provider defines the contract between extensions and
1724
+ * the go to type definition feature.
1725
+ */
1726
+ export interface TypeDefinitionProvider {
1727
+
1728
+ /**
1729
+ * Provide the type definition of the symbol at the given position and document.
1730
+ *
1731
+ * @param document The document in which the command was invoked.
1732
+ * @param position The position at which the command was invoked.
1733
+ * @param token A cancellation token.
1734
+ * @return A definition or a thenable that resolves to such. The lack of a result can be
1735
+ * signaled by returning `undefined` or `null`.
1736
+ */
1737
+ provideTypeDefinition(document: TextDocument, position: Position, token: CancellationToken): ProviderResult<Definition | DefinitionLink[]>;
1738
+ }
1739
+ /**
1740
+ * A snippet string is a template which allows to insert text
1741
+ * and to control the editor cursor when insertion happens.
1742
+ *
1743
+ * A snippet can define tab stops and placeholders with `$1`, `$2`
1744
+ * and `${3:foo}`. `$0` defines the final tab stop, it defaults to
1745
+ * the end of the snippet. Variables are defined with `$name` and
1746
+ * `${name:default value}`. The full snippet syntax is documented
1747
+ * [here](http://code.visualstudio.com/docs/editor/userdefinedsnippets#_creating-your-own-snippets).
1748
+ */
1749
+ export class SnippetString {
1750
+
1751
+ /**
1752
+ * The snippet string.
1753
+ */
1754
+ value: string;
1755
+
1756
+ constructor(value?: string);
1757
+
1758
+ /**
1759
+ * Builder-function that appends the given string to
1760
+ * the [`value`](#SnippetString.value) of this snippet string.
1761
+ *
1762
+ * @param text A value to append 'as given'. The string will be escaped.
1763
+ * @return This snippet string.
1764
+ */
1765
+ appendText(text: string): SnippetString;
1766
+
1767
+ /**
1768
+ * Builder-function that appends a tabstop (`$1`, `$2` etc) to
1769
+ * the [`value`](#SnippetString.value) of this snippet string.
1770
+ *
1771
+ * @param num The number of this tabstop, defaults to an auto-increment
1772
+ * value starting at 1.
1773
+ * @return This snippet string.
1774
+ */
1775
+ appendTabstop(num?: number): SnippetString;
1776
+
1777
+ /**
1778
+ * Builder-function that appends a placeholder (`${1:value}`) to
1779
+ * the [`value`](#SnippetString.value) of this snippet string.
1780
+ *
1781
+ * @param value The value of this placeholder - either a string or a function
1782
+ * with which a nested snippet can be created.
1783
+ * @param num The number of this tabstop, defaults to an auto-increment
1784
+ * value starting at 1.
1785
+ * @return This snippet string.
1786
+ */
1787
+ appendPlaceholder(value: string | ((snippet: SnippetString) => any), num?: number): SnippetString;
1788
+
1789
+ /**
1790
+ * Builder-function that appends a choice (`${1|a,b,c}`) to
1791
+ * the [`value`](#SnippetString.value) of this snippet string.
1792
+ *
1793
+ * @param values The values for choices - the array of strings
1794
+ * @param number The number of this tabstop, defaults to an auto-increment
1795
+ * value starting at 1.
1796
+ * @return This snippet string.
1797
+ */
1798
+ appendChoice(values: string[], num?: number): SnippetString;
1799
+
1800
+ /**
1801
+ * Builder-function that appends a variable (`${VAR}`) to
1802
+ * the [`value`](#SnippetString.value) of this snippet string.
1803
+ *
1804
+ * @param name The name of the variable - excluding the `$`.
1805
+ * @param defaultValue The default value which is used when the variable name cannot
1806
+ * be resolved - either a string or a function with which a nested snippet can be created.
1807
+ * @return This snippet string.
1808
+ */
1809
+ appendVariable(name: string, defaultValue: string | ((snippet: SnippetString) => any)): SnippetString;
1810
+ }
1811
+ /**
1812
+ * The rename provider interface defines the contract between extensions and
1813
+ * the [rename](https://code.visualstudio.com/docs/editor/editingevolved#_rename-symbol)-feature.
1814
+ */
1815
+ export interface RenameProvider {
1816
+
1817
+ /**
1818
+ * Provide an edit that describes changes that have to be made to one
1819
+ * or many resources to rename a symbol to a different name.
1820
+ *
1821
+ * @param document The document in which the command was invoked.
1822
+ * @param position The position at which the command was invoked.
1823
+ * @param newName The new name of the symbol. If the given name is not valid, the provider must return a rejected promise.
1824
+ * @param token A cancellation token.
1825
+ * @return A workspace edit or a thenable that resolves to such. The lack of a result can be
1826
+ * signaled by returning `undefined` or `null`.
1827
+ */
1828
+ provideRenameEdits(document: TextDocument, position: Position, newName: string, token: CancellationToken): ProviderResult<WorkspaceEdit>;
1829
+
1830
+ /**
1831
+ * Optional function for resolving and validating a position *before* running rename. The result can
1832
+ * be a range or a range and a placeholder text. The placeholder text should be the identifier of the symbol
1833
+ * which is being renamed - when omitted the text in the returned range is used.
1834
+ *
1835
+ * @param document The document in which rename will be invoked.
1836
+ * @param position The position at which rename will be invoked.
1837
+ * @param token A cancellation token.
1838
+ * @return The range or range and placeholder text of the identifier that is to be renamed. The lack of a result can signaled by returning `undefined` or `null`.
1839
+ */
1840
+ prepareRename?(document: TextDocument, position: Position, token: CancellationToken): ProviderResult<Range | { range: Range, placeholder: string }>;
1841
+ }
1842
+
1843
+ /**
1844
+ * Value-object describing what options formatting should use.
1845
+ */
1846
+ export interface FormattingOptions {
1847
+
1848
+ /**
1849
+ * Size of a tab in spaces.
1850
+ */
1851
+ tabSize: number;
1852
+
1853
+ /**
1854
+ * Prefer spaces over tabs.
1855
+ */
1856
+ insertSpaces: boolean;
1857
+
1858
+ /**
1859
+ * Signature for further properties.
1860
+ */
1861
+ [key: string]: boolean | number | string;
1862
+ }
1863
+
1864
+ /**
1865
+ * The document formatting provider interface defines the contract between extensions and
1866
+ * the formatting-feature.
1867
+ */
1868
+ export interface DocumentFormattingEditProvider {
1869
+
1870
+ /**
1871
+ * Provide formatting edits for a whole document.
1872
+ *
1873
+ * @param document The document in which the command was invoked.
1874
+ * @param options Options controlling formatting.
1875
+ * @param token A cancellation token.
1876
+ * @return A set of text edits or a thenable that resolves to such. The lack of a result can be
1877
+ * signaled by returning `undefined`, `null`, or an empty array.
1878
+ */
1879
+ provideDocumentFormattingEdits(document: TextDocument, options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;
1880
+ }
1881
+
1882
+ /**
1883
+ * The document formatting provider interface defines the contract between extensions and
1884
+ * the formatting-feature.
1885
+ */
1886
+ export interface DocumentRangeFormattingEditProvider {
1887
+
1888
+ /**
1889
+ * Provide formatting edits for a range in a document.
1890
+ *
1891
+ * The given range is a hint and providers can decide to format a smaller
1892
+ * or larger range. Often this is done by adjusting the start and end
1893
+ * of the range to full syntax nodes.
1894
+ *
1895
+ * @param document The document in which the command was invoked.
1896
+ * @param range The range which should be formatted.
1897
+ * @param options Options controlling formatting.
1898
+ * @param token A cancellation token.
1899
+ * @return A set of text edits or a thenable that resolves to such. The lack of a result can be
1900
+ * signaled by returning `undefined`, `null`, or an empty array.
1901
+ */
1902
+ provideDocumentRangeFormattingEdits(document: TextDocument, range: Range, options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;
1903
+ }
1904
+
1905
+ /**
1906
+ * The document formatting provider interface defines the contract between extensions and
1907
+ * the formatting-feature.
1908
+ */
1909
+ export interface OnTypeFormattingEditProvider {
1910
+
1911
+ /**
1912
+ * Provide formatting edits after a character has been typed.
1913
+ *
1914
+ * The given position and character should hint to the provider
1915
+ * what range the position to expand to, like find the matching `{`
1916
+ * when `}` has been entered.
1917
+ *
1918
+ * @param document The document in which the command was invoked.
1919
+ * @param position The position at which the command was invoked.
1920
+ * @param ch The character that has been typed.
1921
+ * @param options Options controlling formatting.
1922
+ * @param token A cancellation token.
1923
+ * @return A set of text edits or a thenable that resolves to such. The lack of a result can be
1924
+ * signaled by returning `undefined`, `null`, or an empty array.
1925
+ */
1926
+ provideOnTypeFormattingEdits(document: TextDocument, position: Position, ch: string, options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;
1927
+ }
1928
+ export interface CompletionItemProvider {
1929
+
1930
+ /**
1931
+ * Provide completion items for the given position and document.
1932
+ *
1933
+ * @param document The document in which the command was invoked.
1934
+ * @param position The position at which the command was invoked.
1935
+ * @param token A cancellation token.
1936
+ * @param context How the completion was triggered.
1937
+ *
1938
+ * @return An array of completions, a [completion list](#CompletionList), or a thenable that resolves to either.
1939
+ * The lack of a result can be signaled by returning `undefined`, `null`, or an empty array.
1940
+ */
1941
+ provideCompletionItems(document: TextDocument, position: Position, token: CancellationToken, context: CompletionContext): ProviderResult<CompletionItem[] | CompletionList>;
1942
+
1943
+ /**
1944
+ * Given a completion item fill in more data, like [doc-comment](#CompletionItem.documentation)
1945
+ * or [details](#CompletionItem.detail).
1946
+ *
1947
+ * The editor will only resolve a completion item once.
1948
+ *
1949
+ * *Note* that accepting a completion item will not wait for it to be resolved. Because of that [`insertText`](#CompletionItem.insertText),
1950
+ * [`additionalTextEdits`](#CompletionItem.additionalTextEdits), and [`command`](#CompletionItem.command) should not
1951
+ * be changed when resolving an item.
1952
+ *
1953
+ * @param item A completion item currently active in the UI.
1954
+ * @param token A cancellation token.
1955
+ * @return The resolved completion item or a thenable that resolves to of such. It is OK to return the given
1956
+ * `item`. When no result is returned, the given `item` will be used.
1957
+ */
1958
+ resolveCompletionItem?(item: CompletionItem, token: CancellationToken): ProviderResult<CompletionItem>;
1959
+ }
1960
+
1961
+ /**
1962
+ * Represents programming constructs like variables, classes, interfaces etc. that appear in a document. Document
1963
+ * symbols can be hierarchical and they have two ranges: one that encloses its definition and one that points to
1964
+ * its most interesting range, e.g. the range of an identifier.
1965
+ * @寻壑
1966
+ */
1967
+ export class DocumentSymbol {
1968
+
1969
+ /**
1970
+ * The name of this symbol.
1971
+ */
1972
+ name: string;
1973
+
1974
+ /**
1975
+ * More detail for this symbol, e.g. the signature of a function.
1976
+ */
1977
+ detail: string;
1978
+
1979
+ /**
1980
+ * The kind of this symbol.
1981
+ */
1982
+ kind: SymbolKind;
1983
+
1984
+ /**
1985
+ * The range enclosing this symbol not including leading/trailing whitespace but everything else, e.g. comments and code.
1986
+ */
1987
+ range: Range;
1988
+
1989
+ /**
1990
+ * The range that should be selected and reveal when this symbol is being picked, e.g. the name of a function.
1991
+ * Must be contained by the [`range`](#DocumentSymbol.range).
1992
+ */
1993
+ selectionRange: Range;
1994
+
1995
+ /**
1996
+ * Children of this symbol, e.g. properties of a class.
1997
+ */
1998
+ children: DocumentSymbol[];
1999
+
2000
+ /**
2001
+ * Creates a new document symbol.
2002
+ *
2003
+ * @param name The name of the symbol.
2004
+ * @param detail Details for the symbol.
2005
+ * @param kind The kind of the symbol.
2006
+ * @param range The full range of the symbol.
2007
+ * @param selectionRange The range that should be reveal.
2008
+ */
2009
+ constructor(name: string, detail: string, kind: SymbolKind, range: Range, selectionRange: Range);
2010
+ }
2011
+
2012
+ /**
2013
+ * The document symbol provider interface defines the contract between extensions and
2014
+ * the [go to symbol](https://code.visualstudio.com/docs/editor/editingevolved#_go-to-symbol)-feature.
2015
+ */
2016
+ export interface DocumentSymbolProvider {
2017
+
2018
+ /**
2019
+ * Provide symbol information for the given document.
2020
+ *
2021
+ * @param document The document in which the command was invoked.
2022
+ * @param token A cancellation token.
2023
+ * @return An array of document highlights or a thenable that resolves to such. The lack of a result can be
2024
+ * signaled by returning `undefined`, `null`, or an empty array.
2025
+ */
2026
+ provideDocumentSymbols(document: TextDocument, token: CancellationToken): ProviderResult<SymbolInformation[] | DocumentSymbol[]>;
2027
+ }
2028
+
2029
+ /**
2030
+ * Metadata about a document symbol provider.
2031
+ */
2032
+ export interface DocumentSymbolProviderMetadata {
2033
+ /**
2034
+ * A human readable string that is shown when multiple outlines trees show for one document.
2035
+ */
2036
+ label?: string;
2037
+ }
2038
+
2039
+ /**
2040
+ * Represents an end of line character sequence in a [document](#TextDocument).
2041
+ */
2042
+ export enum EndOfLine {
2043
+ /**
2044
+ * The line feed `\n` character.
2045
+ */
2046
+ LF = 1,
2047
+ /**
2048
+ * The carriage return line feed `\r\n` sequence.
2049
+ */
2050
+ CRLF = 2,
2051
+ }
2052
+
2053
+ /**
2054
+ * Describes what to do when pressing Enter.
2055
+ */
2056
+ export interface EnterAction {
2057
+ /**
2058
+ * Describe what to do with the indentation.
2059
+ */
2060
+ indentAction: IndentAction;
2061
+ /**
2062
+ * Describes text to be appended after the new line and after the indentation.
2063
+ */
2064
+ appendText?: string;
2065
+ /**
2066
+ * Describes the number of characters to remove from the new line's indentation.
2067
+ */
2068
+ removeText?: number;
2069
+ }
2070
+ /**
2071
+ * The event that is fired when diagnostics change.
2072
+ */
2073
+ export interface DiagnosticChangeEvent {
2074
+
2075
+ /**
2076
+ * An array of resources for which diagnostics have changed.
2077
+ */
2078
+ readonly uris: ReadonlyArray<Uri>;
2079
+ }
2080
+
2081
+ /**
2082
+ * A diagnostics collection is a container that manages a set of
2083
+ * [diagnostics](#Diagnostic). Diagnostics are always scopes to a
2084
+ * diagnostics collection and a resource.
2085
+ *
2086
+ * To get an instance of a `DiagnosticCollection` use
2087
+ * [createDiagnosticCollection](#languages.createDiagnosticCollection).
2088
+ */
2089
+ export interface DiagnosticCollection {
2090
+
2091
+ /**
2092
+ * The name of this diagnostic collection, for instance `typescript`. Every diagnostic
2093
+ * from this collection will be associated with this name. Also, the task framework uses this
2094
+ * name when defining [problem matchers](https://code.visualstudio.com/docs/editor/tasks#_defining-a-problem-matcher).
2095
+ */
2096
+ readonly name: string;
2097
+
2098
+ /**
2099
+ * Assign diagnostics for given resource. Will replace
2100
+ * existing diagnostics for that resource.
2101
+ *
2102
+ * @param uri A resource identifier.
2103
+ * @param diagnostics Array of diagnostics or `undefined`
2104
+ */
2105
+ set(uri: Uri, diagnostics: ReadonlyArray<Diagnostic> | undefined): void;
2106
+
2107
+ /**
2108
+ * Replace all entries in this collection.
2109
+ *
2110
+ * Diagnostics of multiple tuples of the same uri will be merged, e.g
2111
+ * `[[file1, [d1]], [file1, [d2]]]` is equivalent to `[[file1, [d1, d2]]]`.
2112
+ * If a diagnostics item is `undefined` as in `[file1, undefined]`
2113
+ * all previous but not subsequent diagnostics are removed.
2114
+ *
2115
+ * @param entries An array of tuples, like `[[file1, [d1, d2]], [file2, [d3, d4, d5]]]`, or `undefined`.
2116
+ */
2117
+ set(entries: ReadonlyArray<[Uri, ReadonlyArray<Diagnostic> | undefined]>): void;
2118
+
2119
+ /**
2120
+ * Remove all diagnostics from this collection that belong
2121
+ * to the provided `uri`. The same as `#set(uri, undefined)`.
2122
+ *
2123
+ * @param uri A resource identifier.
2124
+ */
2125
+ delete(uri: Uri): void;
2126
+
2127
+ /**
2128
+ * Remove all diagnostics from this collection. The same
2129
+ * as calling `#set(undefined)`;
2130
+ */
2131
+ clear(): void;
2132
+
2133
+ /**
2134
+ * Iterate over each entry in this collection.
2135
+ *
2136
+ * @param callback Function to execute for each entry.
2137
+ * @param thisArg The `this` context used when invoking the handler function.
2138
+ */
2139
+ forEach(callback: (uri: Uri, diagnostics: ReadonlyArray<Diagnostic>, collection: DiagnosticCollection) => any, thisArg?: any): void;
2140
+
2141
+ /**
2142
+ * Get the diagnostics for a given resource. *Note* that you cannot
2143
+ * modify the diagnostics-array returned from this call.
2144
+ *
2145
+ * @param uri A resource identifier.
2146
+ * @returns An immutable array of [diagnostics](#Diagnostic) or `undefined`.
2147
+ */
2148
+ get(uri: Uri): ReadonlyArray<Diagnostic> | undefined;
2149
+
2150
+ /**
2151
+ * Check if this collection contains diagnostics for a
2152
+ * given resource.
2153
+ *
2154
+ * @param uri A resource identifier.
2155
+ * @returns `true` if this collection has diagnostic for the given resource.
2156
+ */
2157
+ has(uri: Uri): boolean;
2158
+
2159
+ /**
2160
+ * Dispose and free associated resources. Calls
2161
+ * [clear](#DiagnosticCollection.clear).
2162
+ */
2163
+ dispose(): void;
2164
+ }
2165
+
2166
+ /**
2167
+ * The declaration of a symbol representation as one or many [locations](#Location)
2168
+ * or [location links][#LocationLink].
2169
+ */
2170
+ export type Declaration = Location | Location[] | LocationLink[];
2171
+
2172
+ /**
2173
+ * The declaration provider interface defines the contract between extensions and
2174
+ * the go to declaration feature.
2175
+ */
2176
+ export interface DeclarationProvider {
2177
+
2178
+ /**
2179
+ * Provide the declaration of the symbol at the given position and document.
2180
+ *
2181
+ * @param document The document in which the command was invoked.
2182
+ * @param position The position at which the command was invoked.
2183
+ * @param token A cancellation token.
2184
+ * @return A declaration or a thenable that resolves to such. The lack of a result can be
2185
+ * signaled by returning `undefined` or `null`.
2186
+ */
2187
+ provideDeclaration(document: TextDocument, position: Position, token: CancellationToken): ProviderResult<Declaration>;
2188
+ }
2189
+
2190
+ /**
2191
+ * Value-object that contains additional information when
2192
+ * requesting references.
2193
+ */
2194
+ export interface ReferenceContext {
2195
+
2196
+ /**
2197
+ * Include the declaration of the current symbol.
2198
+ */
2199
+ includeDeclaration: boolean;
2200
+ }
2201
+
2202
+ /**
2203
+ * The reference provider interface defines the contract between extensions and
2204
+ * the [find references](https://code.visualstudio.com/docs/editor/editingevolved#_peek)-feature.
2205
+ */
2206
+ export interface ReferenceProvider {
2207
+
2208
+ /**
2209
+ * Provide a set of project-wide references for the given position and document.
2210
+ *
2211
+ * @param document The document in which the command was invoked.
2212
+ * @param position The position at which the command was invoked.
2213
+ * @param token A cancellation token.
2214
+ *
2215
+ * @return An array of locations or a thenable that resolves to such. The lack of a result can be
2216
+ * signaled by returning `undefined`, `null`, or an empty array.
2217
+ */
2218
+ provideReferences(document: TextDocument, position: Position, context: ReferenceContext, token: CancellationToken): ProviderResult<Location[]>;
2219
+ }
2220
+ }