@theia/plugin 1.27.0-next.9 → 1.27.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theia/plugin",
3
- "version": "1.27.0-next.9+53a272e1138",
3
+ "version": "1.27.0",
4
4
  "description": "Theia - Plugin API",
5
5
  "types": "./src/theia.d.ts",
6
6
  "publishConfig": {
@@ -27,10 +27,10 @@
27
27
  "watch": "theiaext watch"
28
28
  },
29
29
  "devDependencies": {
30
- "@theia/ext-scripts": "1.26.0"
30
+ "@theia/ext-scripts": "1.27.0"
31
31
  },
32
32
  "nyc": {
33
33
  "extends": "../../configs/nyc.json"
34
34
  },
35
- "gitHead": "53a272e113890174c8b3049b8d1a74999dee0cd4"
35
+ "gitHead": "b952ad743a97821dee94787e946f5a288174d4e8"
36
36
  }
@@ -161,7 +161,7 @@ export module '@theia/plugin' {
161
161
  * Get the keybindings associated to commandId.
162
162
  * @param commandId The ID of the command for which we are looking for keybindings.
163
163
  */
164
- export function getKeyBinding(commandId: string): PromiseLike<CommandKeyBinding[] | undefined>;
164
+ export function getKeyBinding(commandId: string): Thenable<CommandKeyBinding[] | undefined>;
165
165
 
166
166
  /**
167
167
  * Registers a diff information command that can be invoked via a keyboard shortcut,
@@ -210,7 +210,7 @@ export module '@theia/plugin' {
210
210
  * Returns the type of the operating system on the client side (like browser'OS if using browser mode). If it is neither [Windows](isWindows) nor [OS X](isOSX), then
211
211
  * it always return with the `Linux` OS type.
212
212
  */
213
- export function getClientOperatingSystem(): PromiseLike<OperatingSystem>;
213
+ export function getClientOperatingSystem(): Thenable<OperatingSystem>;
214
214
 
215
215
  }
216
216
 
@@ -321,41 +321,6 @@ export module '@theia/plugin' {
321
321
 
322
322
  // #endregion
323
323
 
324
- // #region Tree View
325
- // copied from https://github.com/microsoft/vscode/blob/3ea5c9ddbebd8ec68e3b821f9c39c3ec785fde97/src/vs/vscode.proposed.d.ts#L1447-L1476
326
- /**
327
- * Label describing the [Tree item](#TreeItem)
328
- */
329
- export interface TreeItemLabel {
330
-
331
- /**
332
- * A human-readable string describing the [Tree item](#TreeItem).
333
- */
334
- label: string;
335
-
336
- /**
337
- * Ranges in the label to highlight. A range is defined as a tuple of two number where the
338
- * first is the inclusive start index and the second the exclusive end index
339
- */
340
- // TODO highlights?: [number, number][];
341
-
342
- }
343
-
344
- export class TreeItem2 extends TreeItem {
345
- /**
346
- * Label describing this item. When `falsy`, it is derived from [resourceUri](#TreeItem.resourceUri).
347
- */
348
- label?: string | TreeItemLabel | /* for compilation */ any;
349
-
350
- /**
351
- * @param label Label describing this item
352
- * @param collapsibleState [TreeItemCollapsibleState](#TreeItemCollapsibleState) of the tree item.
353
- * Default is [TreeItemCollapsibleState.None](#TreeItemCollapsibleState.None)
354
- */
355
- constructor(label: TreeItemLabel, collapsibleState?: TreeItemCollapsibleState);
356
- }
357
- // #endregion
358
-
359
324
  // #region search in workspace
360
325
  /**
361
326
  * The parameters of a query for text search.
package/src/theia.d.ts CHANGED
@@ -112,7 +112,7 @@ export module '@theia/plugin' {
112
112
  *
113
113
  * @return A promise that will resolve when this plug-in has been activated.
114
114
  */
115
- activate(): PromiseLike<T>;
115
+ activate(): Thenable<T>;
116
116
  }
117
117
 
118
118
  /**
@@ -1182,7 +1182,7 @@ export module '@theia/plugin' {
1182
1182
  * @param options The undo/redo behavior around this edit. By default, undo stops will be created before and after this edit.
1183
1183
  * @return A promise that resolves with a value indicating if the edits could be applied.
1184
1184
  */
1185
- edit(callback: (editBuilder: TextEditorEdit) => void, options?: { undoStopBefore: boolean; undoStopAfter: boolean; }): PromiseLike<boolean>;
1185
+ edit(callback: (editBuilder: TextEditorEdit) => void, options?: { undoStopBefore: boolean; undoStopAfter: boolean; }): Thenable<boolean>;
1186
1186
 
1187
1187
  /**
1188
1188
  * Insert a [snippet](#SnippetString) and put the editor into snippet mode. "Snippet mode"
@@ -1195,7 +1195,7 @@ export module '@theia/plugin' {
1195
1195
  * @return A promise that resolves with a value indicating if the snippet could be inserted. Note that the promise does not signal
1196
1196
  * that the snippet is completely filled-in or accepted.
1197
1197
  */
1198
- insertSnippet(snippet: SnippetString, location?: Position | Range | Position[] | Range[], options?: { undoStopBefore: boolean; undoStopAfter: boolean; }): PromiseLike<boolean>;
1198
+ insertSnippet(snippet: SnippetString, location?: Position | Range | Position[] | Range[], options?: { undoStopBefore: boolean; undoStopAfter: boolean; }): Thenable<boolean>;
1199
1199
 
1200
1200
  /**
1201
1201
  * Adds a set of decorations to the text editor. If a set of decorations already exists with
@@ -1215,6 +1215,22 @@ export module '@theia/plugin' {
1215
1215
  * @param revealType The scrolling strategy for revealing `range`.
1216
1216
  */
1217
1217
  revealRange(range: Range, revealType?: TextEditorRevealType): void;
