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