@theia/plugin 1.31.0-next.3 → 1.31.0-next.32

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 +2 -2
  2. package/src/theia.d.ts +413 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theia/plugin",
3
- "version": "1.31.0-next.3+d3f635993",
3
+ "version": "1.31.0-next.32+7f51450b8",
4
4
  "description": "Theia - Plugin API",
5
5
  "types": "./src/theia.d.ts",
6
6
  "publishConfig": {
@@ -32,5 +32,5 @@
32
32
  "nyc": {
33
33
  "extends": "../../configs/nyc.json"
34
34
  },
35
- "gitHead": "d3f6359934d025781810c467e2f3b42b55f0ff0d"
35
+ "gitHead": "7f51450b88967fe2f96f4f895357413bf311ad16"
36
36
  }
package/src/theia.d.ts CHANGED
@@ -3009,6 +3009,11 @@ export module '@theia/plugin' {
3009
3009
  */
3010
3010
  readonly creationOptions: Readonly<TerminalOptions | ExtensionTerminalOptions>
3011
3011
 
3012
+ /**
3013
+ * The current state of the {@link Terminal}.
3014
+ */
3015
+ readonly state: TerminalState;
3016
+
3012
3017
  /**
3013
3018
  * Send text to the terminal.
3014
3019
  * @param text - text content.
@@ -3033,6 +3038,24 @@ export module '@theia/plugin' {
3033
3038
  dispose(): void;
3034
3039
  }
3035
3040
 
3041
+ export interface TerminalState {
3042
+ /**
3043
+ * Whether the {@link Terminal} has been interacted with. Interaction means that the
3044
+ * terminal has sent data to the process which depending on the terminal's _mode_. By
3045
+ * default input is sent when a key is pressed or when a command or extension sends text,
3046
+ * but based on the terminal's mode it can also happen on:
3047
+ *
3048
+ * - a pointer click event
3049
+ * - a pointer scroll event
3050
+ * - a pointer move event
3051
+ * - terminal focus in/out
3052
+ *
3053
+ * For more information on events that can send data see "DEC Private Mode Set (DECSET)" on
3054
+ * https://invisible-island.net/xterm/ctlseqs/ctlseqs.html
3055
+ */
3056
+ readonly isInteractedWith: boolean;
3057
+ }
3058
+
3036
3059
  /**
3037
3060
  * Options to create terminal widget.
3038
3061
  */
