@theia/plugin 1.51.0 → 1.53.0-next.4

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.51.0",
3
+ "version": "1.53.0-next.4+9e9124118",
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.51.0"
30
+ "@theia/ext-scripts": "1.52.0"
31
31
  },
32
32
  "nyc": {
33
33
  "extends": "../../configs/nyc.json"
34
34
  },
35
- "gitHead": "fe70ec5d445d733038564d81357c78aedf5c7e0e"
35
+ "gitHead": "9e912411843f32b2a549ef6580b07872edd95e8b"
36
36
  }
package/src/theia.d.ts CHANGED
@@ -24,18 +24,20 @@
24
24
  import './theia-extra';
25
25
  import './theia.proposed.canonicalUriProvider';
26
26
  import './theia.proposed.customEditorMove';
27
+ import './theia.proposed.debugVisualization';
27
28
  import './theia.proposed.diffCommand';
28
29
  import './theia.proposed.documentPaste';
29
30
  import './theia.proposed.editSessionIdentityProvider';
30
31
  import './theia.proposed.extensionsAny';
31
32
  import './theia.proposed.externalUriOpener';
33
+ import './theia.proposed.findTextInFiles';
34
+ import './theia.proposed.fsChunks';
32
35
  import './theia.proposed.mappedEditsProvider';
36
+ import './theia.proposed.multiDocumentHighlightProvider';
33
37
  import './theia.proposed.notebookCellExecutionState';
34
38
  import './theia.proposed.notebookKernelSource';
35
39
  import './theia.proposed.notebookMessaging';
36
- import './theia.proposed.findTextInFiles';
37
- import './theia.proposed.fsChunks';
38
- import './theia.proposed.multiDocumentHighlightProvider';
40
+ import './theia.proposed.portsAttributes';
39
41
  import './theia.proposed.profileContentHandlers';
40
42
  import './theia.proposed.resolvers';
41
43
  import './theia.proposed.scmValidation';
@@ -3172,7 +3174,7 @@ export module '@theia/plugin' {
3172
3174
  /**
3173
3175
  * The icon path or {@link ThemeIcon} for the terminal.
3174
3176
  */
3175
- iconPath?: ThemeIcon;
3177
+ iconPath?: Uri | { light: Uri; dark: Uri } | ThemeIcon;
3176
3178
 
3177
3179
  /**
3178
3180
  * The icon {@link ThemeColor} for the terminal.
@@ -3293,7 +3295,7 @@ export module '@theia/plugin' {
3293
3295
  /**
3294
3296
  * The icon path or {@link ThemeIcon} for the terminal.
3295
3297
  */
3296
- iconPath?: ThemeIcon;
3298
+ iconPath?: Uri | { light: Uri; dark: Uri } | ThemeIcon;
3297
3299
 
3298
3300
  /**
3299
3301
  * The icon {@link ThemeColor} for the terminal.
@@ -12085,6 +12087,12 @@ export module '@theia/plugin' {
12085
12087
  * When true, the debug viewlet will not be automatically revealed for this session.
12086
12088
  */
12087
12089
  suppressDebugView?: boolean;
12090
+ /**
12091
+ * Signals to the editor that the debug session was started from a test run
12092
+ * request. This is used to link the lifecycle of the debug session and
12093
+ * test run in UI actions.
12094
+ */
12095
+ testRun?: TestRun;
12088
12096
  }
12089
12097
 
12090
12098
  /**
@@ -12546,13 +12554,11 @@ export module '@theia/plugin' {
12546
12554
  * thread or stack is focused. A thread can be focused any time there is
12547
12555
  * an active debug session, while a stack frame can only be focused when
12548
12556
  * a session is paused and the call stack has been retrieved.
12549
- * @stubbed
12550
12557
  */
12551
12558
  export const activeStackItem: DebugThread | DebugStackFrame | undefined;
12552
12559
 
12553
12560
  /**
12554
12561
  * An event which fires when the {@link debug.activeStackItem} has changed.
12555
- * @stubbed
12556
12562
  */
12557
12563
  export const onDidChangeActiveStackItem: Event<DebugThread | DebugStackFrame | undefined>;
12558
12564
 
