@opensumi/sumi 2.12.1-next-079c1930
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/build.ts +18 -0
- package/index.d.ts +5 -0
- package/manifest.json +414 -0
- package/package.json +18 -0
- package/sumi-browser.d.ts +273 -0
- package/sumi-worker/sumi-worker.d.ts +2788 -0
- package/sumi-worker/worker.command.d.ts +86 -0
- package/sumi-worker/worker.comments.d.ts +273 -0
- package/sumi-worker/worker.doc.d.ts +356 -0
- package/sumi-worker/worker.editor.d.ts +725 -0
- package/sumi-worker/worker.extensions.d.ts +63 -0
- package/sumi-worker/worker.language.d.ts +2220 -0
- package/sumi-worker/worker.window.d.ts +318 -0
- package/sumi-worker.d.ts +7 -0
- package/sumi.d.ts +822 -0
- package/vscode/typings/vscode.authentication.d.ts +231 -0
- package/vscode/typings/vscode.command.d.ts +86 -0
- package/vscode/typings/vscode.comments.d.ts +292 -0
- package/vscode/typings/vscode.d.ts +3789 -0
- package/vscode/typings/vscode.debug.d.ts +684 -0
- package/vscode/typings/vscode.doc.d.ts +272 -0
- package/vscode/typings/vscode.editor.d.ts +1017 -0
- package/vscode/typings/vscode.env.d.ts +153 -0
- package/vscode/typings/vscode.extension.d.ts +67 -0
- package/vscode/typings/vscode.language.d.ts +2630 -0
- package/vscode/typings/vscode.message.d.ts +195 -0
- package/vscode/typings/vscode.proposed.d.ts +662 -0
- package/vscode/typings/vscode.quickpick.d.ts +491 -0
- package/vscode/typings/vscode.scm.d.ts +254 -0
- package/vscode/typings/vscode.tasks.d.ts +676 -0
- package/vscode/typings/vscode.theme.d.ts +370 -0
- package/vscode/typings/vscode.window.d.ts +870 -0
- package/vscode/typings/vscode.workspace.d.ts +664 -0
- package/vscode/typings-pending/vscode.d.ts +27 -0
- package/vscode/typings-pending/vscode.proposed.d.ts +3 -0
- package/vscode.d.ts +23 -0
|
@@ -0,0 +1,870 @@
|
|
|
1
|
+
declare module 'vscode' {
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Represents the alignment of status bar items.
|
|
5
|
+
*/
|
|
6
|
+
export enum StatusBarAlignment {
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Aligned to the left side.
|
|
10
|
+
*/
|
|
11
|
+
Left = 1,
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Aligned to the right side.
|
|
15
|
+
*/
|
|
16
|
+
Right = 2,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A status bar item is a status bar contribution that can
|
|
21
|
+
* show text and icons and run a command on click.
|
|
22
|
+
*/
|
|
23
|
+
export interface StatusBarItem {
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The identifier of this item.
|
|
27
|
+
*
|
|
28
|
+
* *Note*: if no identifier was provided by the {@link window.createStatusBarItem `window.createStatusBarItem`}
|
|
29
|
+
* method, the identifier will match the {@link Extension.id extension identifier}.
|
|
30
|
+
*/
|
|
31
|
+
readonly id: string;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The alignment of this item.
|
|
35
|
+
*/
|
|
36
|
+
readonly alignment: StatusBarAlignment;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The priority of this item. Higher value means the item should
|
|
40
|
+
* be shown more to the left.
|
|
41
|
+
*/
|
|
42
|
+
readonly priority?: number;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The name of the entry, like 'Python Language Indicator', 'Git Status' etc.
|
|
46
|
+
* Try to keep the length of the name short, yet descriptive enough that
|
|
47
|
+
* users can understand what the status bar item is about.
|
|
48
|
+
*/
|
|
49
|
+
name: string | undefined;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* The text to show for the entry. You can embed icons in the text by leveraging the syntax:
|
|
53
|
+
*
|
|
54
|
+
* `My text $(icon-name) contains icons like $(icon-name) this one.`
|
|
55
|
+
*
|
|
56
|
+
* Where the icon-name is taken from the [octicon](https://octicons.github.com) icon set, e.g.
|
|
57
|
+
* `light-bulb`, `thumbsup`, `zap` etc.
|
|
58
|
+
*/
|
|
59
|
+
text: string;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The tooltip text when you hover over this entry.
|
|
63
|
+
*/
|
|
64
|
+
tooltip: string | undefined;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* The foreground color for this entry.
|
|
68
|
+
*/
|
|
69
|
+
color: string | ThemeColor | undefined;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* The background color for this entry.
|
|
73
|
+
*
|
|
74
|
+
* *Note*: only the following colors are supported:
|
|
75
|
+
* * `new ThemeColor('statusBarItem.errorBackground')`
|
|
76
|
+
* * `new ThemeColor('statusBarItem.warningBackground')`
|
|
77
|
+
*
|
|
78
|
+
* More background colors may be supported in the future.
|
|
79
|
+
*
|
|
80
|
+
* *Note*: when a background color is set, the statusbar may override
|
|
81
|
+
* the `color` choice to ensure the entry is readable in all themes.
|
|
82
|
+
*/
|
|
83
|
+
backgroundColor: ThemeColor | undefined;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* The identifier of a command to run on click. The command must be
|
|
87
|
+
* [known](#commands.getCommands).
|
|
88
|
+
*/
|
|
89
|
+
command: string | Command | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* Accessibility information used when screen reader interacts with this StatusBar item
|
|
92
|
+
*/
|
|
93
|
+
accessibilityInformation?: AccessibilityInformation;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Shows the entry in the status bar.
|
|
97
|
+
*/
|
|
98
|
+
show(): void;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Hide the entry in the status bar.
|
|
102
|
+
*/
|
|
103
|
+
hide(): void;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Dispose and free associated resources. Call
|
|
107
|
+
* [hide](#StatusBarItem.hide).
|
|
108
|
+
*/
|
|
109
|
+
dispose(): void;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export interface OutputChannel {
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* The human-readable name of this output channel.
|
|
116
|
+
*/
|
|
117
|
+
readonly name: string;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Append the given value to the channel.
|
|
121
|
+
*
|
|
122
|
+
* @param value A string, falsy values will not be printed.
|
|
123
|
+
*/
|
|
124
|
+
append(value: string): void;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Append the given value and a line feed character
|
|
128
|
+
* to the channel.
|
|
129
|
+
*
|
|
130
|
+
* @param value A string, falsy values will be printed.
|
|
131
|
+
*/
|
|
132
|
+
appendLine(value: string): void;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Removes all output from the channel.
|
|
136
|
+
*/
|
|
137
|
+
clear(): void;
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Reveal this channel in the UI.
|
|
141
|
+
*
|
|
142
|
+
* @param preserveFocus When `true` the channel will not take focus.
|
|
143
|
+
*/
|
|
144
|
+
show(preserveFocus?: boolean): void;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Hide this channel from the UI.
|
|
148
|
+
*/
|
|
149
|
+
hide(): void;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Dispose and free associated resources.
|
|
153
|
+
*/
|
|
154
|
+
dispose(): void;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Options to configure the behaviour of a file open dialog.
|
|
159
|
+
*
|
|
160
|
+
* * Note 1: A dialog can select files, folders, or both. This is not true for Windows
|
|
161
|
+
* which enforces to open either files or folder, but *not both*.
|
|
162
|
+
* * Note 2: Explicitly setting `canSelectFiles` and `canSelectFolders` to `false` is futile
|
|
163
|
+
* and the editor then silently adjusts the options to select files.
|
|
164
|
+
*/
|
|
165
|
+
export interface OpenDialogOptions {
|
|
166
|
+
/**
|
|
167
|
+
* The resource the dialog shows when opened.
|
|
168
|
+
*/
|
|
169
|
+
defaultUri?: Uri;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* A human-readable string for the open button.
|
|
173
|
+
*/
|
|
174
|
+
openLabel?: string;
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Allow to select files, defaults to `true`.
|
|
178
|
+
*/
|
|
179
|
+
canSelectFiles?: boolean;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Allow to select folders, defaults to `false`.
|
|
183
|
+
*/
|
|
184
|
+
canSelectFolders?: boolean;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Allow to select many files or folders.
|
|
188
|
+
*/
|
|
189
|
+
canSelectMany?: boolean;
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* A set of file filters that are used by the dialog. Each entry is a human readable label,
|
|
193
|
+
* like "TypeScript", and an array of extensions, e.g.
|
|
194
|
+
* ```ts
|
|
195
|
+
* {
|
|
196
|
+
* 'Images': ['png', 'jpg']
|
|
197
|
+
* 'TypeScript': ['ts', 'tsx']
|
|
198
|
+
* }
|
|
199
|
+
* ```
|
|
200
|
+
*/
|
|
201
|
+
filters?: { [name: string]: string[] };
|
|
202
|
+
/**
|
|
203
|
+
* Dialog title.
|
|
204
|
+
*
|
|
205
|
+
* This parameter might be ignored, as not all operating systems display a title on open dialogs
|
|
206
|
+
* (for example, macOS).
|
|
207
|
+
*/
|
|
208
|
+
title?: string;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Options to configure the behaviour of a file save dialog.
|
|
213
|
+
*/
|
|
214
|
+
export interface SaveDialogOptions {
|
|
215
|
+
/**
|
|
216
|
+
* The resource the dialog shows when opened.
|
|
217
|
+
*/
|
|
218
|
+
defaultUri?: Uri;
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* A human-readable string for the save button.
|
|
222
|
+
*/
|
|
223
|
+
saveLabel?: string;
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* A set of file filters that are used by the dialog. Each entry is a human readable label,
|
|
227
|
+
* like "TypeScript", and an array of extensions, e.g.
|
|
228
|
+
* ```ts
|
|
229
|
+
* {
|
|
230
|
+
* 'Images': ['png', 'jpg']
|
|
231
|
+
* 'TypeScript': ['ts', 'tsx']
|
|
232
|
+
* }
|
|
233
|
+
* ```
|
|
234
|
+
*/
|
|
235
|
+
filters?: { [name: string]: string[] };
|
|
236
|
+
/**
|
|
237
|
+
* Dialog title.
|
|
238
|
+
*
|
|
239
|
+
* This parameter might be ignored, as not all operating systems display a title on save dialogs
|
|
240
|
+
* (for example, macOS).
|
|
241
|
+
*/
|
|
242
|
+
title?: string;
|
|
243
|
+
}
|
|
244
|
+
export namespace window {
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Set a message to the status bar. This is a short hand for the more powerful
|
|
248
|
+
* status bar [items](#window.createStatusBarItem).
|
|
249
|
+
*
|
|
250
|
+
* @param text The message to show, supports icon substitution as in status bar [items](#StatusBarItem.text).
|
|
251
|
+
* @param hideAfterTimeout Timeout in milliseconds after which the message will be disposed.
|
|
252
|
+
* @return A disposable which hides the status bar message.
|
|
253
|
+
*/
|
|
254
|
+
// tslint:disable-next-line: unified-signatures
|
|
255
|
+
export function setStatusBarMessage(text: string, hideAfterTimeout: number): Disposable;
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Set a message to the status bar. This is a short hand for the more powerful
|
|
259
|
+
* status bar [items](#window.createStatusBarItem).
|
|
260
|
+
*
|
|
261
|
+
* @param text The message to show, supports icon substitution as in status bar [items](#StatusBarItem.text).
|
|
262
|
+
* @param hideWhenDone Thenable on which completion (resolve or reject) the message will be disposed.
|
|
263
|
+
* @return A disposable which hides the status bar message.
|
|
264
|
+
*/
|
|
265
|
+
// tslint:disable-next-line: unified-signatures
|
|
266
|
+
export function setStatusBarMessage(text: string, hideWhenDone: Thenable<any>): Disposable;
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Set a message to the status bar. This is a short hand for the more powerful
|
|
270
|
+
* status bar [items](#window.createStatusBarItem).
|
|
271
|
+
*
|
|
272
|
+
* *Note* that status bar messages stack and that they must be disposed when no
|
|
273
|
+
* longer used.
|
|
274
|
+
*
|
|
275
|
+
* @param text The message to show, supports icon substitution as in status bar [items](#StatusBarItem.text).
|
|
276
|
+
* @return A disposable which hides the status bar message.
|
|
277
|
+
*/
|
|
278
|
+
export function setStatusBarMessage(text: string): Disposable;
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Creates a status bar [item](#StatusBarItem).
|
|
282
|
+
*
|
|
283
|
+
* @param alignment The alignment of the item.
|
|
284
|
+
* @param priority The priority of the item. Higher values mean the item should be shown more to the left.
|
|
285
|
+
* @return A new status bar item.
|
|
286
|
+
*/
|
|
287
|
+
export function createStatusBarItem(alignment?: StatusBarAlignment, priority?: number): StatusBarItem;
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Creates a status bar {@link StatusBarItem item}.
|
|
291
|
+
*
|
|
292
|
+
* @param id The unique identifier of the item.
|
|
293
|
+
* @param alignment The alignment of the item.
|
|
294
|
+
* @param priority The priority of the item. Higher values mean the item should be shown more to the left.
|
|
295
|
+
* @return A new status bar item.
|
|
296
|
+
*/
|
|
297
|
+
export function createStatusBarItem(id: string, alignment?: StatusBarAlignment, priority?: number): StatusBarItem;
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Creates a new [output channel](#OutputChannel) with the given name.
|
|
301
|
+
*
|
|
302
|
+
* @param name Human-readable string which will be used to represent the channel in the UI.
|
|
303
|
+
*/
|
|
304
|
+
export function createOutputChannel(name: string): OutputChannel;
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* The currently opened terminals or an empty array.
|
|
308
|
+
*/
|
|
309
|
+
export const terminals: ReadonlyArray<Terminal>;
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* The currently active terminal or `undefined`. The active terminal is the one that
|
|
313
|
+
* currently has focus or most recently had focus.
|
|
314
|
+
*/
|
|
315
|
+
export const activeTerminal: Terminal | undefined;
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* An [event](#Event) which fires when the [active terminal](#window.activeTerminal)
|
|
319
|
+
* has changed. *Note* that the event also fires when the active terminal changes
|
|
320
|
+
* to `undefined`.
|
|
321
|
+
*/
|
|
322
|
+
export const onDidChangeActiveTerminal: Event<Terminal | undefined>;
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* An [event](#Event) which fires when a terminal has been created, either through the
|
|
326
|
+
* [createTerminal](#window.createTerminal) API or commands.
|
|
327
|
+
*/
|
|
328
|
+
export const onDidOpenTerminal: Event<Terminal>;
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* An [event](#Event) which fires when a terminal is disposed.
|
|
332
|
+
*/
|
|
333
|
+
export const onDidCloseTerminal: Event<Terminal>;
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Represents the current window's state.
|
|
337
|
+
*/
|
|
338
|
+
export const state: WindowState;
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* An [event](#Event) which fires when the focus state of the current window
|
|
342
|
+
* changes. The value of the event represents whether the window is focused.
|
|
343
|
+
*/
|
|
344
|
+
export const onDidChangeWindowState: Event<WindowState>;
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Creates a [Terminal](#Terminal). The cwd of the terminal will be the workspace directory
|
|
348
|
+
* if it exists, regardless of whether an explicit customStartPath setting exists.
|
|
349
|
+
*
|
|
350
|
+
* @param name Optional human-readable string which will be used to represent the terminal in the UI.
|
|
351
|
+
* @param shellPath Optional path to a custom shell executable to be used in the terminal.
|
|
352
|
+
* @param shellArgs Optional args for the custom shell executable. A string can be used on Windows only which
|
|
353
|
+
* allows specifying shell args in [command-line format](https://msdn.microsoft.com/en-au/08dfcab2-eb6e-49a4-80eb-87d4076c98c6).
|
|
354
|
+
* @return A new Terminal.
|
|
355
|
+
*/
|
|
356
|
+
export function createTerminal(name?: string, shellPath?: string, shellArgs?: string[] | string): Terminal;
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* Create and show a new webview panel.
|
|
360
|
+
*
|
|
361
|
+
* @param viewType Identifies the type of the webview panel.
|
|
362
|
+
* @param title Title of the panel.
|
|
363
|
+
* @param showOptions Where to show the webview in the editor. If preserveFocus is set, the new webview will not take focus.
|
|
364
|
+
* @param options Settings for the new panel.
|
|
365
|
+
*
|
|
366
|
+
* @return New webview panel.
|
|
367
|
+
*/
|
|
368
|
+
export function createWebviewPanel(viewType: string, title: string, showOptions: ViewColumn | { viewColumn: ViewColumn, preserveFocus?: boolean }, options?: WebviewPanelOptions & WebviewOptions): WebviewPanel;
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* Registers a webview panel serializer.
|
|
372
|
+
*
|
|
373
|
+
* Extensions that support reviving should have an `"onWebviewPanel:viewType"` activation event and
|
|
374
|
+
* make sure that [registerWebviewPanelSerializer](#registerWebviewPanelSerializer) is called during activation.
|
|
375
|
+
*
|
|
376
|
+
* Only a single serializer may be registered at a time for a given `viewType`.
|
|
377
|
+
*
|
|
378
|
+
* @param viewType Type of the webview panel that can be serialized.
|
|
379
|
+
* @param serializer Webview serializer.
|
|
380
|
+
*/
|
|
381
|
+
export function registerWebviewPanelSerializer(viewType: string, serializer: WebviewPanelSerializer): Disposable;
|
|
382
|
+
/**
|
|
383
|
+
* Register a new provider for webview views.
|
|
384
|
+
*
|
|
385
|
+
* @param viewId Unique id of the view. This should match the `id` from the
|
|
386
|
+
* `views` contribution in the package.json.
|
|
387
|
+
* @param provider Provider for the webview views.
|
|
388
|
+
*
|
|
389
|
+
* @return Disposable that unregisters the provider.
|
|
390
|
+
*/
|
|
391
|
+
export function registerWebviewViewProvider(viewId: string, provider: WebviewViewProvider, options?: {
|
|
392
|
+
/**
|
|
393
|
+
* Content settings for the webview created for this view.
|
|
394
|
+
*/
|
|
395
|
+
readonly webviewOptions?: {
|
|
396
|
+
/**
|
|
397
|
+
* Controls if the webview element itself (iframe) is kept around even when the view
|
|
398
|
+
* is no longer visible.
|
|
399
|
+
*
|
|
400
|
+
* Normally the webview's html context is created when the view becomes visible
|
|
401
|
+
* and destroyed when it is hidden. Extensions that have complex state
|
|
402
|
+
* or UI can set the `retainContextWhenHidden` to make VS Code keep the webview
|
|
403
|
+
* context around, even when the webview moves to a background tab. When a webview using
|
|
404
|
+
* `retainContextWhenHidden` becomes hidden, its scripts and other dynamic content are suspended.
|
|
405
|
+
* When the view becomes visible again, the context is automatically restored
|
|
406
|
+
* in the exact same state it was in originally. You cannot send messages to a
|
|
407
|
+
* hidden webview, even with `retainContextWhenHidden` enabled.
|
|
408
|
+
*
|
|
409
|
+
* `retainContextWhenHidden` has a high memory overhead and should only be used if
|
|
410
|
+
* your view's context cannot be quickly saved and restored.
|
|
411
|
+
*/
|
|
412
|
+
readonly retainContextWhenHidden?: boolean;
|
|
413
|
+
};
|
|
414
|
+
}): Disposable;
|
|
415
|
+
/**
|
|
416
|
+
* Register a provider for custom editors for the `viewType` contributed by the `customEditors` extension point.
|
|
417
|
+
*
|
|
418
|
+
* When a custom editor is opened, VS Code fires an `onCustomEditor:viewType` activation event. Your extension
|
|
419
|
+
* must register a [`CustomTextEditorProvider`](#CustomTextEditorProvider), [`CustomReadonlyEditorProvider`](#CustomReadonlyEditorProvider),
|
|
420
|
+
* [`CustomEditorProvider`](#CustomEditorProvider)for `viewType` as part of activation.
|
|
421
|
+
*
|
|
422
|
+
* @param viewType Unique identifier for the custom editor provider. This should match the `viewType` from the
|
|
423
|
+
* `customEditors` contribution point.
|
|
424
|
+
* @param provider Provider that resolves custom editors.
|
|
425
|
+
* @param options Options for the provider.
|
|
426
|
+
*
|
|
427
|
+
* @return Disposable that unregisters the provider.
|
|
428
|
+
*/
|
|
429
|
+
export function registerCustomEditorProvider(viewType: string, provider: CustomTextEditorProvider | CustomReadonlyEditorProvider | CustomEditorProvider, options?: {
|
|
430
|
+
/**
|
|
431
|
+
* Content settings for the webview panels created for this custom editor.
|
|
432
|
+
*/
|
|
433
|
+
readonly webviewOptions?: WebviewPanelOptions;
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* Only applies to `CustomReadonlyEditorProvider | CustomEditorProvider`.
|
|
437
|
+
*
|
|
438
|
+
* Indicates that the provider allows multiple editor instances to be open at the same time for
|
|
439
|
+
* the same resource.
|
|
440
|
+
*
|
|
441
|
+
* By default, VS Code only allows one editor instance to be open at a time for each resource. If the
|
|
442
|
+
* user tries to open a second editor instance for the resource, the first one is instead moved to where
|
|
443
|
+
* the second one was to be opened.
|
|
444
|
+
*
|
|
445
|
+
* When `supportsMultipleEditorsPerDocument` is enabled, users can split and create copies of the custom
|
|
446
|
+
* editor. In this case, the custom editor must make sure it can properly synchronize the states of all
|
|
447
|
+
* editor instances for a resource so that they are consistent.
|
|
448
|
+
*/
|
|
449
|
+
readonly supportsMultipleEditorsPerDocument?: boolean;
|
|
450
|
+
}): Disposable;
|
|
451
|
+
/**
|
|
452
|
+
* Register provider that enables the detection and handling of links within the terminal.
|
|
453
|
+
* @param provider The provider that provides the terminal links.
|
|
454
|
+
* @return Disposable that unregisters the provider.
|
|
455
|
+
*/
|
|
456
|
+
export function registerTerminalLinkProvider(provider: TerminalLinkProvider): Disposable;
|
|
457
|
+
/**
|
|
458
|
+
* ~~Show progress in the Source Control viewlet while running the given callback and while
|
|
459
|
+
* its returned promise isn't resolve or rejected.~~
|
|
460
|
+
*
|
|
461
|
+
* @deprecated Use `withProgress` instead.
|
|
462
|
+
*
|
|
463
|
+
* @param task A callback returning a promise. Progress increments can be reported with
|
|
464
|
+
* the provided [progress](#Progress)-object.
|
|
465
|
+
* @return The thenable the task did return.
|
|
466
|
+
*/
|
|
467
|
+
export function withScmProgress<R>(task: (progress: Progress<number>) => Thenable<R>): Thenable<R>;
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* Show progress in the editor. Progress is shown while running the given callback
|
|
471
|
+
* and while the promise it returned isn't resolved nor rejected. The location at which
|
|
472
|
+
* progress should show (and other details) is defined via the passed [`ProgressOptions`](#ProgressOptions).
|
|
473
|
+
*
|
|
474
|
+
* @param task A callback returning a promise. Progress state can be reported with
|
|
475
|
+
* the provided [progress](#Progress)-object.
|
|
476
|
+
*
|
|
477
|
+
* To report discrete progress, use `increment` to indicate how much work has been completed. Each call with
|
|
478
|
+
* a `increment` value will be summed up and reflected as overall progress until 100% is reached (a value of
|
|
479
|
+
* e.g. `10` accounts for `10%` of work done).
|
|
480
|
+
* Note that currently only `ProgressLocation.Notification` is capable of showing discrete progress.
|
|
481
|
+
*
|
|
482
|
+
* To monitor if the operation has been cancelled by the user, use the provided [`CancellationToken`](#CancellationToken).
|
|
483
|
+
* Note that currently only `ProgressLocation.Notification` is supporting to show a cancel button to cancel the
|
|
484
|
+
* long running operation.
|
|
485
|
+
*
|
|
486
|
+
* @return The thenable the task-callback returned.
|
|
487
|
+
*/
|
|
488
|
+
export function withProgress<R>(options: ProgressOptions, task: (progress: Progress<{ message?: string; increment?: number }>, token: CancellationToken) => Thenable<R>): Thenable<R>;
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* Register a [TreeDataProvider](#TreeDataProvider) for the view contributed using the extension point `views`.
|
|
492
|
+
* This will allow you to contribute data to the [TreeView](#TreeView) and update if the data changes.
|
|
493
|
+
*
|
|
494
|
+
* **Note:** To get access to the [TreeView](#TreeView) and perform operations on it, use [createTreeView](#window.createTreeView).
|
|
495
|
+
*
|
|
496
|
+
* @param viewId Id of the view contributed using the extension point `views`.
|
|
497
|
+
* @param treeDataProvider A [TreeDataProvider](#TreeDataProvider) that provides tree data for the view
|
|
498
|
+
*/
|
|
499
|
+
export function registerTreeDataProvider<T>(viewId: string, treeDataProvider: TreeDataProvider<T>): Disposable;
|
|
500
|
+
|
|
501
|
+
/**
|
|
502
|
+
* Create a [TreeView](#TreeView) for the view contributed using the extension point `views`.
|
|
503
|
+
* @param viewId Id of the view contributed using the extension point `views`.
|
|
504
|
+
* @param options Options for creating the [TreeView](#TreeView)
|
|
505
|
+
* @returns a [TreeView](#TreeView).
|
|
506
|
+
*/
|
|
507
|
+
export function createTreeView<T>(viewId: string, options: TreeViewOptions<T>): TreeView<T>;
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* Options for creating a [TreeView](#TreeView)
|
|
511
|
+
*/
|
|
512
|
+
export interface TreeViewOptions<T> {
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* A data provider that provides tree data.
|
|
516
|
+
*/
|
|
517
|
+
treeDataProvider: TreeDataProvider<T>;
|
|
518
|
+
|
|
519
|
+
/**
|
|
520
|
+
* Whether to show collapse all action or not.
|
|
521
|
+
*/
|
|
522
|
+
showCollapseAll?: boolean;
|
|
523
|
+
}
|
|
524
|
+
/**
|
|
525
|
+
* Shows a file open dialog to the user which allows to select a file
|
|
526
|
+
* for opening-purposes.
|
|
527
|
+
*
|
|
528
|
+
* @param options Options that control the dialog.
|
|
529
|
+
* @returns A promise that resolves to the selected resources or `undefined`.
|
|
530
|
+
*/
|
|
531
|
+
export function showOpenDialog(options: OpenDialogOptions): Thenable<Uri[] | undefined>;
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* Shows a file save dialog to the user which allows to select a file
|
|
535
|
+
* for saving-purposes.
|
|
536
|
+
*
|
|
537
|
+
* @param options Options that control the dialog.
|
|
538
|
+
* @returns A promise that resolves to the selected resource or `undefined`.
|
|
539
|
+
*/
|
|
540
|
+
export function showSaveDialog(options: SaveDialogOptions): Thenable<Uri | undefined>;
|
|
541
|
+
/**
|
|
542
|
+
* Shows a selection list of [workspace folders](#workspace.workspaceFolders) to pick from.
|
|
543
|
+
* Returns `undefined` if no folder is open.
|
|
544
|
+
*
|
|
545
|
+
* @param options Configures the behavior of the workspace folder list.
|
|
546
|
+
* @return A promise that resolves to the workspace folder or `undefined`.
|
|
547
|
+
*/
|
|
548
|
+
export function showWorkspaceFolderPick(options?: WorkspaceFolderPickOptions): Thenable<WorkspaceFolder | undefined>;
|
|
549
|
+
|
|
550
|
+
/**
|
|
551
|
+
* Registers a [uri handler](#UriHandler) capable of handling system-wide [uris](#Uri).
|
|
552
|
+
* In case there are multiple windows open, the topmost window will handle the uri.
|
|
553
|
+
* A uri handler is scoped to the extension it is contributed from; it will only
|
|
554
|
+
* be able to handle uris which are directed to the extension itself. A uri must respect
|
|
555
|
+
* the following rules:
|
|
556
|
+
*
|
|
557
|
+
* - The uri-scheme must be `vscode.env.uriScheme`;
|
|
558
|
+
* - The uri-authority must be the extension id (e.g. `my.extension`);
|
|
559
|
+
* - The uri-path, -query and -fragment parts are arbitrary.
|
|
560
|
+
*
|
|
561
|
+
* For example, if the `my.extension` extension registers a uri handler, it will only
|
|
562
|
+
* be allowed to handle uris with the prefix `product-name://my.extension`.
|
|
563
|
+
*
|
|
564
|
+
* An extension can only register a single uri handler in its entire activation lifetime.
|
|
565
|
+
*
|
|
566
|
+
* * *Note:* There is an activation event `onUri` that fires when a uri directed for
|
|
567
|
+
* the current extension is about to be handled.
|
|
568
|
+
*
|
|
569
|
+
* @param handler The uri handler to register for this extension.
|
|
570
|
+
*/
|
|
571
|
+
export function registerUriHandler(handler: UriHandler): Disposable;
|
|
572
|
+
|
|
573
|
+
/**
|
|
574
|
+
* The currently active color theme as configured in the settings. The active
|
|
575
|
+
* theme can be changed via the `workbench.colorTheme` setting.
|
|
576
|
+
*/
|
|
577
|
+
export let activeColorTheme: ColorTheme;
|
|
578
|
+
|
|
579
|
+
/**
|
|
580
|
+
* An [event](#Event) which fires when the active theme changes or one of it's colors chnage.
|
|
581
|
+
*/
|
|
582
|
+
export const onDidChangeActiveColorTheme: Event<ColorTheme>;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
/**
|
|
586
|
+
* A panel that contains a webview.
|
|
587
|
+
*/
|
|
588
|
+
interface WebviewPanel {
|
|
589
|
+
/**
|
|
590
|
+
* Identifies the type of the webview panel, such as `'markdown.preview'`.
|
|
591
|
+
*/
|
|
592
|
+
readonly viewType: string;
|
|
593
|
+
|
|
594
|
+
/**
|
|
595
|
+
* Title of the panel shown in UI.
|
|
596
|
+
*/
|
|
597
|
+
title: string;
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* Icon for the panel shown in UI.
|
|
601
|
+
*/
|
|
602
|
+
iconPath?: Uri | { light: Uri; dark: Uri };
|
|
603
|
+
|
|
604
|
+
/**
|
|
605
|
+
* Webview belonging to the panel.
|
|
606
|
+
*/
|
|
607
|
+
readonly webview: Webview;
|
|
608
|
+
|
|
609
|
+
/**
|
|
610
|
+
* Content settings for the webview panel.
|
|
611
|
+
*/
|
|
612
|
+
readonly options: WebviewPanelOptions;
|
|
613
|
+
|
|
614
|
+
/**
|
|
615
|
+
* Editor position of the panel. This property is only set if the webview is in
|
|
616
|
+
* one of the editor view columns.
|
|
617
|
+
*/
|
|
618
|
+
readonly viewColumn?: ViewColumn;
|
|
619
|
+
|
|
620
|
+
/**
|
|
621
|
+
* Whether the panel is active (focused by the user).
|
|
622
|
+
*/
|
|
623
|
+
readonly active: boolean;
|
|
624
|
+
|
|
625
|
+
/**
|
|
626
|
+
* Whether the panel is visible.
|
|
627
|
+
*/
|
|
628
|
+
readonly visible: boolean;
|
|
629
|
+
|
|
630
|
+
/**
|
|
631
|
+
* Fired when the panel's view state changes.
|
|
632
|
+
*/
|
|
633
|
+
readonly onDidChangeViewState: Event<WebviewPanelOnDidChangeViewStateEvent>;
|
|
634
|
+
|
|
635
|
+
/**
|
|
636
|
+
* Fired when the panel is disposed.
|
|
637
|
+
*
|
|
638
|
+
* This may be because the user closed the panel or because `.dispose()` was
|
|
639
|
+
* called on it.
|
|
640
|
+
*
|
|
641
|
+
* Trying to use the panel after it has been disposed throws an exception.
|
|
642
|
+
*/
|
|
643
|
+
readonly onDidDispose: Event<void>;
|
|
644
|
+
|
|
645
|
+
/**
|
|
646
|
+
* Show the webview panel in a given column.
|
|
647
|
+
*
|
|
648
|
+
* A webview panel may only show in a single column at a time. If it is already showing, this
|
|
649
|
+
* method moves it to a new column.
|
|
650
|
+
*
|
|
651
|
+
* @param viewColumn View column to show the panel in. Shows in the current `viewColumn` if undefined.
|
|
652
|
+
* @param preserveFocus When `true`, the webview will not take focus.
|
|
653
|
+
*/
|
|
654
|
+
reveal(viewColumn?: ViewColumn, preserveFocus?: boolean): void;
|
|
655
|
+
|
|
656
|
+
/**
|
|
657
|
+
* Dispose of the webview panel.
|
|
658
|
+
*
|
|
659
|
+
* This closes the panel if it showing and disposes of the resources owned by the webview.
|
|
660
|
+
* Webview panels are also disposed when the user closes the webview panel. Both cases
|
|
661
|
+
* fire the `onDispose` event.
|
|
662
|
+
*/
|
|
663
|
+
dispose(): any;
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
/**
|
|
667
|
+
* Restore webview panels that have been persisted when vscode shuts down.
|
|
668
|
+
*
|
|
669
|
+
* There are two types of webview persistence:
|
|
670
|
+
*
|
|
671
|
+
* - Persistence within a session.
|
|
672
|
+
* - Persistence across sessions (across restarts of VS Code).
|
|
673
|
+
*
|
|
674
|
+
* A `WebviewPanelSerializer` is only required for the second case: persisting a webview across sessions.
|
|
675
|
+
*
|
|
676
|
+
* Persistence within a session allows a webview to save its state when it becomes hidden
|
|
677
|
+
* and restore its content from this state when it becomes visible again. It is powered entirely
|
|
678
|
+
* by the webview content itself. To save off a persisted state, call `acquireVsCodeApi().setState()` with
|
|
679
|
+
* any json serializable object. To restore the state again, call `getState()`
|
|
680
|
+
*
|
|
681
|
+
* ```js
|
|
682
|
+
* // Within the webview
|
|
683
|
+
* const vscode = acquireVsCodeApi();
|
|
684
|
+
*
|
|
685
|
+
* // Get existing state
|
|
686
|
+
* const oldState = vscode.getState() || { value: 0 };
|
|
687
|
+
*
|
|
688
|
+
* // Update state
|
|
689
|
+
* setState({ value: oldState.value + 1 })
|
|
690
|
+
* ```
|
|
691
|
+
*
|
|
692
|
+
* A `WebviewPanelSerializer` extends this persistence across restarts of VS Code. When the editor is shutdown,
|
|
693
|
+
* VS Code will save off the state from `setState` of all webviews that have a serializer. When the
|
|
694
|
+
* webview first becomes visible after the restart, this state is passed to `deserializeWebviewPanel`.
|
|
695
|
+
* The extension can then restore the old `WebviewPanel` from this state.
|
|
696
|
+
*
|
|
697
|
+
* @param T Type of the webview's state.
|
|
698
|
+
*/
|
|
699
|
+
interface WebviewPanelSerializer<T = unknown> {
|
|
700
|
+
/**
|
|
701
|
+
* Restore a webview panel from its serialized `state`.
|
|
702
|
+
*
|
|
703
|
+
* Called when a serialized webview first becomes visible.
|
|
704
|
+
*
|
|
705
|
+
* @param webviewPanel Webview panel to restore. The serializer should take ownership of this panel. The
|
|
706
|
+
* serializer must restore the webview's `.html` and hook up all webview events.
|
|
707
|
+
* @param state Persisted state from the webview content.
|
|
708
|
+
*
|
|
709
|
+
* @return Thenable indicating that the webview has been fully restored.
|
|
710
|
+
*/
|
|
711
|
+
deserializeWebviewPanel(webviewPanel: WebviewPanel, state: T): Thenable<void>;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
/**
|
|
715
|
+
* Event fired when a webview panel's view state changes.
|
|
716
|
+
*/
|
|
717
|
+
export interface WebviewPanelOnDidChangeViewStateEvent {
|
|
718
|
+
/**
|
|
719
|
+
* Webview panel whose view state changed.
|
|
720
|
+
*/
|
|
721
|
+
readonly webviewPanel: WebviewPanel;
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
/**
|
|
725
|
+
* A webview based view.
|
|
726
|
+
*/
|
|
727
|
+
/**
|
|
728
|
+
* A webview based view.
|
|
729
|
+
*/
|
|
730
|
+
export interface WebviewView {
|
|
731
|
+
/**
|
|
732
|
+
* Identifies the type of the webview view, such as `'hexEditor.dataView'`.
|
|
733
|
+
*/
|
|
734
|
+
readonly viewType: string;
|
|
735
|
+
|
|
736
|
+
/**
|
|
737
|
+
* The underlying webview for the view.
|
|
738
|
+
*/
|
|
739
|
+
readonly webview: Webview;
|
|
740
|
+
|
|
741
|
+
/**
|
|
742
|
+
* View title displayed in the UI.
|
|
743
|
+
*
|
|
744
|
+
* The view title is initially taken from the extension `package.json` contribution.
|
|
745
|
+
*/
|
|
746
|
+
title?: string;
|
|
747
|
+
|
|
748
|
+
/**
|
|
749
|
+
* Human-readable string which is rendered less prominently in the title.
|
|
750
|
+
*/
|
|
751
|
+
description?: string;
|
|
752
|
+
|
|
753
|
+
/**
|
|
754
|
+
* Event fired when the view is disposed.
|
|
755
|
+
*
|
|
756
|
+
* Views are disposed when they are explicitly hidden by a user (this happens when a user
|
|
757
|
+
* right clicks in a view and unchecks the webview view).
|
|
758
|
+
*
|
|
759
|
+
* Trying to use the view after it has been disposed throws an exception.
|
|
760
|
+
*/
|
|
761
|
+
readonly onDidDispose: Event<void>;
|
|
762
|
+
|
|
763
|
+
/**
|
|
764
|
+
* Tracks if the webview is currently visible.
|
|
765
|
+
*
|
|
766
|
+
* Views are visible when they are on the screen and expanded.
|
|
767
|
+
*/
|
|
768
|
+
readonly visible: boolean;
|
|
769
|
+
|
|
770
|
+
/**
|
|
771
|
+
* Event fired when the visibility of the view changes.
|
|
772
|
+
*
|
|
773
|
+
* Actions that trigger a visibility change:
|
|
774
|
+
*
|
|
775
|
+
* - The view is collapsed or expanded.
|
|
776
|
+
* - The user switches to a different view group in the sidebar or panel.
|
|
777
|
+
*
|
|
778
|
+
* Note that hiding a view using the context menu instead disposes of the view and fires `onDidDispose`.
|
|
779
|
+
*/
|
|
780
|
+
readonly onDidChangeVisibility: Event<void>;
|
|
781
|
+
|
|
782
|
+
/**
|
|
783
|
+
* Reveal the view in the UI.
|
|
784
|
+
*
|
|
785
|
+
* If the view is collapsed, this will expand it.
|
|
786
|
+
*
|
|
787
|
+
* @param preserveFocus When `true` the view will not take focus.
|
|
788
|
+
*/
|
|
789
|
+
show(preserveFocus?: boolean): void;
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
/**
|
|
793
|
+
* Additional information the webview view being resolved.
|
|
794
|
+
*
|
|
795
|
+
* @param T Type of the webview's state.
|
|
796
|
+
*/
|
|
797
|
+
interface WebviewViewResolveContext<T = unknown> {
|
|
798
|
+
/**
|
|
799
|
+
* Persisted state from the webview content.
|
|
800
|
+
*
|
|
801
|
+
* To save resources, VS Code normally deallocates webview documents (the iframe content) that are not visible.
|
|
802
|
+
* For example, when the user collapse a view or switches to another top level activity in the sidebar, the
|
|
803
|
+
* `WebviewView` itself is kept alive but the webview's underlying document is deallocated. It is recreated when
|
|
804
|
+
* the view becomes visible again.
|
|
805
|
+
*
|
|
806
|
+
* You can prevent this behavior by setting `retainContextWhenHidden` in the `WebviewOptions`. However this
|
|
807
|
+
* increases resource usage and should be avoided wherever possible. Instead, you can use persisted state to
|
|
808
|
+
* save off a webview's state so that it can be quickly recreated as needed.
|
|
809
|
+
*
|
|
810
|
+
* To save off a persisted state, inside the webview call `acquireVsCodeApi().setState()` with
|
|
811
|
+
* any json serializable object. To restore the state again, call `getState()`. For example:
|
|
812
|
+
*
|
|
813
|
+
* ```js
|
|
814
|
+
* // Within the webview
|
|
815
|
+
* const vscode = acquireVsCodeApi();
|
|
816
|
+
*
|
|
817
|
+
* // Get existing state
|
|
818
|
+
* const oldState = vscode.getState() || { value: 0 };
|
|
819
|
+
*
|
|
820
|
+
* // Update state
|
|
821
|
+
* setState({ value: oldState.value + 1 })
|
|
822
|
+
* ```
|
|
823
|
+
*
|
|
824
|
+
* VS Code ensures that the persisted state is saved correctly when a webview is hidden and across
|
|
825
|
+
* editor restarts.
|
|
826
|
+
*/
|
|
827
|
+
readonly state: T | undefined;
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
/**
|
|
831
|
+
* Provider for creating `WebviewView` elements.
|
|
832
|
+
*/
|
|
833
|
+
export interface WebviewViewProvider {
|
|
834
|
+
/**
|
|
835
|
+
* Revolves a webview view.
|
|
836
|
+
*
|
|
837
|
+
* `resolveWebviewView` is called when a view first becomes visible. This may happen when the view is
|
|
838
|
+
* first loaded or when the user hides and then shows a view again.
|
|
839
|
+
*
|
|
840
|
+
* @param webviewView Webview view to restore. The provider should take ownership of this view. The
|
|
841
|
+
* provider must set the webview's `.html` and hook up all webview events it is interested in.
|
|
842
|
+
* @param context Additional metadata about the view being resolved.
|
|
843
|
+
* @param token Cancellation token indicating that the view being provided is no longer needed.
|
|
844
|
+
*
|
|
845
|
+
* @return Optional thenable indicating that the view has been fully resolved.
|
|
846
|
+
*/
|
|
847
|
+
resolveWebviewView(webviewView: WebviewView, context: WebviewViewResolveContext, token: CancellationToken): Thenable<void> | void;
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
/**
|
|
851
|
+
* Represents a color theme kind.
|
|
852
|
+
*/
|
|
853
|
+
export enum ColorThemeKind {
|
|
854
|
+
Light = 1,
|
|
855
|
+
Dark = 2,
|
|
856
|
+
HighContrast = 3,
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
/**
|
|
860
|
+
* Represents a color theme.
|
|
861
|
+
*/
|
|
862
|
+
export interface ColorTheme {
|
|
863
|
+
|
|
864
|
+
/**
|
|
865
|
+
* The kind of this color theme: light, dark or high contrast.
|
|
866
|
+
*/
|
|
867
|
+
readonly kind: ColorThemeKind;
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
}
|