1218
+
1219
+ /**
1220
+ * Shows this text editor. A [column](#ViewColumn) can be provided to control where the editor is being shown. Might change the [active editor](#window.activeTextEditor).
1221
+ *
1222
+ * @deprecated use [window.showTextDocument](#Window.showTextDocument) instead.
1223
+ *
1224
+ * @param column A [view column](#ViewColumn) in which this editor should be shown.
1225
+ */
1226
+ show(column?: ViewColumn): void;
1227
+
1228
+ /**
1229
+ * Hides this text editor.
1230
+ *
1231
+ * @deprecated use 'workbench.action.closeActiveEditor' command instead.
1232
+ */
1233
+ hide(): void;
1218
1234
  }
1219
1235
 
1220
1236
  /**
@@ -1658,7 +1674,7 @@ export module '@theia/plugin' {
1658
1674
  *
1659
1675
  * @param thenable A thenable that resolves to [pre-save-edits](#TextEdit).
1660
1676
  */
1661
- waitUntil(thenable: PromiseLike<TextEdit[]>): void;
1677
+ waitUntil(thenable: Thenable<TextEdit[]>): void;
1662
1678
 
1663
1679
  /**
1664
1680
  * Allows to pause the event loop until the provided thenable resolved.
@@ -1667,7 +1683,7 @@ export module '@theia/plugin' {
1667
1683
  *
1668
1684
  * @param thenable A thenable that delays saving.
1669
1685
  */
1670
- waitUntil(thenable: PromiseLike<any>): void;
1686
+ waitUntil(thenable: Thenable<any>): void;
1671
1687
  }
1672
1688
 
1673
1689
  /**
@@ -2455,7 +2471,7 @@ export module '@theia/plugin' {
2455
2471
  *
2456
2472
  * Reject if a command cannot be executed.
2457
2473
  */
2458
- export function executeCommand<T>(commandId: string, ...args: any[]): PromiseLike<T | undefined>;
2474
+ export function executeCommand<T>(commandId: string, ...args: any[]): Thenable<T | undefined>;
2459
2475
 
2460
2476
  /**
2461
2477
  * Retrieve the list of all available commands. Commands starting an underscore are
@@ -2464,7 +2480,7 @@ export module '@theia/plugin' {
2464
2480
  * @param filterInternal Set `true` to not see internal commands (starting with an underscore)
2465
2481
  * @return Thenable that resolves to a list of command ids.
2466
2482
  */
2467
- export function getCommands(filterInternal?: boolean): PromiseLike<string[]>;
2483
+ export function getCommands(filterInternal?: boolean): Thenable<string[]>;
2468
2484
  }
2469
2485
 
2470
2486
  /**
@@ -2652,7 +2668,22 @@ export module '@theia/plugin' {
2652
2668
  */
2653
2669
  static readonly Folder: ThemeIcon;
2654
2670
 
2655
- private constructor(public id: string);
2671
+ /**
2672
+ * The id of the icon. The available icons are listed in https://code.visualstudio.com/api/references/icons-in-labels#icon-listing.
2673
+ */
2674
+ readonly id: string;
2675
+
2676
+ /**
2677
+ * The optional ThemeColor of the icon. The color is currently only used in {@link TreeItem}.
2678
+ */
2679
+ readonly color?: ThemeColor | undefined;
2680
+
2681
+ /**
2682
+ * Creates a reference to a theme icon.
2683
+ * @param id id of the icon. The available icons are listed in https://code.visualstudio.com/api/references/icons-in-labels#icon-listing.
2684
+ * @param color optional `ThemeColor` for the icon. The color is currently only used in {@link TreeItem}.
2685
+ */
2686
+ private constructor(public id: string, public color?: ThemeColor);
2656
2687
  }
2657
2688
 
2658
2689
  /**
@@ -2831,7 +2862,7 @@ export module '@theia/plugin' {
2831
2862
  /**
2832
2863
  * Terminal id.
2833
2864
  */
2834
- readonly processId: PromiseLike<number>;
2865
+ readonly processId: Thenable<number>;
2835
2866
 
2836
2867
  /**
2837
2868
  * The exit status of the terminal, this will be undefined while the terminal is active.
@@ -3450,7 +3481,7 @@ export module '@theia/plugin' {
3450
3481
  * @param key A string.
3451
3482
  * @param value A value. MUST not contain cyclic references.
3452
3483
  */
3453
- update(key: string, value: any): PromiseLike<void>;
3484
+ update(key: string, value: any): Thenable<void>;
3454
3485
  }
3455
3486
 
3456
3487
  /**
@@ -3581,7 +3612,7 @@ export module '@theia/plugin' {
3581
3612
  *
3582
3613
  * @param message Body of the message.
3583
3614
  */
3584
- postMessage(message: any): PromiseLike<boolean>;
3615
+ postMessage(message: any): Thenable<boolean>;
3585
3616
 
3586
3617
  /**
3587
3618
  * Convert a uri for the local file system to one that can be used inside webviews.
@@ -3816,9 +3847,9 @@ export module '@theia/plugin' {
3816
3847
  * serializer must restore the webview's `.html` and hook up all webview events.
3817
3848
  * @param state Persisted state from the webview content.
3818
3849
  *
3819
- * @return PromiseLike indicating that the webview has been fully restored.
3850
+ * @return Thenable indicating that the webview has been fully restored.
3820
3851
  */
3821
- deserializeWebviewPanel(webviewPanel: WebviewPanel, state: T): PromiseLike<void>;
3852
+ deserializeWebviewPanel(webviewPanel: WebviewPanel, state: T): Thenable<void>;
3822
3853
  }
3823
3854
 
3824
3855
  /**
@@ -3830,13 +3861,13 @@ export module '@theia/plugin' {
3830
3861
  * Read the current clipboard contents as text.
3831
3862
  * @returns A thenable that resolves to a string.
3832
3863
  */
3833
- readText(): PromiseLike<string>;
3864
+ readText(): Thenable<string>;
3834
3865
 
3835
3866
  /**
3836
3867
  * Writes text into the clipboard.
3837
3868
  * @returns A thenable that resolves when writing happened.
3838
3869
  */
3839
- writeText(value: string): PromiseLike<void>;
3870
+ writeText(value: string): Thenable<void>;
3840
3871
  }
