@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,2788 @@
1
+
2
+ /**
3
+ * @deprecated `kaitian-worker` was deprecated, Please use `sumi-worker` instead.
4
+ */
5
+ declare module 'kaitian-worker' {
6
+ export * from 'sumi-worker';
7
+ }
8
+ declare module 'sumi-worker' {
9
+ /**
10
+ * Accessibility information which controls screen reader behavior.
11
+ */
12
+ export interface AccessibilityInformation {
13
+ /**
14
+ * Label to be read out by a screen reader once the item has focus.
15
+ */
16
+ label: string;
17
+
18
+ /**
19
+ * Role of the widget which defines how a screen reader interacts with it.
20
+ * The role should be set in special cases when for example a tree-like element behaves like a checkbox.
21
+ * If role is not specified VS Code will pick the appropriate role automatically.
22
+ * More about aria roles can be found here https://w3c.github.io/aria/#widget_roles
23
+ */
24
+ role?: string;
25
+ }
26
+
27
+ export type relativePathKind = 'http' | 'file';
28
+
29
+ export interface ExtensionContext<T> {
30
+ registerExtendModuleService<S>(service: S): void;
31
+
32
+ readonly componentProxy: T;
33
+
34
+ /**
35
+ * An array to which disposables can be added. When this
36
+ * extension is deactivated the disposables will be disposed.
37
+ */
38
+ readonly subscriptions: { dispose(): any }[];
39
+
40
+ /**
41
+ * The absolute file path of the directory containing the extension.
42
+ */
43
+ readonly extensionPath: string;
44
+
45
+ /**
46
+ * Get the absolute path of a resource contained in the extension.
47
+ *
48
+ * @param relativePath A relative path to a resource contained in the extension.
49
+ * @param kind The schema of the absolute path
50
+ * @return The absolute path of the resource.
51
+ *
52
+ * ```typescript
53
+ * // from http server
54
+ * // http://ide.host.com/extensions/resource/test-extension
55
+ * const httpPath = context.asAbsolutePath('icon/name.svg', 'http');
56
+ * // http://ide.host.com/extensions/resource/test-extension/icon/name.svg
57
+ *
58
+ * // from local
59
+ * const filePath = context.asAbsolutePath('icon/name.svg', 'file');
60
+ * // file:///path/to/extensions/test-extension/icon/name.svg
61
+ * ```
62
+ */
63
+ asAbsolutePath(relativePath: string, kind: relativePathKind): string;
64
+ }
65
+
66
+ /**
67
+ * Defines a port mapping used for localhost inside the webview.
68
+ */
69
+ export interface WebviewPortMapping {
70
+ /**
71
+ * Localhost port to remap inside the webview.
72
+ */
73
+ readonly webviewPort: number;
74
+
75
+ /**
76
+ * Destination port. The `webviewPort` is resolved to this port.
77
+ */
78
+ readonly extensionHostPort: number;
79
+ }
80
+
81
+ /**
82
+ * Content settings for a webview.
83
+ */
84
+ export interface WebviewOptions {
85
+ /**
86
+ * Controls whether scripts are enabled in the webview content or not.
87
+ *
88
+ * Defaults to false (scripts-disabled).
89
+ */
90
+ readonly enableScripts?: boolean;
91
+
92
+ /**
93
+ * Controls whether command uris are enabled in webview content or not.
94
+ *
95
+ * Defaults to false.
96
+ */
97
+ readonly enableCommandUris?: boolean;
98
+
99
+ /**
100
+ * Root paths from which the webview can load local (filesystem) resources using the `vscode-resource:` scheme.
101
+ *
102
+ * Default to the root folders of the current workspace plus the extension's install directory.
103
+ *
104
+ * Pass in an empty array to disallow access to any local resources.
105
+ */
106
+ readonly localResourceRoots?: ReadonlyArray<Uri>;
107
+
108
+ /**
109
+ * Mappings of localhost ports used inside the webview.
110
+ *
111
+ * Port mapping allow webviews to transparently define how localhost ports are resolved. This can be used
112
+ * to allow using a static localhost port inside the webview that is resolved to random port that a service is
113
+ * running on.
114
+ *
115
+ * If a webview accesses localhost content, we recommend that you specify port mappings even if
116
+ * the `webviewPort` and `extensionHostPort` ports are the same.
117
+ *
118
+ * *Note* that port mappings only work for `http` or `https` urls. Websocket urls (e.g. `ws://localhost:3000`)
119
+ * cannot be mapped to another port.
120
+ */
121
+ readonly portMapping?: ReadonlyArray<WebviewPortMapping>;
122
+ }
123
+
124
+ /**
125
+ * A webview displays html content, like an iframe.
126
+ */
127
+ export interface Webview {
128
+ /**
129
+ * Content settings for the webview.
130
+ */
131
+ options: WebviewOptions;
132
+
133
+ /**
134
+ * Contents of the webview.
135
+ *
136
+ * Should be a complete html document.
137
+ */
138
+ html: string;
139
+
140
+ /**
141
+ * Fired when the webview content posts a message.
142
+ */
143
+ readonly onDidReceiveMessage: Event<any>;
144
+
145
+ /**
146
+ * Post a message to the webview content.
147
+ *
148
+ * Messages are only delivered if the webview is visible.
149
+ *
150
+ * @param message Body of the message.
151
+ */
152
+ postMessage(message: any): Thenable<boolean>;
153
+ }
154
+
155
+ /**
156
+ * Content settings for a webview panel.
157
+ */
158
+ export interface WebviewPanelOptions {
159
+ /**
160
+ * Controls if the find widget is enabled in the panel.
161
+ *
162
+ * Defaults to false.
163
+ */
164
+ readonly enableFindWidget?: boolean;
165
+
166
+ /**
167
+ * Controls if the webview panel's content (iframe) is kept around even when the panel
168
+ * is no longer visible.
169
+ *
170
+ * Normally the webview panel's html context is created when the panel becomes visible
171
+ * and destroyed when it is hidden. Extensions that have complex state
172
+ * or UI can set the `retainContextWhenHidden` to make VS Code keep the webview
173
+ * context around, even when the webview moves to a background tab. When a webview using
174
+ * `retainContextWhenHidden` becomes hidden, its scripts and other dynamic content are suspended.
175
+ * When the panel becomes visible again, the context is automatically restored
176
+ * in the exact same state it was in originally. You cannot send messages to a
177
+ * hidden webview, even with `retainContextWhenHidden` enabled.
178
+ *
179
+ * `retainContextWhenHidden` has a high memory overhead and should only be used if
180
+ * your panel's context cannot be quickly saved and restored.
181
+ */
182
+ readonly retainContextWhenHidden?: boolean;
183
+ }
184
+
185
+ /**
186
+ * Value-object describing what options a terminal should use.
187
+ */
188
+ export interface TerminalOptions {
189
+ /**
190
+ * A human-readable string which will be used to represent the terminal in the UI.
191
+ */
192
+ name?: string;
193
+
194
+ /**
195
+ * A path to a custom shell executable to be used in the terminal.
196
+ */
197
+ shellPath?: string;
198
+
199
+ /**
200
+ * Args for the custom shell executable. A string can be used on Windows only which allows
201
+ * specifying shell args in [command-line format](https://msdn.microsoft.com/en-au/08dfcab2-eb6e-49a4-80eb-87d4076c98c6).
202
+ */
203
+ shellArgs?: string[] | string;
204
+
205
+ /**
206
+ * A path or Uri for the current working directory to be used for the terminal.
207
+ */
208
+ cwd?: string | Uri;
209
+
210
+ /**
211
+ * Object with environment variables that will be added to the VS Code process.
212
+ */
213
+ env?: { [key: string]: string | null };
214
+
215
+ /**
216
+ * Whether the terminal process environment should be exactly as provided in
217
+ * `TerminalOptions.env`. When this is false (default), the environment will be based on the
218
+ * window's environment and also apply configured platform settings like
219
+ * `terminal.integrated.windows.env` on top. When this is true, the complete environment
220
+ * must be provided as nothing will be inherited from the process or any configuration.
221
+ */
222
+ strictEnv?: boolean;
223
+
224
+ /**
225
+ * When enabled the terminal will run the process as normal but not be surfaced to the user
226
+ * until `Terminal.show` is called. The typical usage for this is when you need to run
227
+ * something that may need interactivity but only want to tell the user about it when
228
+ * interaction is needed. Note that the terminals will still be exposed to all extensions
229
+ * as normal.
230
+ */
231
+ hideFromUser?: boolean;
232
+ }
233
+
234
+ /**
235
+ * The clipboard provides read and write access to the system's clipboard.
236
+ */
237
+ export interface Clipboard {
238
+
239
+ /**
240
+ * Read the current clipboard contents as text.
241
+ * @returns A thenable that resolves to a string.
242
+ */
243
+ readText(): Thenable<string>;
244
+
245
+ /**
246
+ * Writes text into the clipboard.
247
+ * @returns A thenable that resolves when writing happened.
248
+ */
249
+ writeText(value: string): Thenable<void>;
250
+ }
251
+
252
+ /**
253
+ * A selection range represents a part of a selection hierarchy. A selection range
254
+ * may have a parent selection range that contains it.
255
+ */
256
+ export class SelectionRange {
257
+
258
+ /**
259
+ * The [range](#Range) of this selection range.
260
+ */
261
+ range: Range;
262
+
263
+ /**
264
+ * The parent selection range containing this range.
265
+ */
266
+ parent?: SelectionRange;
267
+
268
+ /**
269
+ * Creates a new selection range.
270
+ *
271
+ * @param range The range of the selection range.
272
+ * @param parent The parent of the selection range.
273
+ */
274
+ constructor(range: Range, parent?: SelectionRange);
275
+ }
276
+ /**
277
+ * A tuple of two characters, like a pair of
278
+ * opening and closing brackets.
279
+ */
280
+ export type CharacterPair = [string, string];
281
+
282
+ /**
283
+ * The workspace symbol provider interface defines the contract between extensions and
284
+ * the [symbol search](https://code.visualstudio.com/docs/editor/editingevolved#_open-symbol-by-name)-feature.
285
+ */
286
+ export interface WorkspaceSymbolProvider {
287
+
288
+ /**
289
+ * Project-wide search for a symbol matching the given query string.
290
+ *
291
+ * The `query`-parameter should be interpreted in a *relaxed way* as the editor will apply its own highlighting
292
+ * and scoring on the results. A good rule of thumb is to match case-insensitive and to simply check that the
293
+ * characters of *query* appear in their order in a candidate symbol. Don't use prefix, substring, or similar
294
+ * strict matching.
295
+ *
296
+ * To improve performance implementors can implement `resolveWorkspaceSymbol` and then provide symbols with partial
297
+ * [location](#SymbolInformation.location)-objects, without a `range` defined. The editor will then call
298
+ * `resolveWorkspaceSymbol` for selected symbols only, e.g. when opening a workspace symbol.
299
+ *
300
+ * @param query A query string, can be the empty string in which case all symbols should be returned.
301
+ * @param token A cancellation token.
302
+ * @return An array of document highlights or a thenable that resolves to such. The lack of a result can be
303
+ * signaled by returning `undefined`, `null`, or an empty array.
304
+ */
305
+ provideWorkspaceSymbols(query: string, token: CancellationToken): ProviderResult<SymbolInformation[]>;
306
+
307
+ /**
308
+ * Given a symbol fill in its [location](#SymbolInformation.location). This method is called whenever a symbol
309
+ * is selected in the UI. Providers can implement this method and return incomplete symbols from
310
+ * [`provideWorkspaceSymbols`](#WorkspaceSymbolProvider.provideWorkspaceSymbols) which often helps to improve
311
+ * performance.
312
+ *
313
+ * @param symbol The symbol that is to be resolved. Guaranteed to be an instance of an object returned from an
314
+ * earlier call to `provideWorkspaceSymbols`.
315
+ * @param token A cancellation token.
316
+ * @return The resolved symbol or a thenable that resolves to that. When no result is returned,
317
+ * the given `symbol` is used.
318
+ */
319
+ resolveWorkspaceSymbol?(symbol: SymbolInformation, token: CancellationToken): ProviderResult<SymbolInformation>;
320
+ }
321
+
322
+ /**
323
+ * Describes how comments for a language work.
324
+ */
325
+ export interface CommentRule {
326
+
327
+ /**
328
+ * The line comment token, like `// this is a comment`
329
+ */
330
+ lineComment?: string;
331
+
332
+ /**
333
+ * The block comment character pair, like `/* block comment *&#47;`
334
+ */
335
+ blockComment?: CharacterPair;
336
+ }
337
+
338
+ /**
339
+ * Describes a rule to be evaluated when pressing Enter.
340
+ */
341
+ export interface OnEnterRule {
342
+ /**
343
+ * This rule will only execute if the text before the cursor matches this regular expression.
344
+ */
345
+ beforeText: RegExp;
346
+ /**
347
+ * This rule will only execute if the text after the cursor matches this regular expression.
348
+ */
349
+ afterText?: RegExp;
350
+ /**
351
+ * The action to execute.
352
+ */
353
+ action: EnterAction;
354
+ }
355
+
356
+ /**
357
+ * Describes indentation rules for a language.
358
+ */
359
+ export interface IndentationRule {
360
+ /**
361
+ * If a line matches this pattern, then all the lines after it should be unindented once (until another rule matches).
362
+ */
363
+ decreaseIndentPattern: RegExp;
364
+ /**
365
+ * If a line matches this pattern, then all the lines after it should be indented once (until another rule matches).
366
+ */
367
+ increaseIndentPattern: RegExp;
368
+ /**
369
+ * If a line matches this pattern, then **only the next line** after it should be indented once.
370
+ */
371
+ indentNextLinePattern?: RegExp;
372
+ /**
373
+ * If a line matches this pattern, then its indentation should not be changed and it should not be evaluated against the other rules.
374
+ */
375
+ unIndentedLinePattern?: RegExp;
376
+ }
377
+
378
+ /**
379
+ * A workspace folder is one of potentially many roots opened by the editor. All workspace folders
380
+ * are equal which means there is no notion of an active or master workspace folder.
381
+ */
382
+ export interface WorkspaceFolder {
383
+
384
+ /**
385
+ * The associated uri for this workspace folder.
386
+ *
387
+ * *Note:* The [Uri](#Uri)-type was intentionally chosen such that future releases of the editor can support
388
+ * workspace folders that are not stored on the local disk, e.g. `ftp://server/workspaces/foo`.
389
+ */
390
+ readonly uri: Uri;
391
+
392
+ /**
393
+ * The name of this workspace folder. Defaults to
394
+ * the basename of its [uri-path](#Uri.path)
395
+ */
396
+ readonly name: string;
397
+
398
+ /**
399
+ * The ordinal number of this workspace folder.
400
+ */
401
+ readonly index: number;
402
+ }
403
+ /**
404
+ * Represents reasons why a text document is saved.
405
+ */
406
+ export enum TextDocumentSaveReason {
407
+
408
+ /**
409
+ * Manually triggered, e.g. by the user pressing save, by starting debugging,
410
+ * or by an API call.
411
+ */
412
+ Manual = 1,
413
+
414
+ /**
415
+ * Automatic after a delay.
416
+ */
417
+ AfterDelay = 2,
418
+
419
+ /**
420
+ * When the editor lost focus.
421
+ */
422
+ FocusOut = 3,
423
+ }
424
+
425
+ /**
426
+ * Represents the state of a window.
427
+ */
428
+ export interface WindowState {
429
+
430
+ /**
431
+ * Whether the current window is focused.
432
+ */
433
+ readonly focused: boolean;
434
+ }
435
+
436
+ /**
437
+ * Represents a parameter of a callable-signature. A parameter can
438
+ * have a label and a doc-comment.
439
+ */
440
+ export class ParameterInformation {
441
+
442
+ /**
443
+ * The label of this signature.
444
+ *
445
+ * Either a string or inclusive start and exclusive end offsets within its containing
446
+ * [signature label](#SignatureInformation.label). *Note*: A label of type string must be
447
+ * a substring of its containing signature information's [label](#SignatureInformation.label).
448
+ */
449
+ label: string | [number, number];
450
+
451
+ /**
452
+ * The human-readable doc-comment of this signature. Will be shown
453
+ * in the UI but can be omitted.
454
+ */
455
+ documentation?: string | MarkdownString;
456
+
457
+ /**
458
+ * Creates a new parameter information object.
459
+ *
460
+ * @param label A label string or inclusive start and exclusive end offsets within its containing signature label.
461
+ * @param documentation A doc string.
462
+ */
463
+ constructor(label: string | [number, number], documentation?: string | MarkdownString);
464
+ }
465
+
466
+ /**
467
+ * How a [`SignatureHelpProvider`](#SignatureHelpProvider) was triggered.
468
+ */
469
+ export enum SignatureHelpTriggerKind {
470
+ /**
471
+ * Signature help was invoked manually by the user or by a command.
472
+ */
473
+ Invoke = 1,
474
+
475
+ /**
476
+ * Signature help was triggered by a trigger character.
477
+ */
478
+ TriggerCharacter = 2,
479
+
480
+ /**
481
+ * Signature help was triggered by the cursor moving or by the document content changing.
482
+ */
483
+ ContentChange = 3,
484
+ }
485
+
486
+ /**
487
+ * Additional information about the context in which a
488
+ * [`SignatureHelpProvider`](#SignatureHelpProvider.provideSignatureHelp) was triggered.
489
+ */
490
+ export interface SignatureHelpContext {
491
+ /**
492
+ * Action that caused signature help to be triggered.
493
+ */
494
+ readonly triggerKind: SignatureHelpTriggerKind;
495
+
496
+ /**
497
+ * Character that caused signature help to be triggered.
498
+ *
499
+ * This is `undefined` when signature help is not triggered by typing, such as when manually invoking
500
+ * signature help or when moving the cursor.
501
+ */
502
+ readonly triggerCharacter?: string;
503
+
504
+ /**
505
+ * `true` if signature help was already showing when it was triggered.
506
+ *
507
+ * Retriggers occur when the signature help is already active and can be caused by actions such as
508
+ * typing a trigger character, a cursor move, or document content changes.
509
+ */
510
+ readonly isRetrigger: boolean;
511
+
512
+ /**
513
+ * The currently active [`SignatureHelp`](#SignatureHelp).
514
+ *
515
+ * The `activeSignatureHelp` has its [`SignatureHelp.activeSignature`] field updated based on
516
+ * the user arrowing through available signatures.
517
+ */
518
+ readonly activeSignatureHelp?: SignatureHelp;
519
+ }
520
+
521
+ /**
522
+ * The signature help provider interface defines the contract between extensions and
523
+ * the [parameter hints](https://code.visualstudio.com/docs/editor/intellisense)-feature.
524
+ */
525
+ export interface SignatureHelpProvider {
526
+
527
+ /**
528
+ * Provide help for the signature at the given position and document.
529
+ *
530
+ * @param document The document in which the command was invoked.
531
+ * @param position The position at which the command was invoked.
532
+ * @param token A cancellation token.
533
+ * @param context Information about how signature help was triggered.
534
+ *
535
+ * @return Signature help or a thenable that resolves to such. The lack of a result can be
536
+ * signaled by returning `undefined` or `null`.
537
+ */
538
+ provideSignatureHelp(document: TextDocument, position: Position, token: CancellationToken, context: SignatureHelpContext): ProviderResult<SignatureHelp>;
539
+ }
540
+
541
+ /**
542
+ * Metadata about a registered [`SignatureHelpProvider`](#SignatureHelpProvider).
543
+ */
544
+ export interface SignatureHelpProviderMetadata {
545
+ /**
546
+ * List of characters that trigger signature help.
547
+ */
548
+ readonly triggerCharacters: ReadonlyArray<string>;
549
+
550
+ /**
551
+ * List of characters that re-trigger signature help.
552
+ *
553
+ * These trigger characters are only active when signature help is already showing. All trigger characters
554
+ * are also counted as re-trigger characters.
555
+ */
556
+ readonly retriggerCharacters: ReadonlyArray<string>;
557
+ }
558
+
559
+ /**
560
+ * Represents the signature of something callable. A signature
561
+ * can have a label, like a function-name, a doc-comment, and
562
+ * a set of parameters.
563
+ */
564
+ export class SignatureInformation {
565
+
566
+ /**
567
+ * The label of this signature. Will be shown in
568
+ * the UI.
569
+ */
570
+ label: string;
571
+
572
+ /**
573
+ * The human-readable doc-comment of this signature. Will be shown
574
+ * in the UI but can be omitted.
575
+ */
576
+ documentation?: string | MarkdownString;
577
+
578
+ /**
579
+ * The parameters of this signature.
580
+ */
581
+ parameters: ParameterInformation[];
582
+
583
+ /**
584
+ * The index of the active parameter.
585
+ *
586
+ * If provided, this is used in place of {@linkcode SignatureHelp.activeSignature}.
587
+ */
588
+ activeParameter?: number;
589
+
590
+ /**
591
+ * Creates a new signature information object.
592
+ *
593
+ * @param label A label string.
594
+ * @param documentation A doc string.
595
+ */
596
+ constructor(label: string, documentation?: string | MarkdownString);
597
+ }
598
+
599
+ /**
600
+ * Signature help represents the signature of something
601
+ * callable. There can be multiple signatures but only one
602
+ * active and only one active parameter.
603
+ */
604
+ export class SignatureHelp {
605
+
606
+ /**
607
+ * One or more signatures.
608
+ */
609
+ signatures: SignatureInformation[];
610
+
611
+ /**
612
+ * The active signature.
613
+ */
614
+ activeSignature: number;
615
+
616
+ /**
617
+ * The active parameter of the active signature.
618
+ */
619
+ activeParameter: number;
620
+ }
621
+
622
+ /**
623
+ * Symbol tags are extra annotations that tweak the rendering of a symbol.
624
+ */
625
+ export enum SymbolTag {
626
+
627
+ /**
628
+ * Render a symbol as obsolete, usually using a strike-out.
629
+ */
630
+ Deprecated = 1,
631
+ }
632
+
633
+ /**
634
+ * Represents information about programming constructs like variables, classes,
635
+ * interfaces etc.
636
+ */
637
+ export class SymbolInformation {
638
+
639
+ /**
640
+ * The name of this symbol.
641
+ */
642
+ name: string;
643
+
644
+ /**
645
+ * The name of the symbol containing this symbol.
646
+ */
647
+ containerName: string;
648
+
649
+ /**
650
+ * The kind of this symbol.
651
+ */
652
+ kind: SymbolKind;
653
+
654
+ /**
655
+ * Tags for this symbol.
656
+ */
657
+ tags?: ReadonlyArray<SymbolTag>;
658
+
659
+ /**
660
+ * The location of this symbol.
661
+ */
662
+ location: Location;
663
+
664
+ /**
665
+ * Creates a new symbol information object.
666
+ *
667
+ * @param name The name of the symbol.
668
+ * @param kind The kind of the symbol.
669
+ * @param containerName The name of the symbol containing the symbol.
670
+ * @param location The location of the symbol.
671
+ */
672
+ constructor(name: string, kind: SymbolKind, containerName: string, location: Location);
673
+
674
+ /**
675
+ * ~~Creates a new symbol information object.~~
676
+ *
677
+ * @deprecated Please use the constructor taking a [location](#Location) object.
678
+ *
679
+ * @param name The name of the symbol.
680
+ * @param kind The kind of the symbol.
681
+ * @param range The range of the location of the symbol.
682
+ * @param uri The resource of the location of symbol, defaults to the current document.
683
+ * @param containerName The name of the symbol containing the symbol.
684
+ */
685
+ constructor(name: string, kind: SymbolKind, range: Range, uri?: Uri, containerName?: string);
686
+ }
687
+
688
+ /**
689
+ * A symbol kind.
690
+ */
691
+ export enum SymbolKind {
692
+ File = 0,
693
+ Module = 1,
694
+ Namespace = 2,
695
+ Package = 3,
696
+ Class = 4,
697
+ Method = 5,
698
+ Property = 6,
699
+ Field = 7,
700
+ Constructor = 8,
701
+ Enum = 9,
702
+ Interface = 10,
703
+ Function = 11,
704
+ Variable = 12,
705
+ Constant = 13,
706
+ String = 14,
707
+ Number = 15,
708
+ Boolean = 16,
709
+ Array = 17,
710
+ Object = 18,
711
+ Key = 19,
712
+ Null = 20,
713
+ EnumMember = 21,
714
+ Struct = 22,
715
+ Event = 23,
716
+ Operator = 24,
717
+ TypeParameter = 25,
718
+ }
719
+ /**
720
+ * The version of the editor.
721
+ */
722
+ export const version: string;
723
+
724
+ /**
725
+ * In a remote window the extension kind describes if an extension
726
+ * runs where the UI (window) runs or if an extension runs remotely.
727
+ */
728
+ export enum ExtensionKind {
729
+
730
+ /**
731
+ * Extension runs where the UI runs.
732
+ */
733
+ UI = 1,
734
+
735
+ /**
736
+ * Extension runs where the remote extension host runs.
737
+ */
738
+ Workspace = 2,
739
+ }
740
+
741
+ export interface SelectionRangeProvider {
742
+ /**
743
+ * Provide selection ranges for the given positions.
744
+ *
745
+ * Selection ranges should be computed individually and independend for each position. The editor will merge
746
+ * and deduplicate ranges but providers must return hierarchies of selection ranges so that a range
747
+ * is [contained](#Range.contains) by its parent.
748
+ *
749
+ * @param document The document in which the command was invoked.
750
+ * @param positions The positions at which the command was invoked.
751
+ * @param token A cancellation token.
752
+ * @return Selection ranges or a thenable that resolves to such. The lack of a result can be
753
+ * signaled by returning `undefined` or `null`.
754
+ */
755
+ provideSelectionRanges(document: TextDocument, positions: Position[], token: CancellationToken): ProviderResult<SelectionRange[]>;
756
+ }
757
+ /**
758
+ * Contains additional information about the context in which
759
+ * [completion provider](#CompletionItemProvider.provideCompletionItems) is triggered.
760
+ */
761
+ export interface CompletionContext {
762
+ /**
763
+ * How the completion was triggered.
764
+ */
765
+ readonly triggerKind: CompletionTriggerKind;
766
+
767
+ /**
768
+ * Character that triggered the completion item provider.
769
+ *
770
+ * `undefined` if provider was not triggered by a character.
771
+ *
772
+ * The trigger character is already in the document when the completion provider is triggered.
773
+ */
774
+ readonly triggerCharacter?: string;
775
+ }
776
+
777
+ /**
778
+ * How a [completion provider](#CompletionItemProvider) was triggered
779
+ */
780
+ export enum CompletionTriggerKind {
781
+ /**
782
+ * Completion was triggered normally.
783
+ */
784
+ Invoke = 0,
785
+ /**
786
+ * Completion was triggered by a trigger character.
787
+ */
788
+ TriggerCharacter = 1,
789
+ /**
790
+ * Completion was re-triggered as current completion list is incomplete
791
+ */
792
+ TriggerForIncompleteCompletions = 2,
793
+ }
794
+
795
+ /**
796
+ * Completion item kinds.
797
+ */
798
+ export enum CompletionItemKind {
799
+ Text = 0,
800
+ Method = 1,
801
+ Function = 2,
802
+ Constructor = 3,
803
+ Field = 4,
804
+ Variable = 5,
805
+ Class = 6,
806
+ Interface = 7,
807
+ Module = 8,
808
+ Property = 9,
809
+ Unit = 10,
810
+ Value = 11,
811
+ Enum = 12,
812
+ Keyword = 13,
813
+ Snippet = 14,
814
+ Color = 15,
815
+ Reference = 17,
816
+ File = 16,
817
+ Folder = 18,
818
+ EnumMember = 19,
819
+ Constant = 20,
820
+ Struct = 21,
821
+ Event = 22,
822
+ Operator = 23,
823
+ TypeParameter = 24,
824
+ }
825
+
826
+ /**
827
+ * A workspace edit is a collection of textual and files changes for
828
+ * multiple resources and documents.
829
+ *
830
+ * Use the [applyEdit](#workspace.applyEdit)-function to apply a workspace edit.
831
+ */
832
+ export class WorkspaceEdit {
833
+
834
+ /**
835
+ * The number of affected resources of textual or resource changes.
836
+ */
837
+ readonly size: number;
838
+
839
+ /**
840
+ * Replace the given range with given text for the given resource.
841
+ *
842
+ * @param uri A resource identifier.
843
+ * @param range A range.
844
+ * @param newText A string.
845
+ */
846
+ replace(uri: Uri, range: Range, newText: string): void;
847
+
848
+ /**
849
+ * Insert the given text at the given position.
850
+ *
851
+ * @param uri A resource identifier.
852
+ * @param position A position.
853
+ * @param newText A string.
854
+ */
855
+ insert(uri: Uri, position: Position, newText: string): void;
856
+
857
+ /**
858
+ * Delete the text at the given range.
859
+ *
860
+ * @param uri A resource identifier.
861
+ * @param range A range.
862
+ */
863
+ delete(uri: Uri, range: Range): void;
864
+
865
+ /**
866
+ * Check if a text edit for a resource exists.
867
+ *
868
+ * @param uri A resource identifier.
869
+ * @return `true` if the given resource will be touched by this edit.
870
+ */
871
+ has(uri: Uri): boolean;
872
+
873
+ /**
874
+ * Set (and replace) text edits for a resource.
875
+ *
876
+ * @param uri A resource identifier.
877
+ * @param edits An array of text edits.
878
+ */
879
+ set(uri: Uri, edits: TextEdit[]): void;
880
+
881
+ /**
882
+ * Get the text edits for a resource.
883
+ *
884
+ * @param uri A resource identifier.
885
+ * @return An array of text edits.
886
+ */
887
+ get(uri: Uri): TextEdit[];
888
+
889
+ /**
890
+ * Create a regular file.
891
+ *
892
+ * @param uri Uri of the new file..
893
+ * @param options Defines if an existing file should be overwritten or be
894
+ * ignored. When overwrite and ignoreIfExists are both set overwrite wins.
895
+ */
896
+ createFile(uri: Uri, options?: { overwrite?: boolean, ignoreIfExists?: boolean }): void;
897
+
898
+ /**
899
+ * Delete a file or folder.
900
+ *
901
+ * @param uri The uri of the file that is to be deleted.
902
+ */
903
+ deleteFile(uri: Uri, options?: { recursive?: boolean, ignoreIfNotExists?: boolean }): void;
904
+
905
+ /**
906
+ * Rename a file or folder.
907
+ *
908
+ * @param oldUri The existing file.
909
+ * @param newUri The new location.
910
+ * @param options Defines if existing files should be overwritten or be
911
+ * ignored. When overwrite and ignoreIfExists are both set overwrite wins.
912
+ */
913
+ renameFile(oldUri: Uri, newUri: Uri, options?: { overwrite?: boolean, ignoreIfExists?: boolean }): void;
914
+
915
+ /**
916
+ * Get all text edits grouped by resource.
917
+ *
918
+ * @return A shallow copy of `[Uri, TextEdit[]]`-tuples.
919
+ */
920
+ entries(): [Uri, TextEdit[]][];
921
+ }
922
+
923
+ /**
924
+ * Options for creating a [TreeView](#TreeView)
925
+ */
926
+ export interface TreeViewOptions<T> {
927
+
928
+ /**
929
+ * A data provider that provides tree data.
930
+ */
931
+ treeDataProvider: TreeDataProvider<T>;
932
+
933
+ /**
934
+ * Whether to show collapse all action or not.
935
+ */
936
+ showCollapseAll?: boolean;
937
+
938
+ /**
939
+ * Whether the tree supports multi-select. When the tree supports multi-select and a command is executed from the tree,
940
+ * the first argument to the command is the tree item that the command was executed on and the second argument is an
941
+ * array containing all selected tree items.
942
+ */
943
+ canSelectMany?: boolean;
944
+ }
945
+
946
+ /**
947
+ * The event that is fired when an element in the [TreeView](#TreeView) is expanded or collapsed
948
+ */
949
+ export interface TreeViewExpansionEvent<T> {
950
+
951
+ /**
952
+ * Element that is expanded or collapsed.
953
+ */
954
+ readonly element: T;
955
+
956
+ }
957
+
958
+ /**
959
+ * The event that is fired when there is a change in [tree view's selection](#TreeView.selection)
960
+ */
961
+ export interface TreeViewSelectionChangeEvent<T> {
962
+
963
+ /**
964
+ * Selected elements.
965
+ */
966
+ readonly selection: T[];
967
+
968
+ }
969
+
970
+ /**
971
+ * The event that is fired when there is a change in [tree view's visibility](#TreeView.visible)
972
+ */
973
+ export interface TreeViewVisibilityChangeEvent {
974
+
975
+ /**
976
+ * `true` if the [tree view](#TreeView) is visible otherwise `false`.
977
+ */
978
+ readonly visible: boolean;
979
+
980
+ }
981
+
982
+ /**
983
+ * Represents a Tree view
984
+ */
985
+ export interface TreeView<T> extends Disposable {
986
+
987
+ /**
988
+ * Event that is fired when an element is expanded
989
+ */
990
+ readonly onDidExpandElement: Event<TreeViewExpansionEvent<T>>;
991
+
992
+ /**
993
+ * Event that is fired when an element is collapsed
994
+ */
995
+ readonly onDidCollapseElement: Event<TreeViewExpansionEvent<T>>;
996
+
997
+ /**
998
+ * Currently selected elements.
999
+ */
1000
+ readonly selection: T[];
1001
+
1002
+ /**
1003
+ * Event that is fired when the [selection](#TreeView.selection) has changed
1004
+ */
1005
+ readonly onDidChangeSelection: Event<TreeViewSelectionChangeEvent<T>>;
1006
+
1007
+ /**
1008
+ * `true` if the [tree view](#TreeView) is visible otherwise `false`.
1009
+ */
1010
+ readonly visible: boolean;
1011
+
1012
+ /**
1013
+ * Event that is fired when [visibility](#TreeView.visible) has changed
1014
+ */
1015
+ readonly onDidChangeVisibility: Event<TreeViewVisibilityChangeEvent>;
1016
+
1017
+ /**
1018
+ * Reveals the given element in the tree view.
1019
+ * If the tree view is not visible then the tree view is shown and element is revealed.
1020
+ *
1021
+ * By default revealed element is selected.
1022
+ * In order to not to select, set the option `select` to `false`.
1023
+ * In order to focus, set the option `focus` to `true`.
1024
+ * 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.
1025
+ * **NOTE:** You can expand only to 3 levels maximum.
1026
+ *
1027
+ * **NOTE:** [TreeDataProvider](#TreeDataProvider) is required to implement [getParent](#TreeDataProvider.getParent) method to access this API.
1028
+ */
1029
+ reveal(element: T, options?: { select?: boolean, focus?: boolean, expand?: boolean | number }): Thenable<void>;
1030
+ }
1031
+
1032
+ /**
1033
+ * Collapsible state of the tree item
1034
+ */
1035
+ export enum TreeItemCollapsibleState {
1036
+ /**
1037
+ * Determines an item can be neither collapsed nor expanded. Implies it has no children.
1038
+ */
1039
+ None = 0,
1040
+ /**
1041
+ * Determines an item is collapsed
1042
+ */
1043
+ Collapsed = 1,
1044
+ /**
1045
+ * Determines an item is expanded
1046
+ */
1047
+ Expanded = 2,
1048
+ }
1049
+
1050
+ /**
1051
+ * Label describing the [Tree item](#TreeItem)
1052
+ */
1053
+ export interface TreeItemLabel {
1054
+
1055
+ /**
1056
+ * A human-readable string describing the [Tree item](#TreeItem).
1057
+ */
1058
+ label: string;
1059
+
1060
+ /**
1061
+ * Ranges in the label to highlight. A range is defined as a tuple of two number where the
1062
+ * first is the inclusive start index and the second the exclusive end index
1063
+ */
1064
+ highlights?: [number, number][];
1065
+
1066
+ }
1067
+
1068
+ /**
1069
+ * A data provider that provides tree data
1070
+ */
1071
+ export interface TreeDataProvider<T> {
1072
+ /**
1073
+ * An optional event to signal that an element or root has changed.
1074
+ * This will trigger the view to update the changed element/root and its children recursively (if shown).
1075
+ * To signal that root has changed, do not pass any argument or pass `undefined` or `null`.
1076
+ */
1077
+ onDidChangeTreeData?: Event<T | undefined | null>;
1078
+
1079
+ /**
1080
+ * Get [TreeItem](#TreeItem) representation of the `element`
1081
+ *
1082
+ * @param element The element for which [TreeItem](#TreeItem) representation is asked for.
1083
+ * @return [TreeItem](#TreeItem) representation of the element
1084
+ */
1085
+ getTreeItem(element: T): TreeItem | Thenable<TreeItem>;
1086
+
1087
+ /**
1088
+ * Get the children of `element` or root if no element is passed.
1089
+ *
1090
+ * @param element The element from which the provider gets children. Can be `undefined`.
1091
+ * @return Children of `element` or root if no element is passed.
1092
+ */
1093
+ getChildren(element?: T): ProviderResult<T[]>;
1094
+
1095
+ /**
1096
+ * Optional method to return the parent of `element`.
1097
+ * Return `null` or `undefined` if `element` is a child of root.
1098
+ *
1099
+ * **NOTE:** This method should be implemented in order to access [reveal](#TreeView.reveal) API.
1100
+ *
1101
+ * @param element The element for which the parent has to be returned.
1102
+ * @return Parent of `element`.
1103
+ */
1104
+ getParent?(element: T): ProviderResult<T>;
1105
+
1106
+ /**
1107
+ * Called on hover to resolve the {@link TreeItem.tooltip TreeItem} property if it is undefined.
1108
+ * Called on tree item click/open to resolve the {@link TreeItem.command TreeItem} property if it is undefined.
1109
+ * Only properties that were undefined can be resolved in `resolveTreeItem`.
1110
+ * Functionality may be expanded later to include being called to resolve other missing
1111
+ * properties on selection and/or on open.
1112
+ *
1113
+ * Will only ever be called once per TreeItem.
1114
+ *
1115
+ * onDidChangeTreeData should not be triggered from within resolveTreeItem.
1116
+ *
1117
+ * *Note* that this function is called when tree items are already showing in the UI.
1118
+ * Because of that, no property that changes the presentation (label, description, etc.)
1119
+ * can be changed.
1120
+ *
1121
+ * @param item Undefined properties of `item` should be set then `item` should be returned.
1122
+ * @param element The object associated with the TreeItem.
1123
+ * @param token A cancellation token.
1124
+ * @return The resolved tree item or a thenable that resolves to such. It is OK to return the given
1125
+ * `item`. When no result is returned, the given `item` will be used.
1126
+ */
1127
+ resolveTreeItem?(item: TreeItem, element: T, token: CancellationToken): ProviderResult<TreeItem>;
1128
+ }
1129
+
1130
+ export class TreeItem {
1131
+ /**
1132
+ * A human-readable string describing this item. When `falsy`, it is derived from {@link TreeItem.resourceUri resourceUri}.
1133
+ */
1134
+ label?: string | TreeItemLabel;
1135
+
1136
+ /**
1137
+ * 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.
1138
+ *
1139
+ * 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.
1140
+ */
1141
+ id?: string;
1142
+
1143
+ /**
1144
+ * The icon path or [ThemeIcon](#ThemeIcon) for the tree item.
1145
+ * When `falsy`, [Folder Theme Icon](#ThemeIcon.Folder) is assigned, if item is collapsible otherwise [File Theme Icon](#ThemeIcon.File).
1146
+ * 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).
1147
+ */
1148
+ iconPath?: string | Uri | { light: string | Uri; dark: string | Uri } | ThemeIcon;
1149
+
1150
+ /**
1151
+ * A human readable string which is rendered less prominent.
1152
+ * When `true`, it is derived from [resourceUri](#TreeItem.resourceUri) and when `falsy`, it is not shown.
1153
+ */
1154
+ description?: string | boolean;
1155
+
1156
+ /**
1157
+ * The [uri](#Uri) of the resource representing this item.
1158
+ *
1159
+ * Will be used to derive the [label](#TreeItem.label), when it is not provided.
1160
+ * Will be used to derive the icon from current icon theme, when [iconPath](#TreeItem.iconPath) has [ThemeIcon](#ThemeIcon) value.
1161
+ */
1162
+ resourceUri?: Uri;
1163
+
1164
+ /**
1165
+ * The tooltip text when you hover over this item.
1166
+ */
1167
+ tooltip?: string | undefined;
1168
+
1169
+ /**
1170
+ * The [command](#Command) that should be executed when the tree item is selected.
1171
+ */
1172
+ command?: Command;
1173
+
1174
+ /**
1175
+ * [TreeItemCollapsibleState](#TreeItemCollapsibleState) of the tree item.
1176
+ */
1177
+ collapsibleState?: TreeItemCollapsibleState;
1178
+
1179
+ /**
1180
+ * Context value of the tree item. This can be used to contribute item specific actions in the tree.
1181
+ * For example, a tree item is given a context value as `folder`. When contributing actions to `view/item/context`
1182
+ * using `menus` extension point, you can specify context value for key `viewItem` in `when` expression like `viewItem == folder`.
1183
+ * ```
1184
+ * "contributes": {
1185
+ * "menus": {
1186
+ * "view/item/context": [
1187
+ * {
1188
+ * "command": "extension.deleteFolder",
1189
+ * "when": "viewItem == folder"
1190
+ * }
1191
+ * ]
1192
+ * }
1193
+ * }
1194
+ * ```
1195
+ * This will show action `extension.deleteFolder` only for items with `contextValue` is `folder`.
1196
+ */
1197
+ contextValue?: string;
1198
+
1199
+ /**
1200
+ * Accessibility information used when screen reader interacts with this tree item.
1201
+ * Generally, a TreeItem has no need to set the `role` of the accessibilityInformation;
1202
+ * however, there are cases where a TreeItem is not displayed in a tree-like way where setting the `role` may make sense.
1203
+ */
1204
+ accessibilityInformation?: AccessibilityInformation;
1205
+
1206
+ /**
1207
+ * @param label A human-readable string describing this item
1208
+ * @param collapsibleState {@link TreeItemCollapsibleState} of the tree item. Default is {@link TreeItemCollapsibleState.None}
1209
+ */
1210
+ constructor(label: string | TreeItemLabel, collapsibleState?: TreeItemCollapsibleState);
1211
+
1212
+ /**
1213
+ * @param resourceUri The {@link Uri} of the resource representing this item.
1214
+ * @param collapsibleState {@link TreeItemCollapsibleState} of the tree item. Default is {@link TreeItemCollapsibleState.None}
1215
+ */
1216
+ // tslint:disable unified-signatures
1217
+ constructor(resourceUri: Uri, collapsibleState?: TreeItemCollapsibleState);
1218
+ }
1219
+ /**
1220
+ * Represents a line of text, such as a line of source code.
1221
+ *
1222
+ * TextLine objects are __immutable__. When a [document](#TextDocument) changes,
1223
+ * previously retrieved lines will not represent the latest state.
1224
+ */
1225
+ export interface TextLine {
1226
+
1227
+ /**
1228
+ * The zero-based line number.
1229
+ */
1230
+ readonly lineNumber: number;
1231
+
1232
+ /**
1233
+ * The text of this line without the line separator characters.
1234
+ */
1235
+ readonly text: string;
1236
+
1237
+ /**
1238
+ * The range this line covers without the line separator characters.
1239
+ */
1240
+ readonly range: Range;
1241
+
1242
+ /**
1243
+ * The range this line covers with the line separator characters.
1244
+ */
1245
+ readonly rangeIncludingLineBreak: Range;
1246
+
1247
+ /**
1248
+ * The offset of the first character which is not a whitespace character as defined
1249
+ * by `/\s/`. **Note** that if a line is all whitespace the length of the line is returned.
1250
+ */
1251
+ readonly firstNonWhitespaceCharacterIndex: number;
1252
+
1253
+ /**
1254
+ * Whether this line is whitespace only, shorthand
1255
+ * for [TextLine.firstNonWhitespaceCharacterIndex](#TextLine.firstNonWhitespaceCharacterIndex) === [TextLine.text.length](#TextLine.text).
1256
+ */
1257
+ readonly isEmptyOrWhitespace: boolean;
1258
+ }
1259
+ /**
1260
+ * Represents a text document, such as a source file. Text documents have
1261
+ * [lines](#TextLine) and knowledge about an underlying resource like a file.
1262
+ */
1263
+ export interface TextDocument {
1264
+
1265
+ /**
1266
+ * The associated uri for this document.
1267
+ *
1268
+ * *Note* that most documents use the `file`-scheme, which means they are files on disk. However, **not** all documents are
1269
+ * saved on disk and therefore the `scheme` must be checked before trying to access the underlying file or siblings on disk.
1270
+ *
1271
+ * @see [FileSystemProvider](#FileSystemProvider)
1272
+ * @see [TextDocumentContentProvider](#TextDocumentContentProvider)
1273
+ */
1274
+ readonly uri: Uri;
1275
+
1276
+ /**
1277
+ * The file system path of the associated resource. Shorthand
1278
+ * notation for [TextDocument.uri.fsPath](#TextDocument.uri). Independent of the uri scheme.
1279
+ */
1280
+ readonly fileName: string;
1281
+
1282
+ /**
1283
+ * Is this document representing an untitled file which has never been saved yet. *Note* that
1284
+ * this does not mean the document will be saved to disk, use [`uri.scheme`](#Uri.scheme)
1285
+ * to figure out where a document will be [saved](#FileSystemProvider), e.g. `file`, `ftp` etc.
1286
+ */
1287
+ readonly isUntitled: boolean;
1288
+
1289
+ /**
1290
+ * The identifier of the language associated with this document.
1291
+ */
1292
+ readonly languageId: string;
1293
+
1294
+ /**
1295
+ * The version number of this document (it will strictly increase after each
1296
+ * change, including undo/redo).
1297
+ */
1298
+ readonly version: number;
1299
+
1300
+ /**
1301
+ * `true` if there are unpersisted changes.
1302
+ */
1303
+ readonly isDirty: boolean;
1304
+
1305
+ /**
1306
+ * `true` if the document have been closed. A closed document isn't synchronized anymore
1307
+ * and won't be re-used when the same resource is opened again.
1308
+ */
1309
+ readonly isClosed: boolean;
1310
+
1311
+ /**
1312
+ * Save the underlying file.
1313
+ *
1314
+ * @return A promise that will resolve to true when the file
1315
+ * has been saved. If the file was not dirty or the save failed,
1316
+ * will return false.
1317
+ */
1318
+ save(): Thenable<boolean>;
1319
+
1320
+ /**
1321
+ * The [end of line](#EndOfLine) sequence that is predominately
1322
+ * used in this document.
1323
+ */
1324
+ readonly eol: EndOfLine;
1325
+
1326
+ /**
1327
+ * The number of lines in this document.
1328
+ */
1329
+ readonly lineCount: number;
1330
+
1331
+ /**
1332
+ * Returns a text line denoted by the position. Note
1333
+ * that the returned object is *not* live and changes to the
1334
+ * document are not reflected.
1335
+ *
1336
+ * The position will be [adjusted](#TextDocument.validatePosition).
1337
+ *
1338
+ * @see [TextDocument.lineAt](#TextDocument.lineAt)
1339
+ * @param position A position.
1340
+ * @return A [line](#TextLine).
1341
+ */
1342
+ lineAt(position: Position | number): TextLine;
1343
+
1344
+ /**
1345
+ * Converts the position to a zero-based offset.
1346
+ *
1347
+ * The position will be [adjusted](#TextDocument.validatePosition).
1348
+ *
1349
+ * @param position A position.
1350
+ * @return A valid zero-based offset.
1351
+ */
1352
+ offsetAt(position: Position): number;
1353
+
1354
+ /**
1355
+ * Converts a zero-based offset to a position.
1356
+ *
1357
+ * @param offset A zero-based offset.
1358
+ * @return A valid [position](#Position).
1359
+ */
1360
+ positionAt(offset: number): Position;
1361
+
1362
+ /**
1363
+ * Get the text of this document. A substring can be retrieved by providing
1364
+ * a range. The range will be [adjusted](#TextDocument.validateRange).
1365
+ *
1366
+ * @param range Include only the text included by the range.
1367
+ * @return The text inside the provided range or the entire text.
1368
+ */
1369
+ getText(range?: Range): string;
1370
+
1371
+ /**
1372
+ * Get a word-range at the given position. By default words are defined by
1373
+ * common separators, like space, -, _, etc. In addition, per language custom
1374
+ * [word definitions](#LanguageConfiguration.wordPattern) can be defined. It
1375
+ * is also possible to provide a custom regular expression.
1376
+ *
1377
+ * * *Note 1:* A custom regular expression must not match the empty string and
1378
+ * if it does, it will be ignored.
1379
+ * * *Note 2:* A custom regular expression will fail to match multiline strings
1380
+ * and in the name of speed regular expressions should not match words with
1381
+ * spaces. Use [`TextLine.text`](#TextLine.text) for more complex, non-wordy, scenarios.
1382
+ *
1383
+ * The position will be [adjusted](#TextDocument.validatePosition).
1384
+ *
1385
+ * @param position A position.
1386
+ * @param regex Optional regular expression that describes what a word is.
1387
+ * @return A range spanning a word, or `undefined`.
1388
+ */
1389
+ getWordRangeAtPosition(position: Position, regex?: RegExp): Range | undefined;
1390
+
1391
+ /**
1392
+ * Ensure a range is completely contained in this document.
1393
+ *
1394
+ * @param range A range.
1395
+ * @return The given range or a new, adjusted range.
1396
+ */
1397
+ validateRange(range: Range): Range;
1398
+
1399
+ /**
1400
+ * Ensure a position is contained in the range of this document.
1401
+ *
1402
+ * @param position A position.
1403
+ * @return The given position or a new, adjusted position.
1404
+ */
1405
+ validatePosition(position: Position): Position;
1406
+ }
1407
+
1408
+ /**
1409
+ * Represents a text selection in an editor.
1410
+ */
1411
+ export class Selection extends Range {
1412
+
1413
+ /**
1414
+ * The position at which the selection starts.
1415
+ * This position might be before or after [active](#Selection.active).
1416
+ */
1417
+ anchor: Position;
1418
+
1419
+ /**
1420
+ * The position of the cursor.
1421
+ * This position might be before or after [anchor](#Selection.anchor).
1422
+ */
1423
+ active: Position;
1424
+
1425
+ /**
1426
+ * Create a selection from two positions.
1427
+ *
1428
+ * @param anchor A position.
1429
+ * @param active A position.
1430
+ */
1431
+ constructor(anchor: Position, active: Position);
1432
+
1433
+ /**
1434
+ * Create a selection from four coordinates.
1435
+ *
1436
+ * @param anchorLine A zero-based line value.
1437
+ * @param anchorCharacter A zero-based character value.
1438
+ * @param activeLine A zero-based line value.
1439
+ * @param activeCharacter A zero-based character value.
1440
+ */
1441
+ constructor(anchorLine: number, anchorCharacter: number, activeLine: number, activeCharacter: number);
1442
+
1443
+ /**
1444
+ * A selection is reversed if [active](#Selection.active).isBefore([anchor](#Selection.anchor)).
1445
+ */
1446
+ isReversed: boolean;
1447
+ }
1448
+
1449
+ /**
1450
+ * A complex edit that will be applied in one transaction on a TextEditor.
1451
+ * 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.)
1452
+ * they can be applied on a [document](#TextDocument) associated with a [text editor](#TextEditor).
1453
+ *
1454
+ */
1455
+
1456
+ /**
1457
+ * A universal resource identifier representing either a file on disk
1458
+ * or another resource, like untitled resources.
1459
+ */
1460
+ export class Uri {
1461
+
1462
+ /**
1463
+ * Create an URI from a string, e.g. `http://www.msft.com/some/path`,
1464
+ * `file:///usr/home`, or `scheme:with/path`.
1465
+ *
1466
+ * *Note* that for a while uris without a `scheme` were accepted. That is not correct
1467
+ * as all uris should have a scheme. To avoid breakage of existing code the optional
1468
+ * `strict`-argument has been added. We *strongly* advise to use it, e.g. `Uri.parse('my:uri', true)`
1469
+ *
1470
+ * @see [Uri.toString](#Uri.toString)
1471
+ * @param value The string value of an Uri.
1472
+ * @param strict Throw an error when `value` is empty or when no `scheme` can be parsed.
1473
+ * @return A new Uri instance.
1474
+ */
1475
+ static parse(value: string, strict?: boolean): Uri;
1476
+
1477
+ /**
1478
+ * Create an URI from a file system path. The [scheme](#Uri.scheme)
1479
+ * will be `file`.
1480
+ *
1481
+ * The *difference* between `Uri#parse` and `Uri#file` is that the latter treats the argument
1482
+ * as path, not as stringified-uri. E.g. `Uri.file(path)` is *not* the same as
1483
+ * `Uri.parse('file://' + path)` because the path might contain characters that are
1484
+ * interpreted (# and ?). See the following sample:
1485
+ * ```ts
1486
+ const good = URI.file('/coding/c#/project1');
1487
+ good.scheme === 'file';
1488
+ good.path === '/coding/c#/project1';
1489
+ good.fragment === '';
1490
+
1491
+ const bad = URI.parse('file://' + '/coding/c#/project1');
1492
+ bad.scheme === 'file';
1493
+ bad.path === '/coding/c'; // path is now broken
1494
+ bad.fragment === '/project1';
1495
+ ```
1496
+ *
1497
+ * @param path A file system or UNC path.
1498
+ * @return A new Uri instance.
1499
+ */
1500
+ static file(path: string): Uri;
1501
+
1502
+ /**
1503
+ * Use the `file` and `parse` factory functions to create new `Uri` objects.
1504
+ */
1505
+ private constructor(scheme: string, authority: string, path: string, query: string, fragment: string);
1506
+
1507
+ /**
1508
+ * Scheme is the `http` part of `http://www.msft.com/some/path?query#fragment`.
1509
+ * The part before the first colon.
1510
+ */
1511
+ readonly scheme: string;
1512
+
1513
+ /**
1514
+ * Authority is the `www.msft.com` part of `http://www.msft.com/some/path?query#fragment`.
1515
+ * The part between the first double slashes and the next slash.
1516
+ */
1517
+ readonly authority: string;
1518
+
1519
+ /**
1520
+ * Path is the `/some/path` part of `http://www.msft.com/some/path?query#fragment`.
1521
+ */
1522
+ readonly path: string;
1523
+
1524
+ /**
1525
+ * Query is the `query` part of `http://www.msft.com/some/path?query#fragment`.
1526
+ */
1527
+ readonly query: string;
1528
+
1529
+ /**
1530
+ * Fragment is the `fragment` part of `http://www.msft.com/some/path?query#fragment`.
1531
+ */
1532
+ readonly fragment: string;
1533
+
1534
+ /**
1535
+ * The string representing the corresponding file system path of this Uri.
1536
+ *
1537
+ * Will handle UNC paths and normalize windows drive letters to lower-case. Also
1538
+ * uses the platform specific path separator.
1539
+ *
1540
+ * * Will *not* validate the path for invalid characters and semantics.
1541
+ * * Will *not* look at the scheme of this Uri.
1542
+ * * The resulting string shall *not* be used for display purposes but
1543
+ * for disk operations, like `readFile` et al.
1544
+ *
1545
+ * The *difference* to the [`path`](#Uri.path)-property is the use of the platform specific
1546
+ * path separator and the handling of UNC paths. The sample below outlines the difference:
1547
+ * ```ts
1548
+ const u = URI.parse('file://server/c$/folder/file.txt')
1549
+ u.authority === 'server'
1550
+ u.path === '/shares/c$/file.txt'
1551
+ u.fsPath === '\\server\c$\folder\file.txt'
1552
+ ```
1553
+ */
1554
+ readonly fsPath: string;
1555
+
1556
+ /**
1557
+ * Derive a new Uri from this Uri.
1558
+ *
1559
+ * ```ts
1560
+ * let file = Uri.parse('before:some/file/path');
1561
+ * let other = file.with({ scheme: 'after' });
1562
+ * assert.ok(other.toString() === 'after:some/file/path');
1563
+ * ```
1564
+ *
1565
+ * @param change An object that describes a change to this Uri. To unset components use `null` or
1566
+ * the empty string.
1567
+ * @return A new Uri that reflects the given change. Will return `this` Uri if the change
1568
+ * is not changing anything.
1569
+ */
1570
+ with(change: { scheme?: string; authority?: string; path?: string; query?: string; fragment?: string }): Uri;
1571
+
1572
+ /**
1573
+ * Returns a string representation of this Uri. The representation and normalization
1574
+ * of a URI depends on the scheme.
1575
+ *
1576
+ * * The resulting string can be safely used with [Uri.parse](#Uri.parse).
1577
+ * * The resulting string shall *not* be used for display purposes.
1578
+ *
1579
+ * *Note* that the implementation will encode _aggressive_ which often leads to unexpected,
1580
+ * but not incorrect, results. For instance, colons are encoded to `%3A` which might be unexpected
1581
+ * in file-uri. Also `&` and `=` will be encoded which might be unexpected for http-uris. For stability
1582
+ * reasons this cannot be changed anymore. If you suffer from too aggressive encoding you should use
1583
+ * the `skipEncoding`-argument: `uri.toString(true)`.
1584
+ *
1585
+ * @param skipEncoding Do not percentage-encode the result, defaults to `false`. Note that
1586
+ * the `#` and `?` characters occurring in the path will always be encoded.
1587
+ * @returns A string representation of this Uri.
1588
+ */
1589
+ toString(skipEncoding?: boolean): string;
1590
+
1591
+ /**
1592
+ * Returns a JSON representation of this Uri.
1593
+ *
1594
+ * @return An object.
1595
+ */
1596
+ toJSON(): any;
1597
+ }
1598
+
1599
+ /**
1600
+ * Represents a typed event.
1601
+ *
1602
+ * A function that represents an event to which you subscribe by calling it with
1603
+ * a listener function as argument.
1604
+ *
1605
+ * @sample `item.onDidChange(function(event) { console.log("Event happened: " + event); });`
1606
+ */
1607
+ type Event<T> = (listener: (e: T) => any, thisArgs?: any, disposables?: Disposable[]) => Disposable;
1608
+
1609
+ /**
1610
+ * An event emitter can be used to create and manage an [event](#Event) for others
1611
+ * to subscribe to. One emitter always owns one event.
1612
+ *
1613
+ * Use this class if you want to provide event from within your extension, for instance
1614
+ * inside a [TextDocumentContentProvider](#TextDocumentContentProvider) or when providing
1615
+ * API to other extensions.
1616
+ */
1617
+ export class EventEmitter<T> {
1618
+
1619
+ /**
1620
+ * The event listeners can subscribe to.
1621
+ */
1622
+ event: Event<T>;
1623
+
1624
+ /**
1625
+ * Notify all subscribers of the [event](#EventEmitter.event). Failure
1626
+ * of one or more listener will not fail this function call.
1627
+ *
1628
+ * @param data The event object.
1629
+ */
1630
+ fire(data?: T): void;
1631
+
1632
+ /**
1633
+ * Dispose this object and free resources.
1634
+ */
1635
+ dispose(): void;
1636
+ }
1637
+
1638
+ /**
1639
+ * A cancellation token is passed to an asynchronous or long running
1640
+ * operation to request cancellation, like cancelling a request
1641
+ * for completion items because the user continued to type.
1642
+ *
1643
+ * To get an instance of a `CancellationToken` use a
1644
+ * [CancellationTokenSource](#CancellationTokenSource).
1645
+ */
1646
+ export interface CancellationToken {
1647
+
1648
+ /**
1649
+ * Is `true` when the token has been cancelled, `false` otherwise.
1650
+ */
1651
+ isCancellationRequested: boolean;
1652
+
1653
+ /**
1654
+ * An [event](#Event) which fires upon cancellation.
1655
+ */
1656
+ onCancellationRequested: Event<any>;
1657
+ }
1658
+
1659
+ /**
1660
+ * A cancellation source creates and controls a [cancellation token](#CancellationToken).
1661
+ * @墨蛰
1662
+ *
1663
+ */
1664
+ export class CancellationTokenSource {
1665
+
1666
+ /**
1667
+ * The cancellation token of this source.
1668
+ */
1669
+ token: CancellationToken;
1670
+
1671
+ /**
1672
+ * Signal cancellation on the token.
1673
+ */
1674
+ cancel(): void;
1675
+
1676
+ /**
1677
+ * Dispose object and free resources.
1678
+ */
1679
+ dispose(): void;
1680
+ }
1681
+
1682
+ /**
1683
+ * An event describing a transactional [document](#TextDocument) change.
1684
+ */
1685
+ export interface TextDocumentChangeEvent {
1686
+
1687
+ /**
1688
+ * The affected document.
1689
+ */
1690
+ readonly document: TextDocument;
1691
+
1692
+ /**
1693
+ * An array of content changes.
1694
+ */
1695
+ readonly contentChanges: ReadonlyArray<TextDocumentContentChangeEvent>;
1696
+ }
1697
+
1698
+ /**
1699
+ * Represents a related message and source code location for a diagnostic. This should be
1700
+ * used to point to code locations that cause or related to a diagnostics, e.g. when duplicating
1701
+ * a symbol in a scope.
1702
+ * @寻壑
1703
+ */
1704
+ export class DiagnosticRelatedInformation {
1705
+
1706
+ /**
1707
+ * The location of this related diagnostic information.
1708
+ */
1709
+ location: Location;
1710
+
1711
+ /**
1712
+ * The message of this related diagnostic information.
1713
+ */
1714
+ message: string;
1715
+
1716
+ /**
1717
+ * Creates a new related diagnostic information object.
1718
+ *
1719
+ * @param location The location.
1720
+ * @param message The message.
1721
+ */
1722
+ constructor(location: Location, message: string);
1723
+ }
1724
+
1725
+ /**
1726
+ * Additional metadata about the type of a diagnostic.
1727
+ */
1728
+ export enum DiagnosticTag {
1729
+ /**
1730
+ * Unused or unnecessary code.
1731
+ *
1732
+ * Diagnostics with this tag are rendered faded out. The amount of fading
1733
+ * is controlled by the `"editorUnnecessaryCode.opacity"` theme color. For
1734
+ * example, `"editorUnnecessaryCode.opacity": "#000000c0"` will render the
1735
+ * code with 75% opacity. For high contrast themes, use the
1736
+ * `"editorUnnecessaryCode.border"` theme color to underline unnecessary code
1737
+ * instead of fading it out.
1738
+ */
1739
+ Unnecessary = 1,
1740
+ Deprecated = 2,
1741
+ }
1742
+
1743
+ /**
1744
+ * Represents the severity of diagnostics.
1745
+ */
1746
+ export enum DiagnosticSeverity {
1747
+
1748
+ /**
1749
+ * Something not allowed by the rules of a language or other means.
1750
+ */
1751
+ Error = 0,
1752
+
1753
+ /**
1754
+ * Something suspicious but allowed.
1755
+ */
1756
+ Warning = 1,
1757
+
1758
+ /**
1759
+ * Something to inform about but not a problem.
1760
+ */
1761
+ Information = 2,
1762
+
1763
+ /**
1764
+ * Something to hint to a better way of doing it, like proposing
1765
+ * a refactoring.
1766
+ */
1767
+ Hint = 3,
1768
+ }
1769
+
1770
+ /**
1771
+ * Represents a diagnostic, such as a compiler error or warning. Diagnostic objects
1772
+ * are only valid in the scope of a file.
1773
+ * @寻壑
1774
+ */
1775
+ export class Diagnostic {
1776
+
1777
+ /**
1778
+ * The range to which this diagnostic applies.
1779
+ */
1780
+ range: Range;
1781
+
1782
+ /**
1783
+ * The human-readable message.
1784
+ */
1785
+ message: string;
1786
+
1787
+ /**
1788
+ * The severity, default is [error](#DiagnosticSeverity.Error).
1789
+ */
1790
+ severity: DiagnosticSeverity;
1791
+
1792
+ /**
1793
+ * A human-readable string describing the source of this
1794
+ * diagnostic, e.g. 'typescript' or 'super lint'.
1795
+ */
1796
+ source?: string;
1797
+
1798
+ /**
1799
+ * A code or identifier for this diagnostic.
1800
+ * Should be used for later processing, e.g. when providing [code actions](#CodeActionContext).
1801
+ */
1802
+ code?: string | number;
1803
+
1804
+ /**
1805
+ * An array of related diagnostic information, e.g. when symbol-names within
1806
+ * a scope collide all definitions can be marked via this property.
1807
+ */
1808
+ relatedInformation?: DiagnosticRelatedInformation[];
1809
+
1810
+ /**
1811
+ * Additional metadata about the diagnostic.
1812
+ */
1813
+ tags?: DiagnosticTag[];
1814
+
1815
+ /**
1816
+ * Creates a new diagnostic object.
1817
+ *
1818
+ * @param range The range to which this diagnostic applies.
1819
+ * @param message The human-readable message.
1820
+ * @param severity The severity, default is [error](#DiagnosticSeverity.Error).
1821
+ */
1822
+ constructor(range: Range, message: string, severity?: DiagnosticSeverity);
1823
+ }
1824
+ /**
1825
+ * Represents a type which can release resources, such
1826
+ * as event listening or a timer.
1827
+ */
1828
+ export class Disposable {
1829
+
1830
+ /**
1831
+ * Combine many disposable-likes into one. Use this method
1832
+ * when having objects with a dispose function which are not
1833
+ * instances of Disposable.
1834
+ *
1835
+ * @param disposableLikes Objects that have at least a `dispose`-function member.
1836
+ * @return Returns a new disposable which, upon dispose, will
1837
+ * dispose all provided disposables.
1838
+ */
1839
+ static from(...disposableLikes: { dispose: () => any }[]): Disposable;
1840
+
1841
+ /**
1842
+ * Creates a new Disposable calling the provided function
1843
+ * on dispose.
1844
+ * @param callOnDispose Function that disposes something.
1845
+ */
1846
+ constructor(callOnDispose: () => void);
1847
+
1848
+ /**
1849
+ * Dispose this object.
1850
+ */
1851
+ dispose(): any;
1852
+ }
1853
+
1854
+ /**
1855
+ * Represents an extension.
1856
+ *
1857
+ * To get an instance of an `Extension` use [getExtension](#extensions.getExtension).
1858
+ */
1859
+ export interface Extension<T> {
1860
+
1861
+ /**
1862
+ * The canonical extension identifier in the form of: `publisher.name`.
1863
+ */
1864
+ readonly id: string;
1865
+
1866
+ /**
1867
+ * The absolute file path of the directory containing this extension.
1868
+ */
1869
+ readonly extensionPath: string;
1870
+
1871
+ /**
1872
+ * `true` if the extension has been activated.
1873
+ */
1874
+ readonly isActive: boolean;
1875
+
1876
+ /**
1877
+ * The parsed contents of the extension's package.json.
1878
+ */
1879
+ readonly packageJSON: any;
1880
+
1881
+ /**
1882
+ * The extension kind describes if an extension runs where the UI runs
1883
+ * or if an extension runs where the remote extension host runs. The extension kind
1884
+ * if defined in the `package.json` file of extensions but can also be refined
1885
+ * via the the `remote.extensionKind`-setting. When no remote extension host exists,
1886
+ * the value is [`ExtensionKind.UI`](#ExtensionKind.UI).
1887
+ */
1888
+ extensionKind: ExtensionKind;
1889
+
1890
+ /**
1891
+ * The public API exported by this extension. It is an invalid action
1892
+ * to access this field before this extension has been activated.
1893
+ */
1894
+ readonly exports: T;
1895
+
1896
+ /**
1897
+ * Activates this extension and returns its public API.
1898
+ *
1899
+ * @return A promise that will resolve when this extension has been activated.
1900
+ */
1901
+ activate(): Thenable<T>;
1902
+ }
1903
+
1904
+ /**
1905
+ * A memento represents a storage utility. It can store and retrieve
1906
+ * values.
1907
+ */
1908
+ export interface Memento {
1909
+
1910
+ /**
1911
+ * Return a value.
1912
+ *
1913
+ * @param key A string.
1914
+ * @return The stored value or `undefined`.
1915
+ */
1916
+ get<T>(key: string): T | undefined;
1917
+
1918
+ /**
1919
+ * Return a value.
1920
+ *
1921
+ * @param key A string.
1922
+ * @param defaultValue A value that should be returned when there is no
1923
+ * value (`undefined`) with the given key.
1924
+ * @return The stored value or the defaultValue.
1925
+ */
1926
+ get<T>(key: string, defaultValue: T): T;
1927
+
1928
+ /**
1929
+ * Store a value. The value must be JSON-stringifyable.
1930
+ *
1931
+ * @param key A string.
1932
+ * @param value A value. MUST not contain cyclic references.
1933
+ */
1934
+ update(key: string, value: any): Thenable<void>;
1935
+ }
1936
+
1937
+ export interface Terminal {
1938
+
1939
+ /**
1940
+ * The name of the terminal.
1941
+ */
1942
+ readonly name: string;
1943
+
1944
+ /**
1945
+ * The process ID of the shell process.
1946
+ */
1947
+ readonly processId: Thenable<number>;
1948
+
1949
+ /**
1950
+ * Send text to the terminal. The text is written to the stdin of the underlying pty process
1951
+ * (shell) of the terminal.
1952
+ *
1953
+ * @param text The text to send.
1954
+ * @param addNewLine Whether to add a new line to the text being sent, this is normally
1955
+ * required to run a command in the terminal. The character(s) added are \n or \r\n
1956
+ * depending on the platform. This defaults to `true`.
1957
+ */
1958
+ sendText(text: string, addNewLine?: boolean): void;
1959
+
1960
+ /**
1961
+ * Show the terminal panel and reveal this terminal in the UI.
1962
+ *
1963
+ * @param preserveFocus When `true` the terminal will not take focus.
1964
+ */
1965
+ show(preserveFocus?: boolean): void;
1966
+
1967
+ /**
1968
+ * Hide the terminal panel if this terminal is currently showing.
1969
+ */
1970
+ hide(): void;
1971
+
1972
+ /**
1973
+ * Dispose and free associated resources.
1974
+ */
1975
+ dispose(): void;
1976
+ }
1977
+
1978
+ // tslint:disable no-empty-interface class-name
1979
+ export interface env { }
1980
+
1981
+ /**
1982
+ * A memento represents a storage utility. It can store and retrieve
1983
+ * values.
1984
+ */
1985
+ export interface Memento {
1986
+
1987
+ /**
1988
+ * Return a value.
1989
+ *
1990
+ * @param key A string.
1991
+ * @return The stored value or `undefined`.
1992
+ */
1993
+ get<T>(key: string): T | undefined;
1994
+
1995
+ /**
1996
+ * Return a value.
1997
+ *
1998
+ * @param key A string.
1999
+ * @param defaultValue A value that should be returned when there is no
2000
+ * value (`undefined`) with the given key.
2001
+ * @return The stored value or the defaultValue.
2002
+ */
2003
+ get<T>(key: string, defaultValue: T): T;
2004
+
2005
+ /**
2006
+ * Store a value. The value must be JSON-stringifyable.
2007
+ *
2008
+ * @param key A string.
2009
+ * @param value A value. MUST not contain cyclic references.
2010
+ */
2011
+ update(key: string, value: any): Thenable<void>;
2012
+ }
2013
+
2014
+ /**
2015
+ * A file system watcher notifies about changes to files and folders
2016
+ * on disk.
2017
+ *
2018
+ * To get an instance of a `FileSystemWatcher` use
2019
+ * [createFileSystemWatcher](#workspace.createFileSystemWatcher).
2020
+ */
2021
+ export interface FileSystemWatcher extends Disposable {
2022
+
2023
+ /**
2024
+ * true if this file system watcher has been created such that
2025
+ * it ignores creation file system events.
2026
+ */
2027
+ ignoreCreateEvents: boolean;
2028
+
2029
+ /**
2030
+ * true if this file system watcher has been created such that
2031
+ * it ignores change file system events.
2032
+ */
2033
+ ignoreChangeEvents: boolean;
2034
+
2035
+ /**
2036
+ * true if this file system watcher has been created such that
2037
+ * it ignores delete file system events.
2038
+ */
2039
+ ignoreDeleteEvents: boolean;
2040
+
2041
+ /**
2042
+ * An event which fires on file/folder creation.
2043
+ */
2044
+ onDidCreate: Event<Uri>;
2045
+
2046
+ /**
2047
+ * An event which fires on file/folder change.
2048
+ */
2049
+ onDidChange: Event<Uri>;
2050
+
2051
+ /**
2052
+ * An event which fires on file/folder deletion.
2053
+ */
2054
+ onDidDelete: Event<Uri>;
2055
+ }
2056
+
2057
+ /**
2058
+ * Enumeration of file types. The types `File` and `Directory` can also be
2059
+ * a symbolic links, in that use `FileType.File | FileType.SymbolicLink` and
2060
+ * `FileType.Directory | FileType.SymbolicLink`.
2061
+ */
2062
+ export enum FileType {
2063
+ /**
2064
+ * The file type is unknown.
2065
+ */
2066
+ Unknown = 0,
2067
+ /**
2068
+ * A regular file.
2069
+ */
2070
+ File = 1,
2071
+ /**
2072
+ * A directory.
2073
+ */
2074
+ Directory = 2,
2075
+ /**
2076
+ * A symbolic link to a file.
2077
+ */
2078
+ SymbolicLink = 64,
2079
+ }
2080
+
2081
+ /**
2082
+ * The `FileStat`-type represents metadata about a file
2083
+ */
2084
+ export interface FileStat {
2085
+ /**
2086
+ * The type of the file, e.g. is a regular file, a directory, or symbolic link
2087
+ * to a file.
2088
+ */
2089
+ type: FileType;
2090
+ /**
2091
+ * The creation timestamp in milliseconds elapsed since January 1, 1970 00:00:00 UTC.
2092
+ */
2093
+ ctime: number;
2094
+ /**
2095
+ * The modification timestamp in milliseconds elapsed since January 1, 1970 00:00:00 UTC.
2096
+ */
2097
+ mtime: number;
2098
+ /**
2099
+ * The size in bytes.
2100
+ */
2101
+ size: number;
2102
+ }
2103
+
2104
+ /**
2105
+ * A type that filesystem providers should use to signal errors.
2106
+ *
2107
+ * This class has factory methods for common error-cases, like `FileNotFound` when
2108
+ * a file or folder doesn't exist, use them like so: `throw vscode.FileSystemError.FileNotFound(someUri);`
2109
+ * @墨蛰
2110
+ */
2111
+ export class FileSystemError extends Error {
2112
+
2113
+ /**
2114
+ * Create an error to signal that a file or folder wasn't found.
2115
+ * @param messageOrUri Message or uri.
2116
+ */
2117
+ static FileNotFound(messageOrUri?: string | Uri): FileSystemError;
2118
+
2119
+ /**
2120
+ * Create an error to signal that a file or folder already exists, e.g. when
2121
+ * creating but not overwriting a file.
2122
+ * @param messageOrUri Message or uri.
2123
+ */
2124
+ static FileExists(messageOrUri?: string | Uri): FileSystemError;
2125
+
2126
+ /**
2127
+ * Create an error to signal that a file is not a folder.
2128
+ * @param messageOrUri Message or uri.
2129
+ */
2130
+ static FileNotADirectory(messageOrUri?: string | Uri): FileSystemError;
2131
+
2132
+ /**
2133
+ * Create an error to signal that a file is a folder.
2134
+ * @param messageOrUri Message or uri.
2135
+ */
2136
+ static FileIsADirectory(messageOrUri?: string | Uri): FileSystemError;
2137
+
2138
+ /**
2139
+ * Create an error to signal that an operation lacks required permissions.
2140
+ * @param messageOrUri Message or uri.
2141
+ */
2142
+ static NoPermissions(messageOrUri?: string | Uri): FileSystemError;
2143
+
2144
+ /**
2145
+ * Create an error to signal that the file system is unavailable or too busy to
2146
+ * complete a request.
2147
+ * @param messageOrUri Message or uri.
2148
+ */
2149
+ static Unavailable(messageOrUri?: string | Uri): FileSystemError;
2150
+
2151
+ /**
2152
+ * Creates a new filesystem error.
2153
+ *
2154
+ * @param messageOrUri Message or uri.
2155
+ */
2156
+ constructor(messageOrUri?: string | Uri);
2157
+ }
2158
+
2159
+ /**
2160
+ * Enumeration of file change types.
2161
+ */
2162
+ export enum FileChangeType {
2163
+
2164
+ /**
2165
+ * The contents or metadata of a file have changed.
2166
+ */
2167
+ Changed = 1,
2168
+
2169
+ /**
2170
+ * A file has been created.
2171
+ */
2172
+ Created = 2,
2173
+
2174
+ /**
2175
+ * A file has been deleted.
2176
+ */
2177
+ Deleted = 3,
2178
+ }
2179
+
2180
+ /**
2181
+ * The event filesystem providers must use to signal a file change.
2182
+ */
2183
+ export interface FileChangeEvent {
2184
+
2185
+ /**
2186
+ * The type of change.
2187
+ */
2188
+ readonly type: FileChangeType;
2189
+
2190
+ /**
2191
+ * The uri of the file that has changed.
2192
+ */
2193
+ readonly uri: Uri;
2194
+ }
2195
+
2196
+ /**
2197
+ * The filesystem provider defines what the editor needs to read, write, discover,
2198
+ * and to manage files and folders. It allows extensions to serve files from remote places,
2199
+ * like ftp-servers, and to seamlessly integrate those into the editor.
2200
+ *
2201
+ * * *Note 1:* The filesystem provider API works with [uris](#Uri) and assumes hierarchical
2202
+ * paths, e.g. `foo:/my/path` is a child of `foo:/my/` and a parent of `foo:/my/path/deeper`.
2203
+ * * *Note 2:* There is an activation event `onFileSystem:<scheme>` that fires when a file
2204
+ * or folder is being accessed.
2205
+ * * *Note 3:* The word 'file' is often used to denote all [kinds](#FileType) of files, e.g.
2206
+ * folders, symbolic links, and regular files.
2207
+ */
2208
+ export interface FileSystemProvider {
2209
+
2210
+ /**
2211
+ * An event to signal that a resource has been created, changed, or deleted. This
2212
+ * event should fire for resources that are being [watched](#FileSystemProvider.watch)
2213
+ * by clients of this provider.
2214
+ */
2215
+ readonly onDidChangeFile: Event<FileChangeEvent[]>;
2216
+
2217
+ /**
2218
+ * Subscribe to events in the file or folder denoted by `uri`.
2219
+ *
2220
+ * The editor will call this function for files and folders. In the latter case, the
2221
+ * options differ from defaults, e.g. what files/folders to exclude from watching
2222
+ * and if subfolders, sub-subfolder, etc. should be watched (`recursive`).
2223
+ *
2224
+ * @param uri The uri of the file to be watched.
2225
+ * @param options Configures the watch.
2226
+ * @returns A disposable that tells the provider to stop watching the `uri`.
2227
+ */
2228
+ watch(uri: Uri, options: { recursive: boolean; excludes: string[] }): Disposable;
2229
+
2230
+ /**
2231
+ * Retrieve metadata about a file.
2232
+ *
2233
+ * Note that the metadata for symbolic links should be the metadata of the file they refer to.
2234
+ * Still, the [SymbolicLink](#FileType.SymbolicLink)-type must be used in addition to the actual type, e.g.
2235
+ * `FileType.SymbolicLink | FileType.Directory`.
2236
+ *
2237
+ * @param uri The uri of the file to retrieve metadata about.
2238
+ * @return The file metadata about the file.
2239
+ * @throws [`FileNotFound`](#FileSystemError.FileNotFound) when `uri` doesn't exist.
2240
+ */
2241
+ stat(uri: Uri): FileStat | Thenable<FileStat>;
2242
+
2243
+ /**
2244
+ * Retrieve all entries of a [directory](#FileType.Directory).
2245
+ *
2246
+ * @param uri The uri of the folder.
2247
+ * @return An array of name/type-tuples or a thenable that resolves to such.
2248
+ * @throws [`FileNotFound`](#FileSystemError.FileNotFound) when `uri` doesn't exist.
2249
+ */
2250
+ readDirectory(uri: Uri): [string, FileType][] | Thenable<[string, FileType][]>;
2251
+
2252
+ /**
2253
+ * Create a new directory (Note, that new files are created via `write`-calls).
2254
+ *
2255
+ * @param uri The uri of the new folder.
2256
+ * @throws [`FileNotFound`](#FileSystemError.FileNotFound) when the parent of `uri` doesn't exist, e.g. no mkdirp-logic required.
2257
+ * @throws [`FileExists`](#FileSystemError.FileExists) when `uri` already exists.
2258
+ * @throws [`NoPermissions`](#FileSystemError.NoPermissions) when permissions aren't sufficient.
2259
+ */
2260
+ createDirectory(uri: Uri): void | Thenable<void>;
2261
+
2262
+ /**
2263
+ * Read the entire contents of a file.
2264
+ *
2265
+ * @param uri The uri of the file.
2266
+ * @return An array of bytes or a thenable that resolves to such.
2267
+ * @throws [`FileNotFound`](#FileSystemError.FileNotFound) when `uri` doesn't exist.
2268
+ */
2269
+ readFile(uri: Uri): Uint8Array | Thenable<Uint8Array>;
2270
+
2271
+ /**
2272
+ * Write data to a file, replacing its entire contents.
2273
+ *
2274
+ * @param uri The uri of the file.
2275
+ * @param content The new content of the file.
2276
+ * @param options Defines if missing files should or must be created.
2277
+ * @throws [`FileNotFound`](#FileSystemError.FileNotFound) when `uri` doesn't exist and `create` is not set.
2278
+ * @throws [`FileNotFound`](#FileSystemError.FileNotFound) when the parent of `uri` doesn't exist and `create` is set, e.g. no mkdirp-logic required.
2279
+ * @throws [`FileExists`](#FileSystemError.FileExists) when `uri` already exists, `create` is set but `overwrite` is not set.
2280
+ * @throws [`NoPermissions`](#FileSystemError.NoPermissions) when permissions aren't sufficient.
2281
+ */
2282
+ writeFile(uri: Uri, content: Uint8Array, options: { create: boolean, overwrite: boolean }): void | Thenable<void>;
2283
+
2284
+ /**
2285
+ * Delete a file.
2286
+ *
2287
+ * @param uri The resource that is to be deleted.
2288
+ * @param options Defines if deletion of folders is recursive.
2289
+ * @throws [`FileNotFound`](#FileSystemError.FileNotFound) when `uri` doesn't exist.
2290
+ * @throws [`NoPermissions`](#FileSystemError.NoPermissions) when permissions aren't sufficient.
2291
+ */
2292
+ delete(uri: Uri, options: { recursive: boolean }): void | Thenable<void>;
2293
+
2294
+ /**
2295
+ * Rename a file or folder.
2296
+ *
2297
+ * @param oldUri The existing file.
2298
+ * @param newUri The new location.
2299
+ * @param options Defines if existing files should be overwritten.
2300
+ * @throws [`FileNotFound`](#FileSystemError.FileNotFound) when `oldUri` doesn't exist.
2301
+ * @throws [`FileNotFound`](#FileSystemError.FileNotFound) when parent of `newUri` doesn't exist, e.g. no mkdirp-logic required.
2302
+ * @throws [`FileExists`](#FileSystemError.FileExists) when `newUri` exists and when the `overwrite` option is not `true`.
2303
+ * @throws [`NoPermissions`](#FileSystemError.NoPermissions) when permissions aren't sufficient.
2304
+ */
2305
+ rename(oldUri: Uri, newUri: Uri, options: { overwrite: boolean }): void | Thenable<void>;
2306
+
2307
+ /**
2308
+ * Copy files or folders. Implementing this function is optional but it will speedup
2309
+ * the copy operation.
2310
+ *
2311
+ * @param source The existing file.
2312
+ * @param destination The destination location.
2313
+ * @param options Defines if existing files should be overwritten.
2314
+ * @throws [`FileNotFound`](#FileSystemError.FileNotFound) when `source` doesn't exist.
2315
+ * @throws [`FileNotFound`](#FileSystemError.FileNotFound) when parent of `destination` doesn't exist, e.g. no mkdirp-logic required.
2316
+ * @throws [`FileExists`](#FileSystemError.FileExists) when `destination` exists and when the `overwrite` option is not `true`.
2317
+ * @throws [`NoPermissions`](#FileSystemError.NoPermissions) when permissions aren't sufficient.
2318
+ */
2319
+ copy?(source: Uri, destination: Uri, options: { overwrite: boolean }): void | Thenable<void>;
2320
+ }
2321
+
2322
+ export interface FileSystem {
2323
+ stat(uri: Uri): Thenable<FileStat>;
2324
+ readDirectory(uri: Uri): Thenable<[string, FileType][]>;
2325
+ createDirectory(uri: Uri): Thenable<void>;
2326
+ readFile(uri: Uri): Thenable<Uint8Array>;
2327
+ writeFile(uri: Uri, content: Uint8Array, options?: { create: boolean, overwrite: boolean }): Thenable<void>;
2328
+ delete(uri: Uri, options?: { recursive: boolean }): Thenable<void>;
2329
+ rename(source: Uri, target: Uri, options?: { overwrite: boolean }): Thenable<void>;
2330
+ copy(source: Uri, target: Uri, options?: { overwrite: boolean }): Thenable<void>;
2331
+ }
2332
+
2333
+ /**
2334
+ * Represents the configuration. It is a merged view of
2335
+ *
2336
+ * - Default configuration
2337
+ * - Global configuration
2338
+ * - Workspace configuration (if available)
2339
+ * - Workspace folder configuration of the requested resource (if available)
2340
+ *
2341
+ * *Global configuration* comes from User Settings and shadows Defaults.
2342
+ *
2343
+ * *Workspace configuration* comes from Workspace Settings and shadows Global configuration.
2344
+ *
2345
+ * *Workspace Folder configuration* comes from `.vscode` folder under one of the [workspace folders](#workspace.workspaceFolders).
2346
+ *
2347
+ * *Note:* Workspace and Workspace Folder configurations contains `launch` and `tasks` settings. Their basename will be
2348
+ * part of the section identifier. The following snippets shows how to retrieve all configurations
2349
+ * from `launch.json`:
2350
+ *
2351
+ * ```ts
2352
+ * // launch.json configuration
2353
+ * const config = workspace.getConfiguration('launch', vscode.window.activeTextEditor.document.uri);
2354
+ *
2355
+ * // retrieve values
2356
+ * const values = config.get('configurations');
2357
+ * ```
2358
+ *
2359
+ * Refer to [Settings](https://code.visualstudio.com/docs/getstarted/settings) for more information.
2360
+ */
2361
+
2362
+ /**
2363
+ * An output channel is a container for readonly textual information.
2364
+ *
2365
+ * To get an instance of an `OutputChannel` use
2366
+ * [createOutputChannel](#window.createOutputChannel).
2367
+ */
2368
+ /**
2369
+ * Defines a generalized way of reporting progress updates.
2370
+ */
2371
+ export interface Progress<T> {
2372
+
2373
+ /**
2374
+ * Report a progress update.
2375
+ * @param value A progress item, like a message and/or an
2376
+ * report on how much work finished
2377
+ */
2378
+ report(value: T): void;
2379
+ }
2380
+
2381
+ /**
2382
+ * A location in the editor at which progress information can be shown. It depends on the
2383
+ * location how progress is visually represented.
2384
+ */
2385
+ export enum ProgressLocation {
2386
+
2387
+ /**
2388
+ * Show progress for the source control viewlet, as overlay for the icon and as progress bar
2389
+ * inside the viewlet (when visible). Neither supports cancellation nor discrete progress.
2390
+ */
2391
+ SourceControl = 1,
2392
+
2393
+ /**
2394
+ * Show progress in the status bar of the editor. Neither supports cancellation nor discrete progress.
2395
+ */
2396
+ Window = 10,
2397
+
2398
+ /**
2399
+ * Show progress as notification with an optional cancel button. Supports to show infinite and discrete progress.
2400
+ */
2401
+ Notification = 15,
2402
+ }
2403
+
2404
+ /**
2405
+ * Value-object describing where and how progress should show.
2406
+ */
2407
+ export interface ProgressOptions {
2408
+
2409
+ /**
2410
+ * The location at which progress should show.
2411
+ */
2412
+ location: ProgressLocation;
2413
+
2414
+ /**
2415
+ * A human-readable string which will be used to describe the
2416
+ * operation.
2417
+ */
2418
+ title?: string;
2419
+
2420
+ /**
2421
+ * Controls if a cancel button should show to allow the user to
2422
+ * cancel the long running operation. Note that currently only
2423
+ * `ProgressLocation.Notification` is supporting to show a cancel
2424
+ * button.
2425
+ */
2426
+ cancellable?: boolean;
2427
+ }
2428
+
2429
+ /**
2430
+ * A reference to one of the workbench colors as defined in https://code.visualstudio.com/docs/getstarted/theme-color-reference.
2431
+ * Using a theme color is preferred over a custom color as it gives theme authors and users the possibility to change the color.
2432
+ */
2433
+ export class ThemeColor {
2434
+
2435
+ /**
2436
+ * Creates a reference to a theme color.
2437
+ * @param id of the color. The available colors are listed in https://code.visualstudio.com/docs/getstarted/theme-color-reference.
2438
+ */
2439
+ constructor(id: string);
2440
+ }
2441
+
2442
+ /**
2443
+ * A reference to a named icon. Currently, [File](#ThemeIcon.File), [Folder](#ThemeIcon.Folder),
2444
+ * and [ThemeIcon ids](https://code.visualstudio.com/api/references/icons-in-labels#icon-listing) are supported.
2445
+ * Using a theme icon is preferred over a custom icon as it gives product theme authors the possibility to change the icons.
2446
+ *
2447
+ * *Note* that theme icons can also be rendered inside labels and descriptions. Places that support theme icons spell this out
2448
+ * and they use the `$(<name>)`-syntax, for instance `quickPick.label = "Hello World $(globe)"`.
2449
+ */
2450
+ export class ThemeIcon {
2451
+ /**
2452
+ * Reference to an icon representing a file. The icon is taken from the current file icon theme or a placeholder icon is used.
2453
+ */
2454
+ static readonly File: ThemeIcon;
2455
+
2456
+ /**
2457
+ * Reference to an icon representing a folder. The icon is taken from the current file icon theme or a placeholder icon is used.
2458
+ */
2459
+ static readonly Folder: ThemeIcon;
2460
+
2461
+ /**
2462
+ * The id of the icon. The available icons are listed in https://code.visualstudio.com/api/references/icons-in-labels#icon-listing.
2463
+ */
2464
+ readonly id: string;
2465
+
2466
+ /**
2467
+ * The optional ThemeColor of the icon. The color is currently only used in [TreeItem](#TreeItem).
2468
+ */
2469
+ readonly color?: ThemeColor;
2470
+
2471
+ /**
2472
+ * Creates a reference to a theme icon.
2473
+ * @param id id of the icon. The available icons are listed in https://code.visualstudio.com/api/references/icons-in-labels#icon-listing.
2474
+ * @param color optional `ThemeColor` for the icon. The color is currently only used in [TreeItem](#TreeItem).
2475
+ */
2476
+ constructor(id: string, color?: ThemeColor);
2477
+ }
2478
+
2479
+ /**
2480
+ * Represents theme specific rendering styles for a [text editor decoration](#TextEditorDecorationType).
2481
+ */
2482
+ export interface ThemableDecorationRenderOptions {
2483
+ /**
2484
+ * Background color of the decoration. Use rgba() and define transparent background colors to play well with other decorations.
2485
+ * Alternatively a color from the color registry can be [referenced](#ThemeColor).
2486
+ */
2487
+ backgroundColor?: string | ThemeColor;
2488
+
2489
+ /**
2490
+ * CSS styling property that will be applied to text enclosed by a decoration.
2491
+ */
2492
+ outline?: string;
2493
+
2494
+ /**
2495
+ * CSS styling property that will be applied to text enclosed by a decoration.
2496
+ * Better use 'outline' for setting one or more of the individual outline properties.
2497
+ */
2498
+ outlineColor?: string | ThemeColor;
2499
+
2500
+ /**
2501
+ * CSS styling property that will be applied to text enclosed by a decoration.
2502
+ * Better use 'outline' for setting one or more of the individual outline properties.
2503
+ */
2504
+ outlineStyle?: string;
2505
+
2506
+ /**
2507
+ * CSS styling property that will be applied to text enclosed by a decoration.
2508
+ * Better use 'outline' for setting one or more of the individual outline properties.
2509
+ */
2510
+ outlineWidth?: string;
2511
+
2512
+ /**
2513
+ * CSS styling property that will be applied to text enclosed by a decoration.
2514
+ */
2515
+ border?: string;
2516
+
2517
+ /**
2518
+ * CSS styling property that will be applied to text enclosed by a decoration.
2519
+ * Better use 'border' for setting one or more of the individual border properties.
2520
+ */
2521
+ borderColor?: string | ThemeColor;
2522
+
2523
+ /**
2524
+ * CSS styling property that will be applied to text enclosed by a decoration.
2525
+ * Better use 'border' for setting one or more of the individual border properties.
2526
+ */
2527
+ borderRadius?: string;
2528
+
2529
+ /**
2530
+ * CSS styling property that will be applied to text enclosed by a decoration.
2531
+ * Better use 'border' for setting one or more of the individual border properties.
2532
+ */
2533
+ borderSpacing?: string;
2534
+
2535
+ /**
2536
+ * CSS styling property that will be applied to text enclosed by a decoration.
2537
+ * Better use 'border' for setting one or more of the individual border properties.
2538
+ */
2539
+ borderStyle?: string;
2540
+
2541
+ /**
2542
+ * CSS styling property that will be applied to text enclosed by a decoration.
2543
+ * Better use 'border' for setting one or more of the individual border properties.
2544
+ */
2545
+ borderWidth?: string;
2546
+
2547
+ /**
2548
+ * CSS styling property that will be applied to text enclosed by a decoration.
2549
+ */
2550
+ fontStyle?: string;
2551
+
2552
+ /**
2553
+ * CSS styling property that will be applied to text enclosed by a decoration.
2554
+ */
2555
+ fontWeight?: string;
2556
+
2557
+ /**
2558
+ * CSS styling property that will be applied to text enclosed by a decoration.
2559
+ */
2560
+ textDecoration?: string;
2561
+
2562
+ /**
2563
+ * CSS styling property that will be applied to text enclosed by a decoration.
2564
+ */
2565
+ cursor?: string;
2566
+
2567
+ /**
2568
+ * CSS styling property that will be applied to text enclosed by a decoration.
2569
+ */
2570
+ color?: string | ThemeColor;
2571
+
2572
+ /**
2573
+ * CSS styling property that will be applied to text enclosed by a decoration.
2574
+ */
2575
+ opacity?: string;
2576
+
2577
+ /**
2578
+ * CSS styling property that will be applied to text enclosed by a decoration.
2579
+ */
2580
+ letterSpacing?: string;
2581
+
2582
+ /**
2583
+ * An **absolute path** or an URI to an image to be rendered in the gutter.
2584
+ */
2585
+ gutterIconPath?: string | Uri;
2586
+
2587
+ /**
2588
+ * Specifies the size of the gutter icon.
2589
+ * Available values are 'auto', 'contain', 'cover' and any percentage value.
2590
+ * For further information: https://msdn.microsoft.com/en-us/library/jj127316(v=vs.85).aspx
2591
+ */
2592
+ gutterIconSize?: string;
2593
+
2594
+ /**
2595
+ * The color of the decoration in the overview ruler. Use rgba() and define transparent colors to play well with other decorations.
2596
+ */
2597
+ overviewRulerColor?: string | ThemeColor;
2598
+
2599
+ /**
2600
+ * Defines the rendering options of the attachment that is inserted before the decorated text.
2601
+ */
2602
+ before?: ThemableDecorationAttachmentRenderOptions;
2603
+
2604
+ /**
2605
+ * Defines the rendering options of the attachment that is inserted after the decorated text.
2606
+ */
2607
+ after?: ThemableDecorationAttachmentRenderOptions;
2608
+ }
2609
+
2610
+ export interface ThemableDecorationAttachmentRenderOptions {
2611
+ /**
2612
+ * Defines a text content that is shown in the attachment. Either an icon or a text can be shown, but not both.
2613
+ */
2614
+ contentText?: string;
2615
+ /**
2616
+ * An **absolute path** or an URI to an image to be rendered in the attachment. Either an icon
2617
+ * or a text can be shown, but not both.
2618
+ */
2619
+ contentIconPath?: string | Uri;
2620
+ /**
2621
+ * CSS styling property that will be applied to the decoration attachment.
2622
+ */
2623
+ border?: string;
2624
+ /**
2625
+ * CSS styling property that will be applied to text enclosed by a decoration.
2626
+ */
2627
+ borderColor?: string | ThemeColor;
2628
+ /**
2629
+ * CSS styling property that will be applied to the decoration attachment.
2630
+ */
2631
+ fontStyle?: string;
2632
+ /**
2633
+ * CSS styling property that will be applied to the decoration attachment.
2634
+ */
2635
+ fontWeight?: string;
2636
+ /**
2637
+ * CSS styling property that will be applied to the decoration attachment.
2638
+ */
2639
+ textDecoration?: string;
2640
+ /**
2641
+ * CSS styling property that will be applied to the decoration attachment.
2642
+ */
2643
+ color?: string | ThemeColor;
2644
+ /**
2645
+ * CSS styling property that will be applied to the decoration attachment.
2646
+ */
2647
+ backgroundColor?: string | ThemeColor;
2648
+ /**
2649
+ * CSS styling property that will be applied to the decoration attachment.
2650
+ */
2651
+ margin?: string;
2652
+ /**
2653
+ * CSS styling property that will be applied to the decoration attachment.
2654
+ */
2655
+ width?: string;
2656
+ /**
2657
+ * CSS styling property that will be applied to the decoration attachment.
2658
+ */
2659
+ height?: string;
2660
+ }
2661
+
2662
+ /**
2663
+ * Represents a color in RGBA space.
2664
+ */
2665
+ export class Color {
2666
+
2667
+ /**
2668
+ * The red component of this color in the range [0-1].
2669
+ */
2670
+ readonly red: number;
2671
+
2672
+ /**
2673
+ * The green component of this color in the range [0-1].
2674
+ */
2675
+ readonly green: number;
2676
+
2677
+ /**
2678
+ * The blue component of this color in the range [0-1].
2679
+ */
2680
+ readonly blue: number;
2681
+
2682
+ /**
2683
+ * The alpha component of this color in the range [0-1].
2684
+ */
2685
+ readonly alpha: number;
2686
+
2687
+ /**
2688
+ * Creates a new color instance.
2689
+ *
2690
+ * @param red The red component.
2691
+ * @param green The green component.
2692
+ * @param blue The blue component.
2693
+ * @param alpha The alpha component.
2694
+ */
2695
+ constructor(red: number, green: number, blue: number, alpha: number);
2696
+ }
2697
+
2698
+ /**
2699
+ * Represents a color range from a document.
2700
+ */
2701
+ export class ColorInformation {
2702
+
2703
+ /**
2704
+ * The range in the document where this color appears.
2705
+ */
2706
+ range: Range;
2707
+
2708
+ /**
2709
+ * The actual color value for this color range.
2710
+ */
2711
+ color: Color;
2712
+
2713
+ /**
2714
+ * Creates a new color range.
2715
+ *
2716
+ * @param range The range the color appears in. Must not be empty.
2717
+ * @param color The value of the color.
2718
+ * @param format The format in which this color is currently formatted.
2719
+ */
2720
+ constructor(range: Range, color: Color);
2721
+ }
2722
+
2723
+ /**
2724
+ * A color presentation object describes how a [`color`](#Color) should be represented as text and what
2725
+ * edits are required to refer to it from source code.
2726
+ *
2727
+ * For some languages one color can have multiple presentations, e.g. css can represent the color red with
2728
+ * the constant `Red`, the hex-value `#ff0000`, or in rgba and hsla forms. In csharp other representations
2729
+ * apply, e.g. `System.Drawing.Color.Red`.
2730
+ */
2731
+ export class ColorPresentation {
2732
+
2733
+ /**
2734
+ * The label of this color presentation. It will be shown on the color
2735
+ * picker header. By default this is also the text that is inserted when selecting
2736
+ * this color presentation.
2737
+ */
2738
+ label: string;
2739
+
2740
+ /**
2741
+ * An [edit](#TextEdit) which is applied to a document when selecting
2742
+ * this presentation for the color. When `falsy` the [label](#ColorPresentation.label)
2743
+ * is used.
2744
+ */
2745
+ textEdit?: TextEdit;
2746
+
2747
+ /**
2748
+ * An optional array of additional [text edits](#TextEdit) that are applied when
2749
+ * selecting this color presentation. Edits must not overlap with the main [edit](#ColorPresentation.textEdit) nor with themselves.
2750
+ */
2751
+ additionalTextEdits?: TextEdit[];
2752
+
2753
+ /**
2754
+ * Creates a new color presentation.
2755
+ *
2756
+ * @param label The label of this color presentation.
2757
+ */
2758
+ constructor(label: string);
2759
+ }
2760
+
2761
+ /**
2762
+ * The document color provider defines the contract between extensions and feature of
2763
+ * picking and modifying colors in the editor.
2764
+ */
2765
+ export interface DocumentColorProvider {
2766
+
2767
+ /**
2768
+ * Provide colors for the given document.
2769
+ *
2770
+ * @param document The document in which the command was invoked.
2771
+ * @param token A cancellation token.
2772
+ * @return An array of [color information](#ColorInformation) or a thenable that resolves to such. The lack of a result
2773
+ * can be signaled by returning `undefined`, `null`, or an empty array.
2774
+ */
2775
+ provideDocumentColors(document: TextDocument, token: CancellationToken): ProviderResult<ColorInformation[]>;
2776
+
2777
+ /**
2778
+ * Provide [representations](#ColorPresentation) for a color.
2779
+ *
2780
+ * @param color The color to show and insert.
2781
+ * @param context A context object with additional information
2782
+ * @param token A cancellation token.
2783
+ * @return An array of color presentations or a thenable that resolves to such. The lack of a result
2784
+ * can be signaled by returning `undefined`, `null`, or an empty array.
2785
+ */
2786
+ provideColorPresentations(color: Color, context: { document: TextDocument, range: Range }, token: CancellationToken): ProviderResult<ColorPresentation[]>;
2787
+ }
2788
+ }