@theia/plugin 1.30.0-next.8 → 1.30.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.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/src/theia.d.ts +174 -27
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theia/plugin",
3
- "version": "1.30.0-next.8+03b8549f933",
3
+ "version": "1.30.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.29.0"
30
+ "@theia/ext-scripts": "1.30.0"
31
31
  },
32
32
  "nyc": {
33
33
  "extends": "../../configs/nyc.json"
34
34
  },
35
- "gitHead": "03b8549f933e12ec577f235c281902da66be25e4"
35
+ "gitHead": "1b32ca5626bb8252143b7a6ad6b513410f49366e"
36
36
  }
package/src/theia.d.ts CHANGED
@@ -227,7 +227,12 @@ export module '@theia/plugin' {
227
227
  }
228
228
 
229
229
  /**
230
- * Represents a line and character position.
230
+ * Represents a line and character position, such as
231
+ * the position of the cursor.
232
+ *
233
+ * Position objects are __immutable__. Use the {@link Position.with with} or
234
+ * {@link Position.translate translate} methods to derive new positions
235
+ * from an existing position.
231
236
  */
232
237
  export class Position {
233
238
 
@@ -241,6 +246,10 @@ export module '@theia/plugin' {
241
246
  */
242
247
  readonly character: number;
243
248
 
249
+ /**
250
+ * @param line A zero-based line value.
251
+ * @param character A zero-based character value.
252
+ */
244
253
  constructor(line: number, character: number);
245
254
 
246
255
  /**
@@ -315,7 +324,7 @@ export module '@theia/plugin' {
315
324
  * @return A position that reflects the given delta. Will return `this` position if the change
316
325
  * is not changing anything.
317
326
  */
318
- translate(change: { lineDelta?: number; characterDelta?: number; }): Position;
327
+ translate(change: { lineDelta?: number; characterDelta?: number }): Position;
319
328
 
320
329
  /**
321
330
  * Create a new position derived from this position.
@@ -333,7 +342,7 @@ export module '@theia/plugin' {
333
342
  * @return A position that reflects the given change. Will return `this` position if the change
334
343
  * is not changing anything.
335
344
  */
336
- with(change: { line?: number; character?: number; }): Position;
345
+ with(change: { line?: number; character?: number }): Position;
337
346
  }
338
347
 
339
348
  /**
@@ -410,15 +419,21 @@ export module '@theia/plugin' {
410
419
  /**
411
420
  * Derived a new range from this range.
412
421
  *
413
- * @param start
414
- * @param end
422
+ * @param start A position that should be used as start. The default value is the {@link Range.start current start}.
423
+ * @param end A position that should be used as end. The default value is the {@link Range.end current end}.
424
+ * @return A range derived from this range with the given start and end position.
425
+ * If start and end are not different `this` range will be returned.
415
426
  */
416
427
  with(start?: Position, end?: Position): Range;
417
428
 
418
429
  /**
419
430
  * Derived a new range from this range.
431
+ *
432
+ * @param change An object that describes a change to this range.
433
+ * @return A range that reflects the given change. Will return `this` range if the change
434
+ * is not changing anything.
420
435
  */
421
- with(change: { start?: Position, end?: Position }): Range;
436
+ with(change: { start?: Position; end?: Position }): Range;
422
437
  }
423
438
 
424
439
  /**
@@ -1712,6 +1727,11 @@ export module '@theia/plugin' {
1712
1727
  */