@@ -0,0 +1,189 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2024 Typefox and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ /*---------------------------------------------------------------------------------------------
18
+ * Copyright (c) Microsoft Corporation. All rights reserved.
19
+ * Licensed under the MIT License. See License.txt in the project root for license information.
20
+ *--------------------------------------------------------------------------------------------*/
21
+
22
+ /* eslint-disable @typescript-eslint/no-explicit-any */
23
+
24
+ declare module '@theia/plugin' {
25
+ export namespace debug {
26
+ /**
27
+ * Registers a custom data visualization for variables when debugging.
28
+ *
29
+ * @param id The corresponding ID in the package.json `debugVisualizers` contribution point.
30
+ * @param provider The {@link DebugVisualizationProvider} to register
31
+ * @stubbed
32
+ */
33
+ export function registerDebugVisualizationProvider<T extends DebugVisualization>(
34
+ id: string,
35
+ provider: DebugVisualizationProvider<T>
36
+ ): Disposable;
37
+
38
+ /**
39
+ * Registers a tree that can be referenced by {@link DebugVisualization.visualization}.
40
+ * @param id
41
+ * @param provider
42
+ * @stubbed
43
+ */
44
+ export function registerDebugVisualizationTreeProvider<T extends DebugTreeItem>(
45
+ id: string,
46
+ provider: DebugVisualizationTree<T>
47
+ ): Disposable;
48
+ }
49
+
50
+ /**
51
+ * An item from the {@link DebugVisualizationTree}
52
+ */
53
+ export interface DebugTreeItem {
54
+ /**
55
+ * A human-readable string describing this item.
56
+ */
57
+ label: string;
58
+
59
+ /**
60
+ * A human-readable string which is rendered less prominent.
61
+ */
62
+ description?: string;
63
+
64
+ /**
65
+ * {@link TreeItemCollapsibleState} of the tree item.
66
+ */
67
+ collapsibleState?: TreeItemCollapsibleState;
68
+
69
+ /**
70
+ * Context value of the tree item. This can be used to contribute item specific actions in the tree.
71
+ * For example, a tree item is given a context value as `folder`. When contributing actions to `view/item/context`
72
+ * using `menus` extension point, you can specify context value for key `viewItem` in `when` expression like `viewItem == folder`.
73
+ * ```json
74
+ * "contributes": {
75
+ * "menus": {
76
+ * "view/item/context": [
77
+ * {
78
+ * "command": "extension.deleteFolder",
79
+ * "when": "viewItem == folder"
80
+ * }
81
+ * ]
82
+ * }
83
+ * }
84
+ * ```
85
+ * This will show action `extension.deleteFolder` only for items with `contextValue` is `folder`.
86
+ */
87
+ contextValue?: string;
88
+
89
+ /**
90
+ * Whether this item can be edited by the user.
91
+ */
92
+ canEdit?: boolean;
93
+ }
94
+
95
+ /**
96
+ * Provides a tree that can be referenced in debug visualizations.
97
+ */
98
+ export interface DebugVisualizationTree<T extends DebugTreeItem = DebugTreeItem> {
99
+ /**
100
+ * Gets the tree item for an element or the base context item.
101
+ */
102
+ getTreeItem(context: DebugVisualizationContext): ProviderResult<T>;
103
+ /**
104
+ * Gets children for the tree item or the best context item.
105
+ */
106
+ getChildren(element: T): ProviderResult<T[]>;
107
+ /**
108
+ * Handles the user editing an item.
109
+ */
110
+ editItem?(item: T, value: string): ProviderResult<T>;
111
+ }
112
+
113
+ export class DebugVisualization {
114
+ /**
115
+ * The name of the visualization to show to the user.
116
+ */
117
+ name: string;
118
+
119
+ /**
120
+ * An icon for the view when it's show in inline actions.
121
+ */
122
+ iconPath?: Uri | { light: Uri; dark: Uri } | ThemeIcon;
123
+
124
+ /**
125
+ * Visualization to use for the variable. This may be either:
126
+ * - A command to run when the visualization is selected for a variable.
127
+ * - A reference to a previously-registered {@link DebugVisualizationTree}
128
+ */
129
+ visualization?: Command | { treeId: string };
130
+
131
+ /**
132
+ * Creates a new debug visualization object.
133
+ * @param name Name of the visualization to show to the user.
134
+ */
135
+ constructor(name: string);
136
+ }
137
+
138
+ export interface DebugVisualizationProvider<T extends DebugVisualization = DebugVisualization> {
139
+ /**
140
+ * Called for each variable when the debug session stops. It should return
141
+ * any visualizations the extension wishes to show to the user.
142
+ *
143
+ * Note that this is only called when its `when` clause defined under the
144
+ * `debugVisualizers` contribution point in the `package.json` evaluates
145
+ * to true.
146
+ */
147
+ provideDebugVisualization(context: DebugVisualizationContext, token: CancellationToken): ProviderResult<T[]>;
148
+
149
+ /**
150
+ * Invoked for a variable when a user picks the visualizer.
151
+ *
152
+ * It may return a {@link TreeView} that's shown in the Debug Console or
153
+ * inline in a hover. A visualizer may choose to return `undefined` from
154
+ * this function and instead trigger other actions in the UI, such as opening
155
+ * a custom {@link WebviewView}.
156
+ */
157
+ resolveDebugVisualization?(visualization: T, token: CancellationToken): ProviderResult<T>;
158
+ }
159
+
160
+ export interface DebugVisualizationContext {
161
+ /**
162
+ * The Debug Adapter Protocol Variable to be visualized.
163
+ * @see https://microsoft.github.io/debug-adapter-protocol/specification#Types_Variable
164
+ */
165
+ variable: any;
166
+ /**
167
+ * The Debug Adapter Protocol variable reference the type (such as a scope
168
+ * or another variable) that contained this one. Empty for variables
169
+ * that came from user evaluations in the Debug Console.
170
+ * @see https://microsoft.github.io/debug-adapter-protocol/specification#Types_Variable
171
+ */
172
+ containerId?: number;
173
+ /**
174
+ * The ID of the Debug Adapter Protocol StackFrame in which the variable was found,
175
+ * for variables that came from scopes in a stack frame.
176
+ * @see https://microsoft.github.io/debug-adapter-protocol/specification#Types_StackFrame
177
+ */
178
+ frameId?: number;
179
+ /**
180
+ * The ID of the Debug Adapter Protocol Thread in which the variable was found.
181
+ * @see https://microsoft.github.io/debug-adapter-protocol/specification#Types_StackFrame
182
+ */
183
+ threadId: number;
184
+ /**
185
+ * The debug session the variable belongs to.
186
+ */
187
+ session: DebugSession;
188
+ }
189
+ }
@@ -0,0 +1,115 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2024 Typefox and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ /*---------------------------------------------------------------------------------------------
18
+ * Copyright (c) Microsoft Corporation. All rights reserved.
19
+ * Licensed under the MIT License. See License.txt in the project root for license information.
20
+ *--------------------------------------------------------------------------------------------*/
21
+
22
+ declare module '@theia/plugin' {
23
+
24
+ /**
25
+ * The action that should be taken when a port is discovered through automatic port forwarding discovery.
26
+ */
27
+ export enum PortAutoForwardAction {
28
+ /**
29
+ * Notify the user that the port is being forwarded. This is the default action.
30
+ */
31
+ Notify = 1,
32
+ /**
33
+ * Once the port is forwarded, open the user's web browser to the forwarded port.
34
+ */
35
+ OpenBrowser = 2,
36
+ /**
37
+ * Once the port is forwarded, open the preview browser to the forwarded port.
38
+ */
39
+ OpenPreview = 3,
40
+ /**
41
+ * Forward the port silently.
42
+ */
43
+ Silent = 4,
44
+ /**
45
+ * Do not forward the port.
46
+ */
47
+ Ignore = 5
48
+ }
49
+
50
+ /**
51
+ * The attributes that a forwarded port can have.
52
+ */
53
+ export class PortAttributes {
54
+ /**
55
+ * The action to be taken when this port is detected for auto forwarding.
56
+ */
57
+ autoForwardAction: PortAutoForwardAction;
58
+
59
+ /**
60
+ * Creates a new PortAttributes object
61
+ * @param port the port number
62
+ * @param autoForwardAction the action to take when this port is detected
63
+ */
64
+ constructor(autoForwardAction: PortAutoForwardAction);
65
+ }
66
+
67
+ /**
68
+ * A provider of port attributes. Port attributes are used to determine what action should be taken when a port is discovered.
69
+ */
70
+ export interface PortAttributesProvider {
71
+ /**
72
+ * Provides attributes for the given port. For ports that your extension doesn't know about, simply
73
+ * return undefined. For example, if `providePortAttributes` is called with ports 3000 but your
74
+ * extension doesn't know anything about 3000 you should return undefined.
75
+ * @param port The port number of the port that attributes are being requested for.
76
+ * @param pid The pid of the process that is listening on the port. If the pid is unknown, undefined will be passed.
77
+ * @param commandLine The command line of the process that is listening on the port. If the command line is unknown, undefined will be passed.
78
+ * @param token A cancellation token that indicates the result is no longer needed.
79
+ */
80
+ providePortAttributes(attributes: { port: number; pid?: number; commandLine?: string }, token: CancellationToken): ProviderResult<PortAttributes>;
81
+ }
82
+
83
+ /**
84
+ * A selector that will be used to filter which {@link PortAttributesProvider} should be called for each port.
85
+ */
86
+ export interface PortAttributesSelector {
87
+ /**
88
+ * Specifying a port range will cause your provider to only be called for ports within the range.
89
+ * The start is inclusive and the end is exclusive.
90
+ */
91
+ portRange?: [number, number] | number;
92
+
93
+ /**
94
+ * Specifying a command pattern will cause your provider to only be called for processes whose command line matches the pattern.
95
+ */
96
+ commandPattern?: RegExp;
97
+ }
98
+
99
+ export namespace workspace {
100
+ /**
101
+ * If your extension listens on ports, consider registering a PortAttributesProvider to provide information
102
+ * about the ports. For example, a debug extension may know about debug ports in it's debuggee. By providing
103
+ * this information with a PortAttributesProvider the extension can tell the editor that these ports should be
104
+ * ignored, since they don't need to be user facing.
105
+ *
106
+ * The results of the PortAttributesProvider are merged with the user setting `remote.portsAttributes`. If the values conflict, the user setting takes precedence.
107
+ *
108
+ * @param portSelector It is best practice to specify a port selector to avoid unnecessary calls to your provider.
109
+ * If you don't specify a port selector your provider will be called for every port, which will result in slower port forwarding for the user.
110
+ * @param provider The {@link PortAttributesProvider PortAttributesProvider}.
111
+ * @stubbed
112
+ */
113
+ export function registerPortAttributesProvider(portSelector: PortAttributesSelector, provider: PortAttributesProvider): Disposable;
114
+ }
115
+ }