@theia/plugin 1.53.2 → 1.55.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.53.2",
3
+ "version": "1.55.0-next.4+f6ace675e",
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.53.2"
30
+ "@theia/ext-scripts": "1.54.0"
31
31
  },
32
32
  "nyc": {
33
33
  "extends": "../../configs/nyc.json"
34
34
  },
35
- "gitHead": "4f6f158bd27c5dd608dddc036910698a51d8c953"
35
+ "gitHead": "f6ace675e712c3d2227d1cd19e9c905a6e4d9ad6"
36
36
  }
package/src/theia.d.ts CHANGED
@@ -43,7 +43,6 @@ import './theia.proposed.resolvers';
43
43
  import './theia.proposed.scmValidation';
44
44
  import './theia.proposed.shareProvider';
45
45
  import './theia.proposed.terminalQuickFixProvider';
46
- import './theia.proposed.terminalShellIntegration';
47
46
  import './theia.proposed.textSearchProvider';
48
47
  import './theia.proposed.timeline';
49
48
 
@@ -3058,6 +3057,19 @@ export module '@theia/plugin' {
3058
3057
  */
3059
3058
  readonly state: TerminalState;
3060
3059
 
3060
+ /**
3061
+ * An object that contains [shell integration](https://code.visualstudio.com/docs/terminal/shell-integration)-powered
3062
+ * features for the terminal. This will always be `undefined` immediately after the terminal
3063
+ * is created. Listen to {@link window.onDidChangeTerminalShellIntegration} to be notified
3064
+ * when shell integration is activated for a terminal.
3065
+ *
3066
+ * Note that this object may remain undefined if shell integation never activates. For
3067
+ * example Command Prompt does not support shell integration and a user's shell setup could
3068
+ * conflict with the automatic shell integration activation.
3069
+ * @stubbed
3070
+ */
3071
+ readonly shellIntegration: TerminalShellIntegration | undefined;
3072
+
3061
3073
  /**
3062
3074
  * Send text to the terminal.
3063
3075
  * @param text - The text to send.
@@ -3101,6 +3113,333 @@ export module '@theia/plugin' {
3101
3113
  readonly isInteractedWith: boolean;
3102
3114
  }
3103
3115
 
3116
+ /**
3117
+ * [Shell integration](https://code.visualstudio.com/docs/terminal/shell-integration)-powered capabilities owned by a terminal.
3118
+ * @stubbed
3119
+ */
3120
+ export interface TerminalShellIntegration {
3121
+ /**
3122
+ * The current working directory of the terminal. This {@link Uri} may represent a file on
3123
+ * another machine (eg. ssh into another machine). This requires the shell integration to
3124
+ * support working directory reporting.
3125
+ * @stubbed
3126
+ */
3127
+ readonly cwd: Uri | undefined;
3128
+
3129
+ /**
3130
+ * Execute a command, sending ^C as necessary to interrupt any running command if needed.
3131
+ *
3132
+ * @param commandLine The command line to execute, this is the exact text that will be sent
3133
+ * to the terminal.
3134
+ *
3135
+ * @example
3136
+ * // Execute a command in a terminal immediately after being created
3137
+ * const myTerm = window.createTerminal();
3138
+ * window.onDidChangeTerminalShellIntegration(async ({ terminal, shellIntegration }) => {
3139
+ * if (terminal === myTerm) {
3140
+ * const execution = shellIntegration.executeCommand('echo "Hello world"');
3141
+ * window.onDidEndTerminalShellExecution(event => {
3142
+ * if (event.execution === execution) {
3143
+ * console.log(`Command exited with code ${event.exitCode}`);
3144
+ * }
3145
+ * }
3146
+ * }));
3147
+ * // Fallback to sendText if there is no shell integration within 3 seconds of launching
3148
+ * setTimeout(() => {
3149
+ * if (!myTerm.shellIntegration) {
3150
+ * myTerm.sendText('echo "Hello world"');
3151
+ * // Without shell integration, we can't know when the command has finished or what the
3152
+ * // exit code was.
3153
+ * }
3154
+ * }, 3000);
3155
+ *
3156
+ * @example
3157
+ * // Send command to terminal that has been alive for a while
3158
+ * const commandLine = 'echo "Hello world"';
3159
+ * if (term.shellIntegration) {
3160
+ * const execution = shellIntegration.executeCommand({ commandLine });
3161
+ * window.onDidEndTerminalShellExecution(event => {
3162
+ * if (event.execution === execution) {
3163
+ * console.log(`Command exited with code ${event.exitCode}`);
3164
+ * }
3165
+ * } else {
3166
+ * term.sendText(commandLine);
3167
+ * // Without shell integration, we can't know when the command has finished or what the
3168
+ * // exit code was.
3169
+ * }
3170
+ * @stubbed
3171
+ */
3172
+ executeCommand(commandLine: string): TerminalShellExecution;
3173
+
3174
+ /**
3175
+ * Execute a command, sending ^C as necessary to interrupt any running command if needed.
3176
+ *
3177
+ * *Note* This is not guaranteed to work as [shell integration](https://code.visualstudio.com/docs/terminal/shell-integration)
3178
+ * must be activated. Check whether {@link TerminalShellExecution.exitCode} is rejected to
3179
+ * verify whether it was successful.
3180
+ *
3181
+ * @param command A command to run.
3182
+ * @param args Arguments to launch the executable with which will be automatically escaped
3183
+ * based on the executable type.
3184
+ *
3185
+ * @example
3186
+ * // Execute a command in a terminal immediately after being created
3187
+ * const myTerm = window.createTerminal();
3188
+ * window.onDidActivateTerminalShellIntegration(async ({ terminal, shellIntegration }) => {
3189
+ * if (terminal === myTerm) {
3190
+ * const command = shellIntegration.executeCommand({
3191
+ * command: 'echo',
3192
+ * args: ['Hello world']
3193
+ * });
3194
+ * const code = await command.exitCode;
3195
+ * console.log(`Command exited with code ${code}`);
3196
+ * }
3197
+ * }));
3198
+ * // Fallback to sendText if there is no shell integration within 3 seconds of launching
3199
+ * setTimeout(() => {
3200
+ * if (!myTerm.shellIntegration) {
3201
+ * myTerm.sendText('echo "Hello world"');
3202
+ * // Without shell integration, we can't know when the command has finished or what the
3203
+ * // exit code was.
3204
+ * }
3205
+ * }, 3000);
3206
+ *
3207
+ * @example
3208
+ * // Send command to terminal that has been alive for a while
3209
+ * const commandLine = 'echo "Hello world"';
3210
+ * if (term.shellIntegration) {
3211
+ * const command = term.shellIntegration.executeCommand({
3212
+ * command: 'echo',
3213
+ * args: ['Hello world']
3214
+ * });
3215
+ * const code = await command.exitCode;
3216
+ * console.log(`Command exited with code ${code}`);
3217
+ * } else {
3218
+ * term.sendText(commandLine);
3219
+ * // Without shell integration, we can't know when the command has finished or what the
3220
+ * // exit code was.
3221
+ * }
3222
+ * @stubbed
3223
+ */
3224
+ executeCommand(executable: string, args: string[]): TerminalShellExecution;
3225
+ }
3226
+
3227
+ /**
3228
+ * A command that was executed in a terminal.
3229
+ * @stubbed
3230
+ */
3231
+ export interface TerminalShellExecution {
3232
+ /**
3233
+ * The command line that was executed. The {@link TerminalShellExecutionCommandLineConfidence confidence}
3234
+ * of this value depends on the specific shell's shell integration implementation. This
3235
+ * value may become more accurate after {@link window.onDidEndTerminalShellExecution} is
3236
+ * fired.
3237
+ *
3238
+ * @example
3239
+ * // Log the details of the command line on start and end
3240
+ * window.onDidStartTerminalShellExecution(event => {
3241
+ * const commandLine = event.execution.commandLine;
3242
+ * console.log(`Command started\n${summarizeCommandLine(commandLine)}`);
3243
+ * });
3244
+ * window.onDidEndTerminalShellExecution(event => {
3245
+ * const commandLine = event.execution.commandLine;
3246
+ * console.log(`Command ended\n${summarizeCommandLine(commandLine)}`);
3247
+ * });
3248
+ * function summarizeCommandLine(commandLine: TerminalShellExecutionCommandLine) {
3249
+ * return [
3250
+ * ` Command line: ${command.commandLine.value}`,
3251
+ * ` Confidence: ${command.commandLine.confidence}`,
3252
+ * ` Trusted: ${command.commandLine.isTrusted}
3253
+ * ].join('\n');
3254
+ * }
3255
+ * @stubbed
3256
+ */
3257
+ readonly commandLine: TerminalShellExecutionCommandLine;
3258
+
3259
+ /**
3260
+ * The working directory that was reported by the shell when this command executed. This
3261
+ * {@link Uri} may represent a file on another machine (eg. ssh into another machine). This
3262
+ * requires the shell integration to support working directory reporting.
3263
+ * @stubbed
3264
+ */
3265
+ readonly cwd: Uri | undefined;
3266
+
3267
+ /**
3268
+ * Creates a stream of raw data (including escape sequences) that is written to the
3269
+ * terminal. This will only include data that was written after `read` was called for
3270
+ * the first time, ie. you must call `read` immediately after the command is executed via
3271
+ * {@link TerminalShellIntegration.executeCommand} or
3272
+ * {@link window.onDidStartTerminalShellExecution} to not miss any data.
3273
+ *
3274
+ * @example
3275
+ * // Log all data written to the terminal for a command
3276
+ * const command = term.shellIntegration.executeCommand({ commandLine: 'echo "Hello world"' });
3277
+ * const stream = command.read();
3278
+ * for await (const data of stream) {
3279
+ * console.log(data);
3280
+ * }
3281
+ * @stubbed
3282
+ */
3283
+ read(): AsyncIterable<string>;
3284
+ }
3285
+
3286
+ /**
3287
+ * A command line that was executed in a terminal.
3288
+ * @stubbed
3289
+ */
3290
+ export interface TerminalShellExecutionCommandLine {
3291
+ /**
3292
+ * The full command line that was executed, including both the command and its arguments.
3293
+ * @stubbed
3294
+ */
3295
+ readonly value: string;
3296
+
3297
+ /**
3298
+ * Whether the command line value came from a trusted source and is therefore safe to
3299
+ * execute without user additional confirmation, such as a notification that asks "Do you
3300
+ * want to execute (command)?". This verification is likely only needed if you are going to
3301
+ * execute the command again.
3302
+ *
3303
+ * This is `true` only when the command line was reported explicitly by the shell
3304
+ * integration script (ie. {@link TerminalShellExecutionCommandLineConfidence.High high confidence})
3305
+ * and it used a nonce for verification.
3306
+ * @stubbed
3307
+ */
3308
+ readonly isTrusted: boolean;
3309
+
3310
+ /**
3311
+ * The confidence of the command line value which is determined by how the value was
3312
+ * obtained. This depends upon the implementation of the shell integration script.
3313
+ * @stubbed
3314
+ */
3315
+ readonly confidence: TerminalShellExecutionCommandLineConfidence;
3316
+ }
3317
+
3318
+ /**
3319
+ * The confidence of a {@link TerminalShellExecutionCommandLine} value.
3320
+ */
3321
+ enum TerminalShellExecutionCommandLineConfidence {
3322
+ /**
3323
+ * The command line value confidence is low. This means that the value was read from the
3324
+ * terminal buffer using markers reported by the shell integration script. Additionally one
3325
+ * of the following conditions will be met:
3326
+ *
3327
+ * - The command started on the very left-most column which is unusual, or
3328
+ * - The command is multi-line which is more difficult to accurately detect due to line
3329
+ * continuation characters and right prompts.
3330
+ * - Command line markers were not reported by the shell integration script.
3331
+ */
3332
+ Low = 0,
3333
+
3334
+ /**
3335
+ * The command line value confidence is medium. This means that the value was read from the
3336
+ * terminal buffer using markers reported by the shell integration script. The command is
3337
+ * single-line and does not start on the very left-most column (which is unusual).
3338
+ */
3339
+ Medium = 1,
3340
+
3341
+ /**
3342
+ * The command line value confidence is high. This means that the value was explicitly sent
3343
+ * from the shell integration script or the command was executed via the
3344
+ * {@link TerminalShellIntegration.executeCommand} API.
3345
+ */
3346
+ High = 2
3347
+ }
3348
+
3349
+ /**
3350
+ * An event signalling that a terminal's shell integration has changed.
3351
+ * @stubbed
3352
+ */
3353
+ export interface TerminalShellIntegrationChangeEvent {
3354
+ /**
3355
+ * The terminal that shell integration has been activated in.
3356
+ * @stubbed
3357
+ */
3358
+ readonly terminal: Terminal;
3359
+
3360
+ /**
3361
+ * The shell integration object.
3362
+ * @stubbed
3363
+ */
3364
+ readonly shellIntegration: TerminalShellIntegration;
3365
+ }
3366
+
3367
+ /**
3368
+ * An event signalling that an execution has started in a terminal.
3369
+ * @stubbed
3370
+ */
3371
+ export interface TerminalShellExecutionStartEvent {
3372
+ /**
3373
+ * The terminal that shell integration has been activated in.
3374
+ * @stubbed
3375
+ */
3376
+ readonly terminal: Terminal;
3377
+
3378
+ /**
3379
+ * The shell integration object.
3380
+ * @stubbed
3381
+ */
3382
+ readonly shellIntegration: TerminalShellIntegration;
3383
+
3384
+ /**
3385
+ * The terminal shell execution that has ended.
3386
+ * @stubbed
3387
+ */
3388
+ readonly execution: TerminalShellExecution;
3389
+ }
3390
+
3391
+ /**
3392
+ * An event signalling that an execution has ended in a terminal.
3393
+ * @stubbed
3394
+ */
3395
+ export interface TerminalShellExecutionEndEvent {
3396
+ /**
3397
+ * The terminal that shell integration has been activated in.
3398
+ * @stubbed
3399
+ */
3400
+ readonly terminal: Terminal;
3401
+
3402
+ /**
3403
+ * The shell integration object.
3404
+ * @stubbed
3405
+ */
3406
+ readonly shellIntegration: TerminalShellIntegration;
3407
+
3408
+ /**
3409
+ * The terminal shell execution that has ended.
3410
+ * @stubbed
3411
+ */
3412
+ readonly execution: TerminalShellExecution;
3413
+
3414
+ /**
3415
+ * The exit code reported by the shell.
3416
+ *
3417
+ * Note that `undefined` means the shell either did not report an exit code (ie. the shell
3418
+ * integration script is misbehaving) or the shell reported a command started before the command
3419
+ * finished (eg. a sub-shell was opened). Generally this should not happen, depending on the use
3420
+ * case, it may be best to treat this as a failure.
3421
+ *
3422
+ * @example
3423
+ * const execution = shellIntegration.executeCommand({
3424
+ * command: 'echo',
3425
+ * args: ['Hello world']
3426
+ * });
3427
+ * window.onDidEndTerminalShellExecution(event => {
3428
+ * if (event.execution === execution) {
3429
+ * if (event.exitCode === undefined) {
3430
+ * console.log('Command finished but exit code is unknown');
3431
+ * } else if (event.exitCode === 0) {
3432
+ * console.log('Command succeeded');
3433
+ * } else {
3434
+ * console.log('Command failed');
3435
+ * }
3436
+ * }
3437
+ * });
3438
+ * @stubbed
3439
+ */
3440
+ readonly exitCode: number | undefined;
3441
+ }
3442
+
3104
3443
  /**
3105
3444
  * Options to create terminal widget.
3106
3445
  */
@@ -3181,7 +3520,6 @@ export module '@theia/plugin' {
3181
3520
  * The icon {@link ThemeColor} for the terminal.
3182
3521
  * The `terminal.ansi*` theme keys are
3183
3522
  * recommended for the best contrast and consistency across themes.
3184
- * @stubbed
3185
3523
  */
3186
3524
  color?: ThemeColor;
3187
3525
  }
@@ -5500,6 +5838,28 @@ export module '@theia/plugin' {
5500
5838
  */
5501
5839
  export const onDidChangeTerminalState: Event<Terminal>;
5502
5840
 
5841
+ /**
5842
+ * Fires when shell integration activates or one of its properties changes in a terminal.
5843
+ * @stubbed
5844
+ */
5845
+ export const onDidChangeTerminalShellIntegration: Event<TerminalShellIntegrationChangeEvent>;
5846
+
5847
+ /**
5848
+ * This will be fired when a terminal command is started. This event will fire only when
5849
+ * [shell integration](https://code.visualstudio.com/docs/terminal/shell-integration) is
5850
+ * activated for the terminal.
5851
+ * @stubbed
5852
+ */
5853
+ export const onDidStartTerminalShellExecution: Event<TerminalShellExecutionStartEvent>;
5854
+
5855
+ /**
5856
+ * This will be fired when a terminal command is ended. This event will fire only when
5857
+ * [shell integration](https://code.visualstudio.com/docs/terminal/shell-integration) is
5858
+ * activated for the terminal.
5859
+ * @stubbed
5860
+ */
5861
+ export const onDidEndTerminalShellExecution: Event<TerminalShellExecutionEndEvent>;
5862
+
5503
5863
  /**
5504
5864
  * Create new terminal with predefined options.
5505
5865
  * @param - terminal options.
@@ -6368,13 +6728,31 @@ export module '@theia/plugin' {
6368
6728
  badge: ViewBadge | undefined;
6369
6729
 
6370
6730
  /**
6371
- * Reveal an element. By default revealed element is selected.
6731
+ * Reveals the given element in the tree view.
6732
+ * If the tree view is not visible then the tree view is shown and element is revealed.
6372
6733
  *
6734
+ * By default revealed element is selected.
6373
6735
  * In order to not to select, set the option `select` to `false`.
6736
+ * In order to focus, set the option `focus` to `true`.
6737
+ * In order to expand the revealed element, set the option `expand` to `true`. To expand recursively set `expand` to the number of levels to expand.
6374
6738
  *
6375
- * **NOTE:** {@link TreeDataProvider TreeDataProvider} is required to implement {@link TreeDataProvider.getParent getParent} method to access this API.
6739
+ * * *NOTE:* In VS Code, you can expand only to 3 levels maximum. This is not the case in Theia, there are no limits to expansion level.
6740
+ * * *NOTE:* The {@link TreeDataProvider} that the `TreeView` {@link window.createTreeView is registered with} with must implement {@link TreeDataProvider.getParent getParent} method to access this API.
6376
6741
  */
6377
- reveal(element: T, options?: { select?: boolean; focus?: boolean; expand?: boolean | number }): Thenable<void>;
6742
+ reveal(element: T, options?: {
6743
+ /**
6744
+ * If true, then the element will be selected.
6745
+ */
6746
+ readonly select?: boolean;
6747
+ /**
6748
+ * If true, then the element will be focused.
6749
+ */
6750
+ readonly focus?: boolean;
6751
+ /**
6752
+ * If true, then the element will be expanded. If a number is passed, then up to that number of levels of children will be expanded
6753
+ */
6754
+ readonly expand?: boolean | number;
6755
+ }): Thenable<void>;
6378
6756
  }
6379
6757
 
6380
6758
  /**
@@ -14084,6 +14462,11 @@ export module '@theia/plugin' {
14084
14462
  * Note: you cannot use this option with any other options that prompt the user like {@link createIfNone}.
14085
14463
  */
14086
14464
  silent?: boolean;
14465
+
14466
+ /**
14467
+ * The account that you would like to get a session for. This is passed down to the Authentication Provider to be used for creating the correct session.
14468
+ */
14469
+ account?: AuthenticationSessionAccountInformation;
14087
14470
  }