1713
1728
  export interface FileWillCreateEvent {
1714
1729
 
1730
+ /**
1731
+ * A cancellation token.
1732
+ */
1733
+ readonly token: CancellationToken;
1734
+
1715
1735
  /**
1716
1736
  * The files that are going to be created.
1717
1737
  */
@@ -1767,6 +1787,11 @@ export module '@theia/plugin' {
1767
1787
  */
1768
1788
  export interface FileWillDeleteEvent {
1769
1789
 
1790
+ /**
1791
+ * A cancellation token.
1792
+ */
1793
+ readonly token: CancellationToken;
1794
+
1770
1795
  /**
1771
1796
  * The files that are going to be deleted.
1772
1797
  */
@@ -1822,6 +1847,11 @@ export module '@theia/plugin' {
1822
1847
  */
1823
1848
  export interface FileWillRenameEvent {
1824
1849
 
1850
+ /**
1851
+ * A cancellation token.
1852
+ */
1853
+ readonly token: CancellationToken;
1854
+
1825
1855
  /**
1826
1856
  * The files that are going to be renamed.
1827
1857
  */
@@ -2074,7 +2104,7 @@ export module '@theia/plugin' {
2074
2104
  * Fire the event and pass data object
2075
2105
  * @param data
2076
2106
  */
2077
- fire(data?: T): void;
2107
+ fire(data: T): void;
2078
2108
 
2079
2109
  /**
2080
2110
  * Dispose this object
@@ -2186,35 +2216,63 @@ export module '@theia/plugin' {
2186
2216
  * Represents an item that can be selected from a list of items.
2187
2217
  */
2188
2218
  export interface QuickPickItem {
2219
+
2220
+ /**
2221
+ * A human-readable string which is rendered prominent. Supports rendering of {@link ThemeIcon theme icons} via
2222
+ * the `$(<name>)`-syntax.
2223
+ */
2224
+ label: string;
2225
+
2189
2226
  /**
2190
2227
  * Defaults to {@link QuickPickItemKind.Default}. If set to {@link QUickPickItemKind.Separator}, the item will not be displayed as a row but only as a separator,
2191
2228
  * and all fields other than {@link QuickPickItem.label label} will be ignored.
2192
2229
  */
2193
2230
  kind?: QuickPickItemKind;
2194
- /**
2195
- * The item label
2196
- */
2197
- label: string;
2198
2231
 
2199
2232
  /**
2200
- * The item description
2233
+ * A human-readable string which is rendered less prominent in the same line. Supports rendering of
2234
+ * {@link ThemeIcon theme icons} via the `$(<name>)`-syntax.
2235
+ *
2236
+ * Note: this property is ignored when {@link QuickPickItem.kind kind} is set to {@link QuickPickItemKind.Separator}
2201
2237
  */
2202
2238
  description?: string;
2203
2239
 
2204
2240
  /**
2205
- * The item detail
2241
+ * A human-readable string which is rendered less prominent in a separate line. Supports rendering of
2242
+ * {@link ThemeIcon theme icons} via the `$(<name>)`-syntax.
2243
+ *
2244
+ * Note: this property is ignored when {@link QuickPickItem.kind kind} is set to {@link QuickPickItemKind.Separator}
2206
2245
  */
2207
2246
  detail?: string;
2208
2247
 
2209
2248
  /**
2210
- * Used for [QuickPickOptions.canPickMany](#QuickPickOptions.canPickMany)
2211
- * not implemented yet
2249
+ * Optional flag indicating if this item is picked initially. This is only honored when using
2250
+ * the {@link window.showQuickPick()} API. To do the same thing with the {@link window.createQuickPick()} API,
2251
+ * simply set the {@link QuickPick.selectedItems} to the items you want picked initially.
2252
+ * (*Note:* This is only honored when the picker allows multiple selections.)
2253
+ *
2254
+ * @see {@link QuickPickOptions.canPickMany}
2255
+ *
2256
+ * Note: this property is ignored when {@link QuickPickItem.kind kind} is set to {@link QuickPickItemKind.Separator}
2212
2257
  */
2213
2258
  picked?: boolean;
2259
+
2214
2260
  /**
2215
2261
  * Always show this item.
2262
+ *
2263
+ * Note: this property is ignored when {@link QuickPickItem.kind kind} is set to {@link QuickPickItemKind.Separator}
2216
2264
  */
2217
2265
  alwaysShow?: boolean;
2266
+
2267
+ /**
2268
+ * Optional buttons that will be rendered on this particular item. These buttons will trigger
2269
+ * an {@link QuickPickItemButtonEvent} when clicked. Buttons are only rendered when using a quickpick
2270
+ * created by the {@link window.createQuickPick()} API. Buttons are not rendered when using
2271
+ * the {@link window.showQuickPick()} API.
2272
+ *
2273
+ * Note: this property is ignored when {@link QuickPickItem.kind kind} is set to {@link QuickPickItemKind.Separator}
2274
+ */
2275
+ buttons?: readonly QuickInputButton[];
2218
2276
  }
2219
2277
 
2220
2278
  /**
@@ -2267,6 +2325,12 @@ export module '@theia/plugin' {
2267
2325
  */
2268
2326
  readonly onDidTriggerButton: Event<QuickInputButton>;
2269
2327
 
2328
+ /**
2329
+ * An event signaling when a button in a particular {@link QuickPickItem} was triggered.
2330
+ * This event does not fire for buttons in the title bar.
2331
+ */
2332
+ readonly onDidTriggerItemButton: Event<QuickPickItemButtonEvent<T>>;
2333
+
2270
2334
  /**
2271
2335
  * Items to pick from.
2272
2336
  */
@@ -2782,6 +2846,16 @@ export module '@theia/plugin' {
2782
2846
  */
2783
2847
  clear(): void;
2784
2848
 
2849
+ /**
2850
+ * Reveal this channel in the UI.
2851
+ *
2852
+ * @deprecated Use the overload with just one parameter (`show(preserveFocus?: boolean): void`).
2853
+ *
2854
+ * @param column This argument is **deprecated** and will be ignored.
2855
+ * @param preserveFocus When `true` the channel will not take focus.
2856
+ */
2857
+ show(column?: ViewColumn, preserveFocus?: boolean): void;
2858
+
2785
2859
  /**
2786
2860
  * Reveal this channel in the UI.
2787
2861
  *
@@ -2987,6 +3061,15 @@ export module '@theia/plugin' {
2987
3061
  */
2988
3062
  env?: { [key: string]: string | null };
2989
3063
 
3064
+ /**
3065
+ * Whether the terminal process environment should be exactly as provided in
3066
+ * `TerminalOptions.env`. When this is false (default), the environment will be based on the
3067
+ * window's environment and also apply configured platform settings like
3068
+ * `terminal.integrated.windows.env` on top. When this is true, the complete environment
3069
+ * must be provided as nothing will be inherited from the process or any configuration.
3070
+ */
3071
+ strictEnv?: boolean;
3072
+
2990
3073
  /**
2991
3074
  * A message to write to the terminal on first launch. Note that this is not sent to the
2992
3075
  * process, but rather written directly to the terminal. This supports escape sequences such
@@ -3081,6 +3164,26 @@ export module '@theia/plugin' {
3081
3164
  */
3082
3165
  onDidClose?: Event<void | number>;
3083
3166
 
3167
+ /**
3168
+ * An event that when fired allows changing the name of the terminal.
3169
+ *
3170
+ * Events fired before {@link Pseudoterminal.open} is called will be be ignored.
3171
+ *
3172
+ * **Example:** Change the terminal name to "My new terminal".
3173
+ * ```typescript
3174
+ * const writeEmitter = new vscode.EventEmitter<string>();
3175
+ * const changeNameEmitter = new vscode.EventEmitter<string>();
3176
+ * const pty: vscode.Pseudoterminal = {
3177
+ * onDidWrite: writeEmitter.event,
3178
+ * onDidChangeName: changeNameEmitter.event,
3179
+ * open: () => changeNameEmitter.fire('My new terminal'),
3180
+ * close: () => {}
3181
+ * };
3182
+ * vscode.window.createTerminal({ name: 'My terminal', pty });
3183
+ * ```
3184
+ */
3185
+ onDidChangeName?: Event<string>;
3186
+
3084
3187
  /**
3085
3188
  * Implement to handle when the pty is opened.
3086
3189
  *
@@ -4337,7 +4440,7 @@ export module '@theia/plugin' {
4337
4440
  *
4338
4441
  * Note that hiding a view using the context menu instead disposes of the view and fires `onDidDispose`.
4339
4442
  */
4340
- readonly onDidChangeVisibility: Event<boolean>;
4443
+ readonly onDidChangeVisibility: Event<void>;
4341
4444
 
4342
4445
  /**
4343
4446
  * Reveal the view in the UI.
@@ -4575,7 +4678,7 @@ export module '@theia/plugin' {
4575
4678
  * @param items A set of items that will be rendered as actions in the message.
4576
4679
  * @return A promise that resolves to the selected item or `undefined` when being dismissed.
4577
4680
  */
4578
- export function showInformationMessage(message: string, ...items: string[]): Thenable<string | undefined>;
4681
+ export function showInformationMessage<T extends string>(message: string, ...items: T[]): Thenable<T | undefined>;
4579
4682
 
4580
4683
  /**
4581
4684
  * Show an information message.
@@ -4585,7 +4688,7 @@ export module '@theia/plugin' {
4585
4688
  * @param items A set of items that will be rendered as actions in the message.
4586
4689
  * @return A promise that resolves to the selected item or `undefined` when being dismissed.
4587
4690
  */
4588
- export function showInformationMessage(message: string, options: MessageOptions, ...items: string[]): Thenable<string | undefined>;
4691
+ export function showInformationMessage<T extends string>(message: string, options: MessageOptions, ...items: T[]): Thenable<T | undefined>;
4589
4692
 
4590
4693
  /**
4591
4694
  * Show an information message.
@@ -4613,7 +4716,7 @@ export module '@theia/plugin' {
4613
4716
  * @param items A set of items that will be rendered as actions in the message.
4614
4717
  * @return A promise that resolves to the selected item or `undefined` when being dismissed.
4615
4718
  */
4616
- export function showWarningMessage(message: string, ...items: string[]): Thenable<string | undefined>;
4719
+ export function showWarningMessage<T extends string>(message: string, ...items: T[]): Thenable<T | undefined>;
4617
4720
 
4618
4721
  /**
4619
4722
  * Show a warning message.
@@ -4623,7 +4726,7 @@ export module '@theia/plugin' {
4623
4726
  * @param items A set of items that will be rendered as actions in the message.
4624
4727
  * @return A promise that resolves to the selected item or `undefined` when being dismissed.
4625
4728
  */
4626
- export function showWarningMessage(message: string, options: MessageOptions, ...items: string[]): Thenable<string | undefined>;
4729
+ export function showWarningMessage<T extends string>(message: string, options: MessageOptions, ...items: T[]): Thenable<T | undefined>;
4627
4730
 
4628
4731
  /**
4629
4732
  * Show a warning message.
@@ -4651,7 +4754,7 @@ export module '@theia/plugin' {
4651
4754
  * @param items A set of items that will be rendered as actions in the message.
4652
4755
  * @return A promise that resolves to the selected item or `undefined` when being dismissed.
4653
4756
  */
4654
- export function showErrorMessage(message: string, ...items: string[]): Thenable<string | undefined>;
4757
+ export function showErrorMessage<T extends string>(message: string, ...items: T[]): Thenable<T | undefined>;
4655
4758
 
4656
4759
  /**
4657
4760
  * Show an error message.
@@ -4661,7 +4764,7 @@ export module '@theia/plugin' {
4661
4764
  * @param items A set of items that will be rendered as actions in the message.
4662
4765
  * @return A promise that resolves to the selected item or `undefined` when being dismissed.
4663
4766
  */
4664
- export function showErrorMessage(message: string, options: MessageOptions, ...items: string[]): Thenable<string | undefined>;
4767
+ export function showErrorMessage<T extends string>(message: string, options: MessageOptions, ...items: T[]): Thenable<T | undefined>;
4665
4768
 
4666
4769
  /**
4667
4770
  * Show an error message.
@@ -5064,6 +5167,21 @@ export module '@theia/plugin' {
5064
5167
  private constructor();
5065
5168
  }
5066
5169
 
5170
+ /**
5171
+ * An event signaling when a button in a particular {@link QuickPickItem} was triggered.
5172
+ * This event does not fire for buttons in the title bar.
5173
+ */
5174
+ export interface QuickPickItemButtonEvent<T extends QuickPickItem> {
5175
+ /**
5176
+ * The button that was clicked.
5177
+ */
5178
+ readonly button: QuickInputButton;
5179
+ /**
5180
+ * The item that the button belongs to.
5181
+ */
5182
+ readonly item: T;
5183
+ }
5184
+
5067
5185
  /**
5068
5186
  * A concrete {@link QuickInput QuickInput} to let the user input a text value.
5069
5187
  *
@@ -5402,7 +5520,7 @@ export module '@theia/plugin' {
5402
5520
  * This will trigger the view to update the changed element/root and its children recursively (if shown).
5403
5521
  * To signal that root has changed, do not pass any argument or pass `undefined` or `null`.
5404
5522
  */
5405
- onDidChangeTreeData?: Event<T | undefined | null>;
5523
+ onDidChangeTreeData?: Event<T | T[] | undefined | null | void>;
5406
5524
 
5407
5525
  /**
5408
5526
  * Get {@link TreeItem TreeItem} representation of the `element`
@@ -5469,7 +5587,7 @@ export module '@theia/plugin' {
5469
5587
  /**
5470
5588
  * The tooltip text when you hover over this item.
5471
5589
  */
5472
- tooltip?: string | undefined;
5590
+ tooltip?: string | MarkdownString | undefined;
5473
5591
 
5474
5592
  /**
5475
5593
  * The {@link Command command} which should be run when the tree item is selected.
@@ -7522,6 +7640,12 @@ export module '@theia/plugin' {
7522
7640
  * [Folding](https://code.visualstudio.com/docs/editor/codebasics#_folding) in the editor.
7523
7641
  */
7524
7642
  export interface FoldingRangeProvider {
7643
+
7644
+ /**
7645
+ * An optional event to signal that the folding ranges from this provider have changed.
7646
+ */
7647
+ onDidChangeFoldingRanges?: Event<void>;
7648
+
7525
7649
  /**
7526
7650
  * Returns a list of folding ranges or null and undefined if the provider
7527
7651
  * does not want to participate or was cancelled.
@@ -8324,7 +8448,7 @@ export module '@theia/plugin' {
8324
8448
  * @return An array of commands, quick fixes, or refactorings or a thenable of such. The lack of a result can be
8325
8449
  * signaled by returning `undefined`, `null`, or an empty array.
8326
8450
  */
8327
- provideCodeActions(document: TextDocument, range: Range | Selection, context: CodeActionContext, token: CancellationToken | undefined): ProviderResult<(Command | T)[]>;
8451
+ provideCodeActions(document: TextDocument, range: Range | Selection, context: CodeActionContext, token: CancellationToken): ProviderResult<(Command | T)[]>;
8328
8452
 
8329
8453
  /**
8330
8454
  * Given a code action fill in its `edit`-property. Changes to
@@ -8340,7 +8464,7 @@ export module '@theia/plugin' {
8340
8464
  * @return The resolved code action or a thenable that resolves to such. It is OK to return the given
8341
8465
  * `item`. When no result is returned, the given `item` will be used.
8342
8466
  */
8343
- resolveCodeAction?(codeAction: T, token: CancellationToken | undefined): ProviderResult<T>;
8467
+ resolveCodeAction?(codeAction: T, token: CancellationToken): ProviderResult<T>;
8344
8468
  }
8345
8469
 
8346
8470
  /**
@@ -8551,11 +8675,34 @@ export module '@theia/plugin' {
8551
8675
  intersects(other: CodeActionKind): boolean;
8552
8676
  }
8553
8677
 
8678
+ /**
8679
+ * The reason why code actions were requested.
8680
+ */
8681
+ export enum CodeActionTriggerKind {
8682
+ /**
8683
+ * Code actions were explicitly requested by the user or by an extension.
8684
+ */
8685
+ Invoke = 1,
8686
+
8687
+ /**
8688
+ * Code actions were requested automatically.
8689
+ *
8690
+ * This typically happens when current selection in a file changes, but can
8691
+ * also be triggered when file content changes.
8692
+ */
8693
+ Automatic = 2,
8694
+ }
8695
+
8554
8696
  /**
8555
8697
  * Contains additional diagnostic information about the context in which
8556
8698
  * a {@link CodeActionProvider.provideCodeActions code action} is run.
8557
8699
  */
8558
8700
  export interface CodeActionContext {
8701
+ /**
8702
+ * The reason why code actions were requested.
8703
+ */
8704
+ readonly triggerKind: CodeActionTriggerKind;
8705
+
8559
8706
  /**
8560
8707
  * An array of diagnostics.
8561
8708
  */
@@ -8938,7 +9085,7 @@ export module '@theia/plugin' {
8938
9085
  * @param tokenType The token type.
8939
9086
  * @param tokenModifiers The token modifiers.
8940
9087
  */
8941
- push(range: Range, tokenType: string, tokenModifiers?: string[]): void;
9088
+ push(range: Range, tokenType: string, tokenModifiers?: readonly string[]): void;
8942
9089
 
8943
9090
  /**
8944
9091
  * Finish and create a `SemanticTokens` instance.