@opensumi/sumi 2.12.1-next-079c1930

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +1 -0
  2. package/build.ts +18 -0
  3. package/index.d.ts +5 -0
  4. package/manifest.json +414 -0
  5. package/package.json +18 -0
  6. package/sumi-browser.d.ts +273 -0
  7. package/sumi-worker/sumi-worker.d.ts +2788 -0
  8. package/sumi-worker/worker.command.d.ts +86 -0
  9. package/sumi-worker/worker.comments.d.ts +273 -0
  10. package/sumi-worker/worker.doc.d.ts +356 -0
  11. package/sumi-worker/worker.editor.d.ts +725 -0
  12. package/sumi-worker/worker.extensions.d.ts +63 -0
  13. package/sumi-worker/worker.language.d.ts +2220 -0
  14. package/sumi-worker/worker.window.d.ts +318 -0
  15. package/sumi-worker.d.ts +7 -0
  16. package/sumi.d.ts +822 -0
  17. package/vscode/typings/vscode.authentication.d.ts +231 -0
  18. package/vscode/typings/vscode.command.d.ts +86 -0
  19. package/vscode/typings/vscode.comments.d.ts +292 -0
  20. package/vscode/typings/vscode.d.ts +3789 -0
  21. package/vscode/typings/vscode.debug.d.ts +684 -0
  22. package/vscode/typings/vscode.doc.d.ts +272 -0
  23. package/vscode/typings/vscode.editor.d.ts +1017 -0
  24. package/vscode/typings/vscode.env.d.ts +153 -0
  25. package/vscode/typings/vscode.extension.d.ts +67 -0
  26. package/vscode/typings/vscode.language.d.ts +2630 -0
  27. package/vscode/typings/vscode.message.d.ts +195 -0
  28. package/vscode/typings/vscode.proposed.d.ts +662 -0
  29. package/vscode/typings/vscode.quickpick.d.ts +491 -0
  30. package/vscode/typings/vscode.scm.d.ts +254 -0
  31. package/vscode/typings/vscode.tasks.d.ts +676 -0
  32. package/vscode/typings/vscode.theme.d.ts +370 -0
  33. package/vscode/typings/vscode.window.d.ts +870 -0
  34. package/vscode/typings/vscode.workspace.d.ts +664 -0
  35. package/vscode/typings-pending/vscode.d.ts +27 -0
  36. package/vscode/typings-pending/vscode.proposed.d.ts +3 -0
  37. package/vscode.d.ts +23 -0