3841
3872
 
3842
3873
  /**
@@ -4268,6 +4299,44 @@ export module '@theia/plugin' {
4268
4299
  resolveWebviewView(webviewView: WebviewView, context: WebviewViewResolveContext, token: CancellationToken): Thenable<void> | void;
4269
4300
  }
4270
4301
 
4302
+ /**
4303
+ * Additional information the webview view being resolved.
4304
+ *
4305
+ * @param T Type of the webview's state.
4306
+ */
4307
+ interface WebviewViewResolveContext<T = unknown> {
4308
+ /**
4309
+ * Persisted state from the webview content.
4310
+ *
4311
+ * To save resources, VS Code normally deallocates webview documents (the iframe content) that are not visible.
4312
+ * For example, when the user collapse a view or switches to another top level activity in the sidebar, the
4313
+ * `WebviewView` itself is kept alive but the webview's underlying document is deallocated. It is recreated when
4314
+ * the view becomes visible again.
4315
+ *
4316
+ * You can prevent this behavior by setting `retainContextWhenHidden` in the `WebviewOptions`. However this
4317
+ * increases resource usage and should be avoided wherever possible. Instead, you can use persisted state to
4318
+ * save off a webview's state so that it can be quickly recreated as needed.
4319
+ *
4320
+ * To save off a persisted state, inside the webview call `acquireVsCodeApi().setState()` with
4321
+ * any json serializable object. To restore the state again, call `getState()`. For example:
4322
+ *
4323
+ * ```js
4324
+ * // Within the webview
4325
+ * const vscode = acquireVsCodeApi();
4326
+ *
4327
+ * // Get existing state
4328
+ * const oldState = vscode.getState() || { value: 0 };
4329
+ *
4330
+ * // Update state
4331
+ * setState({ value: oldState.value + 1 })
4332
+ * ```
4333
+ *
4334
+ * VS Code ensures that the persisted state is saved correctly when a webview is hidden and across
4335
+ * editor restarts.
4336
+ */
4337
+ readonly state: T | undefined;
4338
+ }
4339
+
4271
4340
  /**
4272
4341
  * Common namespace for dealing with window and editor, showing messages and user input.
4273
4342
  */
