@theia/plugin 1.66.0-next.41 → 1.66.0-next.67

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.66.0-next.41+d4393e3c9",
3
+ "version": "1.66.0-next.67+6fae23c43",
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": "d4393e3c90401f6c5929236afb26991cddfeb24b"
35
+ "gitHead": "6fae23c43f4e850ef4dd6f7c85aa0422077f70e2"
36
36
  }
package/src/theia.d.ts CHANGED
@@ -4538,6 +4538,11 @@ export module '@theia/plugin' {
4538
4538
  * sensitive.
4539
4539
  */
4540
4540
  export interface SecretStorage {
4541
+ /**
4542
+ * Retrieve the keys of all the secrets stored by this extension.
4543
+ */
4544
+ keys(): Thenable<string[]>;
4545
+
4541
4546
  /**
4542
4547
  * Retrieve a secret that was stored with key. Returns undefined if there
4543
4548
  * is no password matching that key.
@@ -4562,7 +4567,7 @@ export module '@theia/plugin' {
4562
4567
  /**
4563
4568
  * Fires when a secret is stored or deleted.
4564
4569
  */
4565
- onDidChange: Event<SecretStorageChangeEvent>;
4570
+ readonly onDidChange: Event<SecretStorageChangeEvent>;
4566
4571
  }
4567
4572
 
4568
4573
  /**
@@ -6306,7 +6311,7 @@ export module '@theia/plugin' {
6306
6311
  * (Examples include: an explicit call to [QuickInput.hide](#QuickInput.hide),
6307
6312
  * the user pressing Esc, some other input UI opening, etc.)
6308
6313
  */
6309
- onDidHide: Event<void>;
6314
+ readonly onDidHide: Event<void>;
6310
6315
 
6311
6316
  /**
6312
6317
  * Dispose of this input UI and any associated resources. If it is still
@@ -15135,6 +15140,30 @@ export module '@theia/plugin' {
15135
15140
  account?: AuthenticationSessionAccountInformation;
15136
15141
  }
15137
15142
 
15143
+ /**
15144
+ * Represents parameters for creating a session based on a WWW-Authenticate header value.
15145
+ * This is used when an API returns a 401 with a WWW-Authenticate header indicating
15146
+ * that additional authentication is required. The details of which will be passed down
15147
+ * to the authentication provider to create a session.
15148
+ *
15149
+ * @note The authorization provider must support handling challenges and specifically
15150
+ * the challenges in this WWW-Authenticate value.
15151
+ * @note For more information on WWW-Authenticate please see https://developer.mozilla.org/docs/Web/HTTP/Reference/Headers/WWW-Authenticate
15152
+ */
15153
+ export interface AuthenticationWwwAuthenticateRequest {
15154
+ /**
15155
+ * The raw WWW-Authenticate header value that triggered this challenge.
15156
+ * This will be parsed by the authentication provider to extract the necessary
15157
+ * challenge information.
15158
+ */
15159
+ readonly wwwAuthenticate: string;
15160
+
15161
+ /**
15162
+ * The fallback scopes to use if no scopes are found in the WWW-Authenticate header.
15163
+ */
15164
+ readonly fallbackScopes?: readonly string[];
15165
+ }
15166
+
15138
15167
  /**
15139
15168
  * Basic information about an {@link AuthenticationProvider authenticationProvider}
15140
15169
  */
@@ -15256,47 +15285,47 @@ export module '@theia/plugin' {
15256
15285
  */
15257
15286
  export namespace authentication {
15258
15287
  /**
15259
- * Get an authentication session matching the desired scopes. Rejects if a provider with providerId is not
15260
- * registered, or if the user does not consent to sharing authentication information with
15261
- * the extension. If there are multiple sessions with the same scopes, the user will be shown a
15262
- * quickpick to select which account they would like to use.
15288
+ * Get an authentication session matching the desired scopes or satisfying the WWW-Authenticate request. Rejects if
15289
+ * a provider with providerId is not registered, or if the user does not consent to sharing authentication information
15290
+ * with the extension. If there are multiple sessions with the same scopes, the user will be shown a quickpick to
15291
+ * select which account they would like to use.
15263
15292
  *
15264
15293
  * Currently, there are only two authentication providers that are contributed from built in extensions
15265
15294
  * to VS Code that implement GitHub and Microsoft authentication: their providerId's are 'github' and 'microsoft'.
15295
+ *
15266
15296
  * @param providerId The id of the provider to use
15267
- * @param scopes A list of scopes representing the permissions requested. These are dependent on the authentication provider
15268
- * @param options The {@link GetSessionOptions getSessionOptions} to use
15297
+ * @param scopeListOrRequest A scope list of permissions requested or a WWW-Authenticate request. These are dependent on the authentication provider.
15298
+ * @param options The {@link AuthenticationGetSessionOptions} to use
15269
15299
  * @returns A thenable that resolves to an authentication session
15270
15300
  */
15271
- export function getSession(providerId: string, scopes: readonly string[], options: AuthenticationGetSessionOptions & { createIfNone: true | AuthenticationGetSessionPresentationOptions }): Thenable<AuthenticationSession>;
15301
+ export function getSession(providerId: string, scopeListOrRequest: ReadonlyArray<string> | AuthenticationWwwAuthenticateRequest, options: AuthenticationGetSessionOptions & { /** */createIfNone: true | AuthenticationGetSessionPresentationOptions }): Thenable<AuthenticationSession>;
15272
15302
 
15273
15303
  /**
15274
- * Get an authentication session matching the desired scopes. Rejects if a provider with providerId is not
15275
- * registered, or if the user does not consent to sharing authentication information with
15276
- * the extension. If there are multiple sessions with the same scopes, the user will be shown a
15277
- * quickpick to select which account they would like to use.
15304
+ * Get an authentication session matching the desired scopes or request. Rejects if a provider with providerId is not
15305
+ * registered, or if the user does not consent to sharing authentication information with the extension. If there
15306
+ * are multiple sessions with the same scopes, the user will be shown a quickpick to select which account they would like to use.
15278
15307
  *
15279
15308
  * Currently, there are only two authentication providers that are contributed from built in extensions
15280
15309
  * to the editor that implement GitHub and Microsoft authentication: their providerId's are 'github' and 'microsoft'.
15310
+ *
15281
15311
  * @param providerId The id of the provider to use
15282
- * @param scopes A list of scopes representing the permissions requested. These are dependent on the authentication provider
15312
+ * @param scopeListOrRequest A scope list of permissions requested or a WWW-Authenticate request. These are dependent on the authentication provider.
15283
15313
  * @param options The {@link AuthenticationGetSessionOptions} to use
15284
15314
  * @returns A thenable that resolves to an authentication session
15285
15315
  */
15286
- export function getSession(providerId: string, scopes: readonly string[], options: AuthenticationGetSessionOptions & { forceNewSession: true | AuthenticationGetSessionPresentationOptions | AuthenticationForceNewSessionOptions }): Thenable<AuthenticationSession>;
15316
+ export function getSession(providerId: string, scopeListOrRequest: ReadonlyArray<string> | AuthenticationWwwAuthenticateRequest, options: AuthenticationGetSessionOptions & { /** literal-type defines return type */forceNewSession: true | AuthenticationGetSessionPresentationOptions | AuthenticationForceNewSessionOptions }): Thenable<AuthenticationSession>;
15287
15317
 
15288
15318
  /**
15289
- * Get an authentication session matching the desired scopes. Rejects if a provider with providerId is not
15290
- * registered, or if the user does not consent to sharing authentication information with
15291
- * the extension. If there are multiple sessions with the same scopes, the user will be shown a
15292
- * quickpick to select which account they would like to use.
15319
+ * Get an authentication session matching the desired scopes or request. Rejects if a provider with providerId is not
15320
+ * registered, or if the user does not consent to sharing authentication information with the extension. If there
15321
+ * are multiple sessions with the same scopes, the user will be shown a quickpick to select which account they would like to use.
15293
15322
  *
15294
15323
  * @param providerId The id of the provider to use
15295
- * @param scopes A list of scopes representing the permissions requested. These are dependent on the authentication provider
15296
- * @param options The {@link GetSessionOptions getSessionOptions} to use
15297
- * @returns A thenable that resolves to an authentication session if available, or undefined if there are no sessions
15324
+ * @param scopeListOrRequest A scope list of permissions requested or a WWW-Authenticate request. These are dependent on the authentication provider.
15325
+ * @param options The {@link AuthenticationGetSessionOptions} to use
15326
+ * @returns A thenable that resolves to an authentication session or undefined if a silent flow was used and no session was found
15298
15327
  */
15299
- export function getSession(providerId: string, scopes: readonly string[], options?: AuthenticationGetSessionOptions): Thenable<AuthenticationSession | undefined>;
15328
+ export function getSession(providerId: string, scopeListOrRequest: ReadonlyArray<string> | AuthenticationWwwAuthenticateRequest, options?: AuthenticationGetSessionOptions): Thenable<AuthenticationSession | undefined>;
15300
15329
 
15301
15330
  /**
15302
15331
  * Get all accounts that the user is logged in to for the specified provider.
@@ -17158,7 +17187,7 @@ export module '@theia/plugin' {
17158
17187
  * Fired when a user has changed whether this is a default profile. The
17159
17188
  * event contains the new value of {@link isDefault}
17160
17189
  */
17161
- onDidChangeDefault: Event<boolean>;
17190
+ readonly onDidChangeDefault: Event<boolean>;
17162
17191
 
17163
17192
  /**
17164
17193
  * Whether this profile supports continuous running of requests. If so,
@@ -17540,7 +17569,7 @@ export module '@theia/plugin' {
17540
17569
  * An event fired when the editor is no longer interested in data
17541
17570
  * associated with the test run.
17542
17571
  */
17543
- onDidDispose: Event<void>;
17572
+ readonly onDidDispose: Event<void>;
17544
17573
  }
17545
17574
 
17546
17575
  /**
@@ -18216,7 +18245,7 @@ export module '@theia/plugin' {
18216
18245
  * previously returned from this chat participant.
18217
18246
  * @stubbed
18218
18247
  */
18219
- onDidReceiveFeedback: Event<ChatResultFeedback>;
18248
+ readonly onDidReceiveFeedback: Event<ChatResultFeedback>;
18220
18249
 
18221
18250
  /**
18222
18251
  * Dispose this participant and free resources.
@@ -19135,22 +19164,25 @@ export module '@theia/plugin' {
19135
19164
  * Various features that the model supports such as tool calling or image input.
19136
19165
  * @stubbed
19137
19166
  */
19138
- readonly capabilities: {
19167
+ readonly capabilities: LanguageModelChatCapabilities;
19168
+ }
19139
19169
 
19140
- /**
19141
- * Whether image input is supported by the model.
19142
- * Common supported images are jpg and png, but each model will vary in supported mimetypes.
19143
- * @stubbed
19144
- */
19145
- readonly imageInput?: boolean;
19170
+ /**
19171
+ * Various features that the {@link LanguageModelChatInformation} supports such as tool calling or image input.
19172
+ * @stubbed
19173
+ */
19174
+ export interface LanguageModelChatCapabilities {
19175
+ /**
19176
+ * Whether image input is supported by the model.
19177
+ * Common supported images are jpg and png, but each model will vary in supported mimetypes.
19178
+ */
19179
+ readonly imageInput?: boolean;
19146
19180
 
19147
- /**
19148
- * Whether tool calling is supported by the model.
19149
- * If a number is provided, that is the maximum number of tools that can be provided in a request to the model.
19150
- * @stubbed
19151
- */
19152
- readonly toolCalling?: boolean | number;
19153
- };
19181
+ /**
19182
+ * Whether tool calling is supported by the model.
19183
+ * If a number is provided, that is the maximum number of tools that can be provided in a request to the model.
19184
+ */
19185
+ readonly toolCalling?: boolean | number;
19154
19186
  }
19155
19187
 
19156
19188
  /**
@@ -19370,7 +19402,7 @@ export module '@theia/plugin' {
19370
19402
  * An event that fires when access information changes.
19371
19403
  * @stubbed
19372
19404
  */
19373
- onDidChange: Event<void>;
19405
+ readonly onDidChange: Event<void>;
19374
19406
 
19375
19407
  /**
19376
19408
  * Checks if a request can be made to a language model.
@@ -21,7 +21,7 @@
21
21
 
22
22
  /* eslint-disable @typescript-eslint/no-explicit-any */
23
23
 
24
- declare module '@theia/plugin' {
24
+ export module '@theia/plugin' {
25
25
  export namespace debug {
26
26
  /**
27
27
  * Registers a custom data visualization for variables when debugging.
@@ -20,7 +20,7 @@
20
20
  *--------------------------------------------------------------------------------------------*/
21
21
  // code copied and modified from https://github.com/microsoft/vscode/blob/1.85.1/src/vscode-dts/vscode.proposed.multiDocumentHighlightProvider.d.ts
22
22
 
23
- declare module '@theia/plugin' {
23
+ export module '@theia/plugin' {
24
24
 
25
25
  /**
26
26
  * Represents a collection of document highlights from multiple documents.
@@ -19,7 +19,7 @@
19
19
  * Licensed under the MIT License. See License.txt in the project root for license information.
20
20
  *--------------------------------------------------------------------------------------------*/
21
21
 
22
- declare module '@theia/plugin' {
22
+ export module '@theia/plugin' {
23
23
 
24
24
  // https://github.com/microsoft/vscode/issues/124970
25
25
 
@@ -19,7 +19,7 @@
19
19
  * Licensed under the MIT License. See License.txt in the project root for license information.
20
20
  *--------------------------------------------------------------------------------------------*/
21
21
 
22
- declare module '@theia/plugin' {
22
+ export module '@theia/plugin' {
23
23
  export interface NotebookControllerDetectionTask {
24
24
  /**
25
25
  * Dispose and remove the detection task.
@@ -19,7 +19,7 @@
19
19
  * Licensed under the MIT License. See License.txt in the project root for license information.
20
20
  *--------------------------------------------------------------------------------------------*/
21
21
 
22
- declare module '@theia/plugin' {
22
+ export module '@theia/plugin' {
23
23
 
24
24
  // https://github.com/microsoft/vscode/issues/123601
25
25
 
@@ -19,7 +19,7 @@
19
19
  * Licensed under the MIT License. See License.txt in the project root for license information.
20
20
  *--------------------------------------------------------------------------------------------*/
21
21
 
22
- declare module '@theia/plugin' {
22
+ export module '@theia/plugin' {
23
23
 
24
24
  /**
25
25
  * The action that should be taken when a port is discovered through automatic port forwarding discovery.
@@ -20,7 +20,7 @@
20
20
  *--------------------------------------------------------------------------------------------*/
21
21
  // code copied and modified from https://github.com/microsoft/vscode/blob/1.103.2/src/vscode-dts/vscode.proposed.scmProviderOptions.d.ts
22
22
 
23
- declare module '@theia/plugin' {
23
+ export module '@theia/plugin' {
24
24
  // https://github.com/microsoft/vscode/issues/254910
25
25
 
26
26
  export interface SourceControl {
@@ -21,7 +21,7 @@
21
21
 
22
22
  // Copied from https://github.com/microsoft/vscode/blob/85f2ce803d86e9fddeba10874fc2758a75b8e806/src/vscode-dts/vscode.proposed.statusBarItemTooltip.d.ts
23
23
 
24
- declare module '@theia/plugin' {
24
+ export module '@theia/plugin' {
25
25
 
26
26
  // https://github.com/microsoft/vscode/issues/234339
27
27
 
@@ -18,16 +18,28 @@
18
18
  * Copyright (c) Microsoft Corporation. All rights reserved.
19
19
  * Licensed under the MIT License. See License.txt in the project root for license information.
20
20
  *--------------------------------------------------------------------------------------------*/
21
- // code copied and modified from https://github.com/microsoft/vscode/blob/1.96.2/src/vscode-dts/vscode.proposed.terminalCompletionProvider.d.ts
21
+ // code copied and modified from https://github.com/microsoft/vscode/blob/1.105.0/src/vscode-dts/vscode.proposed.terminalCompletionProvider.d.ts
22
22
 
23
- declare module '@theia/plugin' {
23
+ export module '@theia/plugin' {
24
24
 
25
25
  // https://github.com/microsoft/vscode/issues/226562
26
26
 
27
+ /**
28
+ * A provider that supplies terminal completion items.
29
+ *
30
+ * Implementations of this interface should return an array of {@link TerminalCompletionItem} or a
31
+ * {@link TerminalCompletionList} describing completions for the current command line.
32
+ *
33
+ * @example <caption>Simple provider returning a single completion</caption>
34
+ * window.registerTerminalCompletionProvider('extension-provider-id', {
35
+ * provideTerminalCompletions(terminal, context) {
36
+ * return [{ label: '--help', replacementIndex: Math.max(0, context.cursorPosition - 2), replacementLength: 2 }];
37
+ * }
38
+ * });
39
+ */
27
40
  export interface TerminalCompletionProvider<T extends TerminalCompletionItem> {
28
- id: string;
29
41
  /**
30
- * Provide completions for the given position and document.
42
+ * Provide completions for the given terminal and context.
31
43
  * @param terminal The terminal for which completions are being provided.
32
44
  * @param context Information about the terminal's current state.
33
45
  * @param token A cancellation token.
@@ -36,11 +48,26 @@ declare module '@theia/plugin' {
36
48
  provideTerminalCompletions(terminal: Terminal, context: TerminalCompletionContext, token: CancellationToken): ProviderResult<T[] | TerminalCompletionList<T>>;
37
49
  }
38
50
 
51
+ /**
52
+ * Represents a completion suggestion for a terminal command line.
53
+ *
54
+ * @example <caption>Completion item for `ls -|`</caption>
55
+ * const item = {
56
+ * label: '-A',
57
+ * replacementIndex: 3,
58
+ * replacementLength: 1,
59
+ * detail: 'List all entries except for . and .. (always set for the super-user)',
60
+ * kind: TerminalCompletionItemKind.Flag
61
+ * };
62
+ *
63
+ * The fields on a completion item describe what text should be shown to the user
64
+ * and which portion of the command line should be replaced when the item is accepted.
65
+ */
39
66
  export interface TerminalCompletionItem {
40
67
  /**
41
68
  * The label of the completion.
42
69
  */
43
- label: string;
70
+ label: string | CompletionItemLabel;
44
71
 
45
72
  /**
46
73
  * The index of the start of the range to replace.
@@ -57,6 +84,11 @@ declare module '@theia/plugin' {
57
84
  */
58
85
  detail?: string;
59
86
 
87
+ /**
88
+ * A human-readable string that represents a doc-comment.
89
+ */
90
+ documentation?: string | MarkdownString;
91
+
60
92
  /**
61
93
  * The completion's kind. Note that this will map to an icon.
62
94
  */
@@ -64,7 +96,11 @@ declare module '@theia/plugin' {
64
96
  }
65
97
 
66
98
  /**
67
- * Terminal item kinds.
99
+ * The kind of an individual terminal completion item.
100
+ *
101
+ * The kind is used to render an appropriate icon in the suggest list and to convey the semantic
102
+ * meaning of the suggestion (file, folder, flag, commit, branch, etc.).
103
+ *
68
104
  */
69
105
  export enum TerminalCompletionItemKind {
70
106
  File = 0,
@@ -86,32 +122,56 @@ declare module '@theia/plugin' {
86
122
  PullRequestDone = 16,
87
123
  }
88
124
 
125
+ /**
126
+ * Context information passed to {@link TerminalCompletionProvider.provideTerminalCompletions}.
127
+ *
128
+ * It contains the full command line, the current cursor position, and a flag indicating whether
129
+ * fallback completions are allowed when the exact completion type cannot be determined.
130
+ */
89
131
  export interface TerminalCompletionContext {
90
132
  /**
91
133
  * The complete terminal command line.
92
134
  */
93
135
  commandLine: string;
94
136
  /**
95
- * The index of the
96
- * cursor in the command line.
137
+ * The index of the cursor in the command line.
97
138
  */
98
139
  cursorPosition: number;
140
+ /**
141
+ * Whether completions should be provided when it is not clear to what type of completion is
142
+ * well known.
143
+ */
144
+ allowFallbackCompletions: boolean;
99
145
  }
100
146
 
101
147
  export namespace window {
102
148
  /**
103
- * Register a completion provider for a certain type of terminal.
104
- *
149
+ * Register a completion provider for terminals.
150
+ * @param id The unique identifier of the terminal provider, used as a settings key and shown in the information hover of the suggest widget.
105
151
  * @param provider The completion provider.
106
152
  * @returns A {@link Disposable} that unregisters this provider when being disposed.
107
- * @stubbed
108
- */
109
- export function registerTerminalCompletionProvider<T extends TerminalCompletionItem>(provider: TerminalCompletionProvider<T>, ...triggerCharacters: string[]): Disposable;
153
+ *
154
+ * @example <caption>Register a provider for an extension</caption>
155
+ * window.registerTerminalCompletionProvider('extension-provider-id', {
156
+ * provideTerminalCompletions(terminal, context) {
157
+ * return new TerminalCompletionList([
158
+ * { label: '--version', replacementIndex: Math.max(0, context.cursorPosition - 2), replacementLength: 2 }
159
+ * ]);
160
+ * }
161
+ * });
162
+ */
163
+ export function registerTerminalCompletionProvider<T extends TerminalCompletionItem>(
164
+ id: string, provider: TerminalCompletionProvider<T>, ...triggerCharacters: string[]): Disposable;
110
165
  }
111
166
 
112
167
  /**
113
168
  * Represents a collection of {@link TerminalCompletionItem completion items} to be presented
114
169
  * in the terminal.
170
+ *
171
+ * @example <caption>Create a completion list that requests files for the terminal cwd</caption>
172
+ * const list = new TerminalCompletionList([
173
+ * { label: 'ls', replacementIndex: 0, replacementLength: 0, kind: TerminalCompletionItemKind.Method }
174
+ * ], { filesRequested: true, cwd: Uri.file('/home/user') });
115
175
  */
116
176
  export class TerminalCompletionList<T extends TerminalCompletionItem = TerminalCompletionItem> {
117
177
 
@@ -134,6 +194,12 @@ declare module '@theia/plugin' {
134
194
  constructor(items?: T[], resourceRequestConfig?: TerminalResourceRequestConfig);
135
195
  }
136
196
 
197
+ /**
198
+ * Configuration for requesting file and folder resources to be shown as completions.
199
+ *
200
+ * When a provider indicates that it wants file/folder resources, the terminal will surface completions for files and
201
+ * folders that match {@link globPattern} from the provided {@link cwd}.
202
+ */
137
203
  export interface TerminalResourceRequestConfig {
138
204
  /**
139
205
  * Show files as completion items.
@@ -144,12 +210,12 @@ declare module '@theia/plugin' {
144
210
  */
145
211
  foldersRequested?: boolean;
146
212
  /**
147
- * If no cwd is provided, no resources will be shown as completions.
213
+ * A {@link GlobPattern glob pattern} that controls which files suggest should surface.
148
214
  */
149
- cwd?: Uri;
215
+ globPattern?: GlobPattern;
150
216
  /**
151
- * The path separator to use when constructing paths.
217
+ * The cwd from which to request resources.
152
218
  */
153
- pathSeparator: string;
219
+ cwd: Uri;
154
220
  }
155
221
  }
@@ -20,7 +20,7 @@
20
20
  *--------------------------------------------------------------------------------------------*/
21
21
  // code copied and modified from https://github.com/microsoft/vscode/blob/1.103.2/src/vscode-dts/vscode.proposed.textEditorDiffInformation.d.ts
22
22
 
23
- declare module '@theia/plugin' {
23
+ export module '@theia/plugin' {
24
24
  // https://github.com/microsoft/vscode/issues/84899
25
25
 
26
26
  export enum TextEditorChangeKind {