@theia/plugin 1.32.0-next.8 → 1.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -2
- package/package.json +3 -3
- package/src/theia-extra.d.ts +261 -0
- package/src/theia.d.ts +200 -161
package/README.md
CHANGED
|
@@ -490,19 +490,22 @@ In case if a few providers are registered the chain will be executed until one o
|
|
|
490
490
|
To contribute a hover it is only needed to provide a function that can be called with a `TextDocument` and a `Position` returning hover info. Registration is done using a document selector which either a language id ('typescript', 'javascript' etc.) or a more complex filter like `{scheme: 'file', language: 'typescript'}`.
|
|
491
491
|
|
|
492
492
|
For example,
|
|
493
|
+
|
|
493
494
|
```typescript
|
|
494
495
|
theia.languages.registerHoverProvider('typescript', {
|
|
495
|
-
provideHover(doc: theia.TextDocument, position: theia.Position) {
|
|
496
|
+
provideHover(doc: theia.TextDocument, position: theia.Position, token: theia.CancellationToken) {
|
|
496
497
|
return new theia.Hover('Hover for all **typescript** files.');
|
|
497
498
|
}
|
|
498
499
|
});
|
|
499
500
|
```
|
|
501
|
+
|
|
500
502
|
will show the hover message for all `typescript` files.
|
|
501
503
|
|
|
502
504
|
The code below puts word under cursor into hover message:
|
|
505
|
+
|
|
503
506
|
```typescript
|
|
504
507
|
theia.languages.registerHoverProvider({scheme: 'file'}, {
|
|
505
|
-
provideHover(doc: theia.TextDocument, position: theia.Position) {
|
|
508
|
+
provideHover(doc: theia.TextDocument, position: theia.Position, token: theia.CancellationToken) {
|
|
506
509
|
const range = doc.getWordRangeAtPosition(position);
|
|
507
510
|
const text = doc.getText(range);
|
|
508
511
|
return new theia.Hover(text);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/plugin",
|
|
3
|
-
"version": "1.32.0
|
|
3
|
+
"version": "1.32.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.
|
|
30
|
+
"@theia/ext-scripts": "1.32.0"
|
|
31
31
|
},
|
|
32
32
|
"nyc": {
|
|
33
33
|
"extends": "../../configs/nyc.json"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "789d0148748b4dc9dea398520b5a3dd2998d71ec"
|
|
36
36
|
}
|
package/src/theia-extra.d.ts
CHANGED
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
18
|
+
|
|
17
19
|
/**
|
|
18
20
|
* This is the place for extra APIs Theia supports compared to VS Code.
|
|
19
21
|
*/
|
|
@@ -33,4 +35,263 @@ export module '@theia/plugin' {
|
|
|
33
35
|
reveal(area?: WebviewPanelTargetArea, viewColumn?: ViewColumn, preserveFocus?: boolean): void;
|
|
34
36
|
}
|
|
35
37
|
|
|
38
|
+
export type PluginType = 'frontend' | 'backend';
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Namespace for dealing with installed plug-ins. Plug-ins are represented
|
|
42
|
+
* by an [plug-in](#Plugin)-interface which enables reflection on them.
|
|
43
|
+
*
|
|
44
|
+
* Plug-in writers can provide APIs to other plug-ins by returning their API public
|
|
45
|
+
* surface from the `start`-call.
|
|
46
|
+
*
|
|
47
|
+
* ```javascript
|
|
48
|
+
* export function start() {
|
|
49
|
+
* let api = {
|
|
50
|
+
* sum(a, b) {
|
|
51
|
+
* return a + b;
|
|
52
|
+
* },
|
|
53
|
+
* mul(a, b) {
|
|
54
|
+
* return a * b;
|
|
55
|
+
* }
|
|
56
|
+
* };
|
|
57
|
+
* // 'export' public api-surface
|
|
58
|
+
* return api;
|
|
59
|
+
* }
|
|
60
|
+
* ```
|
|
61
|
+
* ```javascript
|
|
62
|
+
* let mathExt = plugins.getPlugin('genius.math');
|
|
63
|
+
* let importedApi = mathExt.exports;
|
|
64
|
+
*
|
|
65
|
+
* console.log(importedApi.mul(42, 1));
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
export namespace plugins {
|
|
69
|
+
/**
|
|
70
|
+
* Get an plug-in by its full identifier in the form of: `publisher.name`.
|
|
71
|
+
*
|
|
72
|
+
* @param pluginId An plug-in identifier.
|
|
73
|
+
* @return An plug-in or `undefined`.
|
|
74
|
+
*/
|
|
75
|
+
export function getPlugin(pluginId: string): Plugin<any> | undefined;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Get an plug-in its full identifier in the form of: `publisher.name`.
|
|
79
|
+
*
|
|
80
|
+
* @param pluginId An plug-in identifier.
|
|
81
|
+
* @return An plug-in or `undefined`.
|
|
82
|
+
*/
|
|
83
|
+
export function getPlugin<T>(pluginId: string): Plugin<T> | undefined;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* All plug-ins currently known to the system.
|
|
87
|
+
*/
|
|
88
|
+
export let all: Plugin<any>[];
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* An event which fires when `plugins.all` changes. This can happen when extensions are
|
|
92
|
+
* installed, uninstalled, enabled or disabled.
|
|
93
|
+
*/
|
|
94
|
+
export let onDidChange: Event<void>;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Represents an plugin.
|
|
99
|
+
*
|
|
100
|
+
* To get an instance of an `Plugin` use {@link plugins.getPlugin getPlugin}.
|
|
101
|
+
*/
|
|
102
|
+
export interface Plugin<T> {
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* The canonical plug-in identifier in the form of: `publisher.name`.
|
|
106
|
+
*/
|
|
107
|
+
readonly id: string;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* The absolute file path of the directory containing this plug-in.
|
|
111
|
+
*/
|
|
112
|
+
readonly pluginPath: string;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* The uri of the directory containing this plug-in.
|
|
116
|
+
*/
|
|
117
|
+
readonly pluginUri: Uri;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* `true` if the plug-in has been activated.
|
|
121
|
+
*/
|
|
122
|
+
readonly isActive: boolean;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* The parsed contents of the plug-in's package.json.
|
|
126
|
+
*/
|
|
127
|
+
readonly packageJSON: any;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
*
|
|
131
|
+
*/
|
|
132
|
+
readonly pluginType: PluginType;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* The public API exported by this plug-in. It is an invalid action
|
|
136
|
+
* to access this field before this plug-in has been activated.
|
|
137
|
+
*/
|
|
138
|
+
readonly exports: T;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Activates this plug-in and returns its public API.
|
|
142
|
+
*
|
|
143
|
+
* @return A promise that will resolve when this plug-in has been activated.
|
|
144
|
+
*/
|
|
145
|
+
activate(): Thenable<T>;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* A plug-in context is a collection of utilities private to a
|
|
150
|
+
* plug-in.
|
|
151
|
+
*
|
|
152
|
+
* An instance of a `PluginContext` is provided as the first
|
|
153
|
+
* parameter to the `start` of a plug-in.
|
|
154
|
+
*/
|
|
155
|
+
export interface PluginContext {
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* An array to which disposables can be added. When this
|
|
159
|
+
* extension is deactivated the disposables will be disposed.
|
|
160
|
+
*/
|
|
161
|
+
subscriptions: { dispose(): any }[];
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* A memento object that stores state in the context
|
|
165
|
+
* of the currently opened {@link workspace.workspaceFolders workspace}.
|
|
166
|
+
*/
|
|
167
|
+
workspaceState: Memento;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* A memento object that stores state independent
|
|
171
|
+
* of the current opened {@link workspace.workspaceFolders workspace}.
|
|
172
|
+
*/
|
|
173
|
+
globalState: Memento & {
|
|
174
|
+
/**
|
|
175
|
+
* Set the keys whose values should be synchronized across devices when synchronizing user-data
|
|
176
|
+
* like configuration, extensions, and mementos.
|
|
177
|
+
*
|
|
178
|
+
* Note that this function defines the whole set of keys whose values are synchronized:
|
|
179
|
+
* - calling it with an empty array stops synchronization for this memento
|
|
180
|
+
* - calling it with a non-empty array replaces all keys whose values are synchronized
|
|
181
|
+
*
|
|
182
|
+
* For any given set of keys this function needs to be called only once but there is no harm in
|
|
183
|
+
* repeatedly calling it.
|
|
184
|
+
*
|
|
185
|
+
* @param keys The set of keys whose values are synced.
|
|
186
|
+
*/
|
|
187
|
+
setKeysForSync(keys: readonly string[]): void;
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* A storage utility for secrets.
|
|
192
|
+
*/
|
|
193
|
+
readonly secrets: SecretStorage;
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* The absolute file path of the directory containing the extension.
|
|
197
|
+
*/
|
|
198
|
+
extensionPath: string;
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* The uri of the directory containing the extension.
|
|
202
|
+
*/
|
|
203
|
+
readonly extensionUri: Uri;
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Gets the extension's environment variable collection for this workspace, enabling changes
|
|
207
|
+
* to be applied to terminal environment variables.
|
|
208
|
+
*/
|
|
209
|
+
readonly environmentVariableCollection: EnvironmentVariableCollection;
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Get the absolute path of a resource contained in the extension.
|
|
213
|
+
*
|
|
214
|
+
* @param relativePath A relative path to a resource contained in the extension.
|
|
215
|
+
* @return The absolute path of the resource.
|
|
216
|
+
*/
|
|
217
|
+
asAbsolutePath(relativePath: string): string;
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* An absolute file path of a workspace specific directory in which the extension
|
|
221
|
+
* can store private state. The directory might not exist on disk and creation is
|
|
222
|
+
* up to the extension. However, the parent directory is guaranteed to be existent.
|
|
223
|
+
*
|
|
224
|
+
* Use [`workspaceState`](#PluginContext.workspaceState) or
|
|
225
|
+
* [`globalState`](#PluginContext.globalState) to store key value data.
|
|
226
|
+
*
|
|
227
|
+
* @deprecated Use {@link PluginContext.storageUri storageUri} instead.
|
|
228
|
+
*/
|
|
229
|
+
storagePath: string | undefined;
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* The uri of a workspace specific directory in which the extension
|
|
233
|
+
* can store private state. The directory might not exist and creation is
|
|
234
|
+
* up to the extension. However, the parent directory is guaranteed to be existent.
|
|
235
|
+
* The value is `undefined` when no workspace nor folder has been opened.
|
|
236
|
+
*
|
|
237
|
+
* Use [`workspaceState`](#PluginContext.workspaceState) or
|
|
238
|
+
* [`globalState`](#PluginContext.globalState) to store key value data.
|
|
239
|
+
*
|
|
240
|
+
* @see [`workspace.fs`](#FileSystem) for how to read and write files and folders from
|
|
241
|
+
* an uri.
|
|
242
|
+
*/
|
|
243
|
+
readonly storageUri: Uri | undefined;
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* An absolute file path in which the extension can store global state.
|
|
247
|
+
* The directory might not exist on disk and creation is
|
|
248
|
+
* up to the extension. However, the parent directory is guaranteed to be existent.
|
|
249
|
+
*
|
|
250
|
+
* Use [`globalState`](#PluginContext.globalState) to store key value data.
|
|
251
|
+
*
|
|
252
|
+
* @deprecated Use {@link PluginContext.globalStorageUri globalStorageUri} instead.
|
|
253
|
+
*/
|
|
254
|
+
readonly globalStoragePath: string;
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* The uri of a directory in which the extension can store global state.
|
|
258
|
+
* The directory might not exist on disk and creation is
|
|
259
|
+
* up to the extension. However, the parent directory is guaranteed to be existent.
|
|
260
|
+
*
|
|
261
|
+
* Use [`globalState`](#PluginContext.globalState) to store key value data.
|
|
262
|
+
*
|
|
263
|
+
* @see [`workspace.fs`](#FileSystem) for how to read and write files and folders from
|
|
264
|
+
* an uri.
|
|
265
|
+
*/
|
|
266
|
+
readonly globalStorageUri: Uri;
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* An absolute file path of a directory in which the extension can create log files.
|
|
270
|
+
* The directory might not exist on disk and creation is up to the extension. However,
|
|
271
|
+
* the parent directory is guaranteed to be existent.
|
|
272
|
+
*/
|
|
273
|
+
readonly logPath: string;
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* The mode the extension is running in. This is specific to the current
|
|
277
|
+
* extension. One extension may be in `ExtensionMode.Development` while
|
|
278
|
+
* other extensions in the host run in `ExtensionMode.Release`.
|
|
279
|
+
*/
|
|
280
|
+
readonly extensionMode: ExtensionMode;
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* The current extension instance.
|
|
284
|
+
*/
|
|
285
|
+
readonly extension: Plugin<any> | undefined;
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* The uri of a directory in which the extension can create log files. The directory might
|
|
289
|
+
* not exist on disk and creation is up to the extension. However, the parent directory is
|
|
290
|
+
* guaranteed to be existent.
|
|
291
|
+
* see - workspace.fs for how to read and write files and folders from an uri.
|
|
292
|
+
*/
|
|
293
|
+
readonly logUri: Uri;
|
|
294
|
+
}
|
|
295
|
+
|
|
36
296
|
}
|
|
297
|
+
|
package/src/theia.d.ts
CHANGED
|
@@ -63,116 +63,6 @@ export module '@theia/plugin' {
|
|
|
63
63
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
export type PluginType = 'frontend' | 'backend';
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Represents an plugin.
|
|
70
|
-
*
|
|
71
|
-
* To get an instance of an `Plugin` use {@link plugins.getPlugin getPlugin}.
|
|
72
|
-
*/
|
|
73
|
-
export interface Plugin<T> {
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* The canonical plug-in identifier in the form of: `publisher.name`.
|
|
77
|
-
*/
|
|
78
|
-
readonly id: string;
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* The absolute file path of the directory containing this plug-in.
|
|
82
|
-
*/
|
|
83
|
-
readonly pluginPath: string;
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* The uri of the directory containing this plug-in.
|
|
87
|
-
*/
|
|
88
|
-
readonly pluginUri: Uri;
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* `true` if the plug-in has been activated.
|
|
92
|
-
*/
|
|
93
|
-
readonly isActive: boolean;
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* The parsed contents of the plug-in's package.json.
|
|
97
|
-
*/
|
|
98
|
-
readonly packageJSON: any;
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
*
|
|
102
|
-
*/
|
|
103
|
-
readonly pluginType: PluginType;
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* The public API exported by this plug-in. It is an invalid action
|
|
107
|
-
* to access this field before this plug-in has been activated.
|
|
108
|
-
*/
|
|
109
|
-
readonly exports: T;
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Activates this plug-in and returns its public API.
|
|
113
|
-
*
|
|
114
|
-
* @return A promise that will resolve when this plug-in has been activated.
|
|
115
|
-
*/
|
|
116
|
-
activate(): Thenable<T>;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Namespace for dealing with installed plug-ins. Plug-ins are represented
|
|
121
|
-
* by an [plug-in](#Plugin)-interface which enables reflection on them.
|
|
122
|
-
*
|
|
123
|
-
* Plug-in writers can provide APIs to other plug-ins by returning their API public
|
|
124
|
-
* surface from the `start`-call.
|
|
125
|
-
*
|
|
126
|
-
* ```javascript
|
|
127
|
-
* export function start() {
|
|
128
|
-
* let api = {
|
|
129
|
-
* sum(a, b) {
|
|
130
|
-
* return a + b;
|
|
131
|
-
* },
|
|
132
|
-
* mul(a, b) {
|
|
133
|
-
* return a * b;
|
|
134
|
-
* }
|
|
135
|
-
* };
|
|
136
|
-
* // 'export' public api-surface
|
|
137
|
-
* return api;
|
|
138
|
-
* }
|
|
139
|
-
* ```
|
|
140
|
-
* ```javascript
|
|
141
|
-
* let mathExt = plugins.getPlugin('genius.math');
|
|
142
|
-
* let importedApi = mathExt.exports;
|
|
143
|
-
*
|
|
144
|
-
* console.log(importedApi.mul(42, 1));
|
|
145
|
-
* ```
|
|
146
|
-
*/
|
|
147
|
-
export namespace plugins {
|
|
148
|
-
/**
|
|
149
|
-
* Get an plug-in by its full identifier in the form of: `publisher.name`.
|
|
150
|
-
*
|
|
151
|
-
* @param pluginId An plug-in identifier.
|
|
152
|
-
* @return An plug-in or `undefined`.
|
|
153
|
-
*/
|
|
154
|
-
export function getPlugin(pluginId: string): Plugin<any> | undefined;
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Get an plug-in its full identifier in the form of: `publisher.name`.
|
|
158
|
-
*
|
|
159
|
-
* @param pluginId An plug-in identifier.
|
|
160
|
-
* @return An plug-in or `undefined`.
|
|
161
|
-
*/
|
|
162
|
-
export function getPlugin<T>(pluginId: string): Plugin<T> | undefined;
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* All plug-ins currently known to the system.
|
|
166
|
-
*/
|
|
167
|
-
export let all: Plugin<any>[];
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* An event which fires when `plugins.all` changes. This can happen when extensions are
|
|
171
|
-
* installed, uninstalled, enabled or disabled.
|
|
172
|
-
*/
|
|
173
|
-
export let onDidChange: Event<void>;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
66
|
/**
|
|
177
67
|
* A command is a unique identifier of a function
|
|
178
68
|
* which can be executed by a user via a keyboard shortcut,
|
|
@@ -2530,7 +2420,7 @@ export module '@theia/plugin' {
|
|
|
2530
2420
|
* Registration can be split in two step: first register command without handler,
|
|
2531
2421
|
* second register handler by command id.
|
|
2532
2422
|
*
|
|
2533
|
-
* Any contributed command are available to any
|
|
2423
|
+
* Any contributed command are available to any extension, command can be invoked
|
|
2534
2424
|
* by {@link commands.executeCommand executeCommand} function.
|
|
2535
2425
|
*
|
|
2536
2426
|
* Simple example that register command:
|
|
@@ -3071,9 +2961,10 @@ export module '@theia/plugin' {
|
|
|
3071
2961
|
shellPath?: string;
|
|
3072
2962
|
|
|
3073
2963
|
/**
|
|
3074
|
-
*
|
|
2964
|
+
* Args for the custom shell executable. A string can be used on Windows only which allows
|
|
2965
|
+
* specifying shell args in [command-line format](https://msdn.microsoft.com/en-au/08dfcab2-eb6e-49a4-80eb-87d4076c98c6).
|
|
3075
2966
|
*/
|
|
3076
|
-
shellArgs?: string[];
|
|
2967
|
+
shellArgs?: string[] | string;
|
|
3077
2968
|
|
|
3078
2969
|
/**
|
|
3079
2970
|
* Current working directory.
|
|
@@ -3514,31 +3405,130 @@ export module '@theia/plugin' {
|
|
|
3514
3405
|
}
|
|
3515
3406
|
|
|
3516
3407
|
/**
|
|
3517
|
-
*
|
|
3518
|
-
*
|
|
3408
|
+
* In a remote window the extension kind describes if an extension
|
|
3409
|
+
* runs where the UI (window) runs or if an extension runs remotely.
|
|
3410
|
+
*/
|
|
3411
|
+
export enum ExtensionKind {
|
|
3412
|
+
|
|
3413
|
+
/**
|
|
3414
|
+
* Extension runs where the UI runs.
|
|
3415
|
+
*/
|
|
3416
|
+
UI = 1,
|
|
3417
|
+
|
|
3418
|
+
/**
|
|
3419
|
+
* Extension runs where the remote extension host runs.
|
|
3420
|
+
*/
|
|
3421
|
+
Workspace = 2
|
|
3422
|
+
}
|
|
3423
|
+
|
|
3424
|
+
/**
|
|
3425
|
+
* Represents an extension.
|
|
3426
|
+
*
|
|
3427
|
+
* To get an instance of an `Extension` use {@link extensions.getExtension getExtension}.
|
|
3428
|
+
*/
|
|
3429
|
+
export interface Extension<T> {
|
|
3430
|
+
|
|
3431
|
+
/**
|
|
3432
|
+
* The canonical extension identifier in the form of: `publisher.name`.
|
|
3433
|
+
*/
|
|
3434
|
+
readonly id: string;
|
|
3435
|
+
|
|
3436
|
+
/**
|
|
3437
|
+
* The uri of the directory containing the extension.
|
|
3438
|
+
*/
|
|
3439
|
+
readonly extensionUri: Uri;
|
|
3440
|
+
|
|
3441
|
+
/**
|
|
3442
|
+
* The absolute file path of the directory containing this extension. Shorthand
|
|
3443
|
+
* notation for {@link Extension.extensionUri Extension.extensionUri.fsPath} (independent of the uri scheme).
|
|
3444
|
+
*/
|
|
3445
|
+
readonly extensionPath: string;
|
|
3446
|
+
|
|
3447
|
+
/**
|
|
3448
|
+
* `true` if the extension has been activated.
|
|
3449
|
+
*/
|
|
3450
|
+
readonly isActive: boolean;
|
|
3451
|
+
|
|
3452
|
+
/**
|
|
3453
|
+
* The parsed contents of the extension's package.json.
|
|
3454
|
+
*/
|
|
3455
|
+
readonly packageJSON: any;
|
|
3456
|
+
|
|
3457
|
+
/**
|
|
3458
|
+
* The extension kind describes if an extension runs where the UI runs
|
|
3459
|
+
* or if an extension runs where the remote extension host runs. The extension kind
|
|
3460
|
+
* is defined in the `package.json`-file of extensions but can also be refined
|
|
3461
|
+
* via the `remote.extensionKind`-setting. When no remote extension host exists,
|
|
3462
|
+
* the value is {@linkcode ExtensionKind.UI}.
|
|
3463
|
+
*/
|
|
3464
|
+
extensionKind: ExtensionKind;
|
|
3465
|
+
|
|
3466
|
+
/**
|
|
3467
|
+
* The public API exported by this extension (return value of `activate`).
|
|
3468
|
+
* It is an invalid action to access this field before this extension has been activated.
|
|
3469
|
+
*/
|
|
3470
|
+
readonly exports: T;
|
|
3471
|
+
|
|
3472
|
+
/**
|
|
3473
|
+
* Activates this extension and returns its public API.
|
|
3474
|
+
*
|
|
3475
|
+
* @return A promise that will resolve when this extension has been activated.
|
|
3476
|
+
*/
|
|
3477
|
+
activate(): Thenable<T>;
|
|
3478
|
+
}
|
|
3479
|
+
|
|
3480
|
+
/**
|
|
3481
|
+
* The ExtensionMode is provided on the `ExtensionContext` and indicates the
|
|
3482
|
+
* mode the specific extension is running in.
|
|
3483
|
+
*/
|
|
3484
|
+
export enum ExtensionMode {
|
|
3485
|
+
/**
|
|
3486
|
+
* The extension is installed normally (for example, from the marketplace
|
|
3487
|
+
* or VSIX) in the editor.
|
|
3488
|
+
*/
|
|
3489
|
+
Production = 1,
|
|
3490
|
+
|
|
3491
|
+
/**
|
|
3492
|
+
* The extension is running from an `--extensionDevelopmentPath` provided
|
|
3493
|
+
* when launching the editor.
|
|
3494
|
+
*/
|
|
3495
|
+
Development = 2,
|
|
3496
|
+
|
|
3497
|
+
/**
|
|
3498
|
+
* The extension is running from an `--extensionTestsPath` and
|
|
3499
|
+
* the extension host is running unit tests.
|
|
3500
|
+
*/
|
|
3501
|
+
Test = 3,
|
|
3502
|
+
}
|
|
3503
|
+
|
|
3504
|
+
/**
|
|
3505
|
+
* An extension context is a collection of utilities private to an
|
|
3506
|
+
* extension.
|
|
3519
3507
|
*
|
|
3520
|
-
* An instance of
|
|
3521
|
-
* parameter to the `
|
|
3508
|
+
* An instance of an `ExtensionContext` is provided as the first
|
|
3509
|
+
* parameter to the `activate`-call of an extension.
|
|
3522
3510
|
*/
|
|
3523
|
-
export interface
|
|
3511
|
+
export interface ExtensionContext {
|
|
3524
3512
|
|
|
3525
3513
|
/**
|
|
3526
3514
|
* An array to which disposables can be added. When this
|
|
3527
3515
|
* extension is deactivated the disposables will be disposed.
|
|
3516
|
+
*
|
|
3517
|
+
* *Note* that asynchronous dispose-functions aren't awaited.
|
|
3528
3518
|
*/
|
|
3529
|
-
subscriptions: { dispose(): any }[];
|
|
3519
|
+
readonly subscriptions: { dispose(): any }[];
|
|
3530
3520
|
|
|
3531
3521
|
/**
|
|
3532
3522
|
* A memento object that stores state in the context
|
|
3533
3523
|
* of the currently opened {@link workspace.workspaceFolders workspace}.
|
|
3534
3524
|
*/
|
|
3535
|
-
workspaceState: Memento;
|
|
3525
|
+
readonly workspaceState: Memento;
|
|
3536
3526
|
|
|
3537
3527
|
/**
|
|
3538
3528
|
* A memento object that stores state independent
|
|
3539
3529
|
* of the current opened {@link workspace.workspaceFolders workspace}.
|
|
3540
3530
|
*/
|
|
3541
|
-
globalState: Memento & {
|
|
3531
|
+
readonly globalState: Memento & {
|
|
3542
3532
|
/**
|
|
3543
3533
|
* Set the keys whose values should be synchronized across devices when synchronizing user-data
|
|
3544
3534
|
* like configuration, extensions, and mementos.
|
|
@@ -3556,19 +3546,21 @@ export module '@theia/plugin' {
|
|
|
3556
3546
|
};
|
|
3557
3547
|
|
|
3558
3548
|
/**
|
|
3559
|
-
* A storage utility for secrets.
|
|
3549
|
+
* A storage utility for secrets. Secrets are persisted across reloads and are independent of the
|
|
3550
|
+
* current opened {@link workspace.workspaceFolders workspace}.
|
|
3560
3551
|
*/
|
|
3561
3552
|
readonly secrets: SecretStorage;
|
|
3562
3553
|
|
|
3563
3554
|
/**
|
|
3564
|
-
* The
|
|
3555
|
+
* The uri of the directory containing the extension.
|
|
3565
3556
|
*/
|
|
3566
|
-
|
|
3557
|
+
readonly extensionUri: Uri;
|
|
3567
3558
|
|
|
3568
3559
|
/**
|
|
3569
|
-
* The
|
|
3560
|
+
* The absolute file path of the directory containing the extension. Shorthand
|
|
3561
|
+
* notation for {@link TextDocument.uri ExtensionContext.extensionUri.fsPath} (independent of the uri scheme).
|
|
3570
3562
|
*/
|
|
3571
|
-
readonly
|
|
3563
|
+
readonly extensionPath: string;
|
|
3572
3564
|
|
|
3573
3565
|
/**
|
|
3574
3566
|
* Gets the extension's environment variable collection for this workspace, enabling changes
|
|
@@ -3579,64 +3571,79 @@ export module '@theia/plugin' {
|
|
|
3579
3571
|
/**
|
|
3580
3572
|
* Get the absolute path of a resource contained in the extension.
|
|
3581
3573
|
*
|
|
3574
|
+
* *Note* that an absolute uri can be constructed via {@linkcode Uri.joinPath} and
|
|
3575
|
+
* {@linkcode ExtensionContext.extensionUri extensionUri}, e.g. `vscode.Uri.joinPath(context.extensionUri, relativePath);`
|
|
3576
|
+
*
|
|
3582
3577
|
* @param relativePath A relative path to a resource contained in the extension.
|
|
3583
3578
|
* @return The absolute path of the resource.
|
|
3584
3579
|
*/
|
|
3585
3580
|
asAbsolutePath(relativePath: string): string;
|
|
3586
3581
|
|
|
3582
|
+
/**
|
|
3583
|
+
* The uri of a workspace specific directory in which the extension
|
|
3584
|
+
* can store private state. The directory might not exist and creation is
|
|
3585
|
+
* up to the extension. However, the parent directory is guaranteed to be existent.
|
|
3586
|
+
* The value is `undefined` when no workspace nor folder has been opened.
|
|
3587
|
+
*
|
|
3588
|
+
* Use {@linkcode ExtensionContext.workspaceState workspaceState} or
|
|
3589
|
+
* {@linkcode ExtensionContext.globalState globalState} to store key value data.
|
|
3590
|
+
*
|
|
3591
|
+
* @see {@linkcode FileSystem workspace.fs} for how to read and write files and folders from
|
|
3592
|
+
* an uri.
|
|
3593
|
+
*/
|
|
3594
|
+
readonly storageUri: Uri | undefined;
|
|
3595
|
+
|
|
3587
3596
|
/**
|
|
3588
3597
|
* An absolute file path of a workspace specific directory in which the extension
|
|
3589
3598
|
* can store private state. The directory might not exist on disk and creation is
|
|
3590
3599
|
* up to the extension. However, the parent directory is guaranteed to be existent.
|
|
3591
3600
|
*
|
|
3592
|
-
* Use
|
|
3593
|
-
*
|
|
3601
|
+
* Use {@linkcode ExtensionContext.workspaceState workspaceState} or
|
|
3602
|
+
* {@linkcode ExtensionContext.globalState globalState} to store key value data.
|
|
3594
3603
|
*
|
|
3595
|
-
* @deprecated Use {@link
|
|
3604
|
+
* @deprecated Use {@link ExtensionContext.storageUri storageUri} instead.
|
|
3596
3605
|
*/
|
|
3597
|
-
storagePath: string | undefined;
|
|
3606
|
+
readonly storagePath: string | undefined;
|
|
3598
3607
|
|
|
3599
3608
|
/**
|
|
3600
|
-
* The uri of a
|
|
3601
|
-
*
|
|
3609
|
+
* The uri of a directory in which the extension can store global state.
|
|
3610
|
+
* The directory might not exist on disk and creation is
|
|
3602
3611
|
* up to the extension. However, the parent directory is guaranteed to be existent.
|
|
3603
|
-
* The value is `undefined` when no workspace nor folder has been opened.
|
|
3604
3612
|
*
|
|
3605
|
-
* Use
|
|
3606
|
-
* [`globalState`](#PluginContext.globalState) to store key value data.
|
|
3613
|
+
* Use {@linkcode ExtensionContext.globalState globalState} to store key value data.
|
|
3607
3614
|
*
|
|
3608
|
-
* @see
|
|
3615
|
+
* @see {@linkcode FileSystem workspace.fs} for how to read and write files and folders from
|
|
3609
3616
|
* an uri.
|
|
3610
3617
|
*/
|
|
3611
|
-
readonly
|
|
3618
|
+
readonly globalStorageUri: Uri;
|
|
3612
3619
|
|
|
3613
3620
|
/**
|
|
3614
3621
|
* An absolute file path in which the extension can store global state.
|
|
3615
3622
|
* The directory might not exist on disk and creation is
|
|
3616
3623
|
* up to the extension. However, the parent directory is guaranteed to be existent.
|
|
3617
3624
|
*
|
|
3618
|
-
* Use
|
|
3625
|
+
* Use {@linkcode ExtensionContext.globalState globalState} to store key value data.
|
|
3619
3626
|
*
|
|
3620
|
-
* @deprecated Use {@link
|
|
3627
|
+
* @deprecated Use {@link ExtensionContext.globalStorageUri globalStorageUri} instead.
|
|
3621
3628
|
*/
|
|
3622
3629
|
readonly globalStoragePath: string;
|
|
3623
3630
|
|
|
3624
3631
|
/**
|
|
3625
|
-
* The uri of a directory in which the extension can
|
|
3626
|
-
* The directory might not exist on disk and creation is
|
|
3627
|
-
*
|
|
3628
|
-
*
|
|
3629
|
-
* Use [`globalState`](#PluginContext.globalState) to store key value data.
|
|
3632
|
+
* The uri of a directory in which the extension can create log files.
|
|
3633
|
+
* The directory might not exist on disk and creation is up to the extension. However,
|
|
3634
|
+
* the parent directory is guaranteed to be existent.
|
|
3630
3635
|
*
|
|
3631
|
-
* @see
|
|
3636
|
+
* @see {@linkcode FileSystem workspace.fs} for how to read and write files and folders from
|
|
3632
3637
|
* an uri.
|
|
3633
3638
|
*/
|
|
3634
|
-
readonly
|
|
3639
|
+
readonly logUri: Uri;
|
|
3635
3640
|
|
|
3636
3641
|
/**
|
|
3637
3642
|
* An absolute file path of a directory in which the extension can create log files.
|
|
3638
3643
|
* The directory might not exist on disk and creation is up to the extension. However,
|
|
3639
3644
|
* the parent directory is guaranteed to be existent.
|
|
3645
|
+
*
|
|
3646
|
+
* @deprecated Use {@link ExtensionContext.logUri logUri} instead.
|
|
3640
3647
|
*/
|
|
3641
3648
|
readonly logPath: string;
|
|
3642
3649
|
|
|
@@ -3648,17 +3655,9 @@ export module '@theia/plugin' {
|
|
|
3648
3655
|
readonly extensionMode: ExtensionMode;
|
|
3649
3656
|
|
|
3650
3657
|
/**
|
|
3651
|
-
* The current
|
|
3658
|
+
* The current `Extension` instance.
|
|
3652
3659
|
*/
|
|
3653
|
-
readonly extension:
|
|
3654
|
-
|
|
3655
|
-
/**
|
|
3656
|
-
* The uri of a directory in which the extension can create log files. The directory might
|
|
3657
|
-
* not exist on disk and creation is up to the extension. However, the parent directory is
|
|
3658
|
-
* guaranteed to be existent.
|
|
3659
|
-
* see - workspace.fs for how to read and write files and folders from an uri.
|
|
3660
|
-
*/
|
|
3661
|
-
readonly logUri: Uri;
|
|
3660
|
+
readonly extension: Extension<any>;
|
|
3662
3661
|
}
|
|
3663
3662
|
|
|
3664
3663
|
/**
|
|
@@ -4874,7 +4873,7 @@ export module '@theia/plugin' {
|
|
|
4874
4873
|
/**
|
|
4875
4874
|
* Registers a webview panel serializer.
|
|
4876
4875
|
*
|
|
4877
|
-
*
|
|
4876
|
+
* Extensions that support reviving should have an `"onWebviewPanel:viewType"` activation event and
|
|
4878
4877
|
* make sure that {@link registerWebviewPanelSerializer registerWebviewPanelSerializer} is called during activation.
|
|
4879
4878
|
*
|
|
4880
4879
|
* Only a single serializer may be registered at a time for a given `viewType`.
|
|
@@ -5026,7 +5025,7 @@ export module '@theia/plugin' {
|
|
|
5026
5025
|
* @param shellPath - path to the executable shell. For example "/bin/bash", "bash", "sh".
|
|
5027
5026
|
* @param shellArgs - arguments to configure executable shell. For example ["-l"] - run shell without login.
|
|
5028
5027
|
*/
|
|
5029
|
-
export function createTerminal(name?: string, shellPath?: string, shellArgs?: string[]): Terminal;
|
|
5028
|
+
export function createTerminal(name?: string, shellPath?: string, shellArgs?: string[] | string): Terminal;
|
|
5030
5029
|
|
|
5031
5030
|
/**
|
|
5032
5031
|
* Event which fires when terminal did closed. Event value contains closed terminal definition.
|
|
@@ -5108,6 +5107,18 @@ export module '@theia/plugin' {
|
|
|
5108
5107
|
*/
|
|
5109
5108
|
export function registerUriHandler(handler: UriHandler): Disposable;
|
|
5110
5109
|
|
|
5110
|
+
/**
|
|
5111
|
+
* Show progress in the Source Control viewlet while running the given callback and while
|
|
5112
|
+
* its returned promise isn't resolve or rejected.
|
|
5113
|
+
*
|
|
5114
|
+
* @deprecated Use `withProgress` instead.
|
|
5115
|
+
*
|
|
5116
|
+
* @param task A callback returning a promise. Progress increments can be reported with
|
|
5117
|
+
* the provided {@link Progress}-object.
|
|
5118
|
+
* @return The thenable the task did return.
|
|
5119
|
+
*/
|
|
5120
|
+
export function withScmProgress<R>(task: (progress: Progress<number>) => Thenable<R>): Thenable<R>;
|
|
5121
|
+
|
|
5111
5122
|
/**
|
|
5112
5123
|
* Show progress in the editor. Progress is shown while running the given callback
|
|
5113
5124
|
* and while the promise it returned isn't resolved nor rejected. The location at which
|
|
@@ -8238,7 +8249,7 @@ export module '@theia/plugin' {
|
|
|
8238
8249
|
}
|
|
8239
8250
|
|
|
8240
8251
|
/**
|
|
8241
|
-
* The completion item provider interface defines the contract between
|
|
8252
|
+
* The completion item provider interface defines the contract between extensions and IntelliSense
|
|
8242
8253
|
*
|
|
8243
8254
|
* Providers can delay the computation of the [`detail`](#CompletionItem.detail)
|
|
8244
8255
|
* and [`documentation`](#CompletionItem.documentation) properties by implementing the
|
|
@@ -9512,6 +9523,27 @@ export module '@theia/plugin' {
|
|
|
9512
9523
|
provideDocumentRangeSemanticTokens(document: TextDocument, range: Range, token: CancellationToken): ProviderResult<SemanticTokens>;
|
|
9513
9524
|
}
|
|
9514
9525
|
|
|
9526
|
+
export namespace extensions {
|
|
9527
|
+
/**
|
|
9528
|
+
* Get an extension by its full identifier in the form of: `publisher.name`.
|
|
9529
|
+
*
|
|
9530
|
+
* @param extensionId An extension identifier.
|
|
9531
|
+
* @return An extension or `undefined`.
|
|
9532
|
+
*/
|
|
9533
|
+
export function getExtension<T = any>(extensionId: string): Extension<T> | undefined;
|
|
9534
|
+
|
|
9535
|
+
/**
|
|
9536
|
+
* All extensions currently known to the system.
|
|
9537
|
+
*/
|
|
9538
|
+
export const all: readonly Extension<any>[];
|
|
9539
|
+
|
|
9540
|
+
/**
|
|
9541
|
+
* An event which fires when `extensions.all` changes. This can happen when extensions are
|
|
9542
|
+
* installed, uninstalled, enabled or disabled.
|
|
9543
|
+
*/
|
|
9544
|
+
export const onDidChange: Event<void>;
|
|
9545
|
+
}
|
|
9546
|
+
|
|
9515
9547
|
export namespace languages {
|
|
9516
9548
|
/**
|
|
9517
9549
|
* Return the identifiers of all known languages.
|
|
@@ -10067,7 +10099,7 @@ export module '@theia/plugin' {
|
|
|
10067
10099
|
* @return A hover or a thenable that resolves to such. The lack of a result can be
|
|
10068
10100
|
* signaled by returning `undefined` or `null`.
|
|
10069
10101
|
*/
|
|
10070
|
-
provideHover(document: TextDocument, position: Position, token: CancellationToken
|
|
10102
|
+
provideHover(document: TextDocument, position: Position, token: CancellationToken): ProviderResult<Hover>;
|
|
10071
10103
|
}
|
|
10072
10104
|
|
|
10073
10105
|
/**
|
|
@@ -10688,6 +10720,13 @@ export module '@theia/plugin' {
|
|
|
10688
10720
|
*/
|
|
10689
10721
|
parentSession?: DebugSession;
|
|
10690
10722
|
|
|
10723
|
+
/**
|
|
10724
|
+
* Controls whether lifecycle requests like 'restart' are sent to the newly created session or its parent session.
|
|
10725
|
+
* By default (if the property is false or missing), lifecycle requests are sent to the new session.
|
|
10726
|
+
* This property is ignored if the session has no parent session.
|
|
10727
|
+
*/
|
|
10728
|
+
lifecycleManagedByParent?: boolean;
|
|
10729
|
+
|
|
10691
10730
|
/**
|
|
10692
10731
|
* Controls whether this session should have a separate debug console or share it
|
|
10693
10732
|
* with the parent session. Has no effect for sessions which do not have a parent session.
|
|
@@ -11763,7 +11802,7 @@ export module '@theia/plugin' {
|
|
|
11763
11802
|
/**
|
|
11764
11803
|
* Fetches all tasks available in the systems. This includes tasks
|
|
11765
11804
|
* from `tasks.json` files as well as tasks from task providers
|
|
11766
|
-
* contributed through extensions
|
|
11805
|
+
* contributed through extensions.
|
|
11767
11806
|
*
|
|
11768
11807
|
* @param filter a filter to filter the return tasks.
|
|
11769
11808
|
*/
|