@theia/plugin 1.31.0-next.7 → 1.32.0-next.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 +1062 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theia/plugin",
3
- "version": "1.31.0-next.7+afe5f3ebe",
3
+ "version": "1.32.0-next.0+eb4b0475f",
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.30.0"
30
+ "@theia/ext-scripts": "1.31.0"
31
31
  },
32
32
  "nyc": {
33
33
  "extends": "../../configs/nyc.json"
34
34
  },
35
- "gitHead": "afe5f3ebe1cf4aa3967747fb6d96f6427b3e178f"
35
+ "gitHead": "eb4b0475f3f18e9a3f2f9ebafa9087d9d01a6016"
36
36
  }
package/src/theia.d.ts CHANGED
@@ -3094,6 +3094,15 @@ export module '@theia/plugin' {
3094
3094
  */
3095
3095
  strictEnv?: boolean;
3096
3096
 
3097
+ /**
3098
+ * When enabled the terminal will run the process as normal but not be surfaced to the user
3099
+ * until `Terminal.show` is called. The typical usage for this is when you need to run
3100
+ * something that may need interactivity but only want to tell the user about it when
3101
+ * interaction is needed. Note that the terminals will still be exposed to all extensions
3102
+ * as normal.
3103
+ */
3104
+ hideFromUser?: boolean;
3105
+
3097
3106
  /**
3098
3107
  * A message to write to the terminal on first launch. Note that this is not sent to the
3099
3108
  * process, but rather written directly to the terminal. This supports escape sequences such
@@ -3274,7 +3283,7 @@ export module '@theia/plugin' {
3274
3283
  /**
3275
3284
  * A link on a terminal line.
3276
3285
  */
3277
- export interface TerminalLink {
3286
+ export class TerminalLink {
3278
3287
  /**
3279
3288
  * The start index of the link on [TerminalLinkContext.line](#TerminalLinkContext.line].
3280
3289
  */
@@ -3293,6 +3302,18 @@ export module '@theia/plugin' {
3293
3302
  * depending on OS, user settings, and localization.
3294
3303
  */
3295
3304
  tooltip?: string;
3305
+
3306
+ /**
3307
+ * Creates a new terminal link.
3308
+ * @param startIndex The start index of the link on [TerminalLinkContext.line](#TerminalLinkContext.line].
3309
+ * @param length The length of the link on [TerminalLinkContext.line](#TerminalLinkContext.line].
3310
+ * @param tooltip The tooltip text when you hover over this link.
3311
+ *
3312
+ * If a tooltip is provided, is will be displayed in a string that includes instructions on
3313
+ * how to trigger the link, such as `{0} (ctrl + click)`. The specific instructions vary
3314
+ * depending on OS, user settings, and localization.
3315
+ */
3316
+ constructor(startIndex: number, length: number, tooltip?: string);
3296
3317
  }
3297
3318
 
3298
3319
  /**
@@ -5124,7 +5145,7 @@ export module '@theia/plugin' {
5124
5145
  * @param provider The provider that provides the terminal links.
5125
5146
  * @return Disposable that unregisters the provider.
5126
5147
  */
5127
- export function registerTerminalLinkProvider(provider: TerminalLinkProvider): void;
5148
+ export function registerTerminalLinkProvider(provider: TerminalLinkProvider): Disposable;
5128
5149
 
5129
5150
  /**
5130
5151
  * Register a file decoration provider.
@@ -5565,6 +5586,29 @@ export module '@theia/plugin' {
5565
5586
  * @return Parent of `element`.
5566
5587
  */
5567
5588
  getParent?(element: T): ProviderResult<T>;
5589
+
5590
+ /**
5591
+ * Called on hover to resolve the {@link TreeItem.tooltip TreeItem} property if it is undefined.
5592
+ * Called on tree item click/open to resolve the {@link TreeItem.command TreeItem} property if it is undefined.
5593
+ * Only properties that were undefined can be resolved in `resolveTreeItem`.
5594
+ * Functionality may be expanded later to include being called to resolve other missing
5595
+ * properties on selection and/or on open.
5596
+ *
5597
+ * Will only ever be called once per TreeItem.
5598
+ *
5599
+ * onDidChangeTreeData should not be triggered from within resolveTreeItem.
5600
+ *
5601
+ * *Note* that this function is called when tree items are already showing in the UI.
5602
+ * Because of that, no property that changes the presentation (label, description, etc.)
5603
+ * can be changed.
5604
+ *
5605
+ * @param item Undefined properties of `item` should be set then `item` should be returned.
5606
+ * @param element The object associated with the TreeItem.
5607
+ * @param token A cancellation token.
5608
+ * @return The resolved tree item or a thenable that resolves to such. It is OK to return the given
5609
+ * `item`. When no result is returned, the given `item` will be used.
5610
+ */
5611
+ resolveTreeItem?(item: TreeItem, element: T, token: CancellationToken): ProviderResult<TreeItem>;
5568
5612
  }
5569
5613
 
5570
5614
  export class TreeItem {
@@ -7600,6 +7644,176 @@ export module '@theia/plugin' {
7600
7644
  provideColorPresentations(color: Color, context: { document: TextDocument, range: Range }, token: CancellationToken): ProviderResult<ColorPresentation[]>;
7601
7645
  }
7602
7646
 
7647
+ /**
7648
+ * Inlay hint kinds.
7649
+ *
7650
+ * The kind of an inline hint defines its appearance, e.g the corresponding foreground and background colors are being
7651
+ * used.
7652
+ */
7653
+ export enum InlayHintKind {
7654
+ /**
7655
+ * An inlay hint that for a type annotation.
7656
+ */
7657
+ Type = 1,
7658
+ /**
7659
+ * An inlay hint that is for a parameter.
7660
+ */
7661
+ Parameter = 2,
7662
+ }
7663
+
7664
+ /**
7665
+ * An inlay hint label part allows for interactive and composite labels of inlay hints.
7666
+ */
7667
+ export class InlayHintLabelPart {
7668
+
7669
+ /**
7670
+ * The value of this label part.
7671
+ */
7672
+ value: string;
7673
+
7674
+ /**
7675
+ * The tooltip text when you hover over this label part.
7676
+ *
7677
+ * *Note* that this property can be set late during
7678
+ * {@link InlayHintsProvider.resolveInlayHint resolving} of inlay hints.
7679
+ */
7680
+ tooltip?: string | MarkdownString | undefined;
7681
+
7682
+ /**
7683
+ * An optional {@link Location source code location} that represents this label
7684
+ * part.
7685
+ *
7686
+ * The editor will use this location for the hover and for code navigation features: This
7687
+ * part will become a clickable link that resolves to the definition of the symbol at the
7688
+ * given location (not necessarily the location itself), it shows the hover that shows at
7689
+ * the given location, and it shows a context menu with further code navigation commands.
7690
+ *
7691
+ * *Note* that this property can be set late during
7692
+ * {@link InlayHintsProvider.resolveInlayHint resolving} of inlay hints.
7693
+ */
7694
+ location?: Location | undefined;
7695
+
7696
+ /**
7697
+ * An optional command for this label part.
7698
+ *
7699
+ * The editor renders parts with commands as clickable links. The command is added to the context menu
7700
+ * when a label part defines {@link InlayHintLabelPart.location location} and {@link InlayHintLabelPart.command command} .
7701
+ *
7702
+ * *Note* that this property can be set late during
7703
+ * {@link InlayHintsProvider.resolveInlayHint resolving} of inlay hints.
7704
+ */
7705
+ command?: Command | undefined;
7706
+
7707
+ /**
7708
+ * Creates a new inlay hint label part.
7709
+ *
7710
+ * @param value The value of the part.
7711
+ */
7712
+ constructor(value: string);
7713
+ }
7714
+
7715
+ /**
7716
+ * Inlay hint information.
7717
+ */
7718
+ export class InlayHint {
7719
+
7720
+ /**
7721
+ * The position of this hint.
7722
+ */
7723
+ position: Position;
7724
+
7725
+ /**
7726
+ * The label of this hint. A human readable string or an array of {@link InlayHintLabelPart label parts}.
7727
+ *
7728
+ * *Note* that neither the string nor the label part can be empty.
7729
+ */
7730
+ label: string | InlayHintLabelPart[];
7731
+
7732
+ /**
7733
+ * The tooltip text when you hover over this item.
7734
+ *
7735
+ * *Note* that this property can be set late during
7736
+ * {@link InlayHintsProvider.resolveInlayHint resolving} of inlay hints.
7737
+ */
7738
+ tooltip?: string | MarkdownString | undefined;
7739
+
7740
+ /**
7741
+ * The kind of this hint. The inlay hint kind defines the appearance of this inlay hint.
7742
+ */
7743
+ kind?: InlayHintKind;
7744
+
7745
+ /**
7746
+ * Optional {@link TextEdit text edits} that are performed when accepting this inlay hint. The default
7747
+ * gesture for accepting an inlay hint is the double click.
7748
+ *
7749
+ * *Note* that edits are expected to change the document so that the inlay hint (or its nearest variant) is
7750
+ * now part of the document and the inlay hint itself is now obsolete.
7751
+ *
7752
+ * *Note* that this property can be set late during
7753
+ * {@link InlayHintsProvider.resolveInlayHint resolving} of inlay hints.
7754
+ */
7755
+ textEdits?: TextEdit[];
7756
+
7757
+ /**
7758
+ * Render padding before the hint. Padding will use the editor's background color,
7759
+ * not the background color of the hint itself. That means padding can be used to visually
7760
+ * align/separate an inlay hint.
7761
+ */
7762
+ paddingLeft?: boolean;
7763
+
7764
+ /**
7765
+ * Render padding after the hint. Padding will use the editor's background color,
7766
+ * not the background color of the hint itself. That means padding can be used to visually
7767
+ * align/separate an inlay hint.
7768
+ */
7769
+ paddingRight?: boolean;
7770
+
7771
+ /**
7772
+ * Creates a new inlay hint.
7773
+ *
7774
+ * @param position The position of the hint.
7775
+ * @param label The label of the hint.
7776
+ * @param kind The {@link InlayHintKind kind} of the hint.
7777
+ */
7778
+ constructor(position: Position, label: string | InlayHintLabelPart[], kind?: InlayHintKind);
7779
+ }
7780
+
7781
+ /**
7782
+ * The inlay hints provider interface defines the contract between extensions and
7783
+ * the inlay hints feature.
7784
+ */
7785
+ export interface InlayHintsProvider<T extends InlayHint = InlayHint> {
7786
+
7787
+ /**
7788
+ * An optional event to signal that inlay hints from this provider have changed.
7789
+ */
7790
+ onDidChangeInlayHints?: Event<void>;
7791
+
7792
+ /**
7793
+ * Provide inlay hints for the given range and document.
7794
+ *
7795
+ * *Note* that inlay hints that are not {@link Range.contains contained} by the given range are ignored.
7796
+ *
7797
+ * @param document The document in which the command was invoked.
7798
+ * @param range The range for which inlay hints should be computed.
7799
+ * @param token A cancellation token.
7800
+ * @return An array of inlay hints or a thenable that resolves to such.
7801
+ */
7802
+ provideInlayHints(document: TextDocument, range: Range, token: CancellationToken): ProviderResult<T[]>;
7803
+
7804
+ /**
7805
+ * Given an inlay hint fill in {@link InlayHint.tooltip tooltip}, {@link InlayHint.textEdits text edits},
7806
+ * or complete label {@link InlayHintLabelPart parts}.
7807
+ *
7808
+ * *Note* that the editor will resolve an inlay hint at most once.
7809
+ *
7810
+ * @param hint An inlay hint.
7811
+ * @param token A cancellation token.
7812
+ * @return The resolved inlay hint or a thenable that resolves to such. It is OK to return the given `item`. When no result is returned, the given `item` will be used.
7813
+ */
7814
+ resolveInlayHint?(hint: T, token: CancellationToken): ProviderResult<T>;
7815
+ }
7816
+
7603
7817
  /**
7604
7818
  * A line based folding range. To be valid, start and end line must a zero or larger and smaller than the number of lines in the document.
7605
7819
  * Invalid ranges will be ignored.
@@ -9506,6 +9720,21 @@ export module '@theia/plugin' {
9506
9720
  */
9507
9721
  export function registerEvaluatableExpressionProvider(selector: DocumentSelector, provider: EvaluatableExpressionProvider): Disposable;
9508
9722
 
9723
+ /**
9724
+ * Register a provider that returns data for the debugger's 'inline value' feature.
9725
+ * Whenever the generic debugger has stopped in a source file, providers registered for the language of the file
9726
+ * are called to return textual data that will be shown in the editor at the end of lines.
9727
+ *
9728
+ * Multiple providers can be registered for a language. In that case providers are asked in
9729
+ * parallel and the results are merged. A failing provider (rejected promise or exception) will
9730
+ * not cause a failure of the whole operation.
9731
+ *
9732
+ * @param selector A selector that defines the documents this provider is applicable to.
9733
+ * @param provider An inline values provider.
9734
+ * @return A {@link Disposable} that unregisters this provider when being disposed.
9735
+ */
9736
+ export function registerInlineValuesProvider(selector: DocumentSelector, provider: InlineValuesProvider): Disposable;
9737
+
9509
9738
  /**
9510
9739
  * Register a workspace symbol provider.
9511
9740
  *
@@ -9662,6 +9891,19 @@ export module '@theia/plugin' {
9662
9891
  */
9663
9892
  export function registerColorProvider(selector: DocumentSelector, provider: DocumentColorProvider): Disposable;
9664
9893
 
9894
+ /**
9895
+ * Register a inlay hints provider.
9896
+ *
9897
+ * Multiple providers can be registered for a language. In that case providers are asked in
9898
+ * parallel and the results are merged. A failing provider (rejected promise or exception) will
9899
+ * not cause a failure of the whole operation.
9900
+ *
9901
+ * @param selector A selector that defines the documents this provider is applicable to.
9902
+ * @param provider An inlay hints provider.
9903
+ * @return A {@link Disposable} that unregisters this provider when being disposed.
9904
+ */
9905
+ export function registerInlayHintsProvider(selector: DocumentSelector, provider: InlayHintsProvider): Disposable;
9906
+
9665
9907
  /**
9666
9908
  * Register a folding range provider.
9667
9909
  *
@@ -9750,6 +9992,15 @@ export module '@theia/plugin' {
9750
9992
  */
9751
9993
  export function registerCallHierarchyProvider(selector: DocumentSelector, provider: CallHierarchyProvider): Disposable;
9752
9994
 
9995
+ /**
9996
+ * Register a type hierarchy provider.
9997
+ *
9998
+ * @param selector A selector that defines the documents this provider is applicable to.
9999
+ * @param provider A type hierarchy provider.
10000
+ * @return A {@link Disposable} that unregisters this provider when being disposed.
10001
+ */
10002
+ export function registerTypeHierarchyProvider(selector: DocumentSelector, provider: TypeHierarchyProvider): Disposable;
10003
+
9753
10004
  /**
9754
10005
  * Register a linked editing range provider.
9755
10006
  *
@@ -9867,6 +10118,134 @@ export module '@theia/plugin' {
9867
10118
  provideEvaluatableExpression(document: TextDocument, position: Position, token: CancellationToken | undefined): ProviderResult<EvaluatableExpression>;
9868
10119
  }
9869
10120
 
10121
+ /**
10122
+ * Provide inline value as text.
10123
+ */
10124
+ export class InlineValueText {
10125
+ /**
10126
+ * The document range for which the inline value applies.
10127
+ */
10128
+ readonly range: Range;
10129
+ /**
10130
+ * The text of the inline value.
10131
+ */
10132
+ readonly text: string;
10133
+ /**
10134
+ * Creates a new InlineValueText object.
10135
+ *
10136
+ * @param range The document line where to show the inline value.
10137
+ * @param text The value to be shown for the line.
10138
+ */
10139
+ constructor(range: Range, text: string);
10140
+ }
10141
+
10142
+ /**
10143
+ * Provide inline value through a variable lookup.
10144
+ * If only a range is specified, the variable name will be extracted from the underlying document.
10145
+ * An optional variable name can be used to override the extracted name.
10146
+ */
10147
+ export class InlineValueVariableLookup {
10148
+ /**
10149
+ * The document range for which the inline value applies.
10150
+ * The range is used to extract the variable name from the underlying document.
10151
+ */
10152
+ readonly range: Range;
10153
+ /**
10154
+ * If specified the name of the variable to look up.
10155
+ */
10156
+ readonly variableName?: string | undefined;
10157
+ /**
10158
+ * How to perform the lookup.
10159
+ */
10160
+ readonly caseSensitiveLookup: boolean;
10161
+ /**
10162
+ * Creates a new InlineValueVariableLookup object.
10163
+ *
10164
+ * @param range The document line where to show the inline value.
10165
+ * @param variableName The name of the variable to look up.
10166
+ * @param caseSensitiveLookup How to perform the lookup. If missing lookup is case sensitive.
10167
+ */
10168
+ constructor(range: Range, variableName?: string, caseSensitiveLookup?: boolean);
10169
+ }
10170
+
10171
+ /**
10172
+ * Provide an inline value through an expression evaluation.
10173
+ * If only a range is specified, the expression will be extracted from the underlying document.
10174
+ * An optional expression can be used to override the extracted expression.
10175
+ */
10176
+ export class InlineValueEvaluatableExpression {
10177
+ /**
10178
+ * The document range for which the inline value applies.
10179
+ * The range is used to extract the evaluatable expression from the underlying document.
10180
+ */
10181
+ readonly range: Range;
10182
+ /**
10183
+ * If specified the expression overrides the extracted expression.
10184
+ */
10185
+ readonly expression?: string | undefined;
10186
+ /**
10187
+ * Creates a new InlineValueEvaluatableExpression object.
10188
+ *
10189
+ * @param range The range in the underlying document from which the evaluatable expression is extracted.
10190
+ * @param expression If specified overrides the extracted expression.
10191
+ */
10192
+ constructor(range: Range, expression?: string);
10193
+ }
10194
+
10195
+ /**
10196
+ * Inline value information can be provided by different means:
10197
+ * - directly as a text value (class InlineValueText).
10198
+ * - as a name to use for a variable lookup (class InlineValueVariableLookup)
10199
+ * - as an evaluatable expression (class InlineValueEvaluatableExpression)
10200
+ * The InlineValue types combines all inline value types into one type.
10201
+ */
10202
+ export type InlineValue = InlineValueText | InlineValueVariableLookup | InlineValueEvaluatableExpression;
10203
+
10204
+ /**
10205
+ * A value-object that contains contextual information when requesting inline values from a InlineValuesProvider.
10206
+ */
10207
+ export interface InlineValueContext {
10208
+
10209
+ /**
10210
+ * The stack frame (as a DAP Id) where the execution has stopped.
10211
+ */
10212
+ readonly frameId: number;
10213
+
10214
+ /**
10215
+ * The document range where execution has stopped.
10216
+ * Typically the end position of the range denotes the line where the inline values are shown.
10217
+ */
10218
+ readonly stoppedLocation: Range;
10219
+ }
10220
+
10221
+ /**
10222
+ * The inline values provider interface defines the contract between extensions and the editor's debugger inline values feature.
10223
+ * In this contract the provider returns inline value information for a given document range
10224
+ * and the editor shows this information in the editor at the end of lines.
10225
+ */
10226
+ export interface InlineValuesProvider {
10227
+
10228
+ /**
10229
+ * An optional event to signal that inline values have changed.
10230
+ * @see {@link EventEmitter}
10231
+ */
10232
+ onDidChangeInlineValues?: Event<void> | undefined;
10233
+
10234
+ /**
10235
+ * Provide "inline value" information for a given document and range.
10236
+ * The editor calls this method whenever debugging stops in the given document.
10237
+ * The returned inline values information is rendered in the editor at the end of lines.
10238
+ *
10239
+ * @param document The document for which the inline values information is needed.
10240
+ * @param viewPort The visible document range for which inline values should be computed.
10241
+ * @param context A bag containing contextual information like the current location.
10242
+ * @param token A cancellation token.
10243
+ * @return An array of InlineValueDescriptors or a thenable that resolves to such. The lack of a result can be
10244
+ * signaled by returning `undefined` or `null`.
10245
+ */
10246
+ provideInlineValues(document: TextDocument, viewPort: Range, context: InlineValueContext, token: CancellationToken): ProviderResult<InlineValue[]>;
10247
+ }
10248
+
9870
10249
  /**
9871
10250
  * A document highlight kind.
9872
10251
  */
@@ -11931,6 +12310,104 @@ export module '@theia/plugin' {
11931
12310
  provideCallHierarchyOutgoingCalls(item: CallHierarchyItem, token: CancellationToken): ProviderResult<CallHierarchyOutgoingCall[]>;
11932
12311
  }
11933
12312
 
12313
+ /**
12314
+ * Represents an item of a type hierarchy, like a class or an interface.
12315
+ */
12316
+ export class TypeHierarchyItem {
12317
+ /**
12318
+ * The name of this item.
12319
+ */
12320
+ name: string;
12321
+
12322
+ /**
12323
+ * The kind of this item.
12324
+ */
12325
+ kind: SymbolKind;
12326
+
12327
+ /**
12328
+ * Tags for this item.
12329
+ */
12330
+ tags?: ReadonlyArray<SymbolTag>;
12331
+
12332
+ /**
12333
+ * More detail for this item, e.g. the signature of a function.
12334
+ */
12335
+ detail?: string;
12336
+
12337
+ /**
12338
+ * The resource identifier of this item.
12339
+ */
12340
+ uri: Uri;
12341
+
12342
+ /**
12343
+ * The range enclosing this symbol not including leading/trailing whitespace
12344
+ * but everything else, e.g. comments and code.
12345
+ */
12346
+ range: Range;
12347
+
12348
+ /**
12349
+ * The range that should be selected and revealed when this symbol is being
12350
+ * picked, e.g. the name of a class. Must be contained by the {@link TypeHierarchyItem.range range}-property.
12351
+ */
12352
+ selectionRange: Range;
12353
+
12354
+ /**
12355
+ * Creates a new type hierarchy item.
12356
+ *
12357
+ * @param kind The kind of the item.
12358
+ * @param name The name of the item.
12359
+ * @param detail The details of the item.
12360
+ * @param uri The Uri of the item.
12361
+ * @param range The whole range of the item.
12362
+ * @param selectionRange The selection range of the item.
12363
+ */
12364
+ constructor(kind: SymbolKind, name: string, detail: string, uri: Uri, range: Range, selectionRange: Range);
12365
+ }
12366
+
12367
+ /**
12368
+ * The type hierarchy provider interface describes the contract between extensions
12369
+ * and the type hierarchy feature.
12370
+ */
12371
+ export interface TypeHierarchyProvider {
12372
+
12373
+ /**
12374
+ * Bootstraps type hierarchy by returning the item that is denoted by the given document
12375
+ * and position. This item will be used as entry into the type graph. Providers should
12376
+ * return `undefined` or `null` when there is no item at the given location.
12377
+ *
12378
+ * @param document The document in which the command was invoked.
12379
+ * @param position The position at which the command was invoked.
12380
+ * @param token A cancellation token.
12381
+ * @returns One or multiple type hierarchy items or a thenable that resolves to such. The lack of a result can be
12382
+ * signaled by returning `undefined`, `null`, or an empty array.
12383
+ */
12384
+ prepareTypeHierarchy(document: TextDocument, position: Position, token: CancellationToken): ProviderResult<TypeHierarchyItem | TypeHierarchyItem[]>;
12385
+
12386
+ /**
12387
+ * Provide all supertypes for an item, e.g all types from which a type is derived/inherited. In graph terms this describes directed
12388
+ * and annotated edges inside the type graph, e.g the given item is the starting node and the result is the nodes
12389
+ * that can be reached.
12390
+ *
12391
+ * @param item The hierarchy item for which super types should be computed.
12392
+ * @param token A cancellation token.
12393
+ * @returns A set of direct supertypes or a thenable that resolves to such. The lack of a result can be
12394
+ * signaled by returning `undefined` or `null`.
12395
+ */
12396
+ provideTypeHierarchySupertypes(item: TypeHierarchyItem, token: CancellationToken): ProviderResult<TypeHierarchyItem[]>;
12397
+
12398
+ /**
12399
+ * Provide all subtypes for an item, e.g all types which are derived/inherited from the given item. In
12400
+ * graph terms this describes directed and annotated edges inside the type graph, e.g the given item is the starting
12401
+ * node and the result is the nodes that can be reached.
12402
+ *
12403
+ * @param item The hierarchy item for which subtypes should be computed.
12404
+ * @param token A cancellation token.
12405
+ * @returns A set of direct subtypes or a thenable that resolves to such. The lack of a result can be
12406
+ * signaled by returning `undefined` or `null`.
12407
+ */
12408
+ provideTypeHierarchySubtypes(item: TypeHierarchyItem, token: CancellationToken): ProviderResult<TypeHierarchyItem[]>;
12409
+ }
12410
+
11934
12411
  /**
11935
12412
  * Represents a list of ranges that can be edited together along with a word pattern to describe valid range contents.
11936
12413
  */
@@ -12236,6 +12713,589 @@ export module '@theia/plugin' {
12236
12713
  }
12237
12714
  }
12238
12715
 
12716
+ /**
12717
+ * Namespace for testing functionality. Tests are published by registering
12718
+ * {@link TestController} instances, then adding {@link TestItem TestItems}.
12719
+ * Controllers may also describe how to run tests by creating one or more
12720
+ * {@link TestRunProfile} instances.
12721
+ */
12722
+ export namespace tests {
12723
+ /**
12724
+ * Creates a new test controller.
12725
+ *
12726
+ * @param id Identifier for the controller, must be globally unique.
12727
+ * @param label A human-readable label for the controller.
12728
+ * @returns An instance of the {@link TestController}.
12729
+ * @stubbed
12730
+ */
12731
+ export function createTestController(id: string, label: string): TestController;
12732
+ }
12733
+
12734
+ /**
12735
+ * The kind of executions that {@link TestRunProfile TestRunProfiles} control.
12736
+ */
12737
+ export enum TestRunProfileKind {
12738
+ Run = 1,
12739
+ Debug = 2,
12740
+ Coverage = 3,
12741
+ }
12742
+
12743
+ /**
12744
+ * Tags can be associated with {@link TestItem TestItems} and
12745
+ * {@link TestRunProfile TestRunProfiles}. A profile with a tag can only
12746
+ * execute tests that include that tag in their {@link TestItem.tags} array.
12747
+ */
12748
+ export class TestTag {
12749
+ /**
12750
+ * ID of the test tag. `TestTag` instances with the same ID are considered
12751
+ * to be identical.
12752
+ */
12753
+ readonly id: string;
12754
+
12755
+ /**
12756
+ * Creates a new TestTag instance.
12757
+ * @param id ID of the test tag.
12758
+ */
12759
+ constructor(id: string);
12760
+ }
12761
+
12762
+ /**
12763
+ * A TestRunProfile describes one way to execute tests in a {@link TestController}.
12764
+ */
12765
+ export interface TestRunProfile {
12766
+ /**
12767
+ * Label shown to the user in the UI.
12768
+ *
12769
+ * Note that the label has some significance if the user requests that
12770
+ * tests be re-run in a certain way. For example, if tests were run
12771
+ * normally and the user requests to re-run them in debug mode, the editor
12772
+ * will attempt use a configuration with the same label of the `Debug`
12773
+ * kind. If there is no such configuration, the default will be used.
12774
+ * @stubbed
12775
+ */
12776
+ label: string;
12777
+
12778
+ /**
12779
+ * Configures what kind of execution this profile controls. If there
12780
+ * are no profiles for a kind, it will not be available in the UI.
12781
+ * @stubbed
12782
+ */
12783
+ readonly kind: TestRunProfileKind;
12784
+
12785
+ /**
12786
+ * Controls whether this profile is the default action that will
12787
+ * be taken when its kind is actioned. For example, if the user clicks
12788
+ * the generic "run all" button, then the default profile for
12789
+ * {@link TestRunProfileKind.Run} will be executed, although the
12790
+ * user can configure this.
12791
+ * @stubbed
12792
+ */
12793
+ isDefault: boolean;
12794
+
12795
+ /**
12796
+ * Associated tag for the profile. If this is set, only {@link TestItem}
12797
+ * instances with the same tag will be eligible to execute in this profile.
12798
+ * @stubbed
12799
+ */
12800
+ tag: TestTag | undefined;
12801
+
12802
+ /**
12803
+ * If this method is present, a configuration gear will be present in the
12804
+ * UI, and this method will be invoked when it's clicked. When called,
12805
+ * you can take other editor actions, such as showing a quick pick or
12806
+ * opening a configuration file.
12807
+ * @stubbed
12808
+ */
12809
+ configureHandler: (() => void) | undefined;
12810
+
12811
+ /**
12812
+ * Handler called to start a test run. When invoked, the function should call
12813
+ * {@link TestController.createTestRun} at least once, and all test runs
12814
+ * associated with the request should be created before the function returns
12815
+ * or the returned promise is resolved.
12816
+ *
12817
+ * @param request Request information for the test run.
12818
+ * @param cancellationToken Token that signals the used asked to abort the
12819
+ * test run. If cancellation is requested on this token, all {@link TestRun}
12820
+ * instances associated with the request will be
12821
+ * automatically cancelled as well.
12822
+ * @stubbed
12823
+ */
12824
+ runHandler: (request: TestRunRequest, token: CancellationToken) => Thenable<void> | void;
12825
+
12826
+ /**
12827
+ * Deletes the run profile.
12828
+ * @stubbed
12829
+ */
12830
+ dispose(): void;
12831
+ }
12832
+
12833
+ /**
12834
+ * Entry point to discover and execute tests. It contains {@link TestController.items} which
12835
+ * are used to populate the editor UI, and is associated with
12836
+ * {@link TestController.createRunProfile run profiles} to allow
12837
+ * for tests to be executed.
12838
+ */
12839
+ export interface TestController {
12840
+ /**
12841
+ * The id of the controller passed in {@link vscode.tests.createTestController}.
12842
+ * This must be globally unique.
12843
+ * @stubbed
12844
+ */
12845
+ readonly id: string;
12846
+
12847
+ /**
12848
+ * Human-readable label for the test controller.
12849
+ * @stubbed
12850
+ */
12851
+ label: string;
12852
+
12853
+ /**
12854
+ * A collection of "top-level" {@link TestItem} instances, which can in
12855
+ * turn have their own {@link TestItem.children children} to form the
12856
+ * "test tree."
12857
+ *
12858
+ * The extension controls when to add tests. For example, extensions should
12859
+ * add tests for a file when {@link vscode.workspace.onDidOpenTextDocument}
12860
+ * fires in order for decorations for tests within a file to be visible.
12861
+ *
12862
+ * However, the editor may sometimes explicitly request children using the
12863
+ * {@link resolveHandler} See the documentation on that method for more details.
12864
+ * @stubbed
12865
+ */
12866
+ readonly items: TestItemCollection;
12867
+
12868
+ /**
12869
+ * Creates a profile used for running tests. Extensions must create
12870
+ * at least one profile in order for tests to be run.
12871
+ * @param label A human-readable label for this profile.
12872
+ * @param kind Configures what kind of execution this profile manages.
12873
+ * @param runHandler Function called to start a test run.
12874
+ * @param isDefault Whether this is the default action for its kind.
12875
+ * @param tag Profile test tag.
12876
+ * @returns An instance of a {@link TestRunProfile}, which is automatically
12877
+ * associated with this controller.
12878
+ * @stubbed
12879
+ */
12880
+ createRunProfile(label: string, kind: TestRunProfileKind, runHandler: (request: TestRunRequest, token: CancellationToken) => Thenable<void> | void, isDefault?: boolean, tag?: TestTag): TestRunProfile;
12881
+
12882
+ /**
12883
+ * A function provided by the extension that the editor may call to request
12884
+ * children of a test item, if the {@link TestItem.canResolveChildren} is
12885
+ * `true`. When called, the item should discover children and call
12886
+ * {@link vscode.tests.createTestItem} as children are discovered.
12887
+ *
12888
+ * Generally the extension manages the lifecycle of test items, but under
12889
+ * certain conditions the editor may request the children of a specific
12890
+ * item to be loaded. For example, if the user requests to re-run tests
12891
+ * after reloading the editor, the editor may need to call this method
12892
+ * to resolve the previously-run tests.
12893
+ *
12894
+ * The item in the explorer will automatically be marked as "busy" until
12895
+ * the function returns or the returned thenable resolves.
12896
+ *
12897
+ * @param item An unresolved test item for which children are being
12898
+ * requested, or `undefined` to resolve the controller's initial {@link TestController.items items}.
12899
+ * @stubbed
12900
+ */
12901
+ resolveHandler?: (item: TestItem | undefined) => Thenable<void> | void;
12902
+
12903
+ /**
12904
+ * If this method is present, a refresh button will be present in the
12905
+ * UI, and this method will be invoked when it's clicked. When called,
12906
+ * the extension should scan the workspace for any new, changed, or
12907
+ * removed tests.
12908
+ *
12909
+ * It's recommended that extensions try to update tests in realtime, using
12910
+ * a {@link FileSystemWatcher} for example, and use this method as a fallback.
12911
+ *
12912
+ * @returns A thenable that resolves when tests have been refreshed.
12913
+ * @stubbed
12914
+ */
12915
+ refreshHandler: ((token: CancellationToken) => Thenable<void> | void) | undefined;
12916
+
12917
+ /**
12918
+ * Creates a {@link TestRun}. This should be called by the
12919
+ * {@link TestRunProfile} when a request is made to execute tests, and may
12920
+ * also be called if a test run is detected externally. Once created, tests
12921
+ * that are included in the request will be moved into the queued state.
12922
+ *
12923
+ * All runs created using the same `request` instance will be grouped
12924
+ * together. This is useful if, for example, a single suite of tests is
12925
+ * run on multiple platforms.
12926
+ *
12927
+ * @param request Test run request. Only tests inside the `include` may be
12928
+ * modified, and tests in its `exclude` are ignored.
12929
+ * @param name The human-readable name of the run. This can be used to
12930
+ * disambiguate multiple sets of results in a test run. It is useful if
12931
+ * tests are run across multiple platforms, for example.
12932
+ * @param persist Whether the results created by the run should be
12933
+ * persisted in the editor. This may be false if the results are coming from
12934
+ * a file already saved externally, such as a coverage information file.
12935
+ * @returns An instance of the {@link TestRun}. It will be considered "running"
12936
+ * from the moment this method is invoked until {@link TestRun.end} is called.
12937
+ * @stubbed
12938
+ */
12939
+ createTestRun(request: TestRunRequest, name?: string, persist?: boolean): TestRun;
12940
+
12941
+ /**
12942
+ * Creates a new managed {@link TestItem} instance. It can be added into
12943
+ * the {@link TestItem.children} of an existing item, or into the
12944
+ * {@link TestController.items}.
12945
+ *
12946
+ * @param id Identifier for the TestItem. The test item's ID must be unique
12947
+ * in the {@link TestItemCollection} it's added to.
12948
+ * @param label Human-readable label of the test item.
12949
+ * @param uri URI this TestItem is associated with. May be a file or directory.
12950
+ * @stubbed
12951
+ */
12952
+ createTestItem(id: string, label: string, uri?: Uri): TestItem;
12953
+
12954
+ /**
12955
+ * Unregisters the test controller, disposing of its associated tests
12956
+ * and unpersisted results.
12957
+ * @stubbed
12958
+ */
12959
+ dispose(): void;
12960
+ }
12961
+
12962
+ /**
12963
+ * A TestRunRequest is a precursor to a {@link TestRun}, which in turn is
12964
+ * created by passing a request to {@link tests.runTests}. The TestRunRequest
12965
+ * contains information about which tests should be run, which should not be
12966
+ * run, and how they are run (via the {@link TestRunRequest.profile profile}).
12967
+ *
12968
+ * In general, TestRunRequests are created by the editor and pass to
12969
+ * {@link TestRunProfile.runHandler}, however you can also create test
12970
+ * requests and runs outside of the `runHandler`.
12971
+ */
12972
+ export class TestRunRequest {
12973
+ /**
12974
+ * A filter for specific tests to run. If given, the extension should run
12975
+ * all of the included tests and all their children, excluding any tests
12976
+ * that appear in {@link TestRunRequest.exclude}. If this property is
12977
+ * undefined, then the extension should simply run all tests.
12978
+ *
12979
+ * The process of running tests should resolve the children of any test
12980
+ * items who have not yet been resolved.
12981
+ */
12982
+ readonly include: readonly TestItem[] | undefined;
12983
+
12984
+ /**
12985
+ * An array of tests the user has marked as excluded from the test included
12986
+ * in this run; exclusions should apply after inclusions.
12987
+ *
12988
+ * May be omitted if no exclusions were requested. Test controllers should
12989
+ * not run excluded tests or any children of excluded tests.
12990
+ */
12991
+ readonly exclude: readonly TestItem[] | undefined;
12992
+
12993
+ /**
12994
+ * The profile used for this request. This will always be defined
12995
+ * for requests issued from the editor UI, though extensions may
12996
+ * programmatically create requests not associated with any profile.
12997
+ */
12998
+ readonly profile: TestRunProfile | undefined;
12999
+
13000
+ /**
13001
+ * @param include Array of specific tests to run, or undefined to run all tests
13002
+ * @param exclude An array of tests to exclude from the run.
13003
+ * @param profile The run profile used for this request.
13004
+ */
13005
+ constructor(include?: readonly TestItem[], exclude?: readonly TestItem[], profile?: TestRunProfile);
13006
+ }
13007
+
13008
+ /**
13009
+ * Options given to {@link TestController.runTests}
13010
+ */
13011
+ export interface TestRun {
13012
+ /**
13013
+ * The human-readable name of the run. This can be used to
13014
+ * disambiguate multiple sets of results in a test run. It is useful if
13015
+ * tests are run across multiple platforms, for example.
13016
+ * @stubbed
13017
+ */
13018
+ readonly name: string | undefined;
13019
+
13020
+ /**
13021
+ * A cancellation token which will be triggered when the test run is
13022
+ * canceled from the UI.
13023
+ * @stubbed
13024
+ */
13025
+ readonly token: CancellationToken;
13026
+
13027
+ /**
13028
+ * Whether the test run will be persisted across reloads by the editor.
13029
+ * @stubbed
13030
+ */
13031
+ readonly isPersisted: boolean;
13032
+
13033
+ /**
13034
+ * Indicates a test is queued for later execution.
13035
+ * @param test Test item to update.
13036
+ * @stubbed
13037
+ */
13038
+ enqueued(test: TestItem): void;
13039
+
13040
+ /**
13041
+ * Indicates a test has started running.
13042
+ * @param test Test item to update.
13043
+ * @stubbed
13044
+ */
13045
+ started(test: TestItem): void;
13046
+
13047
+ /**
13048
+ * Indicates a test has been skipped.
13049
+ * @param test Test item to update.
13050
+ * @stubbed
13051
+ */
13052
+ skipped(test: TestItem): void;
13053
+
13054
+ /**
13055
+ * Indicates a test has failed. You should pass one or more
13056
+ * {@link TestMessage TestMessages} to describe the failure.
13057
+ * @param test Test item to update.
13058
+ * @param message Messages associated with the test failure.
13059
+ * @param duration How long the test took to execute, in milliseconds.
13060
+ * @stubbed
13061
+ */
13062
+ failed(test: TestItem, message: TestMessage | readonly TestMessage[], duration?: number): void;
13063
+
13064
+ /**
13065
+ * Indicates a test has errored. You should pass one or more
13066
+ * {@link TestMessage TestMessages} to describe the failure. This differs
13067
+ * from the "failed" state in that it indicates a test that couldn't be
13068
+ * executed at all, from a compilation error for example.
13069
+ * @param test Test item to update.
13070
+ * @param message Messages associated with the test failure.
13071
+ * @param duration How long the test took to execute, in milliseconds.
13072
+ * @stubbed
13073
+ */
13074
+ errored(test: TestItem, message: TestMessage | readonly TestMessage[], duration?: number): void;
13075
+
13076
+ /**
13077
+ * Indicates a test has passed.
13078
+ * @param test Test item to update.
13079
+ * @param duration How long the test took to execute, in milliseconds.
13080
+ * @stubbed
13081
+ */
13082
+ passed(test: TestItem, duration?: number): void;
13083
+
13084
+ /**
13085
+ * Appends raw output from the test runner. On the user's request, the
13086
+ * output will be displayed in a terminal. ANSI escape sequences,
13087
+ * such as colors and text styles, are supported.
13088
+ *
13089
+ * @param output Output text to append.
13090
+ * @param location Indicate that the output was logged at the given
13091
+ * location.
13092
+ * @param test Test item to associate the output with.
13093
+ * @stubbed
13094
+ */
13095
+ appendOutput(output: string, location?: Location, test?: TestItem): void;
13096
+
13097
+ /**
13098
+ * Signals that the end of the test run. Any tests included in the run whose
13099
+ * states have not been updated will have their state reset.
13100
+ * @stubbed
13101
+ */
13102
+ end(): void;
13103
+ }
13104
+
13105
+ /**
13106
+ * Collection of test items, found in {@link TestItem.children} and
13107
+ * {@link TestController.items}.
13108
+ */
13109
+ export interface TestItemCollection extends Iterable<[id: string, testItem: TestItem]> {
13110
+ /**
13111
+ * Gets the number of items in the collection.
13112
+ * @stubbed
13113
+ */
13114
+ readonly size: number;
13115
+
13116
+ /**
13117
+ * Replaces the items stored by the collection.
13118
+ * @param items Items to store.
13119
+ * @stubbed
13120
+ */
13121
+ replace(items: readonly TestItem[]): void;
13122
+
13123
+ /**
13124
+ * Iterate over each entry in this collection.
13125
+ *
13126
+ * @param callback Function to execute for each entry.
13127
+ * @param thisArg The `this` context used when invoking the handler function.
13128
+ * @stubbed
13129
+ */
13130
+ forEach(callback: (item: TestItem, collection: TestItemCollection) => unknown, thisArg?: any): void;
13131
+
13132
+ /**
13133
+ * Adds the test item to the children. If an item with the same ID already
13134
+ * exists, it'll be replaced.
13135
+ * @param item Item to add.
13136
+ * @stubbed
13137
+ */
13138
+ add(item: TestItem): void;
13139
+
13140
+ /**
13141
+ * Removes a single test item from the collection.
13142
+ * @param itemId Item ID to delete.
13143
+ * @stubbed
13144
+ */
13145
+ delete(itemId: string): void;
13146
+
13147
+ /**
13148
+ * Efficiently gets a test item by ID, if it exists, in the children.
13149
+ * @param itemId Item ID to get.
13150
+ * @returns The found item or undefined if it does not exist.
13151
+ * @stubbed
13152
+ */
13153
+ get(itemId: string): TestItem | undefined;
13154
+ }
13155
+
13156
+ /**
13157
+ * An item shown in the "test explorer" view.
13158
+ *
13159
+ * A `TestItem` can represent either a test suite or a test itself, since
13160
+ * they both have similar capabilities.
13161
+ */
13162
+ export interface TestItem {
13163
+ /**
13164
+ * Identifier for the `TestItem`. This is used to correlate
13165
+ * test results and tests in the document with those in the workspace
13166
+ * (test explorer). This cannot change for the lifetime of the `TestItem`,
13167
+ * and must be unique among its parent's direct children.
13168
+ * @stubbed
13169
+ */
13170
+ readonly id: string;
13171
+
13172
+ /**
13173
+ * URI this `TestItem` is associated with. May be a file or directory.
13174
+ * @stubbed
13175
+ */
13176
+ readonly uri: Uri | undefined;
13177
+
13178
+ /**
13179
+ * The children of this test item. For a test suite, this may contain the
13180
+ * individual test cases or nested suites.
13181
+ * @stubbed
13182
+ */
13183
+ readonly children: TestItemCollection;
13184
+
13185
+ /**
13186
+ * The parent of this item. It's set automatically, and is undefined
13187
+ * top-level items in the {@link TestController.items} and for items that
13188
+ * aren't yet included in another item's {@link TestItem.children children}.
13189
+ * @stubbed
13190
+ */
13191
+ readonly parent: TestItem | undefined;
13192
+
13193
+ /**
13194
+ * Tags associated with this test item. May be used in combination with
13195
+ * {@link TestRunProfile.tags}, or simply as an organizational feature.
13196
+ * @stubbed
13197
+ */
13198
+ tags: readonly TestTag[];
13199
+
13200
+ /**
13201
+ * Indicates whether this test item may have children discovered by resolving.
13202
+ *
13203
+ * If true, this item is shown as expandable in the Test Explorer view and
13204
+ * expanding the item will cause {@link TestController.resolveHandler}
13205
+ * to be invoked with the item.
13206
+ *
13207
+ * Default to `false`.
13208
+ * @stubbed
13209
+ */
13210
+ canResolveChildren: boolean;
13211
+
13212
+ /**
13213
+ * Controls whether the item is shown as "busy" in the Test Explorer view.
13214
+ * This is useful for showing status while discovering children.
13215
+ *
13216
+ * Defaults to `false`.
13217
+ * @stubbed
13218
+ */
13219
+ busy: boolean;
13220
+
13221
+ /**
13222
+ * Display name describing the test case.
13223
+ * @stubbed
13224
+ */
13225
+ label: string;
13226
+
13227
+ /**
13228
+ * Optional description that appears next to the label.
13229
+ * @stubbed
13230
+ */
13231
+ description?: string;
13232
+
13233
+ /**
13234
+ * A string that should be used when comparing this item
13235
+ * with other items. When `falsy` the {@link TestItem.label label}
13236
+ * is used.
13237
+ * @stubbed
13238
+ */
13239
+ sortText?: string | undefined;
13240
+
13241
+ /**
13242
+ * Location of the test item in its {@link TestItem.uri uri}.
13243
+ *
13244
+ * This is only meaningful if the `uri` points to a file.
13245
+ * @stubbed
13246
+ */
13247
+ range: Range | undefined;
13248
+
13249
+ /**
13250
+ * Optional error encountered while loading the test.
13251
+ *
13252
+ * Note that this is not a test result and should only be used to represent errors in
13253
+ * test discovery, such as syntax errors.
13254
+ * @stubbed
13255
+ */
13256
+ error: string | MarkdownString | undefined;
13257
+ }
13258
+
13259
+ /**
13260
+ * Message associated with the test state. Can be linked to a specific
13261
+ * source range -- useful for assertion failures, for example.
13262
+ */
13263
+ export class TestMessage {
13264
+ /**
13265
+ * Human-readable message text to display.
13266
+ */
13267
+ message: string | MarkdownString;
13268
+
13269
+ /**
13270
+ * Expected test output. If given with {@link TestMessage.actualOutput actualOutput }, a diff view will be shown.
13271
+ */
13272
+ expectedOutput?: string;
13273
+
13274
+ /**
13275
+ * Actual test output. If given with {@link TestMessage.expectedOutput expectedOutput }, a diff view will be shown.
13276
+ */
13277
+ actualOutput?: string;
13278
+
13279
+ /**
13280
+ * Associated file location.
13281
+ */
13282
+ location?: Location;
13283
+
13284
+ /**
13285
+ * Creates a new TestMessage that will present as a diff in the editor.
13286
+ * @param message Message to display to the user.
13287
+ * @param expected Expected output.
13288
+ * @param actual Actual output.
13289
+ */
13290
+ static diff(message: string | MarkdownString, expected: string, actual: string): TestMessage;
13291
+
13292
+ /**
13293
+ * Creates a new TestMessage instance.
13294
+ * @param message The message to show to the user.
13295
+ */
13296
+ constructor(message: string | MarkdownString);
13297
+ }
13298
+
12239
13299
  /**
12240
13300
  * Thenable is a common denominator between ES6 promises, Q, jquery.Deferred, WinJS.Promise,
12241
13301
  * and others. This API makes no assumption about what promise library is being used which