@@ -3071,6 +3094,15 @@ export module '@theia/plugin' {
3071
3094
  */
3072
3095
  strictEnv?: boolean;
3073
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
+
3074
3106
  /**
3075
3107
  * A message to write to the terminal on first launch. Note that this is not sent to the
3076
3108
  * process, but rather written directly to the terminal. This supports escape sequences such
@@ -3251,7 +3283,7 @@ export module '@theia/plugin' {
3251
3283
  /**
3252
3284
  * A link on a terminal line.
3253
3285
  */
3254
- export interface TerminalLink {
3286
+ export class TerminalLink {
3255
3287
  /**
3256
3288
  * The start index of the link on [TerminalLinkContext.line](#TerminalLinkContext.line].
3257
3289
  */
@@ -3270,6 +3302,18 @@ export module '@theia/plugin' {
3270
3302
  * depending on OS, user settings, and localization.
3271
3303
  */
3272
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);
3273
3317
  }
3274
3318
 
3275
3319
  /**
@@ -4995,6 +5039,11 @@ export module '@theia/plugin' {
4995
5039
  */
4996
5040
  export const onDidOpenTerminal: Event<Terminal>;
4997
5041
 
5042
+ /**
5043
+ * An {@link Event} which fires when a {@link Terminal.state terminal's state} has changed.
5044
+ */
5045
+ export const onDidChangeTerminalState: Event<Terminal>;
5046
+
4998
5047
  /**
4999
5048
  * Create new terminal with predefined options.
5000
5049
  * @param - terminal options.
@@ -5096,7 +5145,7 @@ export module '@theia/plugin' {
5096
5145
  * @param provider The provider that provides the terminal links.
5097
5146
  * @return Disposable that unregisters the provider.
5098
5147
  */
5099
- export function registerTerminalLinkProvider(provider: TerminalLinkProvider): void;
5148
+ export function registerTerminalLinkProvider(provider: TerminalLinkProvider): Disposable;
5100
5149
 
5101
5150
  /**
5102
5151
  * Register a file decoration provider.
@@ -5537,6 +5586,29 @@ export module '@theia/plugin' {
5537
5586
  * @return Parent of `element`.
5538
5587
  */
5539
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>;
5540
5612
  }
5541
5613
 
5542
5614
  export class TreeItem {
@@ -6812,6 +6884,18 @@ export module '@theia/plugin' {
6812
6884
  /**
6813
6885
  * A base file path to which this pattern will be matched against relatively.
6814
6886
  */
6887
+ baseUri: Uri;
6888
+
6889
+ /**
6890
+ * A base file path against which this pattern will be matched relatively.
6891
+ *
6892
+ * This matches the `fsPath` value of {@link RelativePattern.baseUri}.
6893
+ *
6894
+ * *Note:* updating this value will update {@link RelativePattern.baseUri} to
6895
+ * be a uri with `file` scheme.
6896
+ *
6897
+ * @deprecated This property is deprecated, please use {@link RelativePattern.baseUri} instead.
6898
+ */
6815
6899
  base: string;
6816
6900
 
6817
6901
  /**
@@ -6831,7 +6915,7 @@ export module '@theia/plugin' {
6831
6915
  * @param pattern A file glob pattern like `*.{ts,js}` that will be matched on file paths
6832
6916
  * relative to the base path.
6833
6917
  */
6834
- constructor(base: WorkspaceFolder | string, pattern: string)
6918
+ constructor(base: WorkspaceFolder | Uri | string, pattern: string)
6835
6919
  }
6836
6920
 
6837
6921
  /**
@@ -7560,6 +7644,176 @@ export module '@theia/plugin' {
7560
7644
  provideColorPresentations(color: Color, context: { document: TextDocument, range: Range }, token: CancellationToken): ProviderResult<ColorPresentation[]>;
7561
7645
  }
7562
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
+
7563
7817
  /**
7564
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.
7565
7819
  * Invalid ranges will be ignored.
@@ -9466,6 +9720,21 @@ export module '@theia/plugin' {
9466
9720
  */
9467
9721
  export function registerEvaluatableExpressionProvider(selector: DocumentSelector, provider: EvaluatableExpressionProvider): Disposable;
9468
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
+
9469
9738
  /**
9470
9739
  * Register a workspace symbol provider.
9471
9740
  *
@@ -9622,6 +9891,19 @@ export module '@theia/plugin' {
9622
9891
  */
9623
9892
  export function registerColorProvider(selector: DocumentSelector, provider: DocumentColorProvider): Disposable;
9624
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
+
9625
9907
  /**
9626
9908
  * Register a folding range provider.
9627
9909
  *
@@ -9827,6 +10109,134 @@ export module '@theia/plugin' {
9827
10109
  provideEvaluatableExpression(document: TextDocument, position: Position, token: CancellationToken | undefined): ProviderResult<EvaluatableExpression>;
9828
10110
  }
9829
10111
 
10112
+ /**
10113
+ * Provide inline value as text.
10114
+ */
10115
+ export class InlineValueText {
10116
+ /**
10117
+ * The document range for which the inline value applies.
10118
+ */
10119
+ readonly range: Range;
10120
+ /**
10121
+ * The text of the inline value.
10122
+ */
10123
+ readonly text: string;
10124
+ /**
10125
+ * Creates a new InlineValueText object.
10126
+ *
10127
+ * @param range The document line where to show the inline value.
10128
+ * @param text The value to be shown for the line.
10129
+ */
10130
+ constructor(range: Range, text: string);
10131
+ }
10132
+
10133
+ /**
10134
+ * Provide inline value through a variable lookup.
10135
+ * If only a range is specified, the variable name will be extracted from the underlying document.
10136
+ * An optional variable name can be used to override the extracted name.
10137
+ */
10138
+ export class InlineValueVariableLookup {
10139
+ /**
10140
+ * The document range for which the inline value applies.
10141
+ * The range is used to extract the variable name from the underlying document.
10142
+ */
10143
+ readonly range: Range;
10144
+ /**
10145
+ * If specified the name of the variable to look up.
10146
+ */
10147
+ readonly variableName?: string | undefined;
10148
+ /**
10149
+ * How to perform the lookup.
10150
+ */
10151
+ readonly caseSensitiveLookup: boolean;
10152
+ /**
10153
+ * Creates a new InlineValueVariableLookup object.
10154
+ *
10155
+ * @param range The document line where to show the inline value.
10156
+ * @param variableName The name of the variable to look up.
10157
+ * @param caseSensitiveLookup How to perform the lookup. If missing lookup is case sensitive.
10158
+ */
10159
+ constructor(range: Range, variableName?: string, caseSensitiveLookup?: boolean);
10160
+ }
10161
+
10162
+ /**
10163
+ * Provide an inline value through an expression evaluation.
10164
+ * If only a range is specified, the expression will be extracted from the underlying document.
10165
+ * An optional expression can be used to override the extracted expression.
10166
+ */
10167
+ export class InlineValueEvaluatableExpression {
10168
+ /**
10169
+ * The document range for which the inline value applies.
10170
+ * The range is used to extract the evaluatable expression from the underlying document.
10171
+ */
10172
+ readonly range: Range;
10173
+ /**
10174
+ * If specified the expression overrides the extracted expression.
10175
+ */
10176
+ readonly expression?: string | undefined;
10177
+ /**
10178
+ * Creates a new InlineValueEvaluatableExpression object.
10179
+ *
10180
+ * @param range The range in the underlying document from which the evaluatable expression is extracted.
10181
+ * @param expression If specified overrides the extracted expression.
10182
+ */
10183
+ constructor(range: Range, expression?: string);
10184
+ }
10185
+
10186
+ /**
10187
+ * Inline value information can be provided by different means:
10188
+ * - directly as a text value (class InlineValueText).
10189
+ * - as a name to use for a variable lookup (class InlineValueVariableLookup)
10190
+ * - as an evaluatable expression (class InlineValueEvaluatableExpression)
10191
+ * The InlineValue types combines all inline value types into one type.
10192
+ */
10193
+ export type InlineValue = InlineValueText | InlineValueVariableLookup | InlineValueEvaluatableExpression;
10194
+
10195
+ /**
10196
+ * A value-object that contains contextual information when requesting inline values from a InlineValuesProvider.
10197
+ */
10198
+ export interface InlineValueContext {
10199
+
10200
+ /**
10201
+ * The stack frame (as a DAP Id) where the execution has stopped.
10202
+ */
10203
+ readonly frameId: number;
10204
+
10205
+ /**
10206
+ * The document range where execution has stopped.
10207
+ * Typically the end position of the range denotes the line where the inline values are shown.
10208
+ */
10209
+ readonly stoppedLocation: Range;
10210
+ }
10211
+
10212
+ /**
10213
+ * The inline values provider interface defines the contract between extensions and the editor's debugger inline values feature.
10214
+ * In this contract the provider returns inline value information for a given document range
10215
+ * and the editor shows this information in the editor at the end of lines.
10216
+ */
10217
+ export interface InlineValuesProvider {
10218
+
10219
+ /**
10220
+ * An optional event to signal that inline values have changed.
10221
+ * @see {@link EventEmitter}
10222
+ */
10223
+ onDidChangeInlineValues?: Event<void> | undefined;
10224
+
10225
+ /**
10226
+ * Provide "inline value" information for a given document and range.
10227
+ * The editor calls this method whenever debugging stops in the given document.
10228
+ * The returned inline values information is rendered in the editor at the end of lines.
10229
+ *
10230
+ * @param document The document for which the inline values information is needed.
10231
+ * @param viewPort The visible document range for which inline values should be computed.
10232
+ * @param context A bag containing contextual information like the current location.
10233
+ * @param token A cancellation token.
10234
+ * @return An array of InlineValueDescriptors or a thenable that resolves to such. The lack of a result can be
10235
+ * signaled by returning `undefined` or `null`.
10236
+ */
10237
+ provideInlineValues(document: TextDocument, viewPort: Range, context: InlineValueContext, token: CancellationToken): ProviderResult<InlineValue[]>;
10238
+ }
10239
+
9830
10240
  /**
9831
10241
  * A document highlight kind.
9832
10242
  */