@@ -4346,7 +4415,7 @@ export module '@theia/plugin' {
4346
4415
  * @param preserveFocus When `true` the editor will not take focus.
4347
4416
  * @return A promise that resolves to an [editor](#TextEditor).
4348
4417
  */
4349
- export function showTextDocument(document: TextDocument, column?: ViewColumn, preserveFocus?: boolean): PromiseLike<TextEditor>;
4418
+ export function showTextDocument(document: TextDocument, column?: ViewColumn, preserveFocus?: boolean): Thenable<TextEditor>;
4350
4419
 
4351
4420
  /**
4352
4421
  * Show the given document in a text editor. [Options](#TextDocumentShowOptions) can be provided
@@ -4356,7 +4425,7 @@ export module '@theia/plugin' {
4356
4425
  * @param options [Editor options](#TextDocumentShowOptions) to configure the behavior of showing the [editor](#TextEditor).
4357
4426
  * @return A promise that resolves to an [editor](#TextEditor).
4358
4427
  */
4359
- export function showTextDocument(document: TextDocument, options?: TextDocumentShowOptions): PromiseLike<TextEditor>;
4428
+ export function showTextDocument(document: TextDocument, options?: TextDocumentShowOptions): Thenable<TextEditor>;
4360
4429
 
4361
4430
  /**
4362
4431
  * A short-hand for `openTextDocument(uri).then(document => showTextDocument(document, options))`.
@@ -4367,7 +4436,7 @@ export module '@theia/plugin' {
4367
4436
  * @param options [Editor options](#TextDocumentShowOptions) to configure the behavior of showing the [editor](#TextEditor).
4368
4437
  * @return A promise that resolves to an [editor](#TextEditor).
4369
4438
  */
4370
- export function showTextDocument(uri: Uri, options?: TextDocumentShowOptions): PromiseLike<TextEditor>;
4439
+ export function showTextDocument(uri: Uri, options?: TextDocumentShowOptions): Thenable<TextEditor>;
4371
4440
 
4372
4441
  /**
4373
4442
  * Shows a selection list.
@@ -4377,7 +4446,7 @@ export module '@theia/plugin' {
4377
4446
  * @param token A token that can be used to signal cancellation.
4378
4447
  * @return A promise that resolves to the selection or `undefined`.
4379
4448
  */
4380
- export function showQuickPick(readonly items: string[] | PromiseLike<readonly string[]>, options: QuickPickOptions, token?: CancellationToken): PromiseLike<string | undefined>;
4449
+ export function showQuickPick(readonly items: string[] | Thenable<readonly string[]>, options: QuickPickOptions, token?: CancellationToken): Thenable<string | undefined>;
4381
4450
 
4382
4451
  /**
4383
4452
  * Shows a selection list allowing multiple selections.
@@ -4387,7 +4456,7 @@ export module '@theia/plugin' {
4387
4456
  * @param token A token that can be used to signal cancellation.
4388
4457
  * @return A promise that resolves to the selected items or `undefined`.
4389
4458
  */
4390
- export function showQuickPick(readonly items: string[] | PromiseLike<readonly string[]>, options: QuickPickOptions & { canPickMany: true }, token?: CancellationToken): PromiseLike<string[] | undefined>;
4459
+ export function showQuickPick(readonly items: string[] | Thenable<readonly string[]>, options: QuickPickOptions & { canPickMany: true }, token?: CancellationToken): Thenable<string[] | undefined>;
4391
4460
 
4392
4461
  /**
4393
4462
  * Shows a selection list.
@@ -4397,7 +4466,7 @@ export module '@theia/plugin' {
4397
4466
  * @param token A token that can be used to signal cancellation.
4398
4467
  * @return A promise that resolves to the selected item or `undefined`.
4399
4468
  */
4400
- export function showQuickPick<T extends QuickPickItem>(items: readonly T[] | PromiseLike<readonly T[]>, options: QuickPickOptions, token?: CancellationToken): PromiseLike<T | undefined>;
4469
+ export function showQuickPick<T extends QuickPickItem>(items: readonly T[] | Thenable<readonly T[]>, options: QuickPickOptions, token?: CancellationToken): Thenable<T | undefined>;
4401
4470
 
4402
4471
  /**
4403
4472
  * Shows a selection list allowing multiple selections.
@@ -4407,7 +4476,7 @@ export module '@theia/plugin' {
4407
4476
  * @param token A token that can be used to signal cancellation.
4408
4477
  * @return A promise that resolves to the selected items or `undefined`.
4409
4478
  */
4410
- export function showQuickPick<T extends QuickPickItem>(items: readonly T[] | PromiseLike<readonly T[]>, options: QuickPickOptions & { canPickMany: true }, token?: CancellationToken): PromiseLike<T[] | undefined>;
4479
+ export function showQuickPick<T extends QuickPickItem>(items: readonly T[] | Thenable<readonly T[]>, options: QuickPickOptions & { canPickMany: true }, token?: CancellationToken): Thenable<T[] | undefined>;
4411
4480
 
4412
4481
  /**
4413
4482
  * Creates a [QuickPick](#QuickPick) to let the user pick an item from a list
@@ -4428,7 +4497,7 @@ export module '@theia/plugin' {
4428
4497
  * @param options Configures the behavior of the workspace folder list.
4429
4498
  * @return A promise that resolves to the workspace folder or `undefined`.
4430
4499
  */
4431
- export function showWorkspaceFolderPick(options?: WorkspaceFolderPickOptions): PromiseLike<WorkspaceFolder | undefined>;
4500
+ export function showWorkspaceFolderPick(options?: WorkspaceFolderPickOptions): Thenable<WorkspaceFolder | undefined>;
4432
4501
 
4433
4502
  /**
4434
4503
  * Show an information message.
@@ -4437,7 +4506,7 @@ export module '@theia/plugin' {
4437
4506
  * @param items A set of items that will be rendered as actions in the message.
4438
4507
  * @return A promise that resolves to the selected item or `undefined` when being dismissed.
4439
4508
  */
4440
- export function showInformationMessage(message: string, ...items: string[]): PromiseLike<string | undefined>;
4509
+ export function showInformationMessage(message: string, ...items: string[]): Thenable<string | undefined>;
4441
4510
 
4442
4511
  /**
4443
4512
  * Show an information message.
@@ -4447,7 +4516,7 @@ export module '@theia/plugin' {
4447
4516
  * @param items A set of items that will be rendered as actions in the message.
4448
4517
  * @return A promise that resolves to the selected item or `undefined` when being dismissed.
4449
4518
  */
4450
- export function showInformationMessage(message: string, options: MessageOptions, ...items: string[]): PromiseLike<string | undefined>;
4519
+ export function showInformationMessage(message: string, options: MessageOptions, ...items: string[]): Thenable<string | undefined>;
4451
4520
 
4452
4521
  /**
4453
4522
  * Show an information message.
@@ -4456,7 +4525,7 @@ export module '@theia/plugin' {
4456
4525
  * @param items A set of items that will be rendered as actions in the message.
4457
4526
  * @return A promise that resolves to the selected item or `undefined` when being dismissed.
4458
4527
  */
4459
- export function showInformationMessage<T extends MessageItem>(message: string, ...items: T[]): PromiseLike<T | undefined>;
4528
+ export function showInformationMessage<T extends MessageItem>(message: string, ...items: T[]): Thenable<T | undefined>;
4460
4529
 
4461
4530
  /**
4462
4531
  * Show an information message.
@@ -4466,7 +4535,7 @@ export module '@theia/plugin' {
4466
4535
  * @param items A set of items that will be rendered as actions in the message.
4467
4536
  * @return A promise that resolves to the selected item or `undefined` when being dismissed.
4468
4537
  */
4469
- export function showInformationMessage<T extends MessageItem>(message: string, options: MessageOptions, ...items: T[]): PromiseLike<T | undefined>;
4538
+ export function showInformationMessage<T extends MessageItem>(message: string, options: MessageOptions, ...items: T[]): Thenable<T | undefined>;
4470
4539
 
4471
4540
  /**
4472
4541
  * Show a warning message.
@@ -4475,7 +4544,7 @@ export module '@theia/plugin' {
4475
4544
  * @param items A set of items that will be rendered as actions in the message.
4476
4545
  * @return A promise that resolves to the selected item or `undefined` when being dismissed.
4477
4546
  */
4478
- export function showWarningMessage(message: string, ...items: string[]): PromiseLike<string | undefined>;
4547
+ export function showWarningMessage(message: string, ...items: string[]): Thenable<string | undefined>;
4479
4548
 
4480
4549
  /**
4481
4550
  * Show a warning message.
@@ -4485,7 +4554,7 @@ export module '@theia/plugin' {
4485
4554
  * @param items A set of items that will be rendered as actions in the message.
4486
4555
  * @return A promise that resolves to the selected item or `undefined` when being dismissed.
4487
4556
  */
4488
- export function showWarningMessage(message: string, options: MessageOptions, ...items: string[]): PromiseLike<string | undefined>;
4557
+ export function showWarningMessage(message: string, options: MessageOptions, ...items: string[]): Thenable<string | undefined>;
4489
4558
 
4490
4559
  /**
4491
4560
  * Show a warning message.
@@ -4494,7 +4563,7 @@ export module '@theia/plugin' {
4494
4563
  * @param items A set of items that will be rendered as actions in the message.
4495
4564
  * @return A promise that resolves to the selected item or `undefined` when being dismissed.
4496
4565
  */
4497
- export function showWarningMessage<T extends MessageItem>(message: string, ...items: T[]): PromiseLike<T | undefined>;
4566
+ export function showWarningMessage<T extends MessageItem>(message: string, ...items: T[]): Thenable<T | undefined>;
4498
4567
 
4499
4568
  /**
4500
4569
  * Show a warning message.
@@ -4504,7 +4573,7 @@ export module '@theia/plugin' {
4504
4573
  * @param items A set of items that will be rendered as actions in the message.
4505
4574
  * @return A promise that resolves to the selected item or `undefined` when being dismissed.
4506
4575
  */
4507
- export function showWarningMessage<T extends MessageItem>(message: string, options: MessageOptions, ...items: T[]): PromiseLike<T | undefined>;
4576
+ export function showWarningMessage<T extends MessageItem>(message: string, options: MessageOptions, ...items: T[]): Thenable<T | undefined>;
4508
4577
 
4509
4578
  /**
4510
4579
  * Show an error message.
@@ -4513,7 +4582,7 @@ export module '@theia/plugin' {
4513
4582
  * @param items A set of items that will be rendered as actions in the message.
4514
4583
  * @return A promise that resolves to the selected item or `undefined` when being dismissed.
4515
4584
  */
4516
- export function showErrorMessage(message: string, ...items: string[]): PromiseLike<string | undefined>;
4585
+ export function showErrorMessage(message: string, ...items: string[]): Thenable<string | undefined>;
4517
4586
 
4518
4587
  /**
4519
4588
  * Show an error message.
@@ -4523,7 +4592,7 @@ export module '@theia/plugin' {
4523
4592
  * @param items A set of items that will be rendered as actions in the message.
4524
4593
  * @return A promise that resolves to the selected item or `undefined` when being dismissed.
4525
4594
  */
4526
- export function showErrorMessage(message: string, options: MessageOptions, ...items: string[]): PromiseLike<string | undefined>;
4595
+ export function showErrorMessage(message: string, options: MessageOptions, ...items: string[]): Thenable<string | undefined>;
4527
4596
 
4528
4597
  /**
4529
4598
  * Show an error message.
@@ -4532,7 +4601,7 @@ export module '@theia/plugin' {
4532
4601
  * @param items A set of items that will be rendered as actions in the message.
4533
4602
  * @return A promise that resolves to the selected item or `undefined` when being dismissed.
4534
4603
  */
4535
- export function showErrorMessage<T extends MessageItem>(message: string, ...items: T[]): PromiseLike<T | undefined>;
4604
+ export function showErrorMessage<T extends MessageItem>(message: string, ...items: T[]): Thenable<T | undefined>;
4536
4605
 
4537
4606
  /**
4538
4607
  * Show an error message.
@@ -4542,7 +4611,7 @@ export module '@theia/plugin' {
4542
4611
  * @param items A set of items that will be rendered as actions in the message.
4543
4612
  * @return A promise that resolves to the selected item or `undefined` when being dismissed.
4544
4613
  */
4545
- export function showErrorMessage<T extends MessageItem>(message: string, options: MessageOptions, ...items: T[]): PromiseLike<T | undefined>;
4614
+ export function showErrorMessage<T extends MessageItem>(message: string, options: MessageOptions, ...items: T[]): Thenable<T | undefined>;
4546
4615
 
4547
4616
  /**
4548
4617
  * Opens an input box to ask the user for input.
@@ -4555,7 +4624,7 @@ export module '@theia/plugin' {
4555
4624
  * @param token A token that can be used to signal cancellation.
4556
4625
  * @return A promise that resolves to a string the user provided or to `undefined` in case of dismissal.
4557
4626
  */
4558
- export function showInputBox(options?: InputBoxOptions, token?: CancellationToken): PromiseLike<string | undefined>;
4627
+ export function showInputBox(options?: InputBoxOptions, token?: CancellationToken): Thenable<string | undefined>;
4559
4628
 
4560
4629
  /**
4561
4630
  * Shows a file open dialog to the user which allows to select a file
@@ -4564,7 +4633,7 @@ export module '@theia/plugin' {
4564
4633
  * @param options Options that control the dialog.
4565
4634
  * @returns A promise that resolves to the selected resources or `undefined`.
4566
4635
  */
4567
- export function showOpenDialog(options: OpenDialogOptions): PromiseLike<Uri[] | undefined>;
4636
+ export function showOpenDialog(options: OpenDialogOptions): Thenable<Uri[] | undefined>;
4568
4637
 
4569
4638
  /**
4570
4639
  * Shows a file save dialog to the user which allows to select a file
@@ -4573,7 +4642,7 @@ export module '@theia/plugin' {
4573
4642
  * @param options Options that control the dialog.
4574
4643
  * @returns A promise that resolves to the selected resource or `undefined`.
4575
4644
  */
4576
- export function showSaveDialog(options: SaveDialogOptions): PromiseLike<Uri | undefined>;
4645
+ export function showSaveDialog(options: SaveDialogOptions): Thenable<Uri | undefined>;
4577
4646
 
4578
4647
  /**
4579
4648
  * Shows a file upload dialog to the user which allows to upload files
@@ -4582,7 +4651,7 @@ export module '@theia/plugin' {
4582
4651
  * @param options Options, that control the dialog.
4583
4652
  * @returns A promise that resolves the paths of uploaded files or `undefined`.
4584
4653
  */
4585
- export function showUploadDialog(options: UploadDialogOptions): PromiseLike<Uri[] | undefined>;
4654
+ export function showUploadDialog(options: UploadDialogOptions): Thenable<Uri[] | undefined>;
4586
4655
 
4587
4656
  /**
4588
4657
  * Create and show a new webview panel.
@@ -4609,44 +4678,6 @@ export module '@theia/plugin' {
4609
4678
  * @param serializer Webview serializer.
4610
4679
  */
4611
4680
 
4612
- /**
4613
- * Additional information the webview view being resolved.
4614
- *
4615
- * @param T Type of the webview's state.
4616
- */
4617
- interface WebviewViewResolveContext<T = unknown> {
4618
- /**
4619
- * Persisted state from the webview content.
4620
- *
4621
- * To save resources, VS Code normally deallocates webview documents (the iframe content) that are not visible.
4622
- * For example, when the user collapse a view or switches to another top level activity in the sidebar, the
4623
- * `WebviewView` itself is kept alive but the webview's underlying document is deallocated. It is recreated when
4624
- * the view becomes visible again.
4625
- *
4626
- * You can prevent this behavior by setting `retainContextWhenHidden` in the `WebviewOptions`. However this
4627
- * increases resource usage and should be avoided wherever possible. Instead, you can use persisted state to
4628
- * save off a webview's state so that it can be quickly recreated as needed.
4629
- *
4630
- * To save off a persisted state, inside the webview call `acquireVsCodeApi().setState()` with
4631
- * any json serializable object. To restore the state again, call `getState()`. For example:
4632
- *
4633
- * ```js
4634
- * // Within the webview
4635
- * const vscode = acquireVsCodeApi();
4636
- *
4637
- * // Get existing state
4638
- * const oldState = vscode.getState() || { value: 0 };
4639
- *
4640
- * // Update state
4641
- * setState({ value: oldState.value + 1 })
4642
- * ```
4643
- *
4644
- * VS Code ensures that the persisted state is saved correctly when a webview is hidden and across
4645
- * editor restarts.
4646
- */
4647
- readonly state: T | undefined;
4648
- }
4649
-
4650
4681
  export function registerWebviewViewProvider(viewId: string, provider: WebviewViewProvider, options?: {
4651
4682
  /**
4652
4683
  * Content settings for the webview created for this view.
@@ -4753,10 +4784,10 @@ export module '@theia/plugin' {
4753
4784
  * Set a message to the status bar.
4754
4785
  *
4755
4786
  * @param text The message to show, supports icon substitution as in status bar.
4756
- * @param hideWhenDone PromiseLike on which completion (resolve or reject) the message will be disposed.
4787
+ * @param hideWhenDone Thenable on which completion (resolve or reject) the message will be disposed.
4757
4788
  * @return A disposable which hides the status bar message.
4758
4789
  */
4759
- export function setStatusBarMessage(text: string, hideWhenDone: PromiseLike<any>): Disposable;
4790
+ export function setStatusBarMessage(text: string, hideWhenDone: Thenable<any>): Disposable;
4760
4791
 
4761
4792
  /**
4762
4793
  * Creates a status bar {@link StatusBarItem item}.
@@ -4886,7 +4917,7 @@ export module '@theia/plugin' {
4886
4917
  *
4887
4918
  * @return The thenable the task-callback returned.
4888
4919
  */
4889
- export function withProgress<R>(options: ProgressOptions, task: (progress: Progress<{ message?: string; increment?: number }>, token: CancellationToken) => PromiseLike<R>): PromiseLike<R>;
4920
+ export function withProgress<R>(options: ProgressOptions, task: (progress: Progress<{ message?: string; increment?: number }>, token: CancellationToken) => Thenable<R>): Thenable<R>;
4890
4921
 
4891
4922
  /**
4892
4923
  * Creates a [InputBox](#InputBox) to let the user enter some text input.
@@ -5288,7 +5319,7 @@ export module '@theia/plugin' {
5288
5319
  *
5289
5320
  * **NOTE:** [TreeDataProvider](#TreeDataProvider) is required to implement [getParent](#TreeDataProvider.getParent) method to access this API.
5290
5321
  */
5291
- reveal(element: T, options?: { select?: boolean, focus?: boolean, expand?: boolean | number }): PromiseLike<void>;
5322
+ reveal(element: T, options?: { select?: boolean, focus?: boolean, expand?: boolean | number }): Thenable<void>;
5292
5323
  }
5293
5324
 
5294
5325
  /**
@@ -5308,7 +5339,7 @@ export module '@theia/plugin' {
5308
5339
  * @param element The element for which [TreeItem](#TreeItem) representation is asked for.
5309
5340
  * @return [TreeItem](#TreeItem) representation of the element
5310
5341
  */
5311
- getTreeItem(element: T): TreeItem | PromiseLike<TreeItem>;
5342
+ getTreeItem(element: T): TreeItem | Thenable<TreeItem>;
5312
5343
 
5313
5344
  /**
5314
5345
  * Get the children of `element` or root if no element is passed.
@@ -5334,7 +5365,7 @@ export module '@theia/plugin' {
5334
5365
  /**
5335
5366
  * A human-readable string describing this item. When `falsy`, it is derived from [resourceUri](#TreeItem.resourceUri).
5336
5367
  */
5337
- label?: string;
5368
+ label?: string | TreeItemLabel;
5338
5369
 
5339
5370
  /**
5340
5371
  * 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.
@@ -5410,7 +5441,7 @@ export module '@theia/plugin' {
5410
5441
  * @param label A human-readable string describing this item
5411
5442
  * @param collapsibleState [TreeItemCollapsibleState](#TreeItemCollapsibleState) of the tree item. Default is [TreeItemCollapsibleState.None](#TreeItemCollapsibleState.None)
5412
5443
  */
5413
- constructor(label: string, collapsibleState?: TreeItemCollapsibleState);
5444
+ constructor(label: string | TreeItemLabel, collapsibleState?: TreeItemCollapsibleState);
5414
5445
 
5415
5446
  /**
5416
5447
  * @param resourceUri The [uri](#Uri) of the resource representing this item.
@@ -5437,6 +5468,23 @@ export module '@theia/plugin' {
5437
5468
  Expanded = 2
5438
5469
  }
5439
5470
 
5471
+ /**
5472
+ * Label describing the {@link TreeItem Tree item}
5473
+ */
5474
+ export interface TreeItemLabel {
5475
+
5476
+ /**
5477
+ * A human-readable string describing the {@link TreeItem Tree item}.
5478
+ */
5479
+ label: string;
5480
+
5481
+ /**
5482
+ * Ranges in the label to highlight. A range is defined as a tuple of two numbers where the
5483
+ * first is the inclusive start index and the second the exclusive end index
5484
+ */
5485
+ highlights?: [number, number][];
5486
+ }
5487
+
5440
5488
  /**
5441
5489
  * Represents the configuration. It is a merged view of
5442
5490
  *
@@ -5545,7 +5593,7 @@ export module '@theia/plugin' {
5545
5593
  * `ConfigurationTarget.WorkspaceFolder` when configuration is resource specific
5546
5594
  * `ConfigurationTarget.Workspace` otherwise.
5547
5595
  */
5548
- update(section: string, value: any, configurationTarget?: ConfigurationTarget | boolean): PromiseLike<void>;
5596
+ update(section: string, value: any, configurationTarget?: ConfigurationTarget | boolean): Thenable<void>;
5549
5597
 
5550
5598
  /**
5551
5599
  * Readable dictionary that backs this configuration.
@@ -6212,7 +6260,7 @@ export module '@theia/plugin' {
6212
6260
  * @param uri Identifies the resource to open.
6213
6261
  * @return A promise that resolves to a [document](#TextDocument).
6214
6262
  */
6215
- export function openTextDocument(uri: Uri): PromiseLike<TextDocument | undefined>;
6263
+ export function openTextDocument(uri: Uri): Thenable<TextDocument | undefined>;
6216
6264
 
6217
6265
  /**
6218
6266
  * A short-hand for `openTextDocument(Uri.file(fileName))`.
@@ -6221,7 +6269,7 @@ export module '@theia/plugin' {
6221
6269
  * @param fileName A name of a file on disk.
6222
6270
  * @return A promise that resolves to a [document](#TextDocument).
6223
6271
  */
6224
- export function openTextDocument(fileName: string): PromiseLike<TextDocument | undefined>;
6272
+ export function openTextDocument(fileName: string): Thenable<TextDocument | undefined>;
6225
6273
 
6226
6274
  /**
6227
6275
  * Opens an untitled text document. The editor will prompt the user for a file
@@ -6231,7 +6279,7 @@ export module '@theia/plugin' {
6231
6279
  * @param options Options to control how the document will be created.
6232
6280
  * @return A promise that resolves to a [document](#TextDocument).
6233
6281
  */
6234
- export function openTextDocument(options?: { language?: string; content?: string; }): PromiseLike<TextDocument | undefined>;
6282
+ export function openTextDocument(options?: { language?: string; content?: string; }): Thenable<TextDocument | undefined>;
6235
6283
 
6236
6284
  /**
6237
6285
  * Get a workspace configuration object.
@@ -6290,7 +6338,7 @@ export module '@theia/plugin' {
6290
6338
  * @return A thenable that resolves to an array of resource identifiers. Will return no results if no
6291
6339
  * [workspace folders](#workspace.workspaceFolders) are opened.
6292
6340
  */
6293
- export function findFiles(include: GlobPattern, exclude?: GlobPattern | null, maxResults?: number, token?: CancellationToken): PromiseLike<Uri[]>;
6341
+ export function findFiles(include: GlobPattern, exclude?: GlobPattern | null, maxResults?: number, token?: CancellationToken): Thenable<Uri[]>;
6294
6342
 
6295
6343
  /**
6296
6344
  * Find text in files across all [workspace folders] in the workspace
@@ -6308,7 +6356,7 @@ export module '@theia/plugin' {
6308
6356
  * @param includeUntitled Also save files that have been created during this session.
6309
6357
  * @return A thenable that resolves when the files have been saved.
6310
6358
  */
6311
- export function saveAll(includeUntitled?: boolean): PromiseLike<boolean>;
6359
+ export function saveAll(includeUntitled?: boolean): Thenable<boolean>;
6312
6360
 
6313
6361
  /**
6314
6362
  * Make changes to one or many resources or create, delete, and rename resources as defined by the given
@@ -6326,7 +6374,7 @@ export module '@theia/plugin' {
6326
6374
  * @param edit A workspace edit.
6327
6375
  * @return A thenable that resolves when the edit could be applied.
6328
6376
  */
6329
- export function applyEdit(edit: WorkspaceEdit): PromiseLike<boolean>;
6377
+ export function applyEdit(edit: WorkspaceEdit): Thenable<boolean>;
6330
6378
 
6331
6379
  /**
6332
6380
  * Register a filesystem provider for a given scheme, e.g. `ftp`.
@@ -6448,7 +6496,7 @@ export module '@theia/plugin' {
6448
6496
  * @param envVarName name of environment variable to get
6449
6497
  * @returns value of the given environment variable name or undefined if there is no such variable.
6450
6498
  */
6451
- export function getEnvVariable(envVarName: string): PromiseLike<string | undefined>;
6499
+ export function getEnvVariable(envVarName: string): Thenable<string | undefined>;
6452
6500
 
6453
6501
  /**
6454
6502
  * Gets query parameter value by name.
@@ -6521,7 +6569,7 @@ export module '@theia/plugin' {
6521
6569
  * @param target The uri that should be opened.
6522
6570
  * @returns A promise indicating if open was successful.
6523
6571
  */
6524
- export function openExternal(target: Uri): PromiseLike<boolean>;
6572
+ export function openExternal(target: Uri): Thenable<boolean>;
6525
6573
 
6526
6574
  /**
6527
6575
  * Resolves an *external* uri, such as a `http:` or `https:` link, from where the extension is running to a
@@ -6535,7 +6583,7 @@ export module '@theia/plugin' {
6535
6583
  * the port forwarding tunnel is managed by VS Code and the tunnel can be closed by the user.
6536
6584
  *
6537
6585
  * Extensions should not cache the result of `asExternalUri` as the resolved uri may become invalid due to
6538
- * a system or user action — for example, in remote cases, a user may close a port forwarding tunnel
6586
+ * a system or user action — for example, in remote cases, a user may close a port forwarding tunnel
6539
6587
  * that was opened by `asExternalUri`.
6540
6588
  *
6541
6589
  * *Note* that uris passed through `openExternal` are automatically resolved and you should not call `asExternalUri`
@@ -6543,7 +6591,7 @@ export module '@theia/plugin' {
6543
6591
  *
6544
6592
  * @return A uri that can be used on the client machine.
6545
6593
  */
6546
- export function asExternalUri(target: Uri): PromiseLike<Uri>;
6594
+ export function asExternalUri(target: Uri): Thenable<Uri>;
6547
6595
 
6548
6596
  }
6549
6597
 
@@ -6709,6 +6757,10 @@ export module '@theia/plugin' {
6709
6757
  * This rule will only execute if the text after the cursor matches this regular expression.
6710
6758
  */
6711
6759
  afterText?: RegExp;
6760
+ /**
6761
+ * This rule will only execute if the text above the current line matches this regular expression.
6762
+ */
6763
+ previousLineText?: RegExp;
6712
6764
  /**
6713
6765
  * The action to execute.
6714
6766
  */
@@ -8966,7 +9018,7 @@ export module '@theia/plugin' {
8966
9018
  * Return the identifiers of all known languages.
8967
9019
  * @return Promise resolving to an array of identifier strings.
8968
9020
  */
8969
- export function getLanguages(): PromiseLike<string[]>;
9021
+ export function getLanguages(): Thenable<string[]>;
8970
9022
 
8971
9023
  /**
8972
9024
  * Set (and change) the [language](#TextDocument.languageId) that is associated
@@ -8979,7 +9031,7 @@ export module '@theia/plugin' {
8979
9031
  * @param languageId The new language identifier.
8980
9032
  * @returns A thenable that resolves with the updated document.
8981
9033
  */
8982
- export function setTextDocumentLanguage(document: TextDocument, languageId: string): PromiseLike<TextDocument>;
9034
+ export function setTextDocumentLanguage(document: TextDocument, languageId: string): Thenable<TextDocument>;
8983
9035
 
8984
9036
  /**
8985
9037
  * Compute the match between a document [selector](#DocumentSelector) and a document. Values
@@ -9850,7 +9902,7 @@ export module '@theia/plugin' {
9850
9902
  /**
9851
9903
  * Send a custom request to the debug adapter.
9852
9904
  */
9853
- customRequest(command: string, args?: any): PromiseLike<any>;
9905
+ customRequest(command: string, args?: any): Thenable<any>;
9854
9906
  }
9855
9907
 
9856
9908
  /**
@@ -10363,13 +10415,13 @@ export module '@theia/plugin' {
10363
10415
  * @param parentSessionOrOptions Debug session options. When passed a parent debug session, assumes options with just this parent session.
10364
10416
  * @return A thenable that resolves when debugging could be successfully started.
10365
10417
  */
10366
- export function startDebugging(folder: WorkspaceFolder | undefined, nameOrConfiguration: string | DebugConfiguration, parentSessionOrOptions?: DebugSession | DebugSessionOptions): PromiseLike<boolean>;
10418
+ export function startDebugging(folder: WorkspaceFolder | undefined, nameOrConfiguration: string | DebugConfiguration, parentSessionOrOptions?: DebugSession | DebugSessionOptions): Thenable<boolean>;
10367
10419
 
10368
10420
  /**
10369
10421
  * Stop the given debug session or stop all debug sessions if session is omitted.
10370
10422
  * @param session The [debug session](#DebugSession) to stop; if omitted all sessions are stopped.
10371
10423
  */
10372
- export function stopDebugging(session?: DebugSession): PromiseLike<void>;
10424
+ export function stopDebugging(session?: DebugSession): Thenable<void>;
10373
10425
 
10374
10426
  /**
10375
10427
  * Add breakpoints.
@@ -10715,6 +10767,9 @@ export module '@theia/plugin' {
10715
10767
 
10716
10768
  /** Controls whether to show the "Terminal will be reused by tasks, press any key to close it" message. */
10717
10769
  showReuseMessage?: boolean;
10770
+
10771
+ /** Controls whether the terminal is cleared before executing the task. */
10772
+ clear?: boolean;
10718
10773
  }
10719
10774
 
10720
10775
  export class Task {
@@ -10937,7 +10992,7 @@ export module '@theia/plugin' {
10937
10992
  *
10938
10993
  * @param filter a filter to filter the return tasks.
10939
10994
  */
10940
- export function fetchTasks(filter?: TaskFilter): PromiseLike<Task[]>;
10995
+ export function fetchTasks(filter?: TaskFilter): Thenable<Task[]>;
10941
10996
 
10942
10997
  /**
10943
10998
  * Executes a task that is managed by VS Code. The returned
@@ -10945,7 +11000,7 @@ export module '@theia/plugin' {
10945
11000
  *
10946
11001
  * @param task the task to execute
10947
11002
  */
10948
- export function executeTask(task: Task): PromiseLike<TaskExecution>;
11003
+ export function executeTask(task: Task): Thenable<TaskExecution>;
10949
11004
 
10950
11005
  /**
10951
11006
  * The currently active task executions or an empty array.
@@ -11003,7 +11058,7 @@ export module '@theia/plugin' {
11003
11058
  * @param key A string.
11004
11059
  * @param value A value. MUST not contain cyclic references.
11005
11060
  */
11006
- update(key: string, value: any): PromiseLike<void>;
11061
+ update(key: string, value: any): Thenable<void>;
11007
11062
  }
11008
11063
 
11009
11064
  /* The workspace symbol provider interface defines the contract between extensions
@@ -11838,3 +11893,21 @@ export module '@theia/plugin' {
11838
11893
 
11839
11894
  }
11840
11895
  }
11896
+
11897
+ /**
11898
+ * Thenable is a common denominator between ES6 promises, Q, jquery.Deferred, WinJS.Promise,
11899
+ * and others. This API makes no assumption about what promise library is being used which
11900
+ * enables reusing existing code without migrating to a specific promise implementation. Still,
11901
+ * we recommend the use of native promises which are available in this editor.
11902
+ */
11903
+ interface Thenable<T> {
11904
+ /**
11905
+ * Attaches callbacks for the resolution and/or rejection of the Promise.
11906
+ * @param onfulfilled The callback to execute when the Promise is resolved.
11907
+ * @param onrejected The callback to execute when the Promise is rejected.
11908
+ * @returns A Promise for the completion of which ever callback is executed.
11909
+ */
11910
+ then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => TResult | Thenable<TResult>): Thenable<TResult>;
11911
+ then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => void): Thenable<TResult>;
11912
+ }
11913
+