@@ -0,0 +1,3789 @@
1
+ declare module 'vscode' {
2
+
3
+ /**
4
+ * Accessibility information which controls screen reader behavior.
5
+ */
6
+ export interface AccessibilityInformation {
7
+ /**
8
+ * Label to be read out by a screen reader once the item has focus.
9
+ */
10
+ label: string;
11
+
12
+ /**
13
+ * Role of the widget which defines how a screen reader interacts with it.
14
+ * The role should be set in special cases when for example a tree-like element behaves like a checkbox.
15
+ * If role is not specified VS Code will pick the appropriate role automatically.
16
+ * More about aria roles can be found here https://w3c.github.io/aria/#widget_roles
17
+ */
18
+ role?: string;
19
+ }
20
+
21
+ /**
22
+ * Represents the configuration. It is a merged view of
23
+ *
24
+ * - Default configuration
25
+ * - Global configuration
26
+ * - Workspace configuration (if available)
27
+ * - Workspace folder configuration of the requested resource (if available)
28
+ *
29
+ * *Global configuration* comes from User Settings and shadows Defaults.
30
+ *
31
+ * *Workspace configuration* comes from Workspace Settings and shadows Global configuration.
32
+ *
33
+ * *Workspace Folder configuration* comes from `.vscode` folder under one of the [workspace folders](#workspace.workspaceFolders).
34
+ *
35
+ * *Note:* Workspace and Workspace Folder configurations contains `launch` and `tasks` settings. Their basename will be
36
+ * part of the section identifier. The following snippets shows how to retrieve all configurations
37
+ * from `launch.json`:
38
+ *
39
+ * ```ts
40
+ * // launch.json configuration
41
+ * const config = workspace.getConfiguration('launch', vscode.window.activeTextEditor.document.uri);
42
+ *
43
+ * // retrieve values
44
+ * const values = config.get('configurations');
45
+ * ```
46
+ *
47
+ * Refer to [Settings](https://code.visualstudio.com/docs/getstarted/settings) for more information.
48
+ */
49
+
50
+ export interface WorkspaceConfiguration {
51
+
52
+ /**
53
+ * Return a value from this configuration.
54
+ *
55
+ * @param section Configuration name, supports _dotted_ names.
56
+ * @return The value `section` denotes or `undefined`.
57
+ */
58
+ get<T>(section: string): T | undefined;
59
+
60
+ /**
61
+ * Return a value from this configuration.
62
+ *
63
+ * @param section Configuration name, supports _dotted_ names.
64
+ * @param defaultValue A value should be returned when no value could be found, is `undefined`.
65
+ * @return The value `section` denotes or the default.
66
+ */
67
+ get<T>(section: string, defaultValue: T): T;
68
+
69
+ /**
70
+ * Check if this configuration has a certain value.
71
+ *
72
+ * @param section Configuration name, supports _dotted_ names.
73
+ * @return `true` if the section doesn't resolve to `undefined`.
74
+ */
75
+ has(section: string): boolean;
76
+
77
+ /**
78
+ * Retrieve all information about a configuration setting. A configuration value
79
+ * often consists of a *default* value, a global or installation-wide value,
80
+ * a workspace-specific value and a folder-specific value.
81
+ *
82
+ * The *effective* value (returned by [`get`](#WorkspaceConfiguration.get))
83
+ * is computed like this: `defaultValue` overwritten by `globalValue`,
84
+ * `globalValue` overwritten by `workspaceValue`. `workspaceValue` overwritten by `workspaceFolderValue`.
85
+ * Refer to [Settings Inheritance](https://code.visualstudio.com/docs/getstarted/settings)
86
+ * for more information.
87
+ *
88
+ * *Note:* The configuration name must denote a leaf in the configuration tree
89
+ * (`editor.fontSize` vs `editor`) otherwise no result is returned.
90
+ *
91
+ * @param section Configuration name, supports _dotted_ names.
92
+ * @return Information about a configuration setting or `undefined`.
93
+ */
94
+ inspect<T>(section: string): { key: string; defaultValue?: T; globalValue?: T; workspaceValue?: T, workspaceFolderValue?: T } | undefined;
95
+
96
+ /**
97
+ * Update a configuration value. The updated configuration values are persisted.
98
+ *
99
+ * A value can be changed in
100
+ *
101
+ * - [Global configuration](#ConfigurationTarget.Global): Changes the value for all instances of the editor.
102
+ * - [Workspace configuration](#ConfigurationTarget.Workspace): Changes the value for current workspace, if available.
103
+ * - [Workspace folder configuration](#ConfigurationTarget.WorkspaceFolder): Changes the value for the
104
+ * [Workspace folder](#workspace.workspaceFolders) to which the current [configuration](#WorkspaceConfiguration) is scoped to.
105
+ *
106
+ * *Note 1:* Setting a global value in the presence of a more specific workspace value
107
+ * has no observable effect in that workspace, but in others. Setting a workspace value
108
+ * in the presence of a more specific folder value has no observable effect for the resources
109
+ * under respective [folder](#workspace.workspaceFolders), but in others. Refer to
110
+ * [Settings Inheritance](https://code.visualstudio.com/docs/getstarted/settings) for more information.
111
+ *
112
+ * *Note 2:* To remove a configuration value use `undefined`, like so: `config.update('somekey', undefined)`
113
+ *
114
+ * Will throw error when
115
+ * - Writing a configuration which is not registered.
116
+ * - Writing a configuration to workspace or folder target when no workspace is opened
117
+ * - Writing a configuration to folder target when there is no folder settings
118
+ * - Writing to folder target without passing a resource when getting the configuration (`workspace.getConfiguration(section, resource)`)
119
+ * - Writing a window configuration to folder target
120
+ *
121
+ * @param section Configuration name, supports _dotted_ names.
122
+ * @param value The new value.
123
+ * @param configurationTarget The [configuration target](#ConfigurationTarget) or a boolean value.
124
+ * - If `true` configuration target is `ConfigurationTarget.Global`.
125
+ * - If `false` configuration target is `ConfigurationTarget.Workspace`.
126
+ * - If `undefined` or `null` configuration target is
127
+ * `ConfigurationTarget.WorkspaceFolder` when configuration is resource specific
128
+ * `ConfigurationTarget.Workspace` otherwise.
129
+ */
130
+ update(section: string, value: any, configurationTarget?: ConfigurationTarget | boolean): Thenable<void>;
131
+
132
+ /**
133
+ * Readable dictionary that backs this configuration.
134
+ */
135
+ readonly [key: string]: any;
136
+ }
137
+
138
+ export interface ConfigurationChangeEvent {
139
+
140
+ /**
141
+ * Returns `true` if the given section for the given resource (if provided) is affected.
142
+ *
143
+ * @param section Configuration name, supports _dotted_ names.
144
+ * @param resource A resource Uri.
145
+ * @return `true` if the given section for the given resource (if provided) is affected.
146
+ */
147
+ affectsConfiguration(section: string, resource?: Uri): boolean;
148
+ }
149
+
150
+ /**
151
+ * The configuration target
152
+ */
153
+ export enum ConfigurationTarget {
154
+ /**
155
+ * Global configuration
156
+ */
157
+ Global = 1,
158
+
159
+ /**
160
+ * Workspace configuration
161
+ */
162
+ Workspace = 2,
163
+
164
+ /**
165
+ * Workspace folder configuration
166
+ */
167
+ WorkspaceFolder = 3,
168
+ }
169
+ /**
170
+ * A workspace folder is one of potentially many roots opened by the editor. All workspace folders
171
+ * are equal which means there is no notion of an active or master workspace folder.
172
+ */
173
+ export interface WorkspaceFolder {
174
+
175
+ /**
176
+ * The associated uri for this workspace folder.
177
+ *
178
+ * *Note:* The [Uri](#Uri)-type was intentionally chosen such that future releases of the editor can support
179
+ * workspace folders that are not stored on the local disk, e.g. `ftp://server/workspaces/foo`.
180
+ */
181
+ readonly uri: Uri;
182
+
183
+ /**
184
+ * The name of this workspace folder. Defaults to
185
+ * the basename of its [uri-path](#Uri.path)
186
+ */
187
+ readonly name: string;
188
+
189
+ /**
190
+ * The ordinal number of this workspace folder.
191
+ */
192
+ readonly index: number;
193
+ }
194
+
195
+ /**
196
+ * A uri handler is responsible for handling system-wide [uris](#Uri).
197
+ *
198
+ * @see [window.registerUriHandler](#window.registerUriHandler).
199
+ */
200
+ export interface UriHandler {
201
+
202
+ /**
203
+ * Handle the provided system-wide [uri](#Uri).
204
+ *
205
+ * @see [window.registerUriHandler](#window.registerUriHandler).
206
+ */
207
+ handleUri(uri: Uri): ProviderResult<void>;
208
+ }
209
+
210
+ /**
211
+ * Content settings for a webview panel.
212
+ */
213
+ export interface WebviewPanelOptions {
214
+ /**
215
+ * Controls if the find widget is enabled in the panel.
216
+ *
217
+ * Defaults to false.
218
+ */
219
+ readonly enableFindWidget?: boolean;
220
+
221
+ /**
222
+ * Controls if the webview panel's content (iframe) is kept around even when the panel
223
+ * is no longer visible.
224
+ *
225
+ * Normally the webview panel's html context is created when the panel becomes visible
226
+ * and destroyed when it is hidden. Extensions that have complex state
227
+ * or UI can set the `retainContextWhenHidden` to make VS Code keep the webview
228
+ * context around, even when the webview moves to a background tab. When a webview using
229
+ * `retainContextWhenHidden` becomes hidden, its scripts and other dynamic content are suspended.
230
+ * When the panel becomes visible again, the context is automatically restored
231
+ * in the exact same state it was in originally. You cannot send messages to a
232
+ * hidden webview, even with `retainContextWhenHidden` enabled.
233
+ *
234
+ * `retainContextWhenHidden` has a high memory overhead and should only be used if
235
+ * your panel's context cannot be quickly saved and restored.
236
+ */
237
+ readonly retainContextWhenHidden?: boolean;
238
+ }
239
+
240
+ /**
241
+ * Value-object describing what options a terminal should use.
242
+ */
243
+ export interface TerminalOptions {
244
+ /**
245
+ * A human-readable string which will be used to represent the terminal in the UI.
246
+ */
247
+ name?: string;
248
+
249
+ /**
250
+ * A path to a custom shell executable to be used in the terminal.
251
+ */
252
+ shellPath?: string;
253
+
254
+ /**
255
+ * Args for the custom shell executable. A string can be used on Windows only which allows
256
+ * specifying shell args in [command-line format](https://msdn.microsoft.com/en-au/08dfcab2-eb6e-49a4-80eb-87d4076c98c6).
257
+ */
258
+ shellArgs?: string[] | string;
259
+
260
+ /**
261
+ * A path or Uri for the current working directory to be used for the terminal.
262
+ */
263
+ cwd?: string | Uri;
264
+
265
+ /**
266
+ * Object with environment variables that will be added to the VS Code process.
267
+ */
268
+ env?: { [key: string]: string | null };
269
+
270
+ /**
271
+ * Whether the terminal process environment should be exactly as provided in
272
+ * `TerminalOptions.env`. When this is false (default), the environment will be based on the
273
+ * window's environment and also apply configured platform settings like
274
+ * `terminal.integrated.windows.env` on top. When this is true, the complete environment
275
+ * must be provided as nothing will be inherited from the process or any configuration.
276
+ */
277
+ strictEnv?: boolean;
278
+
279
+ /**
280
+ * When enabled the terminal will run the process as normal but not be surfaced to the user
281
+ * until `Terminal.show` is called. The typical usage for this is when you need to run
282
+ * something that may need interactivity but only want to tell the user about it when
283
+ * interaction is needed. Note that the terminals will still be exposed to all extensions
284
+ * as normal.
285
+ */
286
+ hideFromUser?: boolean;
287
+
288
+ /**
289
+ * Whether an extension is controlling the terminal via a `vscode.Pseudoterminal`.
290
+ */
291
+ isExtensionTerminal?: boolean;
292
+
293
+ /**
294
+ * A message to write to the terminal on first launch, note that this is not sent to the
295
+ * process but, rather written directly to the terminal. This supports escape sequences such
296
+ * a setting text style.
297
+ */
298
+ message?: string;
299
+
300
+ /**
301
+ * The icon path or {@link ThemeIcon} for the terminal.
302
+ */
303
+ iconPath?: Uri | { light: Uri; dark: Uri } | ThemeIcon;
304
+
305
+ /**
306
+ * The icon {@link ThemeColor} for the terminal.
307
+ * The `terminal.ansi*` theme keys are
308
+ * recommended for the best contrast and consistency across themes.
309
+ */
310
+ color?: ThemeColor;
311
+ }
312
+
313
+ /**
314
+ * Provides information on a line in a terminal in order to provide links for it.
315
+ */
316
+ export interface TerminalLinkContext {
317
+ /**
318
+ * This is the text from the unwrapped line in the terminal.
319
+ */
320
+ line: string;
321
+
322
+ /**
323
+ * The terminal the link belongs to.
324
+ */
325
+ terminal: Terminal;
326
+ }
327
+
328
+ /**
329
+ * A provider that enables detection and handling of links within terminals.
330
+ */
331
+ export interface TerminalLinkProvider<T extends TerminalLink = TerminalLink> {
332
+ /**
333
+ * Provide terminal links for the given context. Note that this can be called multiple times
334
+ * even before previous calls resolve, make sure to not share global objects (eg. `RegExp`)
335
+ * that could have problems when asynchronous usage may overlap.
336
+ * @param context Information about what links are being provided for.
337
+ * @param token A cancellation token.
338
+ * @return A list of terminal links for the given line.
339
+ */
340
+ provideTerminalLinks(context: TerminalLinkContext, token: CancellationToken): ProviderResult<T[]>;
341
+
342
+ /**
343
+ * Handle an activated terminal link.
344
+ * @param link The link to handle.
345
+ */
346
+ handleTerminalLink(link: T): ProviderResult<void>;
347
+ }
348
+
349
+ /**
350
+ * A link on a terminal line.
351
+ */
352
+ export interface TerminalLink {
353
+ /**
354
+ * The start index of the link on [TerminalLinkContext.line](#TerminalLinkContext.line].
355
+ */
356
+ startIndex: number;
357
+
358
+ /**
359
+ * The length of the link on [TerminalLinkContext.line](#TerminalLinkContext.line]
360
+ */
361
+ length: number;
362
+
363
+ /**
364
+ * TODO: The tooltip text when you hover over this link.
365
+ *
366
+ * If a tooltip is provided, is will be displayed in a string that includes instructions on
367
+ * how to trigger the link, such as `{0} (ctrl + click)`. The specific instructions vary
368
+ * depending on OS, user settings, and localization.
369
+ */
370
+ // tooltip?: string;
371
+ }
372
+
373
+ /**
374
+ * Class used to execute an extension callback as a task.
375
+ */
376
+ export class CustomExecution {
377
+ /**
378
+ * Constructs a CustomExecution task object. The callback will be executed the task is run, at which point the
379
+ * extension should return the Pseudoterminal it will "run in". The task should wait to do further execution until
380
+ * [Pseudoterminal.open](#Pseudoterminal.open) is called. Task cancellation should be handled using
381
+ * [Pseudoterminal.close](#Pseudoterminal.close). When the task is complete fire
382
+ * [Pseudoterminal.onDidClose](#Pseudoterminal.onDidClose).
383
+ * @param process The [Pseudoterminal](#Pseudoterminal) to be used by the task to display output.
384
+ * @param callback The callback that will be called when the task is started by a user.
385
+ */
386
+ constructor(callback: () => Thenable<Pseudoterminal>);
387
+ }
388
+
389
+ /**
390
+ * Value-object describing what options a virtual process terminal should use.
391
+ */
392
+ export interface ExtensionTerminalOptions {
393
+ /**
394
+ * A human-readable string which will be used to represent the terminal in the UI.
395
+ */
396
+ name: string;
397
+
398
+ /**
399
+ * An implementation of [Pseudoterminal](#Pseudoterminal) that allows an extension to
400
+ * control a terminal.
401
+ */
402
+ pty: Pseudoterminal;
403
+
404
+ /**
405
+ * The icon path or {@link ThemeIcon} for the terminal.
406
+ */
407
+ iconPath?: Uri | { light: Uri; dark: Uri } | ThemeIcon;
408
+
409
+ /**
410
+ * The icon {@link ThemeColor} for the terminal.
411
+ * The standard `terminal.ansi*` theme keys are
412
+ * recommended for the best contrast and consistency across themes.
413
+ */
414
+ color?: ThemeColor;
415
+ }
416
+
417
+ /**
418
+ * Defines the interface of a terminal pty, enabling extensions to control a terminal.
419
+ */
420
+ interface Pseudoterminal {
421
+ /**
422
+ * An event that when fired will write data to the terminal. Unlike
423
+ * [Terminal.sendText](#Terminal.sendText) which sends text to the underlying child
424
+ * pseudo-device (the child), this will write the text to parent pseudo-device (the
425
+ * _terminal_ itself).
426
+ *
427
+ * Note writing `\n` will just move the cursor down 1 row, you need to write `\r` as well
428
+ * to move the cursor to the left-most cell.
429
+ *
430
+ * **Example:** Write red text to the terminal
431
+ * ```typescript
432
+ * const writeEmitter = new vscode.EventEmitter<string>();
433
+ * const pty: vscode.Pseudoterminal = {
434
+ * onDidWrite: writeEmitter.event,
435
+ * open: () => writeEmitter.fire('\x1b[31mHello world\x1b[0m'),
436
+ * close: () => {}
437
+ * };
438
+ * vscode.window.createTerminal({ name: 'My terminal', pty });
439
+ * ```
440
+ *
441
+ * **Example:** Move the cursor to the 10th row and 20th column and write an asterisk
442
+ * ```typescript
443
+ * writeEmitter.fire('\x1b[10;20H*');
444
+ * ```
445
+ */
446
+ onDidWrite: Event<string>;
447
+
448
+ /**
449
+ * An event that when fired allows overriding the [dimensions](#Pseudoterminal.setDimensions) of the
450
+ * terminal. Note that when set, the overridden dimensions will only take effect when they
451
+ * are lower than the actual dimensions of the terminal (ie. there will never be a scroll
452
+ * bar). Set to `undefined` for the terminal to go back to the regular dimensions (fit to
453
+ * the size of the panel).
454
+ *
455
+ * **Example:** Override the dimensions of a terminal to 20 columns and 10 rows
456
+ * ```typescript
457
+ * const dimensionsEmitter = new vscode.EventEmitter<vscode.TerminalDimensions>();
458
+ * const pty: vscode.Pseudoterminal = {
459
+ * onDidWrite: writeEmitter.event,
460
+ * onDidOverrideDimensions: dimensionsEmitter.event,
461
+ * open: () => {
462
+ * dimensionsEmitter.fire({
463
+ * columns: 20,
464
+ * rows: 10
465
+ * });
466
+ * },
467
+ * close: () => {}
468
+ * };
469
+ * vscode.window.createTerminal({ name: 'My terminal', pty });
470
+ * ```
471
+ */
472
+ onDidOverrideDimensions?: Event<TerminalDimensions | undefined>;
473
+
474
+ /**
475
+ * An event that when fired will signal that the pty is closed and dispose of the terminal.
476
+ *
477
+ * A number can be used to provide an exit code for the terminal. Exit codes must be
478
+ * positive and a non-zero exit codes signals failure which shows a notification for a
479
+ * regular terminal and allows dependent tasks to proceed when used with the
480
+ * `CustomExecution` API.
481
+ *
482
+ * **Example:** Exit the terminal when "y" is pressed, otherwise show a notification.
483
+ * ```typescript
484
+ * const writeEmitter = new vscode.EventEmitter<string>();
485
+ * const closeEmitter = new vscode.EventEmitter<vscode.TerminalDimensions>();
486
+ * const pty: vscode.Pseudoterminal = {
487
+ * onDidWrite: writeEmitter.event,
488
+ * onDidClose: closeEmitter.event,
489
+ * open: () => writeEmitter.fire('Press y to exit successfully'),
490
+ * close: () => {},
491
+ * handleInput: data => {
492
+ * if (data !== 'y') {
493
+ * vscode.window.showInformationMessage('Something went wrong');
494
+ * }
495
+ * closeEmitter.fire();
496
+ * }
497
+ * };
498
+ * vscode.window.createTerminal({ name: 'Exit example', pty });
499
+ * ```
500
+ */
501
+ onDidClose?: Event<void | number>;
502
+
503
+ /**
504
+ * An event that when fired allows changing the name of the terminal.
505
+ *
506
+ * **Example:** Change the terminal name to "My new terminal".
507
+ * ```typescript
508
+ * const writeEmitter = new vscode.EventEmitter<string>();
509
+ * const changeNameEmitter = new vscode.EventEmitter<string>();
510
+ * const pty: vscode.Pseudoterminal = {
511
+ * onDidWrite: writeEmitter.event,
512
+ * onDidChangeName: changeNameEmitter.event,
513
+ * open: () => changeNameEmitter.fire('My new terminal'),
514
+ * close: () => {}
515
+ * };
516
+ * vscode.window.createTerminal({ name: 'My terminal', pty });
517
+ * ```
518
+ */
519
+ onDidChangeName?: Event<string>;
520
+
521
+ /**
522
+ * Implement to handle when the pty is open and ready to start firing events.
523
+ *
524
+ * @param initialDimensions The dimensions of the terminal, this will be undefined if the
525
+ * terminal panel has not been opened before this is called.
526
+ */
527
+ open(initialDimensions: TerminalDimensions | undefined): void;
528
+
529
+ /**
530
+ * Implement to handle when the terminal is closed by an act of the user.
531
+ */
532
+ close(): void;
533
+
534
+ /**
535
+ * Implement to handle incoming keystrokes in the terminal or when an extension calls
536
+ * [Terminal.sendText](#Terminal.sendText). `data` contains the keystrokes/text serialized into
537
+ * their corresponding VT sequence representation.
538
+ *
539
+ * @param data The incoming data.
540
+ *
541
+ * **Example:** Echo input in the terminal. The sequence for enter (`\r`) is translated to
542
+ * CRLF to go to a new line and move the cursor to the start of the line.
543
+ * ```typescript
544
+ * const writeEmitter = new vscode.EventEmitter<string>();
545
+ * const pty: vscode.Pseudoterminal = {
546
+ * onDidWrite: writeEmitter.event,
547
+ * open: () => {},
548
+ * close: () => {},
549
+ * handleInput: data => writeEmitter.fire(data === '\r' ? '\r\n' : data)
550
+ * };
551
+ * vscode.window.createTerminal({ name: 'Local echo', pty });
552
+ * ```
553
+ */
554
+ handleInput?(data: string): void;
555
+
556
+ /**
557
+ * Implement to handle when the number of rows and columns that fit into the terminal panel
558
+ * changes, for example when font size changes or when the panel is resized. The initial
559
+ * state of a terminal's dimensions should be treated as `undefined` until this is triggered
560
+ * as the size of a terminal isn't know until it shows up in the user interface.
561
+ *
562
+ * When dimensions are overridden by
563
+ * [onDidOverrideDimensions](#Pseudoterminal.onDidOverrideDimensions), `setDimensions` will
564
+ * continue to be called with the regular panel dimensions, allowing the extension continue
565
+ * to react dimension changes.
566
+ *
567
+ * @param dimensions The new dimensions.
568
+ */
569
+ setDimensions?(dimensions: TerminalDimensions): void;
570
+ }
571
+
572
+ /**
573
+ * The clipboard provides read and write access to the system's clipboard.
574
+ */
575
+ export interface Clipboard {
576
+
577
+ /**
578
+ * Read the current clipboard contents as text.
579
+ * @returns A thenable that resolves to a string.
580
+ */
581
+ readText(): Thenable<string>;
582
+
583
+ /**
584
+ * Writes text into the clipboard.
585
+ * @returns A thenable that resolves when writing happened.
586
+ */
587
+ writeText(value: string): Thenable<void>;
588
+ }
589
+
590
+ /**
591
+ * A selection range represents a part of a selection hierarchy. A selection range
592
+ * may have a parent selection range that contains it.
593
+ */
594
+ export class SelectionRange {
595
+
596
+ /**
597
+ * The [range](#Range) of this selection range.
598
+ */
599
+ range: Range;
600
+
601
+ /**
602
+ * The parent selection range containing this range.
603
+ */
604
+ parent?: SelectionRange;
605
+
606
+ /**
607
+ * Creates a new selection range.
608
+ *
609
+ * @param range The range of the selection range.
610
+ * @param parent The parent of the selection range.
611
+ */
612
+ constructor(range: Range, parent?: SelectionRange);
613
+ }
614
+ /**
615
+ * A tuple of two characters, like a pair of
616
+ * opening and closing brackets.
617
+ */
618
+ export type CharacterPair = [string, string];
619
+
620
+ /**
621
+ * The workspace symbol provider interface defines the contract between extensions and
622
+ * the [symbol search](https://code.visualstudio.com/docs/editor/editingevolved#_open-symbol-by-name)-feature.
623
+ */
624
+ export interface WorkspaceSymbolProvider<T extends SymbolInformation = SymbolInformation> {
625
+
626
+ /**
627
+ * Project-wide search for a symbol matching the given query string.
628
+ *
629
+ * The `query`-parameter should be interpreted in a *relaxed way* as the editor will apply its own highlighting
630
+ * and scoring on the results. A good rule of thumb is to match case-insensitive and to simply check that the
631
+ * characters of *query* appear in their order in a candidate symbol. Don't use prefix, substring, or similar
632
+ * strict matching.
633
+ *
634
+ * To improve performance implementors can implement `resolveWorkspaceSymbol` and then provide symbols with partial
635
+ * {@link SymbolInformation.location location}-objects, without a `range` defined. The editor will then call
636
+ * `resolveWorkspaceSymbol` for selected symbols only, e.g. when opening a workspace symbol.
637
+ *
638
+ * @param query A query string, can be the empty string in which case all symbols should be returned.
639
+ * @param token A cancellation token.
640
+ * @return An array of document highlights or a thenable that resolves to such. The lack of a result can be
641
+ * signaled by returning `undefined`, `null`, or an empty array.
642
+ */
643
+ provideWorkspaceSymbols(query: string, token: CancellationToken): ProviderResult<T[]>;
644
+
645
+ /**
646
+ * Given a symbol fill in its {@link SymbolInformation.location location}. This method is called whenever a symbol
647
+ * is selected in the UI. Providers can implement this method and return incomplete symbols from
648
+ * {@link WorkspaceSymbolProvider.provideWorkspaceSymbols `provideWorkspaceSymbols`} which often helps to improve
649
+ * performance.
650
+ *
651
+ * @param symbol The symbol that is to be resolved. Guaranteed to be an instance of an object returned from an
652
+ * earlier call to `provideWorkspaceSymbols`.
653
+ * @param token A cancellation token.
654
+ * @return The resolved symbol or a thenable that resolves to that. When no result is returned,
655
+ * the given `symbol` is used.
656
+ */
657
+ resolveWorkspaceSymbol?(symbol: T, token: CancellationToken): ProviderResult<T>;
658
+ }
659
+
660
+ /**
661
+ * Describes how comments for a language work.
662
+ */
663
+ export interface CommentRule {
664
+
665
+ /**
666
+ * The line comment token, like `// this is a comment`
667
+ */
668
+ lineComment?: string;
669
+
670
+ /**
671
+ * The block comment character pair, like `/* block comment *&#47;`
672
+ */
673
+ blockComment?: CharacterPair;
674
+ }
675
+
676
+ /**
677
+ * Describes a rule to be evaluated when pressing Enter.
678
+ */
679
+ export interface OnEnterRule {
680
+ /**
681
+ * This rule will only execute if the text before the cursor matches this regular expression.
682
+ */
683
+ beforeText: RegExp;
684
+ /**
685
+ * This rule will only execute if the text after the cursor matches this regular expression.
686
+ */
687
+ afterText?: RegExp;
688
+ /**
689
+ * The action to execute.
690
+ */
691
+ action: EnterAction;
692
+
693
+ previousLineText?: RegExp;
694
+ }
695
+
696
+ /**
697
+ * Describes indentation rules for a language.
698
+ */
699
+ export interface IndentationRule {
700
+ /**
701
+ * If a line matches this pattern, then all the lines after it should be unindented once (until another rule matches).
702
+ */
703
+ decreaseIndentPattern: RegExp;
704
+ /**
705
+ * If a line matches this pattern, then all the lines after it should be indented once (until another rule matches).
706
+ */
707
+ increaseIndentPattern: RegExp;
708
+ /**
709
+ * If a line matches this pattern, then **only the next line** after it should be indented once.
710
+ */
711
+ indentNextLinePattern?: RegExp;
712
+ /**
713
+ * If a line matches this pattern, then its indentation should not be changed and it should not be evaluated against the other rules.
714
+ */
715
+ unIndentedLinePattern?: RegExp;
716
+ }
717
+
718
+ /**
719
+ * A workspace folder is one of potentially many roots opened by the editor. All workspace folders
720
+ * are equal which means there is no notion of an active or master workspace folder.
721
+ */
722
+ export interface WorkspaceFolder {
723
+
724
+ /**
725
+ * The associated uri for this workspace folder.
726
+ *
727
+ * *Note:* The [Uri](#Uri)-type was intentionally chosen such that future releases of the editor can support
728
+ * workspace folders that are not stored on the local disk, e.g. `ftp://server/workspaces/foo`.
729
+ */
730
+ readonly uri: Uri;
731
+
732
+ /**
733
+ * The name of this workspace folder. Defaults to
734
+ * the basename of its [uri-path](#Uri.path)
735
+ */
736
+ readonly name: string;
737
+
738
+ /**
739
+ * The ordinal number of this workspace folder.
740
+ */
741
+ readonly index: number;
742
+ }
743
+ /**
744
+ * Represents reasons why a text document is saved.
745
+ */
746
+ export enum TextDocumentSaveReason {
747
+
748
+ /**
749
+ * Manually triggered, e.g. by the user pressing save, by starting debugging,
750
+ * or by an API call.
751
+ */
752
+ Manual = 1,
753
+
754
+ /**
755
+ * Automatic after a delay.
756
+ */
757
+ AfterDelay = 2,
758
+
759
+ /**
760
+ * When the editor lost focus.
761
+ */
762
+ FocusOut = 3,
763
+ }
764
+
765
+ /**
766
+ * Content settings for a webview.
767
+ */
768
+ export interface WebviewOptions {
769
+ /**
770
+ * Controls whether scripts are enabled in the webview content or not.
771
+ *
772
+ * Defaults to false (scripts-disabled).
773
+ */
774
+ readonly enableScripts?: boolean;
775
+
776
+ /**
777
+ * Controls whether command uris are enabled in webview content or not.
778
+ *
779
+ * Defaults to false.
780
+ */
781
+ readonly enableCommandUris?: boolean;
782
+
783
+ /**
784
+ * Root paths from which the webview can load local (filesystem) resources using the `vscode-resource:` scheme.
785
+ *
786
+ * Default to the root folders of the current workspace plus the extension's install directory.
787
+ *
788
+ * Pass in an empty array to disallow access to any local resources.
789
+ */
790
+ readonly localResourceRoots?: ReadonlyArray<Uri>;
791
+
792
+ /**
793
+ * Mappings of localhost ports used inside the webview.
794
+ *
795
+ * Port mapping allow webviews to transparently define how localhost ports are resolved. This can be used
796
+ * to allow using a static localhost port inside the webview that is resolved to random port that a service is
797
+ * running on.
798
+ *
799
+ * If a webview accesses localhost content, we recommend that you specify port mappings even if
800
+ * the `webviewPort` and `extensionHostPort` ports are the same.
801
+ *
802
+ * *Note* that port mappings only work for `http` or `https` urls. Websocket urls (e.g. `ws://localhost:3000`)
803
+ * cannot be mapped to another port.
804
+ */
805
+ readonly portMapping?: ReadonlyArray<WebviewPortMapping>;
806
+ }
807
+
808
+ /**
809
+ * A webview displays html content, like an iframe.
810
+ */
811
+ export interface Webview {
812
+ /**
813
+ * Content settings for the webview.
814
+ */
815
+ options: WebviewOptions;
816
+
817
+ /**
818
+ * Contents of the webview.
819
+ *
820
+ * Should be a complete html document.
821
+ */
822
+ html: string;
823
+
824
+ /**
825
+ * Fired when the webview content posts a message.
826
+ */
827
+ readonly onDidReceiveMessage: Event<any>;
828
+
829
+ /**
830
+ * Post a message to the webview content.
831
+ *
832
+ * Messages are only delivered if the webview is visible.
833
+ *
834
+ * @param message Body of the message.
835
+ */
836
+ postMessage(message: any): Thenable<boolean>;
837
+ /**
838
+ * Convert a uri for the local file system to one that can be used inside webviews.
839
+ *
840
+ * Webviews cannot directly load resources from the workspace or local file system using `file:` uris. The
841
+ * `asWebviewUri` function takes a local `file:` uri and converts it into a uri that can be used inside of
842
+ * a webview to load the same resource:
843
+ *
844
+ * ```ts
845
+ * webview.html = `<img src="${webview.asWebviewUri(vscode.Uri.file('/Users/codey/workspace/cat.gif'))}">`
846
+ * ```
847
+ */
848
+ asWebviewUri(localResource: Uri): Uri;
849
+
850
+ /**
851
+ * Content security policy source for webview resources.
852
+ *
853
+ * This is the origin that should be used in a content security policy rule:
854
+ *
855
+ * ```
856
+ * img-src https: ${webview.cspSource} ...;
857
+ * ```
858
+ */
859
+ readonly cspSource: string;
860
+ }
861
+
862
+ /**
863
+ * Represents the state of a window.
864
+ */
865
+ export interface WindowState {
866
+
867
+ /**
868
+ * Whether the current window is focused.
869
+ */
870
+ readonly focused: boolean;
871
+ }
872
+
873
+ /**
874
+ * Represents a parameter of a callable-signature. A parameter can
875
+ * have a label and a doc-comment.
876
+ */
877
+ export class ParameterInformation {
878
+
879
+ /**
880
+ * The label of this signature.
881
+ *
882
+ * Either a string or inclusive start and exclusive end offsets within its containing
883
+ * [signature label](#SignatureInformation.label). *Note*: A label of type string must be
884
+ * a substring of its containing signature information's [label](#SignatureInformation.label).
885
+ */
886
+ label: string | [number, number];
887
+
888
+ /**
889
+ * The human-readable doc-comment of this signature. Will be shown
890
+ * in the UI but can be omitted.
891
+ */
892
+ documentation?: string | MarkdownString;
893
+
894
+ /**
895
+ * Creates a new parameter information object.
896
+ *
897
+ * @param label A label string or inclusive start and exclusive end offsets within its containing signature label.
898
+ * @param documentation A doc string.
899
+ */
900
+ constructor(label: string | [number, number], documentation?: string | MarkdownString);
901
+ }
902
+
903
+ /**
904
+ * How a [`SignatureHelpProvider`](#SignatureHelpProvider) was triggered.
905
+ */
906
+ export enum SignatureHelpTriggerKind {
907
+ /**
908
+ * Signature help was invoked manually by the user or by a command.
909
+ */
910
+ Invoke = 1,
911
+
912
+ /**
913
+ * Signature help was triggered by a trigger character.
914
+ */
915
+ TriggerCharacter = 2,
916
+
917
+ /**
918
+ * Signature help was triggered by the cursor moving or by the document content changing.
919
+ */
920
+ ContentChange = 3,
921
+ }
922
+
923
+ /**
924
+ * Additional information about the context in which a
925
+ * [`SignatureHelpProvider`](#SignatureHelpProvider.provideSignatureHelp) was triggered.
926
+ */
927
+ export interface SignatureHelpContext {
928
+ /**
929
+ * Action that caused signature help to be triggered.
930
+ */
931
+ readonly triggerKind: SignatureHelpTriggerKind;
932
+
933
+ /**
934
+ * Character that caused signature help to be triggered.
935
+ *
936
+ * This is `undefined` when signature help is not triggered by typing, such as when manually invoking
937
+ * signature help or when moving the cursor.
938
+ */
939
+ readonly triggerCharacter?: string;
940
+
941
+ /**
942
+ * `true` if signature help was already showing when it was triggered.
943
+ *
944
+ * Retriggers occur when the signature help is already active and can be caused by actions such as
945
+ * typing a trigger character, a cursor move, or document content changes.
946
+ */
947
+ readonly isRetrigger: boolean;
948
+
949
+ /**
950
+ * The currently active [`SignatureHelp`](#SignatureHelp).
951
+ *
952
+ * The `activeSignatureHelp` has its [`SignatureHelp.activeSignature`] field updated based on
953
+ * the user arrowing through available signatures.
954
+ */
955
+ readonly activeSignatureHelp?: SignatureHelp;
956
+ }
957
+
958
+ /**
959
+ * The signature help provider interface defines the contract between extensions and
960
+ * the [parameter hints](https://code.visualstudio.com/docs/editor/intellisense)-feature.
961
+ */
962
+ export interface SignatureHelpProvider {
963
+
964
+ /**
965
+ * Provide help for the signature at the given position and document.
966
+ *
967
+ * @param document The document in which the command was invoked.
968
+ * @param position The position at which the command was invoked.
969
+ * @param token A cancellation token.
970
+ * @param context Information about how signature help was triggered.
971
+ *
972
+ * @return Signature help or a thenable that resolves to such. The lack of a result can be
973
+ * signaled by returning `undefined` or `null`.
974
+ */
975
+ provideSignatureHelp(document: TextDocument, position: Position, token: CancellationToken, context: SignatureHelpContext): ProviderResult<SignatureHelp>;
976
+ }
977
+
978
+ /**
979
+ * Metadata about a registered [`SignatureHelpProvider`](#SignatureHelpProvider).
980
+ */
981
+ export interface SignatureHelpProviderMetadata {
982
+ /**
983
+ * List of characters that trigger signature help.
984
+ */
985
+ readonly triggerCharacters: ReadonlyArray<string>;
986
+
987
+ /**
988
+ * List of characters that re-trigger signature help.
989
+ *
990
+ * These trigger characters are only active when signature help is already showing. All trigger characters
991
+ * are also counted as re-trigger characters.
992
+ */
993
+ readonly retriggerCharacters: ReadonlyArray<string>;
994
+ }
995
+
996
+ /**
997
+ * Represents the signature of something callable. A signature
998
+ * can have a label, like a function-name, a doc-comment, and
999
+ * a set of parameters.
1000
+ */
1001
+ export class SignatureInformation {
1002
+
1003
+ /**
1004
+ * The label of this signature. Will be shown in
1005
+ * the UI.
1006
+ */
1007
+ label: string;
1008
+
1009
+ /**
1010
+ * The human-readable doc-comment of this signature. Will be shown
1011
+ * in the UI but can be omitted.
1012
+ */
1013
+ documentation?: string | MarkdownString;
1014
+
1015
+ /**
1016
+ * The parameters of this signature.
1017
+ */
1018
+ parameters: ParameterInformation[];
1019
+
1020
+ /**
1021
+ * The index of the active parameter.
1022
+ *
1023
+ * If provided, this is used in place of {@linkcode SignatureHelp.activeSignature}.
1024
+ */
1025
+ activeParameter?: number;
1026
+
1027
+ /**
1028
+ * Creates a new signature information object.
1029
+ *
1030
+ * @param label A label string.
1031
+ * @param documentation A doc string.
1032
+ */
1033
+ constructor(label: string, documentation?: string | MarkdownString);
1034
+ }
1035
+
1036
+ /**
1037
+ * Signature help represents the signature of something
1038
+ * callable. There can be multiple signatures but only one
1039
+ * active and only one active parameter.
1040
+ */
1041
+ export class SignatureHelp {
1042
+
1043
+ /**
1044
+ * One or more signatures.
1045
+ */
1046
+ signatures: SignatureInformation[];
1047
+
1048
+ /**
1049
+ * The active signature.
1050
+ */
1051
+ activeSignature: number;
1052
+
1053
+ /**
1054
+ * The active parameter of the active signature.
1055
+ */
1056
+ activeParameter: number;
1057
+ }
1058
+
1059
+ /**
1060
+ * Symbol tags are extra annotations that tweak the rendering of a symbol.
1061
+ */
1062
+ export enum SymbolTag {
1063
+
1064
+ /**
1065
+ * Render a symbol as obsolete, usually using a strike-out.
1066
+ */
1067
+ Deprecated = 1,
1068
+ }
1069
+
1070
+ /**
1071
+ * Represents information about programming constructs like variables, classes,
1072
+ * interfaces etc.
1073
+ */
1074
+ export class SymbolInformation {
1075
+
1076
+ /**
1077
+ * The name of this symbol.
1078
+ */
1079
+ name: string;
1080
+
1081
+ /**
1082
+ * The name of the symbol containing this symbol.
1083
+ */
1084
+ containerName: string;
1085
+
1086
+ /**
1087
+ * The kind of this symbol.
1088
+ */
1089
+ kind: SymbolKind;
1090
+
1091
+ /**
1092
+ * Tags for this symbol.
1093
+ */
1094
+ tags?: ReadonlyArray<SymbolTag>;
1095
+
1096
+ /**
1097
+ * The location of this symbol.
1098
+ */
1099
+ location: Location;
1100
+
1101
+ /**
1102
+ * Creates a new symbol information object.
1103
+ *
1104
+ * @param name The name of the symbol.
1105
+ * @param kind The kind of the symbol.
1106
+ * @param containerName The name of the symbol containing the symbol.
1107
+ * @param location The location of the symbol.
1108
+ */
1109
+ constructor(name: string, kind: SymbolKind, containerName: string, location: Location);
1110
+
1111
+ /**
1112
+ * ~~Creates a new symbol information object.~~
1113
+ *
1114
+ * @deprecated Please use the constructor taking a [location](#Location) object.
1115
+ *
1116
+ * @param name The name of the symbol.
1117
+ * @param kind The kind of the symbol.
1118
+ * @param range The range of the location of the symbol.
1119
+ * @param uri The resource of the location of symbol, defaults to the current document.
1120
+ * @param containerName The name of the symbol containing the symbol.
1121
+ */
1122
+ constructor(name: string, kind: SymbolKind, range: Range, uri?: Uri, containerName?: string);
1123
+ }
1124
+
1125
+ /**
1126
+ * A symbol kind.
1127
+ */
1128
+ export enum SymbolKind {
1129
+ File = 0,
1130
+ Module = 1,
1131
+ Namespace = 2,
1132
+ Package = 3,
1133
+ Class = 4,
1134
+ Method = 5,
1135
+ Property = 6,
1136
+ Field = 7,
1137
+ Constructor = 8,
1138
+ Enum = 9,
1139
+ Interface = 10,
1140
+ Function = 11,
1141
+ Variable = 12,
1142
+ Constant = 13,
1143
+ String = 14,
1144
+ Number = 15,
1145
+ Boolean = 16,
1146
+ Array = 17,
1147
+ Object = 18,
1148
+ Key = 19,
1149
+ Null = 20,
1150
+ EnumMember = 21,
1151
+ Struct = 22,
1152
+ Event = 23,
1153
+ Operator = 24,
1154
+ TypeParameter = 25,
1155
+ }
1156
+ /**
1157
+ * The version of the editor.
1158
+ */
1159
+ export const version: string;
1160
+
1161
+ /**
1162
+ * In a remote window the extension kind describes if an extension
1163
+ * runs where the UI (window) runs or if an extension runs remotely.
1164
+ */
1165
+ export enum ExtensionKind {
1166
+
1167
+ /**
1168
+ * Extension runs where the UI runs.
1169
+ */
1170
+ UI = 1,
1171
+
1172
+ /**
1173
+ * Extension runs where the remote extension host runs.
1174
+ */
1175
+ Workspace = 2,
1176
+ }
1177
+
1178
+ export interface SelectionRangeProvider {
1179
+ /**
1180
+ * Provide selection ranges for the given positions.
1181
+ *
1182
+ * Selection ranges should be computed individually and independend for each position. The editor will merge
1183
+ * and deduplicate ranges but providers must return hierarchies of selection ranges so that a range
1184
+ * is [contained](#Range.contains) by its parent.
1185
+ *
1186
+ * @param document The document in which the command was invoked.
1187
+ * @param positions The positions at which the command was invoked.
1188
+ * @param token A cancellation token.
1189
+ * @return Selection ranges or a thenable that resolves to such. The lack of a result can be
1190
+ * signaled by returning `undefined` or `null`.
1191
+ */
1192
+ provideSelectionRanges(document: TextDocument, positions: Position[], token: CancellationToken): ProviderResult<SelectionRange[]>;
1193
+ }
1194
+ /**
1195
+ * Contains additional information about the context in which
1196
+ * [completion provider](#CompletionItemProvider.provideCompletionItems) is triggered.
1197
+ */
1198
+ export interface CompletionContext {
1199
+ /**
1200
+ * How the completion was triggered.
1201
+ */
1202
+ readonly triggerKind: CompletionTriggerKind;
1203
+
1204
+ /**
1205
+ * Character that triggered the completion item provider.
1206
+ *
1207
+ * `undefined` if provider was not triggered by a character.
1208
+ *
1209
+ * The trigger character is already in the document when the completion provider is triggered.
1210
+ */
1211
+ readonly triggerCharacter?: string;
1212
+ }
1213
+
1214
+ /**
1215
+ * How a [completion provider](#CompletionItemProvider) was triggered
1216
+ */
1217
+ export enum CompletionTriggerKind {
1218
+ /**
1219
+ * Completion was triggered normally.
1220
+ */
1221
+ Invoke = 0,
1222
+ /**
1223
+ * Completion was triggered by a trigger character.
1224
+ */
1225
+ TriggerCharacter = 1,
1226
+ /**
1227
+ * Completion was re-triggered as current completion list is incomplete
1228
+ */
1229
+ TriggerForIncompleteCompletions = 2,
1230
+ }
1231
+
1232
+ /**
1233
+ * Completion item kinds.
1234
+ */
1235
+ export enum CompletionItemKind {
1236
+ Text = 0,
1237
+ Method = 1,
1238
+ Function = 2,
1239
+ Constructor = 3,
1240
+ Field = 4,
1241
+ Variable = 5,
1242
+ Class = 6,
1243
+ Interface = 7,
1244
+ Module = 8,
1245
+ Property = 9,
1246
+ Unit = 10,
1247
+ Value = 11,
1248
+ Enum = 12,
1249
+ Keyword = 13,
1250
+ Snippet = 14,
1251
+ Color = 15,
1252
+ Reference = 17,
1253
+ File = 16,
1254
+ Folder = 18,
1255
+ EnumMember = 19,
1256
+ Constant = 20,
1257
+ Struct = 21,
1258
+ Event = 22,
1259
+ Operator = 23,
1260
+ TypeParameter = 24,
1261
+ User = 25,
1262
+ Issue = 26,
1263
+ }
1264
+
1265
+ export enum CompletionItemTag {
1266
+ Deprecated = 1,
1267
+ }
1268
+
1269
+ /**
1270
+ * Additional data for entries of a workspace edit. Supports to label entries and marks entries
1271
+ * as needing confirmation by the user. The editor groups edits with equal labels into tree nodes,
1272
+ * for instance all edits labelled with "Changes in Strings" would be a tree node.
1273
+ */
1274
+ export interface WorkspaceEditEntryMetadata {
1275
+
1276
+ /**
1277
+ * A flag which indicates that user confirmation is needed.
1278
+ */
1279
+ needsConfirmation: boolean;
1280
+
1281
+ /**
1282
+ * A human-readable string which is rendered prominent.
1283
+ */
1284
+ label: string;
1285
+
1286
+ /**
1287
+ * A human-readable string which is rendered less prominent on the same line.
1288
+ */
1289
+ description?: string;
1290
+
1291
+ /**
1292
+ * The icon path or [ThemeIcon](#ThemeIcon) for the edit.
1293
+ */
1294
+ iconPath?: Uri | { light: Uri; dark: Uri } | ThemeIcon;
1295
+ }
1296
+
1297
+ /**
1298
+ * A workspace edit is a collection of textual and files changes for
1299
+ * multiple resources and documents.
1300
+ *
1301
+ * Use the [applyEdit](#workspace.applyEdit)-function to apply a workspace edit.
1302
+ */
1303
+ export class WorkspaceEdit {
1304
+
1305
+ /**
1306
+ * The number of affected resources of textual or resource changes.
1307
+ */
1308
+ readonly size: number;
1309
+
1310
+ /**
1311
+ * Replace the given range with given text for the given resource.
1312
+ *
1313
+ * @param uri A resource identifier.
1314
+ * @param range A range.
1315
+ * @param newText A string.
1316
+ */
1317
+ replace(uri: Uri, range: Range, newText: string, metadata?: WorkspaceEditEntryMetadata): void;
1318
+
1319
+ /**
1320
+ * Insert the given text at the given position.
1321
+ *
1322
+ * @param uri A resource identifier.
1323
+ * @param position A position.
1324
+ * @param newText A string.
1325
+ */
1326
+ insert(uri: Uri, position: Position, newText: string, metadata?: WorkspaceEditEntryMetadata): void;
1327
+
1328
+ /**
1329
+ * Delete the text at the given range.
1330
+ *
1331
+ * @param uri A resource identifier.
1332
+ * @param range A range.
1333
+ */
1334
+ delete(uri: Uri, range: Range, metadata?: WorkspaceEditEntryMetadata): void;
1335
+
1336
+ /**
1337
+ * Check if a text edit for a resource exists.
1338
+ *
1339
+ * @param uri A resource identifier.
1340
+ * @return `true` if the given resource will be touched by this edit.
1341
+ */
1342
+ has(uri: Uri): boolean;
1343
+
1344
+ /**
1345
+ * Set (and replace) text edits for a resource.
1346
+ *
1347
+ * @param uri A resource identifier.
1348
+ * @param edits An array of text edits.
1349
+ */
1350
+ set(uri: Uri, edits: TextEdit[]): void;
1351
+
1352
+ /**
1353
+ * Get the text edits for a resource.
1354
+ *
1355
+ * @param uri A resource identifier.
1356
+ * @return An array of text edits.
1357
+ */
1358
+ get(uri: Uri): TextEdit[];
1359
+
1360
+ /**
1361
+ * Create a regular file.
1362
+ *
1363
+ * @param uri Uri of the new file..
1364
+ * @param options Defines if an existing file should be overwritten or be
1365
+ * ignored. When overwrite and ignoreIfExists are both set overwrite wins.
1366
+ */
1367
+ createFile(uri: Uri, options?: { overwrite?: boolean, ignoreIfExists?: boolean }, metadata?: WorkspaceEditEntryMetadata): void;
1368
+
1369
+ /**
1370
+ * Delete a file or folder.
1371
+ *
1372
+ * @param uri The uri of the file that is to be deleted.
1373
+ */
1374
+ deleteFile(uri: Uri, options?: { recursive?: boolean, ignoreIfNotExists?: boolean }, metadata?: WorkspaceEditEntryMetadata): void;
1375
+
1376
+ /**
1377
+ * Rename a file or folder.
1378
+ *
1379
+ * @param oldUri The existing file.
1380
+ * @param newUri The new location.
1381
+ * @param options Defines if existing files should be overwritten or be
1382
+ * ignored. When overwrite and ignoreIfExists are both set overwrite wins.
1383
+ */
1384
+ renameFile(oldUri: Uri, newUri: Uri, options?: { overwrite?: boolean, ignoreIfExists?: boolean }, metadata?: WorkspaceEditEntryMetadata): void;
1385
+
1386
+ /**
1387
+ * Get all text edits grouped by resource.
1388
+ *
1389
+ * @return A shallow copy of `[Uri, TextEdit[]]`-tuples.
1390
+ */
1391
+ entries(): [Uri, TextEdit[]][];
1392
+ }
1393
+
1394
+ /**
1395
+ * Options for creating a [TreeView](#TreeView)
1396
+ */
1397
+ export interface TreeViewOptions<T> {
1398
+
1399
+ /**
1400
+ * A data provider that provides tree data.
1401
+ */
1402
+ treeDataProvider: TreeDataProvider<T>;
1403
+
1404
+ /**
1405
+ * Whether to show collapse all action or not.
1406
+ */
1407
+ showCollapseAll?: boolean;
1408
+
1409
+ /**
1410
+ * Whether the tree supports multi-select. When the tree supports multi-select and a command is executed from the tree,
1411
+ * the first argument to the command is the tree item that the command was executed on and the second argument is an
1412
+ * array containing all selected tree items.
1413
+ */
1414
+ canSelectMany?: boolean;
1415
+ }
1416
+
1417
+ /**
1418
+ * The event that is fired when an element in the [TreeView](#TreeView) is expanded or collapsed
1419
+ */
1420
+ export interface TreeViewExpansionEvent<T> {
1421
+
1422
+ /**
1423
+ * Element that is expanded or collapsed.
1424
+ */
1425
+ readonly element: T;
1426
+
1427
+ }
1428
+
1429
+ /**
1430
+ * The event that is fired when there is a change in [tree view's selection](#TreeView.selection)
1431
+ */
1432
+ export interface TreeViewSelectionChangeEvent<T> {
1433
+
1434
+ /**
1435
+ * Selected elements.
1436
+ */
1437
+ readonly selection: T[];
1438
+
1439
+ }
1440
+
1441
+ /**
1442
+ * The event that is fired when there is a change in [tree view's visibility](#TreeView.visible)
1443
+ */
1444
+ export interface TreeViewVisibilityChangeEvent {
1445
+
1446
+ /**
1447
+ * `true` if the [tree view](#TreeView) is visible otherwise `false`.
1448
+ */
1449
+ readonly visible: boolean;
1450
+
1451
+ }
1452
+
1453
+ /**
1454
+ * Represents a Tree view
1455
+ */
1456
+ export interface TreeView<T> extends Disposable {
1457
+
1458
+ /**
1459
+ * Event that is fired when an element is expanded
1460
+ */
1461
+ readonly onDidExpandElement: Event<TreeViewExpansionEvent<T>>;
1462
+
1463
+ /**
1464
+ * Event that is fired when an element is collapsed
1465
+ */
1466
+ readonly onDidCollapseElement: Event<TreeViewExpansionEvent<T>>;
1467
+
1468
+ /**
1469
+ * Currently selected elements.
1470
+ */
1471
+ readonly selection: T[];
1472
+
1473
+ /**
1474
+ * Event that is fired when the [selection](#TreeView.selection) has changed
1475
+ */
1476
+ readonly onDidChangeSelection: Event<TreeViewSelectionChangeEvent<T>>;
1477
+
1478
+ /**
1479
+ * `true` if the [tree view](#TreeView) is visible otherwise `false`.
1480
+ */
1481
+ readonly visible: boolean;
1482
+
1483
+ /**
1484
+ * Event that is fired when [visibility](#TreeView.visible) has changed
1485
+ */
1486
+ readonly onDidChangeVisibility: Event<TreeViewVisibilityChangeEvent>;
1487
+
1488
+ /**
1489
+ * An optional human-readable message that will be rendered in the view.
1490
+ * Setting the message to null, undefined, or empty string will remove the message from the view.
1491
+ */
1492
+ message?: string;
1493
+
1494
+ /**
1495
+ * The tree view title is initially taken from the extension package.json
1496
+ * Changes to the title property will be properly reflected in the UI in the title of the view.
1497
+ */
1498
+ title?: string;
1499
+
1500
+ /**
1501
+ * An optional human-readable description which is rendered less prominently in the title of the view.
1502
+ * Setting the title description to null, undefined, or empty string will remove the description from the view.
1503
+ */
1504
+ description?: string;
1505
+
1506
+ /**
1507
+ * Reveals the given element in the tree view.
1508
+ * If the tree view is not visible then the tree view is shown and element is revealed.
1509
+ *
1510
+ * By default revealed element is selected.
1511
+ * In order to not to select, set the option `select` to `false`.
1512
+ * In order to focus, set the option `focus` to `true`.
1513
+ * In order to expand the revealed element, set the option `expand` to `true`. To expand recursively set `expand` to the number of levels to expand.
1514
+ * **NOTE:** You can expand only to 3 levels maximum.
1515
+ *
1516
+ * **NOTE:** The [TreeDataProvider](#TreeDataProvider) that the `TreeView` [is registered with](#window.createTreeView) with must implement [getParent](#TreeDataProvider.getParent) method to access this API.
1517
+ */
1518
+ reveal(element: T, options?: { select?: boolean, focus?: boolean, expand?: boolean | number }): Thenable<void>;
1519
+ }
1520
+
1521
+ /**
1522
+ * Collapsible state of the tree item
1523
+ */
1524
+ export enum TreeItemCollapsibleState {
1525
+ /**
1526
+ * Determines an item can be neither collapsed nor expanded. Implies it has no children.
1527
+ */
1528
+ None = 0,
1529
+ /**
1530
+ * Determines an item is collapsed
1531
+ */
1532
+ Collapsed = 1,
1533
+ /**
1534
+ * Determines an item is expanded
1535
+ */
1536
+ Expanded = 2,
1537
+ }
1538
+
1539
+ /**
1540
+ * A data provider that provides tree data
1541
+ */
1542
+ export interface TreeDataProvider<T> {
1543
+ /**
1544
+ * An optional event to signal that an element or root has changed.
1545
+ * This will trigger the view to update the changed element/root and its children recursively (if shown).
1546
+ * To signal that root has changed, do not pass any argument or pass `undefined` or `null`.
1547
+ */
1548
+ onDidChangeTreeData?: Event<T | undefined | null>;
1549
+
1550
+ /**
1551
+ * Get [TreeItem](#TreeItem) representation of the `element`
1552
+ *
1553
+ * @param element The element for which [TreeItem](#TreeItem) representation is asked for.
1554
+ * @return [TreeItem](#TreeItem) representation of the element
1555
+ */
1556
+ getTreeItem(element: T): TreeItem | Thenable<TreeItem>;
1557
+
1558
+ /**
1559
+ * Get the children of `element` or root if no element is passed.
1560
+ *
1561
+ * @param element The element from which the provider gets children. Can be `undefined`.
1562
+ * @return Children of `element` or root if no element is passed.
1563
+ */
1564
+ getChildren(element?: T): ProviderResult<T[]>;
1565
+
1566
+ /**
1567
+ * Optional method to return the parent of `element`.
1568
+ * Return `null` or `undefined` if `element` is a child of root.
1569
+ *
1570
+ * **NOTE:** This method should be implemented in order to access [reveal](#TreeView.reveal) API.
1571
+ *
1572
+ * @param element The element for which the parent has to be returned.
1573
+ * @return Parent of `element`.
1574
+ */
1575
+ getParent?(element: T): ProviderResult<T>;
1576
+
1577
+ /**
1578
+ * Called on hover to resolve the {@link TreeItem.tooltip TreeItem} property if it is undefined.
1579
+ * Called on tree item click/open to resolve the {@link TreeItem.command TreeItem} property if it is undefined.
1580
+ * Only properties that were undefined can be resolved in `resolveTreeItem`.
1581
+ * Functionality may be expanded later to include being called to resolve other missing
1582
+ * properties on selection and/or on open.
1583
+ *
1584
+ * Will only ever be called once per TreeItem.
1585
+ *
1586
+ * onDidChangeTreeData should not be triggered from within resolveTreeItem.
1587
+ *
1588
+ * *Note* that this function is called when tree items are already showing in the UI.
1589
+ * Because of that, no property that changes the presentation (label, description, etc.)
1590
+ * can be changed.
1591
+ *
1592
+ * @param item Undefined properties of `item` should be set then `item` should be returned.
1593
+ * @param element The object associated with the TreeItem.
1594
+ * @param token A cancellation token.
1595
+ * @return The resolved tree item or a thenable that resolves to such. It is OK to return the given
1596
+ * `item`. When no result is returned, the given `item` will be used.
1597
+ */
1598
+ resolveTreeItem?(item: TreeItem, element: T, token: CancellationToken): ProviderResult<TreeItem>;
1599
+ }
1600
+
1601
+ export class TreeItem {
1602
+ /**
1603
+ * A human-readable string describing this item. When `falsy`, it is derived from {@link TreeItem.resourceUri resourceUri}.
1604
+ */
1605
+ label?: string | TreeItemLabel;
1606
+
1607
+ /**
1608
+ * Optional id for the tree item that has to be unique across tree. The id is used to preserve the selection and expansion state of the tree item.
1609
+ *
1610
+ * If not provided, an id is generated using the tree item's label. **Note** that when labels change, ids will change and that selection and expansion state cannot be kept stable anymore.
1611
+ */
1612
+ id?: string;
1613
+
1614
+ /**
1615
+ * The icon path or [ThemeIcon](#ThemeIcon) for the tree item.
1616
+ * When `falsy`, [Folder Theme Icon](#ThemeIcon.Folder) is assigned, if item is collapsible otherwise [File Theme Icon](#ThemeIcon.File).
1617
+ * When a [ThemeIcon](#ThemeIcon) is specified, icon is derived from the current file icon theme for the specified theme icon using [resourceUri](#TreeItem.resourceUri) (if provided).
1618
+ */
1619
+ iconPath?: string | Uri | { light: string | Uri; dark: string | Uri } | ThemeIcon;
1620
+
1621
+ /**
1622
+ * A human readable string which is rendered less prominent.
1623
+ * When `true`, it is derived from [resourceUri](#TreeItem.resourceUri) and when `falsy`, it is not shown.
1624
+ */
1625
+ description?: string | boolean;
1626
+
1627
+ /**
1628
+ * The [uri](#Uri) of the resource representing this item.
1629
+ *
1630
+ * Will be used to derive the [label](#TreeItem.label), when it is not provided.
1631
+ * Will be used to derive the icon from current icon theme, when [iconPath](#TreeItem.iconPath) has [ThemeIcon](#ThemeIcon) value.
1632
+ */
1633
+ resourceUri?: Uri;
1634
+
1635
+ /**
1636
+ * The tooltip text when you hover over this item.
1637
+ */
1638
+ tooltip?: string | undefined;
1639
+
1640
+ /**
1641
+ * The [command](#Command) that should be executed when the tree item is selected.
1642
+ */
1643
+ command?: Command;
1644
+
1645
+ /**
1646
+ * [TreeItemCollapsibleState](#TreeItemCollapsibleState) of the tree item.
1647
+ */
1648
+ collapsibleState?: TreeItemCollapsibleState;
1649
+
1650
+ /**
1651
+ * Context value of the tree item. This can be used to contribute item specific actions in the tree.
1652
+ * For example, a tree item is given a context value as `folder`. When contributing actions to `view/item/context`
1653
+ * using `menus` extension point, you can specify context value for key `viewItem` in `when` expression like `viewItem == folder`.
1654
+ * ```
1655
+ * "contributes": {
1656
+ * "menus": {
1657
+ * "view/item/context": [
1658
+ * {
1659
+ * "command": "extension.deleteFolder",
1660
+ * "when": "viewItem == folder"
1661
+ * }
1662
+ * ]
1663
+ * }
1664
+ * }
1665
+ * ```
1666
+ * This will show action `extension.deleteFolder` only for items with `contextValue` is `folder`.
1667
+ */
1668
+ contextValue?: string;
1669
+
1670
+ /**
1671
+ * Accessibility information used when screen reader interacts with this tree item.
1672
+ * Generally, a TreeItem has no need to set the `role` of the accessibilityInformation;
1673
+ * however, there are cases where a TreeItem is not displayed in a tree-like way where setting the `role` may make sense.
1674
+ */
1675
+ accessibilityInformation?: AccessibilityInformation;
1676
+
1677
+ /**
1678
+ * @param label A human-readable string describing this item
1679
+ * @param collapsibleState {@link TreeItemCollapsibleState} of the tree item. Default is {@link TreeItemCollapsibleState.None}
1680
+ */
1681
+ constructor(label: string | TreeItemLabel, collapsibleState?: TreeItemCollapsibleState);
1682
+
1683
+ /**
1684
+ * @param resourceUri The {@link Uri} of the resource representing this item.
1685
+ * @param collapsibleState {@link TreeItemCollapsibleState} of the tree item. Default is {@link TreeItemCollapsibleState.None}
1686
+ */
1687
+ constructor(resourceUri: Uri, collapsibleState?: TreeItemCollapsibleState);
1688
+ }
1689
+ /**
1690
+ * Represents a line of text, such as a line of source code.
1691
+ *
1692
+ * TextLine objects are __immutable__. When a [document](#TextDocument) changes,
1693
+ * previously retrieved lines will not represent the latest state.
1694
+ */
1695
+ export interface TextLine {
1696
+
1697
+ /**
1698
+ * The zero-based line number.
1699
+ */
1700
+ readonly lineNumber: number;
1701
+
1702
+ /**
1703
+ * The text of this line without the line separator characters.
1704
+ */
1705
+ readonly text: string;
1706
+
1707
+ /**
1708
+ * The range this line covers without the line separator characters.
1709
+ */
1710
+ readonly range: Range;
1711
+
1712
+ /**
1713
+ * The range this line covers with the line separator characters.
1714
+ */
1715
+ readonly rangeIncludingLineBreak: Range;
1716
+
1717
+ /**
1718
+ * The offset of the first character which is not a whitespace character as defined
1719
+ * by `/\s/`. **Note** that if a line is all whitespace the length of the line is returned.
1720
+ */
1721
+ readonly firstNonWhitespaceCharacterIndex: number;
1722
+
1723
+ /**
1724
+ * Whether this line is whitespace only, shorthand
1725
+ * for [TextLine.firstNonWhitespaceCharacterIndex](#TextLine.firstNonWhitespaceCharacterIndex) === [TextLine.text.length](#TextLine.text).
1726
+ */
1727
+ readonly isEmptyOrWhitespace: boolean;
1728
+ }
1729
+ /**
1730
+ * Represents a text document, such as a source file. Text documents have
1731
+ * [lines](#TextLine) and knowledge about an underlying resource like a file.
1732
+ */
1733
+ export interface TextDocument {
1734
+
1735
+ /**
1736
+ * The associated uri for this document.
1737
+ *
1738
+ * *Note* that most documents use the `file`-scheme, which means they are files on disk. However, **not** all documents are
1739
+ * saved on disk and therefore the `scheme` must be checked before trying to access the underlying file or siblings on disk.
1740
+ *
1741
+ * @see [FileSystemProvider](#FileSystemProvider)
1742
+ * @see [TextDocumentContentProvider](#TextDocumentContentProvider)
1743
+ */
1744
+ readonly uri: Uri;
1745
+
1746
+ /**
1747
+ * The file system path of the associated resource. Shorthand
1748
+ * notation for [TextDocument.uri.fsPath](#TextDocument.uri). Independent of the uri scheme.
1749
+ */
1750
+ readonly fileName: string;
1751
+
1752
+ /**
1753
+ * Is this document representing an untitled file which has never been saved yet. *Note* that
1754
+ * this does not mean the document will be saved to disk, use [`uri.scheme`](#Uri.scheme)
1755
+ * to figure out where a document will be [saved](#FileSystemProvider), e.g. `file`, `ftp` etc.
1756
+ */
1757
+ readonly isUntitled: boolean;
1758
+
1759
+ /**
1760
+ * The identifier of the language associated with this document.
1761
+ */
1762
+ readonly languageId: string;
1763
+
1764
+ /**
1765
+ * The version number of this document (it will strictly increase after each
1766
+ * change, including undo/redo).
1767
+ */
1768
+ readonly version: number;
1769
+
1770
+ /**
1771
+ * `true` if there are unpersisted changes.
1772
+ */
1773
+ readonly isDirty: boolean;
1774
+
1775
+ /**
1776
+ * `true` if the document have been closed. A closed document isn't synchronized anymore
1777
+ * and won't be re-used when the same resource is opened again.
1778
+ */
1779
+ readonly isClosed: boolean;
1780
+
1781
+ /**
1782
+ * Save the underlying file.
1783
+ *
1784
+ * @return A promise that will resolve to true when the file
1785
+ * has been saved. If the file was not dirty or the save failed,
1786
+ * will return false.
1787
+ */
1788
+ save(): Thenable<boolean>;
1789
+
1790
+ /**
1791
+ * The [end of line](#EndOfLine) sequence that is predominately
1792
+ * used in this document.
1793
+ */
1794
+ readonly eol: EndOfLine;
1795
+
1796
+ /**
1797
+ * The number of lines in this document.
1798
+ */
1799
+ readonly lineCount: number;
1800
+
1801
+ /**
1802
+ * Returns a text line denoted by the line number. Note
1803
+ * that the returned object is *not* live and changes to the
1804
+ * document are not reflected.
1805
+ *
1806
+ * @param line A line number in [0, lineCount).
1807
+ * @return A [line](#TextLine).
1808
+ */
1809
+ /* tslint:disable-next-line */
1810
+ lineAt(line: number): TextLine;
1811
+
1812
+ /**
1813
+ * Returns a text line denoted by the position. Note
1814
+ * that the returned object is *not* live and changes to the
1815
+ * document are not reflected.
1816
+ *
1817
+ * The position will be [adjusted](#TextDocument.validatePosition).
1818
+ *
1819
+ * @see [TextDocument.lineAt](#TextDocument.lineAt)
1820
+ * @param position A position.
1821
+ * @return A [line](#TextLine).
1822
+ */
1823
+ /* tslint:disable-next-line */
1824
+ lineAt(position: Position): TextLine;
1825
+
1826
+ /**
1827
+ * Converts the position to a zero-based offset.
1828
+ *
1829
+ * The position will be [adjusted](#TextDocument.validatePosition).
1830
+ *
1831
+ * @param position A position.
1832
+ * @return A valid zero-based offset.
1833
+ */
1834
+ offsetAt(position: Position): number;
1835
+
1836
+ /**
1837
+ * Converts a zero-based offset to a position.
1838
+ *
1839
+ * @param offset A zero-based offset.
1840
+ * @return A valid [position](#Position).
1841
+ */
1842
+ positionAt(offset: number): Position;
1843
+
1844
+ /**
1845
+ * Get the text of this document. A substring can be retrieved by providing
1846
+ * a range. The range will be [adjusted](#TextDocument.validateRange).
1847
+ *
1848
+ * @param range Include only the text included by the range.
1849
+ * @return The text inside the provided range or the entire text.
1850
+ */
1851
+ getText(range?: Range): string;
1852
+
1853
+ /**
1854
+ * Get a word-range at the given position. By default words are defined by
1855
+ * common separators, like space, -, _, etc. In addition, per language custom
1856
+ * [word definitions](#LanguageConfiguration.wordPattern) can be defined. It
1857
+ * is also possible to provide a custom regular expression.
1858
+ *
1859
+ * * *Note 1:* A custom regular expression must not match the empty string and
1860
+ * if it does, it will be ignored.
1861
+ * * *Note 2:* A custom regular expression will fail to match multiline strings
1862
+ * and in the name of speed regular expressions should not match words with
1863
+ * spaces. Use [`TextLine.text`](#TextLine.text) for more complex, non-wordy, scenarios.
1864
+ *
1865
+ * The position will be [adjusted](#TextDocument.validatePosition).
1866
+ *
1867
+ * @param position A position.
1868
+ * @param regex Optional regular expression that describes what a word is.
1869
+ * @return A range spanning a word, or `undefined`.
1870
+ */
1871
+ getWordRangeAtPosition(position: Position, regex?: RegExp): Range | undefined;
1872
+
1873
+ /**
1874
+ * Ensure a range is completely contained in this document.
1875
+ *
1876
+ * @param range A range.
1877
+ * @return The given range or a new, adjusted range.
1878
+ */
1879
+ validateRange(range: Range): Range;
1880
+
1881
+ /**
1882
+ * Ensure a position is contained in the range of this document.
1883
+ *
1884
+ * @param position A position.
1885
+ * @return The given position or a new, adjusted position.
1886
+ */
1887
+ validatePosition(position: Position): Position;
1888
+ }
1889
+
1890
+ /**
1891
+ * Represents a text selection in an editor.
1892
+ */
1893
+ export class Selection extends Range {
1894
+
1895
+ /**
1896
+ * The position at which the selection starts.
1897
+ * This position might be before or after [active](#Selection.active).
1898
+ */
1899
+ anchor: Position;
1900
+
1901
+ /**
1902
+ * The position of the cursor.
1903
+ * This position might be before or after [anchor](#Selection.anchor).
1904
+ */
1905
+ active: Position;
1906
+
1907
+ /**
1908
+ * Create a selection from two positions.
1909
+ *
1910
+ * @param anchor A position.
1911
+ * @param active A position.
1912
+ */
1913
+ constructor(anchor: Position, active: Position);
1914
+
1915
+ /**
1916
+ * Create a selection from four coordinates.
1917
+ *
1918
+ * @param anchorLine A zero-based line value.
1919
+ * @param anchorCharacter A zero-based character value.
1920
+ * @param activeLine A zero-based line value.
1921
+ * @param activeCharacter A zero-based character value.
1922
+ */
1923
+ constructor(anchorLine: number, anchorCharacter: number, activeLine: number, activeCharacter: number);
1924
+
1925
+ /**
1926
+ * A selection is reversed if [active](#Selection.active).isBefore([anchor](#Selection.anchor)).
1927
+ */
1928
+ isReversed: boolean;
1929
+ }
1930
+
1931
+ /**
1932
+ * A complex edit that will be applied in one transaction on a TextEditor.
1933
+ * This holds a description of the edits and if the edits are valid (i.e. no overlapping regions, document was not changed in the meantime, etc.)
1934
+ * they can be applied on a [document](#TextDocument) associated with a [text editor](#TextEditor).
1935
+ *
1936
+ */
1937
+
1938
+ /**
1939
+ * A universal resource identifier representing either a file on disk
1940
+ * or another resource, like untitled resources.
1941
+ */
1942
+ export class Uri {
1943
+
1944
+ /**
1945
+ * Create an URI from a string, e.g. `http://www.msft.com/some/path`,
1946
+ * `file:///usr/home`, or `scheme:with/path`.
1947
+ *
1948
+ * *Note* that for a while uris without a `scheme` were accepted. That is not correct
1949
+ * as all uris should have a scheme. To avoid breakage of existing code the optional
1950
+ * `strict`-argument has been added. We *strongly* advise to use it, e.g. `Uri.parse('my:uri', true)`
1951
+ *
1952
+ * @see [Uri.toString](#Uri.toString)
1953
+ * @param value The string value of an Uri.
1954
+ * @param strict Throw an error when `value` is empty or when no `scheme` can be parsed.
1955
+ * @return A new Uri instance.
1956
+ */
1957
+ static parse(value: string, strict?: boolean): Uri;
1958
+
1959
+ /**
1960
+ * Create an URI from a file system path. The [scheme](#Uri.scheme)
1961
+ * will be `file`.
1962
+ *
1963
+ * The *difference* between `Uri#parse` and `Uri#file` is that the latter treats the argument
1964
+ * as path, not as stringified-uri. E.g. `Uri.file(path)` is *not* the same as
1965
+ * `Uri.parse('file://' + path)` because the path might contain characters that are
1966
+ * interpreted (# and ?). See the following sample:
1967
+ * ```ts
1968
+ const good = URI.file('/coding/c#/project1');
1969
+ good.scheme === 'file';
1970
+ good.path === '/coding/c#/project1';
1971
+ good.fragment === '';
1972
+
1973
+ const bad = URI.parse('file://' + '/coding/c#/project1');
1974
+ bad.scheme === 'file';
1975
+ bad.path === '/coding/c'; // path is now broken
1976
+ bad.fragment === '/project1';
1977
+ ```
1978
+ *
1979
+ * @param path A file system or UNC path.
1980
+ * @return A new Uri instance.
1981
+ */
1982
+ static file(path: string): Uri;
1983
+
1984
+ /**
1985
+ * Create a new uri which path is the result of joining
1986
+ * the path of the base uri with the provided path segments.
1987
+ *
1988
+ * - Note 1: `joinPath` only affects the path component
1989
+ * and all other components (scheme, authority, query, and fragment) are
1990
+ * left as they are.
1991
+ * - Note 2: The base uri must have a path; an error is thrown otherwise.
1992
+ *
1993
+ * The path segments are normalized in the following ways:
1994
+ * - sequences of path separators (`/` or `\`) are replaced with a single separator
1995
+ * - for `file`-uris on windows, the backslash-character (`\`) is considered a path-separator
1996
+ * - the `..`-segment denotes the parent segment, the `.` denotes the current segment
1997
+ * - paths have a root which always remains, for instance on windows drive-letters are roots
1998
+ * so that is true: `joinPath(Uri.file('file:///c:/root'), '../../other').fsPath === 'c:/other'`
1999
+ *
2000
+ * @param base An uri. Must have a path.
2001
+ * @param pathSegments One more more path fragments
2002
+ * @returns A new uri which path is joined with the given fragments
2003
+ */
2004
+ static joinPath(base: Uri, ...pathSegments: string[]): Uri;
2005
+
2006
+ /**
2007
+ * Use the `file` and `parse` factory functions to create new `Uri` objects.
2008
+ */
2009
+ private constructor(scheme: string, authority: string, path: string, query: string, fragment: string);
2010
+
2011
+ /**
2012
+ * Scheme is the `http` part of `http://www.msft.com/some/path?query#fragment`.
2013
+ * The part before the first colon.
2014
+ */
2015
+ readonly scheme: string;
2016
+
2017
+ /**
2018
+ * Authority is the `www.msft.com` part of `http://www.msft.com/some/path?query#fragment`.
2019
+ * The part between the first double slashes and the next slash.
2020
+ */
2021
+ readonly authority: string;
2022
+
2023
+ /**
2024
+ * Path is the `/some/path` part of `http://www.msft.com/some/path?query#fragment`.
2025
+ */
2026
+ readonly path: string;
2027
+
2028
+ /**
2029
+ * Query is the `query` part of `http://www.msft.com/some/path?query#fragment`.
2030
+ */
2031
+ readonly query: string;
2032
+
2033
+ /**
2034
+ * Fragment is the `fragment` part of `http://www.msft.com/some/path?query#fragment`.
2035
+ */
2036
+ readonly fragment: string;
2037
+
2038
+ /**
2039
+ * The string representing the corresponding file system path of this Uri.
2040
+ *
2041
+ * Will handle UNC paths and normalize windows drive letters to lower-case. Also
2042
+ * uses the platform specific path separator.
2043
+ *
2044
+ * * Will *not* validate the path for invalid characters and semantics.
2045
+ * * Will *not* look at the scheme of this Uri.
2046
+ * * The resulting string shall *not* be used for display purposes but
2047
+ * for disk operations, like `readFile` et al.
2048
+ *
2049
+ * The *difference* to the [`path`](#Uri.path)-property is the use of the platform specific
2050
+ * path separator and the handling of UNC paths. The sample below outlines the difference:
2051
+ * ```ts
2052
+ const u = URI.parse('file://server/c$/folder/file.txt')
2053
+ u.authority === 'server'
2054
+ u.path === '/shares/c$/file.txt'
2055
+ u.fsPath === '\\server\c$\folder\file.txt'
2056
+ ```
2057
+ */
2058
+ readonly fsPath: string;
2059
+
2060
+ /**
2061
+ * Derive a new Uri from this Uri.
2062
+ *
2063
+ * ```ts
2064
+ * let file = Uri.parse('before:some/file/path');
2065
+ * let other = file.with({ scheme: 'after' });
2066
+ * assert.ok(other.toString() === 'after:some/file/path');
2067
+ * ```
2068
+ *
2069
+ * @param change An object that describes a change to this Uri. To unset components use `null` or
2070
+ * the empty string.
2071
+ * @return A new Uri that reflects the given change. Will return `this` Uri if the change
2072
+ * is not changing anything.
2073
+ */
2074
+ with(change: { scheme?: string; authority?: string; path?: string; query?: string; fragment?: string }): Uri;
2075
+
2076
+ /**
2077
+ * Returns a string representation of this Uri. The representation and normalization
2078
+ * of a URI depends on the scheme.
2079
+ *
2080
+ * * The resulting string can be safely used with [Uri.parse](#Uri.parse).
2081
+ * * The resulting string shall *not* be used for display purposes.
2082
+ *
2083
+ * *Note* that the implementation will encode _aggressive_ which often leads to unexpected,
2084
+ * but not incorrect, results. For instance, colons are encoded to `%3A` which might be unexpected
2085
+ * in file-uri. Also `&` and `=` will be encoded which might be unexpected for http-uris. For stability
2086
+ * reasons this cannot be changed anymore. If you suffer from too aggressive encoding you should use
2087
+ * the `skipEncoding`-argument: `uri.toString(true)`.
2088
+ *
2089
+ * @param skipEncoding Do not percentage-encode the result, defaults to `false`. Note that
2090
+ * the `#` and `?` characters occurring in the path will always be encoded.
2091
+ * @returns A string representation of this Uri.
2092
+ */
2093
+ toString(skipEncoding?: boolean): string;
2094
+
2095
+ /**
2096
+ * Returns a JSON representation of this Uri.
2097
+ *
2098
+ * @return An object.
2099
+ */
2100
+ toJSON(): any;
2101
+
2102
+ }
2103
+
2104
+ /**
2105
+ * Represents a typed event.
2106
+ *
2107
+ * A function that represents an event to which you subscribe by calling it with
2108
+ * a listener function as argument.
2109
+ *
2110
+ * @sample `item.onDidChange(function(event) { console.log("Event happened: " + event); });`
2111
+ */
2112
+ export interface Event<T> {
2113
+
2114
+ /**
2115
+ * A function that represents an event to which you subscribe by calling it with
2116
+ * a listener function as argument.
2117
+ *
2118
+ * @param listener The listener function will be called when the event happens.
2119
+ * @param thisArgs The `this`-argument which will be used when calling the event listener.
2120
+ * @param disposables An array to which a [disposable](#Disposable) will be added.
2121
+ * @return A disposable which unsubscribes the event listener.
2122
+ */
2123
+ /* tslint:disable-next-line */
2124
+ (listener: (e: T) => any, thisArgs?: any, disposables?: Disposable[]): Disposable;
2125
+ }
2126
+
2127
+ /**
2128
+ * An event emitter can be used to create and manage an [event](#Event) for others
2129
+ * to subscribe to. One emitter always owns one event.
2130
+ *
2131
+ * Use this class if you want to provide event from within your extension, for instance
2132
+ * inside a [TextDocumentContentProvider](#TextDocumentContentProvider) or when providing
2133
+ * API to other extensions.
2134
+ */
2135
+ export class EventEmitter<T> {
2136
+
2137
+ /**
2138
+ * The event listeners can subscribe to.
2139
+ */
2140
+ event: Event<T>;
2141
+
2142
+ /**
2143
+ * Notify all subscribers of the [event](#EventEmitter.event). Failure
2144
+ * of one or more listener will not fail this function call.
2145
+ *
2146
+ * @param data The event object.
2147
+ */
2148
+ fire(data?: T): void;
2149
+
2150
+ /**
2151
+ * Dispose this object and free resources.
2152
+ */
2153
+ dispose(): void;
2154
+ }
2155
+
2156
+ /**
2157
+ * A cancellation token is passed to an asynchronous or long running
2158
+ * operation to request cancellation, like cancelling a request
2159
+ * for completion items because the user continued to type.
2160
+ *
2161
+ * To get an instance of a `CancellationToken` use a
2162
+ * [CancellationTokenSource](#CancellationTokenSource).
2163
+ */
2164
+ export interface CancellationToken {
2165
+
2166
+ /**
2167
+ * Is `true` when the token has been cancelled, `false` otherwise.
2168
+ */
2169
+ isCancellationRequested: boolean;
2170
+
2171
+ /**
2172
+ * An [event](#Event) which fires upon cancellation.
2173
+ */
2174
+ onCancellationRequested: Event<any>;
2175
+ }
2176
+
2177
+ /**
2178
+ * A cancellation source creates and controls a [cancellation token](#CancellationToken).
2179
+ * @墨蛰
2180
+ *
2181
+ */
2182
+ export class CancellationTokenSource {
2183
+
2184
+ /**
2185
+ * The cancellation token of this source.
2186
+ */
2187
+ token: CancellationToken;
2188
+
2189
+ /**
2190
+ * Signal cancellation on the token.
2191
+ */
2192
+ cancel(): void;
2193
+
2194
+ /**
2195
+ * Dispose object and free resources.
2196
+ */
2197
+ dispose(): void;
2198
+ }
2199
+
2200
+ /**
2201
+ * An event describing a transactional [document](#TextDocument) change.
2202
+ */
2203
+ export interface TextDocumentChangeEvent {
2204
+
2205
+ /**
2206
+ * The affected document.
2207
+ */
2208
+ readonly document: TextDocument;
2209
+
2210
+ /**
2211
+ * An array of content changes.
2212
+ */
2213
+ readonly contentChanges: ReadonlyArray<TextDocumentContentChangeEvent>;
2214
+ }
2215
+
2216
+ /**
2217
+ * Represents a related message and source code location for a diagnostic. This should be
2218
+ * used to point to code locations that cause or related to a diagnostics, e.g. when duplicating
2219
+ * a symbol in a scope.
2220
+ * @寻壑
2221
+ */
2222
+ export class DiagnosticRelatedInformation {
2223
+
2224
+ /**
2225
+ * The location of this related diagnostic information.
2226
+ */
2227
+ location: Location;
2228
+
2229
+ /**
2230
+ * The message of this related diagnostic information.
2231
+ */
2232
+ message: string;
2233
+
2234
+ /**
2235
+ * Creates a new related diagnostic information object.
2236
+ *
2237
+ * @param location The location.
2238
+ * @param message The message.
2239
+ */
2240
+ constructor(location: Location, message: string);
2241
+ }
2242
+
2243
+ /**
2244
+ * Additional metadata about the type of a diagnostic.
2245
+ */
2246
+ export enum DiagnosticTag {
2247
+ /**
2248
+ * Unused or unnecessary code.
2249
+ *
2250
+ * Diagnostics with this tag are rendered faded out. The amount of fading
2251
+ * is controlled by the `"editorUnnecessaryCode.opacity"` theme color. For
2252
+ * example, `"editorUnnecessaryCode.opacity": "#000000c0"` will render the
2253
+ * code with 75% opacity. For high contrast themes, use the
2254
+ * `"editorUnnecessaryCode.border"` theme color to underline unnecessary code
2255
+ * instead of fading it out.
2256
+ */
2257
+ Unnecessary = 1,
2258
+ Deprecated = 2,
2259
+ }
2260
+
2261
+ /**
2262
+ * Represents the severity of diagnostics.
2263
+ */
2264
+ export enum DiagnosticSeverity {
2265
+
2266
+ /**
2267
+ * Something not allowed by the rules of a language or other means.
2268
+ */
2269
+ Error = 0,
2270
+
2271
+ /**
2272
+ * Something suspicious but allowed.
2273
+ */
2274
+ Warning = 1,
2275
+
2276
+ /**
2277
+ * Something to inform about but not a problem.
2278
+ */
2279
+ Information = 2,
2280
+
2281
+ /**
2282
+ * Something to hint to a better way of doing it, like proposing
2283
+ * a refactoring.
2284
+ */
2285
+ Hint = 3,
2286
+ }
2287
+
2288
+ /**
2289
+ * Represents a diagnostic, such as a compiler error or warning. Diagnostic objects
2290
+ * are only valid in the scope of a file.
2291
+ * @寻壑
2292
+ */
2293
+ export class Diagnostic {
2294
+
2295
+ /**
2296
+ * The range to which this diagnostic applies.
2297
+ */
2298
+ range: Range;
2299
+
2300
+ /**
2301
+ * The human-readable message.
2302
+ */
2303
+ message: string;
2304
+
2305
+ /**
2306
+ * The severity, default is [error](#DiagnosticSeverity.Error).
2307
+ */
2308
+ severity: DiagnosticSeverity;
2309
+
2310
+ /**
2311
+ * A human-readable string describing the source of this
2312
+ * diagnostic, e.g. 'typescript' or 'super lint'.
2313
+ */
2314
+ source?: string;
2315
+
2316
+ /**
2317
+ * A code or identifier for this diagnostic.
2318
+ * Should be used for later processing, e.g. when providing [code actions](#CodeActionContext).
2319
+ */
2320
+ code?: string | number;
2321
+
2322
+ /**
2323
+ * An array of related diagnostic information, e.g. when symbol-names within
2324
+ * a scope collide all definitions can be marked via this property.
2325
+ */
2326
+ relatedInformation?: DiagnosticRelatedInformation[];
2327
+
2328
+ /**
2329
+ * Additional metadata about the diagnostic.
2330
+ */
2331
+ tags?: DiagnosticTag[];
2332
+
2333
+ /**
2334
+ * Creates a new diagnostic object.
2335
+ *
2336
+ * @param range The range to which this diagnostic applies.
2337
+ * @param message The human-readable message.
2338
+ * @param severity The severity, default is [error](#DiagnosticSeverity.Error).
2339
+ */
2340
+ constructor(range: Range, message: string, severity?: DiagnosticSeverity);
2341
+ }
2342
+ /**
2343
+ * An error type that should be used to signal cancellation of an operation.
2344
+ *
2345
+ * This type can be used in response to a [cancellation token](#CancellationToken)
2346
+ * being cancelled or when an operation is being cancelled by the
2347
+ * executor of that operation.
2348
+ */
2349
+ export class CancellationError extends Error {
2350
+
2351
+ /**
2352
+ * Creates a new cancellation error.
2353
+ */
2354
+ constructor();
2355
+ }
2356
+ /**
2357
+ * Represents a type which can release resources, such
2358
+ * as event listening or a timer.
2359
+ */
2360
+ export class Disposable {
2361
+
2362
+ /**
2363
+ * Combine many disposable-likes into one. Use this method
2364
+ * when having objects with a dispose function which are not
2365
+ * instances of Disposable.
2366
+ *
2367
+ * @param disposableLikes Objects that have at least a `dispose`-function member.
2368
+ * @return Returns a new disposable which, upon dispose, will
2369
+ * dispose all provided disposables.
2370
+ */
2371
+ static from(...disposableLikes: { dispose: () => any }[]): Disposable;
2372
+
2373
+ /**
2374
+ * Creates a new Disposable calling the provided function
2375
+ * on dispose.
2376
+ * @param callOnDispose Function that disposes something.
2377
+ */
2378
+ constructor(callOnDispose: () => void);
2379
+
2380
+ /**
2381
+ * Dispose this object.
2382
+ */
2383
+ dispose(): any;
2384
+ }
2385
+
2386
+ /**
2387
+ * Represents an extension.
2388
+ *
2389
+ * To get an instance of an `Extension` use [getExtension](#extensions.getExtension).
2390
+ */
2391
+ export interface Extension<T> {
2392
+
2393
+ /**
2394
+ * The canonical extension identifier in the form of: `publisher.name`.
2395
+ */
2396
+ readonly id: string;
2397
+
2398
+ /**
2399
+ * The uri of the directory containing the extension.
2400
+ */
2401
+ readonly extensionUri: Uri;
2402
+
2403
+ /**
2404
+ * The absolute file path of the directory containing this extension.
2405
+ */
2406
+ readonly extensionPath: string;
2407
+
2408
+ /**
2409
+ * `true` if the extension has been activated.
2410
+ */
2411
+ readonly isActive: boolean;
2412
+
2413
+ /**
2414
+ * The parsed contents of the extension's package.json.
2415
+ */
2416
+ readonly packageJSON: any;
2417
+
2418
+ /**
2419
+ * The extension kind describes if an extension runs where the UI runs
2420
+ * or if an extension runs where the remote extension host runs. The extension kind
2421
+ * if defined in the `package.json` file of extensions but can also be refined
2422
+ * via the the `remote.extensionKind`-setting. When no remote extension host exists,
2423
+ * the value is [`ExtensionKind.UI`](#ExtensionKind.UI).
2424
+ */
2425
+ extensionKind: ExtensionKind;
2426
+
2427
+ /**
2428
+ * The public API exported by this extension. It is an invalid action
2429
+ * to access this field before this extension has been activated.
2430
+ */
2431
+ readonly exports: T;
2432
+
2433
+ /**
2434
+ * Activates this extension and returns its public API.
2435
+ *
2436
+ * @return A promise that will resolve when this extension has been activated.
2437
+ */
2438
+ activate(): Thenable<T>;
2439
+ }
2440
+
2441
+ /**
2442
+ * A memento represents a storage utility. It can store and retrieve
2443
+ * values.
2444
+ */
2445
+ export interface Memento {
2446
+
2447
+ /**
2448
+ * Return a value.
2449
+ *
2450
+ * @param key A string.
2451
+ * @return The stored value or `undefined`.
2452
+ */
2453
+ get<T>(key: string): T | undefined;
2454
+
2455
+ /**
2456
+ * Return a value.
2457
+ *
2458
+ * @param key A string.
2459
+ * @param defaultValue A value that should be returned when there is no
2460
+ * value (`undefined`) with the given key.
2461
+ * @return The stored value or the defaultValue.
2462
+ */
2463
+ get<T>(key: string, defaultValue: T): T;
2464
+
2465
+ /**
2466
+ * Store a value. The value must be JSON-stringifyable.
2467
+ *
2468
+ * @param key A string.
2469
+ * @param value A value. MUST not contain cyclic references.
2470
+ */
2471
+ update(key: string, value: any): Thenable<void>;
2472
+ }
2473
+
2474
+ /**
2475
+ * The event data that is fired when a secret is added or removed.
2476
+ */
2477
+ export interface SecretStorageChangeEvent {
2478
+ /**
2479
+ * The key of the secret that has changed.
2480
+ */
2481
+ readonly key: string;
2482
+ }
2483
+
2484
+ /**
2485
+ * Represents a storage utility for secrets, information that is
2486
+ * sensitive.
2487
+ */
2488
+ export interface SecretStorage {
2489
+ /**
2490
+ * Retrieve a secret that was stored with key. Returns undefined if there
2491
+ * is no password matching that key.
2492
+ * @param key The key the secret was stored under.
2493
+ * @returns The stored value or `undefined`.
2494
+ */
2495
+ get(key: string): Thenable<string | undefined>;
2496
+
2497
+ /**
2498
+ * Store a secret under a given key.
2499
+ * @param key The key to store the secret under.
2500
+ * @param value The secret.
2501
+ */
2502
+ store(key: string, value: string): Thenable<void>;
2503
+
2504
+ /**
2505
+ * Remove a secret from storage.
2506
+ * @param key The key the secret was stored under.
2507
+ */
2508
+ delete(key: string): Thenable<void>;
2509
+
2510
+ /**
2511
+ * Fires when a secret is stored or deleted.
2512
+ */
2513
+ onDidChange: Event<SecretStorageChangeEvent>;
2514
+ }
2515
+
2516
+ /**
2517
+ * Represents how a terminal exited.
2518
+ */
2519
+ export interface TerminalExitStatus {
2520
+ /**
2521
+ * The exit code that a terminal exited with, it can have the following values:
2522
+ * - Zero: the terminal process or custom execution succeeded.
2523
+ * - Non-zero: the terminal process or custom execution failed.
2524
+ * - `undefined`: the user forcibly closed the terminal or a custom execution exited
2525
+ * without providing an exit code.
2526
+ */
2527
+ readonly code: number | undefined;
2528
+ }
2529
+
2530
+ export interface Terminal {
2531
+
2532
+ /**
2533
+ * The name of the terminal.
2534
+ */
2535
+ readonly name: string;
2536
+
2537
+ /**
2538
+ * The process ID of the shell process.
2539
+ */
2540
+ readonly processId: Thenable<number>;
2541
+
2542
+ /**
2543
+ * The object used to initialize the terminal, this is useful for example to detecting the
2544
+ * shell type of when the terminal was not launched by this extension or for detecting what
2545
+ * folder the shell was launched in.
2546
+ */
2547
+ readonly creationOptions: Readonly<TerminalOptions | ExtensionTerminalOptions>;
2548
+ /**
2549
+ * The exit status of the terminal, this will be undefined while the terminal is active.
2550
+ *
2551
+ * **Example:** Show a notification with the exit code when the terminal exits with a
2552
+ * non-zero exit code.
2553
+ * ```typescript
2554
+ * window.onDidCloseTerminal(t => {
2555
+ * if (t.exitStatus && t.exitStatus.code) {
2556
+ * vscode.window.showInformationMessage(`Exit code: ${t.exitStatus.code}`);
2557
+ * }
2558
+ * });
2559
+ * ```
2560
+ */
2561
+ readonly exitStatus: TerminalExitStatus | undefined;
2562
+
2563
+ /**
2564
+ * Send text to the terminal. The text is written to the stdin of the underlying pty process
2565
+ * (shell) of the terminal.
2566
+ *
2567
+ * @param text The text to send.
2568
+ * @param addNewLine Whether to add a new line to the text being sent, this is normally
2569
+ * required to run a command in the terminal. The character(s) added are \n or \r\n
2570
+ * depending on the platform. This defaults to `true`.
2571
+ */
2572
+ sendText(text: string, addNewLine?: boolean): void;
2573
+
2574
+ /**
2575
+ * Show the terminal panel and reveal this terminal in the UI.
2576
+ *
2577
+ * @param preserveFocus When `true` the terminal will not take focus.
2578
+ */
2579
+ show(preserveFocus?: boolean): void;
2580
+
2581
+ /**
2582
+ * Hide the terminal panel if this terminal is currently showing.
2583
+ */
2584
+ hide(): void;
2585
+
2586
+ /**
2587
+ * Dispose and free associated resources.
2588
+ */
2589
+ dispose(): void;
2590
+ }
2591
+
2592
+ //#region EnvironmentVariable
2593
+
2594
+ /**
2595
+ * A type of mutation that can be applied to an environment variable.
2596
+ */
2597
+ export enum EnvironmentVariableMutatorType {
2598
+ /**
2599
+ * Replace the variable's existing value.
2600
+ */
2601
+ Replace = 1,
2602
+ /**
2603
+ * Append to the end of the variable's existing value.
2604
+ */
2605
+ Append = 2,
2606
+ /**
2607
+ * Prepend to the start of the variable's existing value.
2608
+ */
2609
+ Prepend = 3,
2610
+ }
2611
+
2612
+ /**
2613
+ * A type of mutation and its value to be applied to an environment variable.
2614
+ */
2615
+ export interface EnvironmentVariableMutator {
2616
+ /**
2617
+ * The type of mutation that will occur to the variable.
2618
+ */
2619
+ readonly type: EnvironmentVariableMutatorType;
2620
+
2621
+ /**
2622
+ * The value to use for the variable.
2623
+ */
2624
+ readonly value: string;
2625
+ }
2626
+
2627
+ /**
2628
+ * A collection of mutations that an extension can apply to a process environment.
2629
+ */
2630
+ export interface EnvironmentVariableCollection {
2631
+ /**
2632
+ * Whether the collection should be cached for the workspace and applied to the terminal
2633
+ * across window reloads. When true the collection will be active immediately such when the
2634
+ * window reloads. Additionally, this API will return the cached version if it exists. The
2635
+ * collection will be invalidated when the extension is uninstalled or when the collection
2636
+ * is cleared. Defaults to true.
2637
+ */
2638
+ persistent: boolean;
2639
+
2640
+ /**
2641
+ * Replace an environment variable with a value.
2642
+ *
2643
+ * Note that an extension can only make a single change to any one variable, so this will
2644
+ * overwrite any previous calls to replace, append or prepend.
2645
+ *
2646
+ * @param variable The variable to replace.
2647
+ * @param value The value to replace the variable with.
2648
+ */
2649
+ replace(variable: string, value: string): void;
2650
+
2651
+ /**
2652
+ * Append a value to an environment variable.
2653
+ *
2654
+ * Note that an extension can only make a single change to any one variable, so this will
2655
+ * overwrite any previous calls to replace, append or prepend.
2656
+ *
2657
+ * @param variable The variable to append to.
2658
+ * @param value The value to append to the variable.
2659
+ */
2660
+ append(variable: string, value: string): void;
2661
+
2662
+ /**
2663
+ * Prepend a value to an environment variable.
2664
+ *
2665
+ * Note that an extension can only make a single change to any one variable, so this will
2666
+ * overwrite any previous calls to replace, append or prepend.
2667
+ *
2668
+ * @param variable The variable to prepend.
2669
+ * @param value The value to prepend to the variable.
2670
+ */
2671
+ prepend(variable: string, value: string): void;
2672
+
2673
+ /**
2674
+ * Gets the mutator that this collection applies to a variable, if any.
2675
+ *
2676
+ * @param variable The variable to get the mutator for.
2677
+ */
2678
+ get(variable: string): EnvironmentVariableMutator | undefined;
2679
+
2680
+ /**
2681
+ * Iterate over each mutator in this collection.
2682
+ *
2683
+ * @param callback Function to execute for each entry.
2684
+ * @param thisArg The `this` context used when invoking the handler function.
2685
+ */
2686
+ forEach(callback: (variable: string, mutator: EnvironmentVariableMutator, collection: EnvironmentVariableCollection) => any, thisArg?: any): void;
2687
+
2688
+ /**
2689
+ * Deletes this collection's mutator for a variable.
2690
+ *
2691
+ * @param variable The variable to delete the mutator for.
2692
+ */
2693
+ delete(variable: string): void;
2694
+
2695
+ /**
2696
+ * Clears all mutators from this collection.
2697
+ */
2698
+ clear(): void;
2699
+ }
2700
+
2701
+ //#endregion
2702
+
2703
+ /**
2704
+ * An extension context is a collection of utilities private to an
2705
+ * extension.
2706
+ *
2707
+ * An instance of an `ExtensionContext` is provided as the first
2708
+ * parameter to the `activate`-call of an extension.
2709
+ */
2710
+ export interface ExtensionContext {
2711
+
2712
+ /**
2713
+ * An array to which disposables can be added. When this
2714
+ * extension is deactivated the disposables will be disposed.
2715
+ */
2716
+ readonly subscriptions: { dispose(): any }[];
2717
+
2718
+ /**
2719
+ * A memento object that stores state in the context
2720
+ * of the currently opened [workspace](#workspace.workspaceFolders).
2721
+ */
2722
+ readonly workspaceState: Memento;
2723
+
2724
+ /**
2725
+ * A memento object that stores state independent
2726
+ * of the current opened [workspace](#workspace.workspaceFolders).
2727
+ */
2728
+ readonly globalState: Memento & {
2729
+ /**
2730
+ * Set the keys whose values should be synchronized across devices when synchronizing user-data
2731
+ * like configuration, extensions, and mementos.
2732
+ *
2733
+ * Note that this function defines the whole set of keys whose values are synchronized:
2734
+ * - calling it with an empty array stops synchronization for this memento
2735
+ * - calling it with a non-empty array replaces all keys whose values are synchronized
2736
+ *
2737
+ * For any given set of keys this function needs to be called only once but there is no harm in
2738
+ * repeatedly calling it.
2739
+ *
2740
+ * @param keys The set of keys whose values are synced.
2741
+ */
2742
+ setKeysForSync(keys: string[]): void;
2743
+ };
2744
+
2745
+ /**
2746
+ * The absolute file path of the directory containing the extension.
2747
+ */
2748
+ readonly extensionPath: string;
2749
+
2750
+ /**
2751
+ * A storage utility for secrets. Secrets are persisted across reloads and are independent of the
2752
+ * current opened {@link workspace.workspaceFolders workspace}.
2753
+ */
2754
+ readonly secrets: SecretStorage;
2755
+
2756
+ /**
2757
+ * The uri of the directory containing the extension.
2758
+ */
2759
+ readonly extensionUri: Uri;
2760
+
2761
+ /**
2762
+ * Gets the extension's environment variable collection for this workspace, enabling changes
2763
+ * to be applied to terminal environment variables.
2764
+ */
2765
+ readonly environmentVariableCollection: EnvironmentVariableCollection;
2766
+
2767
+ /**
2768
+ * Get the absolute path of a resource contained in the extension.
2769
+ *
2770
+ * @param relativePath A relative path to a resource contained in the extension.
2771
+ * @return The absolute path of the resource.
2772
+ */
2773
+ asAbsolutePath(relativePath: string): string;
2774
+
2775
+ /**
2776
+ * An absolute file path of a workspace specific directory in which the extension
2777
+ * can store private state. The directory might not exist on disk and creation is
2778
+ * up to the extension. However, the parent directory is guaranteed to be existent.
2779
+ *
2780
+ * Use [`workspaceState`](#ExtensionContext.workspaceState) or
2781
+ * [`globalState`](#ExtensionContext.globalState) to store key value data.
2782
+ *
2783
+ * @deprecated Use [storagePath](#ExtensionContent.storageUri) instead.
2784
+ */
2785
+ readonly storagePath: string | undefined;
2786
+
2787
+ /**
2788
+ * The uri of a workspace specific directory in which the extension
2789
+ * can store private state. The directory might not exist and creation is
2790
+ * up to the extension. However, the parent directory is guaranteed to be existent.
2791
+ * The value is `undefined` when no workspace nor folder has been opened.
2792
+ *
2793
+ * Use [`workspaceState`](#ExtensionContext.workspaceState) or
2794
+ * [`globalState`](#ExtensionContext.globalState) to store key value data.
2795
+ *
2796
+ * @see [`workspace.fs`](#FileSystem) for how to read and write files and folders from
2797
+ * an uri.
2798
+ */
2799
+ readonly storageUri: Uri | undefined;
2800
+
2801
+ /**
2802
+ * An absolute file path in which the extension can store global state.
2803
+ * The directory might not exist on disk and creation is
2804
+ * up to the extension. However, the parent directory is guaranteed to be existent.
2805
+ *
2806
+ * Use [`globalState`](#ExtensionContext.globalState) to store key value data.
2807
+ *
2808
+ * @deprecated Use [globalStoragePath](#ExtensionContent.globalStorageUri) instead.
2809
+ */
2810
+ readonly globalStoragePath: string;
2811
+
2812
+ /**
2813
+ * The uri of a directory in which the extension can store global state.
2814
+ * The directory might not exist on disk and creation is
2815
+ * up to the extension. However, the parent directory is guaranteed to be existent.
2816
+ *
2817
+ * Use [`globalState`](#ExtensionContext.globalState) to store key value data.
2818
+ *
2819
+ * @see [`workspace.fs`](#FileSystem) for how to read and write files and folders from
2820
+ * an uri.
2821
+ */
2822
+ readonly globalStorageUri: Uri;
2823
+
2824
+ /**
2825
+ * An absolute file path of a directory in which the extension can create log files.
2826
+ * The directory might not exist on disk and creation is up to the extension. However,
2827
+ * the parent directory is guaranteed to be existent.
2828
+ *
2829
+ * @deprecated Use [logUri](#ExtensionContext.logUri) instead.
2830
+ */
2831
+ readonly logPath: string;
2832
+
2833
+ /**
2834
+ * The uri of a directory in which the extension can create log files.
2835
+ * The directory might not exist on disk and creation is up to the extension. However,
2836
+ * the parent directory is guaranteed to be existent.
2837
+ *
2838
+ * @see [`workspace.fs`](#FileSystem) for how to read and write files and folders from
2839
+ * an uri.
2840
+ */
2841
+ readonly logUri: Uri;
2842
+
2843
+ /**
2844
+ * The mode the extension is running in. This is specific to the current
2845
+ * extension. One extension may be in `ExtensionMode.Development` while
2846
+ * other extensions in the host run in `ExtensionMode.Release`.
2847
+ */
2848
+ readonly extensionMode: ExtensionMode;
2849
+ /**
2850
+ * The current `Extension` instance.
2851
+ */
2852
+ readonly extension: Extension<any>;
2853
+ }
2854
+
2855
+ /**
2856
+ * The ExtensionMode is provided on the `ExtensionContext` and indicates the
2857
+ * mode the specific extension is running in.
2858
+ */
2859
+ export enum ExtensionMode {
2860
+ /**
2861
+ * The extension is installed normally (for example, from the marketplace
2862
+ * or VSIX) in VS Code.
2863
+ */
2864
+ Production = 1,
2865
+
2866
+ /**
2867
+ * The extension is running from an `--extensionDevelopmentPath` provided
2868
+ * when launching VS Code.
2869
+ */
2870
+ Development = 2,
2871
+
2872
+ /**
2873
+ * The extension is running from an `--extensionTestsPath` and
2874
+ * the extension host is running unit tests.
2875
+ */
2876
+ Test = 3,
2877
+ }
2878
+
2879
+ /**
2880
+ * A memento represents a storage utility. It can store and retrieve
2881
+ * values.
2882
+ */
2883
+ export interface Memento {
2884
+
2885
+ /**
2886
+ * Return a value.
2887
+ *
2888
+ * @param key A string.
2889
+ * @return The stored value or `undefined`.
2890
+ */
2891
+ get<T>(key: string): T | undefined;
2892
+
2893
+ /**
2894
+ * Return a value.
2895
+ *
2896
+ * @param key A string.
2897
+ * @param defaultValue A value that should be returned when there is no
2898
+ * value (`undefined`) with the given key.
2899
+ * @return The stored value or the defaultValue.
2900
+ */
2901
+ get<T>(key: string, defaultValue: T): T;
2902
+
2903
+ /**
2904
+ * Store a value. The value must be JSON-stringifyable.
2905
+ *
2906
+ * @param key A string.
2907
+ * @param value A value. MUST not contain cyclic references.
2908
+ */
2909
+ update(key: string, value: any): Thenable<void>;
2910
+ }
2911
+
2912
+ /**
2913
+ * A file system watcher notifies about changes to files and folders
2914
+ * on disk.
2915
+ *
2916
+ * To get an instance of a `FileSystemWatcher` use
2917
+ * [createFileSystemWatcher](#workspace.createFileSystemWatcher).
2918
+ */
2919
+ export interface FileSystemWatcher extends Disposable {
2920
+
2921
+ /**
2922
+ * true if this file system watcher has been created such that
2923
+ * it ignores creation file system events.
2924
+ */
2925
+ ignoreCreateEvents: boolean;
2926
+
2927
+ /**
2928
+ * true if this file system watcher has been created such that
2929
+ * it ignores change file system events.
2930
+ */
2931
+ ignoreChangeEvents: boolean;
2932
+
2933
+ /**
2934
+ * true if this file system watcher has been created such that
2935
+ * it ignores delete file system events.
2936
+ */
2937
+ ignoreDeleteEvents: boolean;
2938
+
2939
+ /**
2940
+ * An event which fires on file/folder creation.
2941
+ */
2942
+ onDidCreate: Event<Uri>;
2943
+
2944
+ /**
2945
+ * An event which fires on file/folder change.
2946
+ */
2947
+ onDidChange: Event<Uri>;
2948
+
2949
+ /**
2950
+ * An event which fires on file/folder deletion.
2951
+ */
2952
+ onDidDelete: Event<Uri>;
2953
+ }
2954
+
2955
+ /**
2956
+ * Enumeration of file types. The types `File` and `Directory` can also be
2957
+ * a symbolic links, in that use `FileType.File | FileType.SymbolicLink` and
2958
+ * `FileType.Directory | FileType.SymbolicLink`.
2959
+ */
2960
+ export enum FileType {
2961
+ /**
2962
+ * The file type is unknown.
2963
+ */
2964
+ Unknown = 0,
2965
+ /**
2966
+ * A regular file.
2967
+ */
2968
+ File = 1,
2969
+ /**
2970
+ * A directory.
2971
+ */
2972
+ Directory = 2,
2973
+ /**
2974
+ * A symbolic link to a file.
2975
+ */
2976
+ SymbolicLink = 64,
2977
+ }
2978
+
2979
+ /**
2980
+ * The `FileStat`-type represents metadata about a file
2981
+ */
2982
+ export interface FileStat {
2983
+ /**
2984
+ * The type of the file, e.g. is a regular file, a directory, or symbolic link
2985
+ * to a file.
2986
+ */
2987
+ type: FileType;
2988
+ /**
2989
+ * The creation timestamp in milliseconds elapsed since January 1, 1970 00:00:00 UTC.
2990
+ */
2991
+ ctime: number;
2992
+ /**
2993
+ * The modification timestamp in milliseconds elapsed since January 1, 1970 00:00:00 UTC.
2994
+ */
2995
+ mtime: number;
2996
+ /**
2997
+ * The size in bytes.
2998
+ */
2999
+ size: number;
3000
+ }
3001
+
3002
+ /**
3003
+ * A type that filesystem providers should use to signal errors.
3004
+ *
3005
+ * This class has factory methods for common error-cases, like `FileNotFound` when
3006
+ * a file or folder doesn't exist, use them like so: `throw vscode.FileSystemError.FileNotFound(someUri);`
3007
+ * @墨蛰
3008
+ */
3009
+ export class FileSystemError extends Error {
3010
+
3011
+ /**
3012
+ * Create an error to signal that a file or folder wasn't found.
3013
+ * @param messageOrUri Message or uri.
3014
+ */
3015
+ static FileNotFound(messageOrUri?: string | Uri): FileSystemError;
3016
+
3017
+ /**
3018
+ * Create an error to signal that a file or folder already exists, e.g. when
3019
+ * creating but not overwriting a file.
3020
+ * @param messageOrUri Message or uri.
3021
+ */
3022
+ static FileExists(messageOrUri?: string | Uri): FileSystemError;
3023
+
3024
+ /**
3025
+ * Create an error to signal that a file is not a folder.
3026
+ * @param messageOrUri Message or uri.
3027
+ */
3028
+ static FileNotADirectory(messageOrUri?: string | Uri): FileSystemError;
3029
+
3030
+ /**
3031
+ * Create an error to signal that a file is a folder.
3032
+ * @param messageOrUri Message or uri.
3033
+ */
3034
+ static FileIsADirectory(messageOrUri?: string | Uri): FileSystemError;
3035
+
3036
+ /**
3037
+ * Create an error to signal that an operation lacks required permissions.
3038
+ * @param messageOrUri Message or uri.
3039
+ */
3040
+ static NoPermissions(messageOrUri?: string | Uri): FileSystemError;
3041
+
3042
+ /**
3043
+ * Create an error to signal that the file system is unavailable or too busy to
3044
+ * complete a request.
3045
+ * @param messageOrUri Message or uri.
3046
+ */
3047
+ static Unavailable(messageOrUri?: string | Uri): FileSystemError;
3048
+
3049
+ /**
3050
+ * Creates a new filesystem error.
3051
+ *
3052
+ * @param messageOrUri Message or uri.
3053
+ */
3054
+ constructor(messageOrUri?: string | Uri);
3055
+
3056
+ /**
3057
+ * A code that identifies this error.
3058
+ *
3059
+ * Possible values are names of errors, like [`FileNotFound`](#FileSystemError.FileNotFound),
3060
+ * or `Unknown` for unspecified errors.
3061
+ */
3062
+ readonly code: string;
3063
+ }
3064
+
3065
+ /**
3066
+ * Enumeration of file change types.
3067
+ */
3068
+ export enum FileChangeType {
3069
+
3070
+ /**
3071
+ * The contents or metadata of a file have changed.
3072
+ */
3073
+ Changed = 1,
3074
+
3075
+ /**
3076
+ * A file has been created.
3077
+ */
3078
+ Created = 2,
3079
+
3080
+ /**
3081
+ * A file has been deleted.
3082
+ */
3083
+ Deleted = 3,
3084
+ }
3085
+
3086
+ /**
3087
+ * The event filesystem providers must use to signal a file change.
3088
+ */
3089
+ export interface FileChangeEvent {
3090
+
3091
+ /**
3092
+ * The type of change.
3093
+ */
3094
+ readonly type: FileChangeType;
3095
+
3096
+ /**
3097
+ * The uri of the file that has changed.
3098
+ */
3099
+ readonly uri: Uri;
3100
+ }
3101
+
3102
+ /**
3103
+ * The filesystem provider defines what the editor needs to read, write, discover,
3104
+ * and to manage files and folders. It allows extensions to serve files from remote places,
3105
+ * like ftp-servers, and to seamlessly integrate those into the editor.
3106
+ *
3107
+ * * *Note 1:* The filesystem provider API works with [uris](#Uri) and assumes hierarchical
3108
+ * paths, e.g. `foo:/my/path` is a child of `foo:/my/` and a parent of `foo:/my/path/deeper`.
3109
+ * * *Note 2:* There is an activation event `onFileSystem:<scheme>` that fires when a file
3110
+ * or folder is being accessed.
3111
+ * * *Note 3:* The word 'file' is often used to denote all [kinds](#FileType) of files, e.g.
3112
+ * folders, symbolic links, and regular files.
3113
+ */
3114
+ export interface FileSystemProvider {
3115
+
3116
+ /**
3117
+ * An event to signal that a resource has been created, changed, or deleted. This
3118
+ * event should fire for resources that are being [watched](#FileSystemProvider.watch)
3119
+ * by clients of this provider.
3120
+ */
3121
+ readonly onDidChangeFile: Event<FileChangeEvent[]>;
3122
+
3123
+ /**
3124
+ * Subscribe to events in the file or folder denoted by `uri`.
3125
+ *
3126
+ * The editor will call this function for files and folders. In the latter case, the
3127
+ * options differ from defaults, e.g. what files/folders to exclude from watching
3128
+ * and if subfolders, sub-subfolder, etc. should be watched (`recursive`).
3129
+ *
3130
+ * @param uri The uri of the file to be watched.
3131
+ * @param options Configures the watch.
3132
+ * @returns A disposable that tells the provider to stop watching the `uri`.
3133
+ */
3134
+ watch(uri: Uri, options: { recursive: boolean; excludes: string[] }): Disposable;
3135
+
3136
+ /**
3137
+ * Retrieve metadata about a file.
3138
+ *
3139
+ * Note that the metadata for symbolic links should be the metadata of the file they refer to.
3140
+ * Still, the [SymbolicLink](#FileType.SymbolicLink)-type must be used in addition to the actual type, e.g.
3141
+ * `FileType.SymbolicLink | FileType.Directory`.
3142
+ *
3143
+ * @param uri The uri of the file to retrieve metadata about.
3144
+ * @return The file metadata about the file.
3145
+ * @throws [`FileNotFound`](#FileSystemError.FileNotFound) when `uri` doesn't exist.
3146
+ */
3147
+ stat(uri: Uri): FileStat | Thenable<FileStat>;
3148
+
3149
+ /**
3150
+ * Retrieve all entries of a [directory](#FileType.Directory).
3151
+ *
3152
+ * @param uri The uri of the folder.
3153
+ * @return An array of name/type-tuples or a thenable that resolves to such.
3154
+ * @throws [`FileNotFound`](#FileSystemError.FileNotFound) when `uri` doesn't exist.
3155
+ */
3156
+ readDirectory(uri: Uri): [string, FileType][] | Thenable<[string, FileType][]>;
3157
+
3158
+ /**
3159
+ * Create a new directory (Note, that new files are created via `write`-calls).
3160
+ *
3161
+ * @param uri The uri of the new folder.
3162
+ * @throws [`FileNotFound`](#FileSystemError.FileNotFound) when the parent of `uri` doesn't exist, e.g. no mkdirp-logic required.
3163
+ * @throws [`FileExists`](#FileSystemError.FileExists) when `uri` already exists.
3164
+ * @throws [`NoPermissions`](#FileSystemError.NoPermissions) when permissions aren't sufficient.
3165
+ */
3166
+ createDirectory(uri: Uri): void | Thenable<void>;
3167
+
3168
+ /**
3169
+ * Read the entire contents of a file.
3170
+ *
3171
+ * @param uri The uri of the file.
3172
+ * @return An array of bytes or a thenable that resolves to such.
3173
+ * @throws [`FileNotFound`](#FileSystemError.FileNotFound) when `uri` doesn't exist.
3174
+ */
3175
+ readFile(uri: Uri): Uint8Array | Thenable<Uint8Array>;
3176
+
3177
+ /**
3178
+ * Write data to a file, replacing its entire contents.
3179
+ *
3180
+ * @param uri The uri of the file.
3181
+ * @param content The new content of the file.
3182
+ * @param options Defines if missing files should or must be created.
3183
+ * @throws [`FileNotFound`](#FileSystemError.FileNotFound) when `uri` doesn't exist and `create` is not set.
3184
+ * @throws [`FileNotFound`](#FileSystemError.FileNotFound) when the parent of `uri` doesn't exist and `create` is set, e.g. no mkdirp-logic required.
3185
+ * @throws [`FileExists`](#FileSystemError.FileExists) when `uri` already exists, `create` is set but `overwrite` is not set.
3186
+ * @throws [`NoPermissions`](#FileSystemError.NoPermissions) when permissions aren't sufficient.
3187
+ */
3188
+ writeFile(uri: Uri, content: Uint8Array, options: { create: boolean, overwrite: boolean }): void | Thenable<void>;
3189
+
3190
+ /**
3191
+ * Delete a file.
3192
+ *
3193
+ * @param uri The resource that is to be deleted.
3194
+ * @param options Defines if deletion of folders is recursive.
3195
+ * @throws [`FileNotFound`](#FileSystemError.FileNotFound) when `uri` doesn't exist.
3196
+ * @throws [`NoPermissions`](#FileSystemError.NoPermissions) when permissions aren't sufficient.
3197
+ */
3198
+ delete(uri: Uri, options: { recursive: boolean }): void | Thenable<void>;
3199
+
3200
+ /**
3201
+ * Rename a file or folder.
3202
+ *
3203
+ * @param oldUri The existing file.
3204
+ * @param newUri The new location.
3205
+ * @param options Defines if existing files should be overwritten.
3206
+ * @throws [`FileNotFound`](#FileSystemError.FileNotFound) when `oldUri` doesn't exist.
3207
+ * @throws [`FileNotFound`](#FileSystemError.FileNotFound) when parent of `newUri` doesn't exist, e.g. no mkdirp-logic required.
3208
+ * @throws [`FileExists`](#FileSystemError.FileExists) when `newUri` exists and when the `overwrite` option is not `true`.
3209
+ * @throws [`NoPermissions`](#FileSystemError.NoPermissions) when permissions aren't sufficient.
3210
+ */
3211
+ rename(oldUri: Uri, newUri: Uri, options: { overwrite: boolean }): void | Thenable<void>;
3212
+
3213
+ /**
3214
+ * Copy files or folders. Implementing this function is optional but it will speedup
3215
+ * the copy operation.
3216
+ *
3217
+ * @param source The existing file.
3218
+ * @param destination The destination location.
3219
+ * @param options Defines if existing files should be overwritten.
3220
+ * @throws [`FileNotFound`](#FileSystemError.FileNotFound) when `source` doesn't exist.
3221
+ * @throws [`FileNotFound`](#FileSystemError.FileNotFound) when parent of `destination` doesn't exist, e.g. no mkdirp-logic required.
3222
+ * @throws [`FileExists`](#FileSystemError.FileExists) when `destination` exists and when the `overwrite` option is not `true`.
3223
+ * @throws [`NoPermissions`](#FileSystemError.NoPermissions) when permissions aren't sufficient.
3224
+ */
3225
+ copy?(source: Uri, destination: Uri, options: { overwrite: boolean }): void | Thenable<void>;
3226
+ }
3227
+
3228
+ export interface FileSystem {
3229
+ stat(uri: Uri): Thenable<FileStat>;
3230
+ readDirectory(uri: Uri): Thenable<[string, FileType][]>;
3231
+ createDirectory(uri: Uri): Thenable<void>;
3232
+ readFile(uri: Uri): Thenable<Uint8Array>;
3233
+ writeFile(uri: Uri, content: Uint8Array, options?: { create: boolean, overwrite: boolean }): Thenable<void>;
3234
+ delete(uri: Uri, options?: { recursive: boolean }): Thenable<void>;
3235
+ rename(source: Uri, target: Uri, options?: { overwrite: boolean }): Thenable<void>;
3236
+ copy(source: Uri, target: Uri, options?: { overwrite: boolean }): Thenable<void>;
3237
+ isWritableFileSystem(scheme: string): boolean | undefined;
3238
+ }
3239
+
3240
+ /**
3241
+ * Represents the configuration. It is a merged view of
3242
+ *
3243
+ * - Default configuration
3244
+ * - Global configuration
3245
+ * - Workspace configuration (if available)
3246
+ * - Workspace folder configuration of the requested resource (if available)
3247
+ *
3248
+ * *Global configuration* comes from User Settings and shadows Defaults.
3249
+ *
3250
+ * *Workspace configuration* comes from Workspace Settings and shadows Global configuration.
3251
+ *
3252
+ * *Workspace Folder configuration* comes from `.vscode` folder under one of the [workspace folders](#workspace.workspaceFolders).
3253
+ *
3254
+ * *Note:* Workspace and Workspace Folder configurations contains `launch` and `tasks` settings. Their basename will be
3255
+ * part of the section identifier. The following snippets shows how to retrieve all configurations
3256
+ * from `launch.json`:
3257
+ *
3258
+ * ```ts
3259
+ * // launch.json configuration
3260
+ * const config = workspace.getConfiguration('launch', vscode.window.activeTextEditor.document.uri);
3261
+ *
3262
+ * // retrieve values
3263
+ * const values = config.get('configurations');
3264
+ * ```
3265
+ *
3266
+ * Refer to [Settings](https://code.visualstudio.com/docs/getstarted/settings) for more information.
3267
+ */
3268
+
3269
+ /**
3270
+ * An output channel is a container for readonly textual information.
3271
+ *
3272
+ * To get an instance of an `OutputChannel` use
3273
+ * [createOutputChannel](#window.createOutputChannel).
3274
+ */
3275
+ /**
3276
+ * Defines a generalized way of reporting progress updates.
3277
+ */
3278
+ export interface Progress<T> {
3279
+
3280
+ /**
3281
+ * Report a progress update.
3282
+ * @param value A progress item, like a message and/or an
3283
+ * report on how much work finished
3284
+ */
3285
+ report(value: T): void;
3286
+ }
3287
+
3288
+ /**
3289
+ * A location in the editor at which progress information can be shown. It depends on the
3290
+ * location how progress is visually represented.
3291
+ */
3292
+ export enum ProgressLocation {
3293
+
3294
+ /**
3295
+ * Show progress for the source control viewlet, as overlay for the icon and as progress bar
3296
+ * inside the viewlet (when visible). Neither supports cancellation nor discrete progress.
3297
+ */
3298
+ SourceControl = 1,
3299
+
3300
+ /**
3301
+ * Show progress in the status bar of the editor. Neither supports cancellation nor discrete progress.
3302
+ */
3303
+ Window = 10,
3304
+
3305
+ /**
3306
+ * Show progress as notification with an optional cancel button. Supports to show infinite and discrete progress.
3307
+ */
3308
+ Notification = 15,
3309
+ }
3310
+
3311
+ /**
3312
+ * Value-object describing where and how progress should show.
3313
+ */
3314
+ export interface ProgressOptions {
3315
+
3316
+ /**
3317
+ * The location at which progress should show.
3318
+ */
3319
+ location: ProgressLocation;
3320
+
3321
+ /**
3322
+ * A human-readable string which will be used to describe the
3323
+ * operation.
3324
+ */
3325
+ title?: string;
3326
+
3327
+ /**
3328
+ * Controls if a cancel button should show to allow the user to
3329
+ * cancel the long running operation. Note that currently only
3330
+ * `ProgressLocation.Notification` is supporting to show a cancel
3331
+ * button.
3332
+ */
3333
+ cancellable?: boolean;
3334
+ }
3335
+
3336
+ /**
3337
+ * Possible kinds of UI that can use extensions.
3338
+ */
3339
+ export enum UIKind {
3340
+
3341
+ /**
3342
+ * Extensions are accessed from a desktop application.
3343
+ */
3344
+ Desktop = 1,
3345
+
3346
+ /**
3347
+ * Extensions are accessed from a web browser.
3348
+ */
3349
+ Web = 2,
3350
+ }
3351
+
3352
+ //#region Semantic Tokens
3353
+
3354
+ /**
3355
+ * A semantic tokens legend contains the needed information to decipher
3356
+ * the integer encoded representation of semantic tokens.
3357
+ */
3358
+ export class SemanticTokensLegend {
3359
+ /**
3360
+ * The possible token types.
3361
+ */
3362
+ public readonly tokenTypes: string[];
3363
+ /**
3364
+ * The possible token modifiers.
3365
+ */
3366
+ public readonly tokenModifiers: string[];
3367
+
3368
+ constructor(tokenTypes: string[], tokenModifiers?: string[]);
3369
+ }
3370
+
3371
+ /**
3372
+ * A semantic tokens builder can help with creating a `SemanticTokens` instance
3373
+ * which contains delta encoded semantic tokens.
3374
+ */
3375
+ export class SemanticTokensBuilder {
3376
+
3377
+ constructor(legend?: SemanticTokensLegend);
3378
+
3379
+ /**
3380
+ * Add another token.
3381
+ *
3382
+ * @param line The token start line number (absolute value).
3383
+ * @param char The token start character (absolute value).
3384
+ * @param length The token length in characters.
3385
+ * @param tokenType The encoded token type.
3386
+ * @param tokenModifiers The encoded token modifiers.
3387
+ */
3388
+ push(line: number, char: number, length: number, tokenType: number, tokenModifiers?: number): void;
3389
+
3390
+ /**
3391
+ * Add another token. Use only when providing a legend.
3392
+ *
3393
+ * @param range The range of the token. Must be single-line.
3394
+ * @param tokenType The token type.
3395
+ * @param tokenModifiers The token modifiers.
3396
+ */
3397
+ push(range: Range, tokenType: string, tokenModifiers?: string[]): void;
3398
+
3399
+ /**
3400
+ * Finish and create a `SemanticTokens` instance.
3401
+ */
3402
+ build(resultId?: string): SemanticTokens;
3403
+ }
3404
+
3405
+ /**
3406
+ * Represents semantic tokens, either in a range or in an entire document.
3407
+ * @see [provideDocumentSemanticTokens](#DocumentSemanticTokensProvider.provideDocumentSemanticTokens) for an explanation of the format.
3408
+ * @see [SemanticTokensBuilder](#SemanticTokensBuilder) for a helper to create an instance.
3409
+ */
3410
+ export class SemanticTokens {
3411
+ /**
3412
+ * The result id of the tokens.
3413
+ *
3414
+ * This is the id that will be passed to `DocumentSemanticTokensProvider.provideDocumentSemanticTokensEdits` (if implemented).
3415
+ */
3416
+ readonly resultId?: string;
3417
+ /**
3418
+ * The actual tokens data.
3419
+ * @see [provideDocumentSemanticTokens](#DocumentSemanticTokensProvider.provideDocumentSemanticTokens) for an explanation of the format.
3420
+ */
3421
+ readonly data: Uint32Array;
3422
+
3423
+ constructor(data: Uint32Array, resultId?: string);
3424
+ }
3425
+
3426
+ /**
3427
+ * Represents edits to semantic tokens.
3428
+ * @see [provideDocumentSemanticTokensEdits](#DocumentSemanticTokensProvider.provideDocumentSemanticTokensEdits) for an explanation of the format.
3429
+ */
3430
+ export class SemanticTokensEdits {
3431
+ /**
3432
+ * The result id of the tokens.
3433
+ *
3434
+ * This is the id that will be passed to `DocumentSemanticTokensProvider.provideDocumentSemanticTokensEdits` (if implemented).
3435
+ */
3436
+ readonly resultId?: string;
3437
+ /**
3438
+ * The edits to the tokens data.
3439
+ * All edits refer to the initial data state.
3440
+ */
3441
+ readonly edits: SemanticTokensEdit[];
3442
+
3443
+ constructor(edits: SemanticTokensEdit[], resultId?: string);
3444
+ }
3445
+
3446
+ /**
3447
+ * Represents an edit to semantic tokens.
3448
+ * @see [provideDocumentSemanticTokensEdits](#DocumentSemanticTokensProvider.provideDocumentSemanticTokensEdits) for an explanation of the format.
3449
+ */
3450
+ export class SemanticTokensEdit {
3451
+ /**
3452
+ * The start offset of the edit.
3453
+ */
3454
+ readonly start: number;
3455
+ /**
3456
+ * The count of elements to remove.
3457
+ */
3458
+ readonly deleteCount: number;
3459
+ /**
3460
+ * The elements to insert.
3461
+ */
3462
+ readonly data?: Uint32Array;
3463
+
3464
+ constructor(start: number, deleteCount: number, data?: Uint32Array);
3465
+ }
3466
+ /**
3467
+ * The document semantic tokens provider interface defines the contract between extensions and
3468
+ * semantic tokens.
3469
+ */
3470
+ export interface DocumentSemanticTokensProvider {
3471
+ /**
3472
+ * An optional event to signal that the semantic tokens from this provider have changed.
3473
+ */
3474
+ onDidChangeSemanticTokens?: Event<void>;
3475
+
3476
+ /**
3477
+ * Tokens in a file are represented as an array of integers. The position of each token is expressed relative to
3478
+ * the token before it, because most tokens remain stable relative to each other when edits are made in a file.
3479
+ *
3480
+ * ---
3481
+ * In short, each token takes 5 integers to represent, so a specific token `i` in the file consists of the following array indices:
3482
+ * - at index `5*i` - `deltaLine`: token line number, relative to the previous token
3483
+ * - at index `5*i+1` - `deltaStart`: token start character, relative to the previous token (relative to 0 or the previous token's start if they are on the same line)
3484
+ * - at index `5*i+2` - `length`: the length of the token. A token cannot be multiline.
3485
+ * - at index `5*i+3` - `tokenType`: will be looked up in `SemanticTokensLegend.tokenTypes`. We currently ask that `tokenType` < 65536.
3486
+ * - at index `5*i+4` - `tokenModifiers`: each set bit will be looked up in `SemanticTokensLegend.tokenModifiers`
3487
+ *
3488
+ * ---
3489
+ * ### How to encode tokens
3490
+ *
3491
+ * Here is an example for encoding a file with 3 tokens in a uint32 array:
3492
+ * ```
3493
+ * { line: 2, startChar: 5, length: 3, tokenType: "property", tokenModifiers: ["private", "static"] },
3494
+ * { line: 2, startChar: 10, length: 4, tokenType: "type", tokenModifiers: [] },
3495
+ * { line: 5, startChar: 2, length: 7, tokenType: "class", tokenModifiers: [] }
3496
+ * ```
3497
+ *
3498
+ * 1. First of all, a legend must be devised. This legend must be provided up-front and capture all possible token types.
3499
+ * For this example, we will choose the following legend which must be passed in when registering the provider:
3500
+ * ```
3501
+ * tokenTypes: ['property', 'type', 'class'],
3502
+ * tokenModifiers: ['private', 'static']
3503
+ * ```
3504
+ *
3505
+ * 2. The first transformation step is to encode `tokenType` and `tokenModifiers` as integers using the legend. Token types are looked
3506
+ * up by index, so a `tokenType` value of `1` means `tokenTypes[1]`. Multiple token modifiers can be set by using bit flags,
3507
+ * so a `tokenModifier` value of `3` is first viewed as binary `0b00000011`, which means `[tokenModifiers[0], tokenModifiers[1]]` because
3508
+ * bits 0 and 1 are set. Using this legend, the tokens now are:
3509
+ * ```
3510
+ * { line: 2, startChar: 5, length: 3, tokenType: 0, tokenModifiers: 3 },
3511
+ * { line: 2, startChar: 10, length: 4, tokenType: 1, tokenModifiers: 0 },
3512
+ * { line: 5, startChar: 2, length: 7, tokenType: 2, tokenModifiers: 0 }
3513
+ * ```
3514
+ *
3515
+ * 3. The next step is to represent each token relative to the previous token in the file. In this case, the second token
3516
+ * is on the same line as the first token, so the `startChar` of the second token is made relative to the `startChar`
3517
+ * of the first token, so it will be `10 - 5`. The third token is on a different line than the second token, so the
3518
+ * `startChar` of the third token will not be altered:
3519
+ * ```
3520
+ * { deltaLine: 2, deltaStartChar: 5, length: 3, tokenType: 0, tokenModifiers: 3 },
3521
+ * { deltaLine: 0, deltaStartChar: 5, length: 4, tokenType: 1, tokenModifiers: 0 },
3522
+ * { deltaLine: 3, deltaStartChar: 2, length: 7, tokenType: 2, tokenModifiers: 0 }
3523
+ * ```
3524
+ *
3525
+ * 4. Finally, the last step is to inline each of the 5 fields for a token in a single array, which is a memory friendly representation:
3526
+ * ```
3527
+ * // 1st token, 2nd token, 3rd token
3528
+ * [ 2,5,3,0,3, 0,5,4,1,0, 3,2,7,2,0 ]
3529
+ * ```
3530
+ *
3531
+ * @see [SemanticTokensBuilder](#SemanticTokensBuilder) for a helper to encode tokens as integers.
3532
+ * *NOTE*: When doing edits, it is possible that multiple edits occur until VS Code decides to invoke the semantic tokens provider.
3533
+ * *NOTE*: If the provider cannot temporarily compute semantic tokens, it can indicate this by throwing an error with the message 'Busy'.
3534
+ */
3535
+ provideDocumentSemanticTokens(document: TextDocument, token: CancellationToken): ProviderResult<SemanticTokens>;
3536
+
3537
+ /**
3538
+ * Instead of always returning all the tokens in a file, it is possible for a `DocumentSemanticTokensProvider` to implement
3539
+ * this method (`provideDocumentSemanticTokensEdits`) and then return incremental updates to the previously provided semantic tokens.
3540
+ *
3541
+ * ---
3542
+ * ### How tokens change when the document changes
3543
+ *
3544
+ * Suppose that `provideDocumentSemanticTokens` has previously returned the following semantic tokens:
3545
+ * ```
3546
+ * // 1st token, 2nd token, 3rd token
3547
+ * [ 2,5,3,0,3, 0,5,4,1,0, 3,2,7,2,0 ]
3548
+ * ```
3549
+ *
3550
+ * Also suppose that after some edits, the new semantic tokens in a file are:
3551
+ * ```
3552
+ * // 1st token, 2nd token, 3rd token
3553
+ * [ 3,5,3,0,3, 0,5,4,1,0, 3,2,7,2,0 ]
3554
+ * ```
3555
+ * It is possible to express these new tokens in terms of an edit applied to the previous tokens:
3556
+ * ```
3557
+ * [ 2,5,3,0,3, 0,5,4,1,0, 3,2,7,2,0 ] // old tokens
3558
+ * [ 3,5,3,0,3, 0,5,4,1,0, 3,2,7,2,0 ] // new tokens
3559
+ *
3560
+ * edit: { start: 0, deleteCount: 1, data: [3] } // replace integer at offset 0 with 3
3561
+ * ```
3562
+ *
3563
+ * *NOTE*: If the provider cannot compute `SemanticTokensEdits`, it can "give up" and return all the tokens in the document again.
3564
+ * *NOTE*: All edits in `SemanticTokensEdits` contain indices in the old integers array, so they all refer to the previous result state.
3565
+ */
3566
+ provideDocumentSemanticTokensEdits?(document: TextDocument, previousResultId: string, token: CancellationToken): ProviderResult<SemanticTokens | SemanticTokensEdits>;
3567
+ }
3568
+
3569
+ /**
3570
+ * The document range semantic tokens provider interface defines the contract between extensions and
3571
+ * semantic tokens.
3572
+ */
3573
+ export interface DocumentRangeSemanticTokensProvider {
3574
+ /**
3575
+ * @see [provideDocumentSemanticTokens](#DocumentSemanticTokensProvider.provideDocumentSemanticTokens).
3576
+ */
3577
+ provideDocumentRangeSemanticTokens(document: TextDocument, range: Range, token: CancellationToken): ProviderResult<SemanticTokens>;
3578
+ }
3579
+
3580
+ //#endregion Semantic Tokens
3581
+
3582
+ /**
3583
+ * The configuration scope which can be a
3584
+ * a 'resource' or a languageId or both or
3585
+ * a '[TextDocument](#TextDocument)' or
3586
+ * a '[WorkspaceFolder](#WorkspaceFolder)'
3587
+ */
3588
+ export type ConfigurationScope = Uri | TextDocument | WorkspaceFolder | { uri?: Uri, languageId: string };
3589
+ //#region EvaluatableExpression
3590
+
3591
+ /**
3592
+ * An EvaluatableExpression represents an expression in a document that can be evaluated by an active debugger or runtime.
3593
+ * The result of this evaluation is shown in a tooltip-like widget.
3594
+ * If only a range is specified, the expression will be extracted from the underlying document.
3595
+ * An optional expression can be used to override the extracted expression.
3596
+ * In this case the range is still used to highlight the range in the document.
3597
+ */
3598
+ export class EvaluatableExpression {
3599
+
3600
+ /*
3601
+ * The range is used to extract the evaluatable expression from the underlying document and to highlight it.
3602
+ */
3603
+ readonly range: Range;
3604
+
3605
+ /*
3606
+ * If specified the expression overrides the extracted expression.
3607
+ */
3608
+ readonly expression?: string;
3609
+
3610
+ /**
3611
+ * Creates a new evaluatable expression object.
3612
+ *
3613
+ * @param range The range in the underlying document from which the evaluatable expression is extracted.
3614
+ * @param expression If specified overrides the extracted expression.
3615
+ */
3616
+ constructor(range: Range, expression?: string);
3617
+ }
3618
+
3619
+ /**
3620
+ * The evaluatable expression provider interface defines the contract between extensions and
3621
+ * the debug hover. In this contract the provider returns an evaluatable expression for a given position
3622
+ * in a document and VS Code evaluates this expression in the active debug session and shows the result in a debug hover.
3623
+ */
3624
+ export interface EvaluatableExpressionProvider {
3625
+
3626
+ /**
3627
+ * Provide an evaluatable expression for the given document and position.
3628
+ * VS Code will evaluate this expression in the active debug session and will show the result in the debug hover.
3629
+ * The expression can be implicitly specified by the range in the underlying document or by explicitly returning an expression.
3630
+ *
3631
+ * @param document The document for which the debug hover is about to appear.
3632
+ * @param position The line and character position in the document where the debug hover is about to appear.
3633
+ * @param token A cancellation token.
3634
+ * @return An EvaluatableExpression or a thenable that resolves to such. The lack of a result can be
3635
+ * signaled by returning `undefined` or `null`.
3636
+ */
3637
+ provideEvaluatableExpression(document: TextDocument, position: Position, token: CancellationToken): ProviderResult<EvaluatableExpression>;
3638
+ }
3639
+
3640
+ //#endregion
3641
+
3642
+ //#region Inline Values
3643
+ /**
3644
+ * Provide inline value as text.
3645
+ */
3646
+ export class InlineValueText {
3647
+ /**
3648
+ * The document range for which the inline value applies.
3649
+ */
3650
+ readonly range: Range;
3651
+ /**
3652
+ * The text of the inline value.
3653
+ */
3654
+ readonly text: string;
3655
+ /**
3656
+ * Creates a new InlineValueText object.
3657
+ *
3658
+ * @param range The document line where to show the inline value.
3659
+ * @param text The value to be shown for the line.
3660
+ */
3661
+ constructor(range: Range, text: string);
3662
+ }
3663
+
3664
+ /**
3665
+ * Provide inline value through a variable lookup.
3666
+ * If only a range is specified, the variable name will be extracted from the underlying document.
3667
+ * An optional variable name can be used to override the extracted name.
3668
+ */
3669
+ export class InlineValueVariableLookup {
3670
+ /**
3671
+ * The document range for which the inline value applies.
3672
+ * The range is used to extract the variable name from the underlying document.
3673
+ */
3674
+ readonly range: Range;
3675
+ /**
3676
+ * If specified the name of the variable to look up.
3677
+ */
3678
+ readonly variableName?: string;
3679
+ /**
3680
+ * How to perform the lookup.
3681
+ */
3682
+ readonly caseSensitiveLookup: boolean;
3683
+ /**
3684
+ * Creates a new InlineValueVariableLookup object.
3685
+ *
3686
+ * @param range The document line where to show the inline value.
3687
+ * @param variableName The name of the variable to look up.
3688
+ * @param caseSensitiveLookup How to perform the lookup. If missing lookup is case sensitive.
3689
+ */
3690
+ constructor(range: Range, variableName?: string, caseSensitiveLookup?: boolean);
3691
+ }
3692
+
3693
+ /**
3694
+ * Provide an inline value through an expression evaluation.
3695
+ * If only a range is specified, the expression will be extracted from the underlying document.
3696
+ * An optional expression can be used to override the extracted expression.
3697
+ */
3698
+ export class InlineValueEvaluatableExpression {
3699
+ /**
3700
+ * The document range for which the inline value applies.
3701
+ * The range is used to extract the evaluatable expression from the underlying document.
3702
+ */
3703
+ readonly range: Range;
3704
+ /**
3705
+ * If specified the expression overrides the extracted expression.
3706
+ */
3707
+ readonly expression?: string;
3708
+ /**
3709
+ * Creates a new InlineValueEvaluatableExpression object.
3710
+ *
3711
+ * @param range The range in the underlying document from which the evaluatable expression is extracted.
3712
+ * @param expression If specified overrides the extracted expression.
3713
+ */
3714
+ constructor(range: Range, expression?: string);
3715
+ }
3716
+
3717
+ /**
3718
+ * Inline value information can be provided by different means:
3719
+ * - directly as a text value (class InlineValueText).
3720
+ * - as a name to use for a variable lookup (class InlineValueVariableLookup)
3721
+ * - as an evaluatable expression (class InlineValueEvaluatableExpression)
3722
+ * The InlineValue types combines all inline value types into one type.
3723
+ */
3724
+ export type InlineValue = InlineValueText | InlineValueVariableLookup | InlineValueEvaluatableExpression;
3725
+
3726
+ /**
3727
+ * A value-object that contains contextual information when requesting inline values from a InlineValuesProvider.
3728
+ */
3729
+ export interface InlineValueContext {
3730
+
3731
+ /**
3732
+ * The stack frame (as a DAP Id) where the execution has stopped.
3733
+ */
3734
+ readonly frameId: number;
3735
+
3736
+ /**
3737
+ * The document range where execution has stopped.
3738
+ * Typically the end position of the range denotes the line where the inline values are shown.
3739
+ */
3740
+ readonly stoppedLocation: Range;
3741
+ }
3742
+
3743
+ /**
3744
+ * The inline values provider interface defines the contract between extensions and the VS Code debugger inline values feature.
3745
+ * In this contract the provider returns inline value information for a given document range
3746
+ * and VS Code shows this information in the editor at the end of lines.
3747
+ */
3748
+ export interface InlineValuesProvider {
3749
+
3750
+ /**
3751
+ * An optional event to signal that inline values have changed.
3752
+ * @see [EventEmitter](#EventEmitter)
3753
+ */
3754
+ onDidChangeInlineValues?: Event<void> | undefined;
3755
+
3756
+ /**
3757
+ * Provide "inline value" information for a given document and range.
3758
+ * VS Code calls this method whenever debugging stops in the given document.
3759
+ * The returned inline values information is rendered in the editor at the end of lines.
3760
+ *
3761
+ * @param document The document for which the inline values information is needed.
3762
+ * @param viewPort The visible document range for which inline values should be computed.
3763
+ * @param context A bag containing contextual information like the current location.
3764
+ * @param token A cancellation token.
3765
+ * @return An array of InlineValueDescriptors or a thenable that resolves to such. The lack of a result can be
3766
+ * signaled by returning `undefined` or `null`.
3767
+ */
3768
+ provideInlineValues(document: TextDocument, viewPort: Range, context: InlineValueContext, token: CancellationToken): ProviderResult<InlineValue[]>;
3769
+ }
3770
+ //#endregion Inline Values
3771
+ }
3772
+
3773
+ /**
3774
+ * Thenable is a common denominator between ES6 promises, Q, jquery.Deferred, WinJS.Promise,
3775
+ * and others. This API makes no assumption about what promise library is being used which
3776
+ * enables reusing existing code without migrating to a specific promise implementation. Still,
3777
+ * we recommend the use of native promises which are available in this editor.
3778
+ */
3779
+ interface Thenable<T> {
3780
+ /**
3781
+ * Attaches callbacks for the resolution and/or rejection of the Promise.
3782
+ * @param onfulfilled The callback to execute when the Promise is resolved.
3783
+ * @param onrejected The callback to execute when the Promise is rejected.
3784
+ * @returns A Promise for the completion of which ever callback is executed.
3785
+ */
3786
+ then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => TResult | Thenable<TResult>): Thenable<TResult>;
3787
+ /* tslint:disable-next-line */
3788
+ then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => void): Thenable<TResult>;
3789
+ }