14088
14471
 
14089
14472
  /**
@@ -14144,6 +14527,18 @@ export module '@theia/plugin' {
14144
14527
  readonly changed: readonly AuthenticationSession[] | undefined;
14145
14528
  }
14146
14529
 
14530
+ /**
14531
+ * The options passed in to the {@link AuthenticationProvider.getSessions} and
14532
+ * {@link AuthenticationProvider.createSession} call.
14533
+ */
14534
+ export interface AuthenticationProviderSessionOptions {
14535
+ /**
14536
+ * The account that is being asked about. If this is passed in, the provider should
14537
+ * attempt to return the sessions that are only related to this account.
14538
+ */
14539
+ account?: AuthenticationSessionAccountInformation;
14540
+ }
14541
+
14147
14542
  /**
14148
14543
  * A provider for performing authentication to a service.
14149
14544
  */
@@ -14158,9 +14553,10 @@ export module '@theia/plugin' {
14158
14553
  * Get a list of sessions.
14159
14554
  * @param scopes An optional list of scopes. If provided, the sessions returned should match
14160
14555
  * these permissions, otherwise all sessions should be returned.
14556
+ * @param options Additional options for getting sessions.
14161
14557
  * @returns A promise that resolves to an array of authentication sessions.
14162
14558
  */
14163
- getSessions(scopes?: readonly string[]): Thenable<readonly AuthenticationSession[]>;
14559
+ getSessions(scopes: readonly string[] | undefined, options: AuthenticationProviderSessionOptions): Thenable<AuthenticationSession[]>;
14164
14560
 
14165
14561
  /**
14166
14562
  * Prompts a user to login.
@@ -14173,9 +14569,10 @@ export module '@theia/plugin' {
14173
14569
  * then this should never be called if there is already an existing session matching these
14174
14570
  * scopes.
14175
14571
  * @param scopes A list of scopes, permissions, that the new session should be created with.
14572
+ * @param options Additional options for creating a session.
14176
14573
  * @returns A promise that resolves to an authentication session.
14177
14574
  */
14178
- createSession(scopes: readonly string[]): Thenable<AuthenticationSession>;
14575
+ createSession(scopes: readonly string[], options: AuthenticationProviderSessionOptions): Thenable<AuthenticationSession>;
14179
14576
 
14180
14577
  /**
14181
14578
  * Removes the session corresponding to session id.
@@ -14235,6 +14632,20 @@ export module '@theia/plugin' {
14235
14632
  */
14236
14633
  export function getSession(providerId: string, scopes: readonly string[], options?: AuthenticationGetSessionOptions): Thenable<AuthenticationSession | undefined>;
14237
14634
 
14635
+ /**
14636
+ * Get all accounts that the user is logged in to for the specified provider.
14637
+ * Use this paired with {@link getSession} in order to get an authentication session for a specific account.
14638
+ *
14639
+ * Currently, there are only two authentication providers that are contributed from built in extensions
14640
+ * to the editor that implement GitHub and Microsoft authentication: their providerId's are 'github' and 'microsoft'.
14641
+ *
14642
+ * Note: Getting accounts does not imply that your extension has access to that account or its authentication sessions. You can verify access to the account by calling {@link getSession}.
14643
+ *
14644
+ * @param providerId The id of the provider to use
14645
+ * @returns A thenable that resolves to a readonly array of authentication accounts.
14646
+ */
14647
+ export function getAccounts(providerId: string): Thenable<readonly AuthenticationSessionAccountInformation[]>;
14648
+
14238
14649
  /**
14239
14650
  * An {@link Event event} which fires when the authentication sessions of an authentication provider have
14240
14651
  * been added, removed, or changed.
@@ -16573,6 +16984,34 @@ export module '@theia/plugin' {
16573
16984
  error: string | MarkdownString | undefined;
16574
16985
  }
16575
16986
 
16987
+ /**
16988
+ * A stack frame found in the {@link TestMessage.stackTrace}.
16989
+ */
16990
+ export class TestMessageStackFrame {
16991
+ /**
16992
+ * The location of this stack frame. This should be provided as a URI if the
16993
+ * location of the call frame can be accessed by the editor.
16994
+ */
16995
+ uri?: Uri;
16996
+
16997
+ /**
16998
+ * Position of the stack frame within the file.
16999
+ */
17000
+ position?: Position;
17001
+
17002
+ /**
17003
+ * The name of the stack frame, typically a method or function name.
17004
+ */
17005
+ label: string;
17006
+
17007
+ /**
17008
+ * @param label The name of the stack frame
17009
+ * @param file The file URI of the stack frame
17010
+ * @param position The position of the stack frame within the file
17011
+ */
17012
+ constructor(label: string, uri?: Uri, position?: Position);
17013
+ }
17014
+
16576
17015
  /**
16577
17016
  * Message associated with the test state. Can be linked to a specific
16578
17017
  * source range -- useful for assertion failures, for example.
@@ -16629,6 +17068,11 @@ export module '@theia/plugin' {
16629
17068
  */
16630
17069
  contextValue?: string;
16631
17070
 
17071
+ /**
17072
+ * The stack trace associated with the message or failure.
17073
+ */
17074
+ stackTrace?: TestMessageStackFrame[];
17075
+
16632
17076
  /**
16633
17077
  * Creates a new TestMessage that will present as a diff in the editor.
16634
17078
  * @param message Message to display to the user.
@@ -41,9 +41,13 @@ export module '@theia/plugin' {
41
41
  * @param extensionId An extension identifier.
42
42
  * @param includeDifferentExtensionHosts Include extensions from different extension host
43
43
  * @return An extension or `undefined`.
44
+ *
45
+ * *Note* In Theia, includeDifferentExtensionHosts will always be set to false, as we only support one host currently.
44
46
  */
45
47
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
46
48
  export function getExtension<T = any>(extensionId: string, includeDifferentExtensionHosts: boolean): Extension<T> | undefined;
49
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
50
+ export function getExtension<T = any>(extensionId: string, includeDifferentExtensionHosts: true): Extension<T | undefined> | undefined;
47
51
 
48
52
  /**
49
53
  * All extensions across all extension hosts.
@@ -1,329 +0,0 @@
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
- // https://github.com/microsoft/vscode/issues/145234
25
-
26
- /**
27
- * A command that was executed in a terminal.
28
- */
29
- export interface TerminalShellExecution {
30
- /**
31
- * The command line that was executed. The {@link TerminalShellExecutionCommandLineConfidence confidence}
32
- * of this value depends on the specific shell's shell integration implementation. This
33
- * value may become more accurate after {@link window.onDidEndTerminalShellExecution} is
34
- * fired.
35
- *
36
- * @example
37
- * // Log the details of the command line on start and end
38
- * window.onDidStartTerminalShellExecution(event => {
39
- * const commandLine = event.execution.commandLine;
40
- * console.log(`Command started\n${summarizeCommandLine(commandLine)}`);
41
- * });
42
- * window.onDidEndTerminalShellExecution(event => {
43
- * const commandLine = event.execution.commandLine;
44
- * console.log(`Command ended\n${summarizeCommandLine(commandLine)}`);
45
- * });
46
- * function summarizeCommandLine(commandLine: TerminalShellExecutionCommandLine) {
47
- * return [
48
- * ` Command line: ${command.ommandLine.value}`,
49
- * ` Confidence: ${command.ommandLine.confidence}`,
50
- * ` Trusted: ${command.ommandLine.isTrusted}
51
- * ].join('\n');
52
- * }
53
- */
54
- readonly commandLine: TerminalShellExecutionCommandLine;
55
-
56
- /**
57
- * The working directory that was reported by the shell when this command executed. This
58
- * {@link Uri} may represent a file on another machine (eg. ssh into another machine). This
59
- * requires the shell integration to support working directory reporting.
60
- */
61
- readonly cwd: Uri | undefined;
62
-
63
- /**
64
- * Creates a stream of raw data (including escape sequences) that is written to the
65
- * terminal. This will only include data that was written after `read` was called for
66
- * the first time, ie. you must call `read` immediately after the command is executed via
67
- * {@link TerminalShellIntegration.executeCommand} or
68
- * {@link window.onDidStartTerminalShellExecution} to not miss any data.
69
- *
70
- * @example
71
- * // Log all data written to the terminal for a command
72
- * const command = term.shellIntegration.executeCommand({ commandLine: 'echo "Hello world"' });
73
- * const stream = command.read();
74
- * for await (const data of stream) {
75
- * console.log(data);
76
- * }
77
- */
78
- read(): AsyncIterable<string>;
79
- }
80
-
81
- /**
82
- * A command line that was executed in a terminal.
83
- */
84
- export interface TerminalShellExecutionCommandLine {
85
- /**
86
- * The full command line that was executed, including both the command and its arguments.
87
- */
88
- readonly value: string;
89
-
90
- /**
91
- * Whether the command line value came from a trusted source and is therefore safe to
92
- * execute without user additional confirmation, such as a notification that asks "Do you
93
- * want to execute (command)?". This verification is likely only needed if you are going to
94
- * execute the command again.
95
- *
96
- * This is `true` only when the command line was reported explicitly by the shell
97
- * integration script (ie. {@link TerminalShellExecutionCommandLineConfidence.High high confidence})
98
- * and it used a nonce for verification.
99
- */
100
- readonly isTrusted: boolean;
101
-
102
- /**
103
- * The confidence of the command line value which is determined by how the value was
104
- * obtained. This depends upon the implementation of the shell integration script.
105
- */
106
- readonly confidence: TerminalShellExecutionCommandLineConfidence;
107
- }
108
-
109
- /**
110
- * The confidence of a {@link TerminalShellExecutionCommandLine} value.
111
- */
112
- enum TerminalShellExecutionCommandLineConfidence {
113
- /**
114
- * The command line value confidence is low. This means that the value was read from the
115
- * terminal buffer using markers reported by the shell integration script. Additionally one
116
- * of the following conditions will be met:
117
- *
118
- * - The command started on the very left-most column which is unusual, or
119
- * - The command is multi-line which is more difficult to accurately detect due to line
120
- * continuation characters and right prompts.
121
- * - Command line markers were not reported by the shell integration script.
122
- */
123
- Low = 0,
124
-
125
- /**
126
- * The command line value confidence is medium. This means that the value was read from the
127
- * terminal buffer using markers reported by the shell integration script. The command is
128
- * single-line and does not start on the very left-most column (which is unusual).
129
- */
130
- Medium = 1,
131
-
132
- /**
133
- * The command line value confidence is high. This means that the value was explicitly sent
134
- * from the shell integration script or the command was executed via the
135
- * {@link TerminalShellIntegration.executeCommand} API.
136
- */
137
- High = 2
138
- }
139
-
140
- export interface Terminal {
141
- /**
142
- * An object that contains [shell integration](https://code.visualstudio.com/docs/terminal/shell-integration)-powered
143
- * features for the terminal. This will always be `undefined` immediately after the terminal
144
- * is created. Listen to {@link window.onDidActivateTerminalShellIntegration} to be notified
145
- * when shell integration is activated for a terminal.
146
- *
147
- * Note that this object may remain undefined if shell integation never activates. For
148
- * example Command Prompt does not support shell integration and a user's shell setup could
149
- * conflict with the automatic shell integration activation.
150
- */
151
- readonly shellIntegration: TerminalShellIntegration | undefined;
152
- }
153
-
154
- /**
155
- * [Shell integration](https://code.visualstudio.com/docs/terminal/shell-integration)-powered capabilities owned by a terminal.
156
- */
157
- export interface TerminalShellIntegration {
158
- /**
159
- * The current working directory of the terminal. This {@link Uri} may represent a file on
160
- * another machine (eg. ssh into another machine). This requires the shell integration to
161
- * support working directory reporting.
162
- */
163
- readonly cwd: Uri | undefined;
164
-
165
- /**
166
- * Execute a command, sending ^C as necessary to interrupt any running command if needed.
167
- *
168
- * @param commandLine The command line to execute, this is the exact text that will be sent
169
- * to the terminal.
170
- *
171
- * @example
172
- * // Execute a command in a terminal immediately after being created
173
- * const myTerm = window.createTerminal();
174
- * window.onDidActivateTerminalShellIntegration(async ({ terminal, shellIntegration }) => {
175
- * if (terminal === myTerm) {
176
- * const command = shellIntegration.executeCommand('echo "Hello world"');
177
- * const code = await command.exitCode;
178
- * console.log(`Command exited with code ${code}`);
179
- * }
180
- * }));
181
- * // Fallback to sendText if there is no shell integration within 3 seconds of launching
182
- * setTimeout(() => {
183
- * if (!myTerm.shellIntegration) {
184
- * myTerm.sendText('echo "Hello world"');
185
- * // Without shell integration, we can't know when the command has finished or what the
186
- * // exit code was.
187
- * }
188
- * }, 3000);
189
- *
190
- * @example
191
- * // Send command to terminal that has been alive for a while
192
- * const commandLine = 'echo "Hello world"';
193
- * if (term.shellIntegration) {
194
- * const command = term.shellIntegration.executeCommand({ commandLine });
195
- * const code = await command.exitCode;
196
- * console.log(`Command exited with code ${code}`);
197
- * } else {
198
- * term.sendText(commandLine);
199
- * // Without shell integration, we can't know when the command has finished or what the
200
- * // exit code was.
201
- * }
202
- */
203
- executeCommand(commandLine: string): TerminalShellExecution;
204
-
205
- /**
206
- * Execute a command, sending ^C as necessary to interrupt any running command if needed.
207
- *
208
- * *Note* This is not guaranteed to work as [shell integration](https://code.visualstudio.com/docs/terminal/shell-integration)
209
- * must be activated. Check whether {@link TerminalShellExecution.exitCode} is rejected to
210
- * verify whether it was successful.
211
- *
212
- * @param command A command to run.
213
- * @param args Arguments to launch the executable with which will be automatically escaped
214
- * based on the executable type.
215
- *
216
- * @example
217
- * // Execute a command in a terminal immediately after being created
218
- * const myTerm = window.createTerminal();
219
- * window.onDidActivateTerminalShellIntegration(async ({ terminal, shellIntegration }) => {
220
- * if (terminal === myTerm) {
221
- * const command = shellIntegration.executeCommand({
222
- * command: 'echo',
223
- * args: ['Hello world']
224
- * });
225
- * const code = await command.exitCode;
226
- * console.log(`Command exited with code ${code}`);
227
- * }
228
- * }));
229
- * // Fallback to sendText if there is no shell integration within 3 seconds of launching
230
- * setTimeout(() => {
231
- * if (!myTerm.shellIntegration) {
232
- * myTerm.sendText('echo "Hello world"');
233
- * // Without shell integration, we can't know when the command has finished or what the
234
- * // exit code was.
235
- * }
236
- * }, 3000);
237
- *
238
- * @example
239
- * // Send command to terminal that has been alive for a while
240
- * const commandLine = 'echo "Hello world"';
241
- * if (term.shellIntegration) {
242
- * const command = term.shellIntegration.executeCommand({
243
- * command: 'echo',
244
- * args: ['Hello world']
245
- * });
246
- * const code = await command.exitCode;
247
- * console.log(`Command exited with code ${code}`);
248
- * } else {
249
- * term.sendText(commandLine);
250
- * // Without shell integration, we can't know when the command has finished or what the
251
- * // exit code was.
252
- * }
253
- */
254
- executeCommand(executable: string, args: string[]): TerminalShellExecution;
255
- }
256
-
257
- export interface TerminalShellIntegrationChangeEvent {
258
- /**
259
- * The terminal that shell integration has been activated in.
260
- */
261
- readonly terminal: Terminal;
262
-
263
- /**
264
- * The shell integration object.
265
- */
266
- readonly shellIntegration: TerminalShellIntegration;
267
- }
268
-
269
- export interface TerminalShellExecutionStartEvent {
270
- /**
271
- * The terminal that shell integration has been activated in.
272
- */
273
- readonly terminal: Terminal;
274
-
275
- /**
276
- * The shell integration object.
277
- */
278
- readonly shellIntegration: TerminalShellIntegration;
279
-
280
- /**
281
- * The terminal shell execution that has ended.
282
- */
283
- readonly execution: TerminalShellExecution;
284
- }
285
-
286
- export interface TerminalShellExecutionEndEvent {
287
- /**
288
- * The terminal that shell integration has been activated in.
289
- */
290
- readonly terminal: Terminal;
291
-
292
- /**
293
- * The shell integration object.
294
- */
295
- readonly shellIntegration: TerminalShellIntegration;
296
-
297
- /**
298
- * The terminal shell execution that has ended.
299
- */
300
- readonly execution: TerminalShellExecution;
301
-
302
- /**
303
- * The exit code reported by the shell. `undefined` means the shell did not report an exit
304
- * code or the shell reported a command started before the command finished.
305
- */
306
- readonly exitCode: number | undefined;
307
- }
308
-
309
- export namespace window {
310
- /**
311
- * Fires when shell integration activates or one of its properties changes in a terminal.
312
- */
313
- export const onDidChangeTerminalShellIntegration: Event<TerminalShellIntegrationChangeEvent>;
314
-
315
- /**
316
- * This will be fired when a terminal command is started. This event will fire only when
317
- * [shell integration](https://code.visualstudio.com/docs/terminal/shell-integration) is
318
- * activated for the terminal.
319
- */
320
- export const onDidStartTerminalShellExecution: Event<TerminalShellExecutionStartEvent>;
321
-
322
- /**
323
- * This will be fired when a terminal command is ended. This event will fire only when
324
- * [shell integration](https://code.visualstudio.com/docs/terminal/shell-integration) is
325
- * activated for the terminal.
326
- */
327
- export const onDidEndTerminalShellExecution: Event<TerminalShellExecutionEndEvent>;
328
- }
329
- }