@codingame/monaco-vscode-rollup-vsix-plugin 3.2.2 → 4.0.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/package.json +4 -4
- package/vscode-dts/vscode.proposed.aiTextSearchProvider.d.ts +261 -0
- package/vscode-dts/vscode.proposed.authLearnMore.d.ts +16 -0
- package/vscode-dts/vscode.proposed.chatParticipant.d.ts +49 -78
- package/vscode-dts/vscode.proposed.chatParticipantAdditions.d.ts +13 -16
- package/vscode-dts/vscode.proposed.chatProvider.d.ts +1 -1
- package/vscode-dts/vscode.proposed.commentThreadApplicability.d.ts +32 -0
- package/vscode-dts/vscode.proposed.commentingRangeHint.d.ts +16 -0
- package/vscode-dts/vscode.proposed.contribCommentsViewThreadMenus.d.ts +6 -0
- package/vscode-dts/vscode.proposed.contribDiffEditorGutterToolBarMenus.d.ts +6 -0
- package/vscode-dts/vscode.proposed.debugFocus.d.ts +15 -23
- package/vscode-dts/vscode.proposed.defaultChatParticipant.d.ts +10 -0
- package/vscode-dts/vscode.proposed.documentPaste.d.ts +115 -30
- package/vscode-dts/vscode.proposed.dropMetadata.d.ts +19 -14
- package/vscode-dts/vscode.proposed.fileComments.d.ts +2 -4
- package/vscode-dts/vscode.proposed.inlineCompletionsAdditions.d.ts +18 -0
- package/vscode-dts/vscode.proposed.interactive.d.ts +0 -16
- package/vscode-dts/vscode.proposed.languageModels.d.ts +115 -53
- package/vscode-dts/vscode.proposed.notebookCellExecution.d.ts +44 -0
- package/vscode-dts/vscode.proposed.notebookVariableProvider.d.ts +3 -0
- package/vscode-dts/vscode.proposed.tabInputMultiDiff.d.ts +22 -0
- package/vscode-dts/vscode.proposed.terminalExecuteCommandEvent.d.ts +2 -0
- package/vscode-dts/vscode.proposed.terminalShellIntegration.d.ts +207 -0
- package/vscode-dts/vscode.proposed.testCoverage.d.ts +0 -222
|
@@ -8,20 +8,14 @@ declare module 'vscode' {
|
|
|
8
8
|
/**
|
|
9
9
|
* Represents a language model response.
|
|
10
10
|
*
|
|
11
|
-
* @see {@link LanguageModelAccess.
|
|
11
|
+
* @see {@link LanguageModelAccess.chatRequest}
|
|
12
12
|
*/
|
|
13
|
-
export interface
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* The overall result of the request which represents failure or success
|
|
17
|
-
* but. The concrete value is not specified and depends on the selected language model.
|
|
18
|
-
*
|
|
19
|
-
* *Note* that the actual response represented by the {@link LanguageModelResponse.stream `stream`}-property
|
|
20
|
-
*/
|
|
21
|
-
result: Thenable<unknown>;
|
|
13
|
+
export interface LanguageModelChatResponse {
|
|
22
14
|
|
|
23
15
|
/**
|
|
24
16
|
* An async iterable that is a stream of text chunks forming the overall response.
|
|
17
|
+
*
|
|
18
|
+
* *Note* that this stream will error when during data receiving an error occurrs.
|
|
25
19
|
*/
|
|
26
20
|
stream: AsyncIterable<string>;
|
|
27
21
|
}
|
|
@@ -35,7 +29,7 @@ declare module 'vscode' {
|
|
|
35
29
|
* *Note* that a language model may choose to add additional system messages to the ones
|
|
36
30
|
* provided by extensions.
|
|
37
31
|
*/
|
|
38
|
-
export class
|
|
32
|
+
export class LanguageModelChatSystemMessage {
|
|
39
33
|
|
|
40
34
|
/**
|
|
41
35
|
* The content of this message.
|
|
@@ -53,7 +47,7 @@ declare module 'vscode' {
|
|
|
53
47
|
/**
|
|
54
48
|
* A language model message that represents a user message.
|
|
55
49
|
*/
|
|
56
|
-
export class
|
|
50
|
+
export class LanguageModelChatUserMessage {
|
|
57
51
|
|
|
58
52
|
/**
|
|
59
53
|
* The content of this message.
|
|
@@ -78,78 +72,100 @@ declare module 'vscode' {
|
|
|
78
72
|
* A language model message that represents an assistant message, usually in response to a user message
|
|
79
73
|
* or as a sample response/reply-pair.
|
|
80
74
|
*/
|
|
81
|
-
export class
|
|
75
|
+
export class LanguageModelChatAssistantMessage {
|
|
82
76
|
|
|
83
77
|
/**
|
|
84
78
|
* The content of this message.
|
|
85
79
|
*/
|
|
86
80
|
content: string;
|
|
87
81
|
|
|
82
|
+
/**
|
|
83
|
+
* The optional name of a user for this message.
|
|
84
|
+
*/
|
|
85
|
+
name: string | undefined;
|
|
86
|
+
|
|
88
87
|
/**
|
|
89
88
|
* Create a new assistant message.
|
|
90
89
|
*
|
|
91
90
|
* @param content The content of the message.
|
|
91
|
+
* @param name The optional name of a user for the message.
|
|
92
92
|
*/
|
|
93
|
-
constructor(content: string);
|
|
93
|
+
constructor(content: string, name?: string);
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
export type LanguageModelMessage = LanguageModelSystemMessage | LanguageModelUserMessage | LanguageModelAssistantMessage;
|
|
97
|
-
|
|
98
96
|
/**
|
|
99
|
-
*
|
|
100
|
-
* must check if the access is {@link LanguageModelAccess.isRevoked still valid} before using it.
|
|
97
|
+
* Different types of language model messages.
|
|
101
98
|
*/
|
|
102
|
-
export
|
|
99
|
+
export type LanguageModelChatMessage = LanguageModelChatSystemMessage | LanguageModelChatUserMessage | LanguageModelChatAssistantMessage;
|
|
103
100
|
|
|
101
|
+
/**
|
|
102
|
+
* An event describing the change in the set of available language models.
|
|
103
|
+
*/
|
|
104
|
+
export interface LanguageModelChangeEvent {
|
|
105
|
+
/**
|
|
106
|
+
* Added language models.
|
|
107
|
+
*/
|
|
108
|
+
readonly added: readonly string[];
|
|
104
109
|
/**
|
|
105
|
-
*
|
|
110
|
+
* Removed language models.
|
|
106
111
|
*/
|
|
107
|
-
readonly
|
|
112
|
+
readonly removed: readonly string[];
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* An error type for language model specific errors.
|
|
117
|
+
*
|
|
118
|
+
* Consumers of language models should check the code property to determine specific
|
|
119
|
+
* failure causes, like `if(someError.code === vscode.LanguageModelError.NotFound.name) {...}`
|
|
120
|
+
* for the case of referring to an unknown language model. For unspecified errors the `cause`-property
|
|
121
|
+
* will contain the actual error.
|
|
122
|
+
*/
|
|
123
|
+
export class LanguageModelError extends Error {
|
|
108
124
|
|
|
109
125
|
/**
|
|
110
|
-
*
|
|
126
|
+
* The language model does not exist.
|
|
111
127
|
*/
|
|
112
|
-
|
|
113
|
-
readonly onDidChangeAccess: Event<void>;
|
|
128
|
+
static NotFound(message?: string): LanguageModelError;
|
|
114
129
|
|
|
115
130
|
/**
|
|
116
|
-
* The
|
|
117
|
-
*
|
|
118
|
-
* It is expected that the model name can be used to lookup properties like token limits or what
|
|
119
|
-
* `options` are available.
|
|
131
|
+
* The requestor does not have permissions to use this
|
|
132
|
+
* language model
|
|
120
133
|
*/
|
|
121
|
-
|
|
134
|
+
static NoPermissions(message?: string): LanguageModelError;
|
|
122
135
|
|
|
123
136
|
/**
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
* *Note:* This will throw an error if access has been revoked.
|
|
137
|
+
* A code that identifies this error.
|
|
127
138
|
*
|
|
128
|
-
* @
|
|
129
|
-
*
|
|
139
|
+
* Possible values are names of errors, like {@linkcode LanguageModelError.NotFound NotFound},
|
|
140
|
+
* or `Unknown` for unspecified errors from the language model itself. In the latter case the
|
|
141
|
+
* `cause`-property will contain the actual error.
|
|
130
142
|
*/
|
|
131
|
-
|
|
143
|
+
readonly code: string;
|
|
132
144
|
}
|
|
133
145
|
|
|
134
|
-
|
|
146
|
+
/**
|
|
147
|
+
* Options for making a chat request using a language model.
|
|
148
|
+
*
|
|
149
|
+
* @see {@link lm.chatRequest}
|
|
150
|
+
*/
|
|
151
|
+
export interface LanguageModelChatRequestOptions {
|
|
152
|
+
|
|
135
153
|
/**
|
|
136
154
|
* A human-readable message that explains why access to a language model is needed and what feature is enabled by it.
|
|
137
155
|
*/
|
|
138
156
|
justification?: string;
|
|
139
|
-
}
|
|
140
157
|
|
|
141
|
-
/**
|
|
142
|
-
* An event describing the change in the set of available language models.
|
|
143
|
-
*/
|
|
144
|
-
export interface LanguageModelChangeEvent {
|
|
145
158
|
/**
|
|
146
|
-
*
|
|
159
|
+
* Do not show the consent UI if the user has not yet granted access to the language model but fail the request instead.
|
|
147
160
|
*/
|
|
148
|
-
|
|
161
|
+
// TODO@API Revisit this, how do you do the first request?
|
|
162
|
+
silent?: boolean;
|
|
163
|
+
|
|
149
164
|
/**
|
|
150
|
-
*
|
|
165
|
+
* A set of options that control the behavior of the language model. These options are specific to the language model
|
|
166
|
+
* and need to be lookup in the respective documentation.
|
|
151
167
|
*/
|
|
152
|
-
|
|
168
|
+
modelOptions?: { [name: string]: any };
|
|
153
169
|
}
|
|
154
170
|
|
|
155
171
|
/**
|
|
@@ -158,18 +174,28 @@ declare module 'vscode' {
|
|
|
158
174
|
export namespace lm {
|
|
159
175
|
|
|
160
176
|
/**
|
|
161
|
-
*
|
|
177
|
+
* Make a chat request using a language model.
|
|
178
|
+
*
|
|
179
|
+
* - *Note 1:* language model use may be subject to access restrictions and user consent.
|
|
162
180
|
*
|
|
163
|
-
* - *Note
|
|
164
|
-
*
|
|
181
|
+
* - *Note 2:* language models are contributed by other extensions and as they evolve and change,
|
|
182
|
+
* the set of available language models may change over time. Therefore it is strongly recommend to check
|
|
183
|
+
* {@link languageModels} for aviailable values and handle missing language models gracefully.
|
|
165
184
|
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
185
|
+
* This function will return a rejected promise if making a request to the language model is not
|
|
186
|
+
* possible. Reasons for this can be:
|
|
168
187
|
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
188
|
+
* - user consent not given, see {@link LanguageModelError.NoPermissions `NoPermissions`}
|
|
189
|
+
* - model does not exist, see {@link LanguageModelError.NotFound `NotFound`}
|
|
190
|
+
* - quota limits exceeded, see {@link LanguageModelError.cause `LanguageModelError.cause`}
|
|
191
|
+
*
|
|
192
|
+
* @param languageModel A language model identifier.
|
|
193
|
+
* @param messages An array of message instances.
|
|
194
|
+
* @param options Options that control the request.
|
|
195
|
+
* @param token A cancellation token which controls the request. See {@link CancellationTokenSource} for how to create one.
|
|
196
|
+
* @returns A thenable that resolves to a {@link LanguageModelChatResponse}. The promise will reject when the request couldn't be made.
|
|
171
197
|
*/
|
|
172
|
-
export function
|
|
198
|
+
export function sendChatRequest(languageModel: string, messages: LanguageModelChatMessage[], options: LanguageModelChatRequestOptions, token: CancellationToken): Thenable<LanguageModelChatResponse>;
|
|
173
199
|
|
|
174
200
|
/**
|
|
175
201
|
* The identifiers of all language models that are currently available.
|
|
@@ -181,4 +207,40 @@ declare module 'vscode' {
|
|
|
181
207
|
*/
|
|
182
208
|
export const onDidChangeLanguageModels: Event<LanguageModelChangeEvent>;
|
|
183
209
|
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Represents extension specific information about the access to language models.
|
|
213
|
+
*/
|
|
214
|
+
export interface LanguageModelAccessInformation {
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* An event that fires when access information changes.
|
|
218
|
+
*/
|
|
219
|
+
onDidChange: Event<void>;
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Checks if a request can be made to a language model.
|
|
223
|
+
*
|
|
224
|
+
* *Note* that calling this function will not trigger a consent UI but just checks.
|
|
225
|
+
*
|
|
226
|
+
* @param languageModelId A language model identifier.
|
|
227
|
+
* @return `true` if a request can be made, `false` if not, `undefined` if the language
|
|
228
|
+
* model does not exist or consent hasn't been asked for.
|
|
229
|
+
*/
|
|
230
|
+
canSendRequest(languageModelId: string): boolean | undefined;
|
|
231
|
+
|
|
232
|
+
// TODO@API SYNC or ASYNC?
|
|
233
|
+
// TODO@API future
|
|
234
|
+
// retrieveQuota(languageModelId: string): { remaining: number; resets: Date };
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
export interface ExtensionContext {
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* An object that keeps information about how this extension can use language models.
|
|
241
|
+
*
|
|
242
|
+
* @see {@link lm.sendChatRequest}
|
|
243
|
+
*/
|
|
244
|
+
readonly languageModelAccessInformation: LanguageModelAccessInformation;
|
|
245
|
+
}
|
|
184
246
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
|
|
6
|
+
declare module 'vscode' {
|
|
7
|
+
|
|
8
|
+
export interface NotebookCellExecution {
|
|
9
|
+
/**
|
|
10
|
+
* Signal that execution has ended.
|
|
11
|
+
*
|
|
12
|
+
* @param success If true, a green check is shown on the cell status bar.
|
|
13
|
+
* If false, a red X is shown.
|
|
14
|
+
* If undefined, no check or X icon is shown.
|
|
15
|
+
* @param endTime The time that execution finished, in milliseconds in the Unix epoch.
|
|
16
|
+
* @param error Details about an error that occurred during execution if any.
|
|
17
|
+
*/
|
|
18
|
+
end(success: boolean | undefined, endTime?: number, error?: CellExecutionError): void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface CellExecutionError {
|
|
22
|
+
/**
|
|
23
|
+
* The error message.
|
|
24
|
+
*/
|
|
25
|
+
readonly message: string;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The error stack trace.
|
|
29
|
+
*/
|
|
30
|
+
readonly stack: string | undefined;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The cell resource which had the error.
|
|
34
|
+
*/
|
|
35
|
+
uri: Uri;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The location within the resource where the error occurred.
|
|
39
|
+
*/
|
|
40
|
+
readonly location: Range | undefined;
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
|
|
6
|
+
// https://github.com/microsoft/vscode/issues/206411
|
|
7
|
+
|
|
8
|
+
declare module 'vscode' {
|
|
9
|
+
|
|
10
|
+
export class TabInputTextMultiDiff {
|
|
11
|
+
|
|
12
|
+
readonly textDiffs: TabInputTextDiff[];
|
|
13
|
+
|
|
14
|
+
constructor(textDiffs: TabInputTextDiff[]);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface Tab {
|
|
18
|
+
|
|
19
|
+
readonly input: TabInputText | TabInputTextDiff | TabInputTextMultiDiff | TabInputCustom | TabInputWebview | TabInputNotebook | TabInputNotebookDiff | TabInputTerminal | unknown;
|
|
20
|
+
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -40,6 +40,8 @@ declare module 'vscode' {
|
|
|
40
40
|
*
|
|
41
41
|
* Note that this event will not fire if the executed command exits the shell, listen to
|
|
42
42
|
* {@link onDidCloseTerminal} to handle that case.
|
|
43
|
+
*
|
|
44
|
+
* @deprecated Use {@link window.onDidStartTerminalShellExecution}
|
|
43
45
|
*/
|
|
44
46
|
export const onDidExecuteTerminalCommand: Event<TerminalExecutedCommand>;
|
|
45
47
|
}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
|
|
6
|
+
declare module 'vscode' {
|
|
7
|
+
|
|
8
|
+
// https://github.com/microsoft/vscode/issues/145234
|
|
9
|
+
|
|
10
|
+
export interface TerminalShellExecution {
|
|
11
|
+
// TODO: This is circular, is that fine? Should we add a `TerminalShellExecutionEvent`?
|
|
12
|
+
/**
|
|
13
|
+
* The {@link Terminal} the command was executed in.
|
|
14
|
+
*/
|
|
15
|
+
readonly terminal: Terminal;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The full command line that was executed, including both the command and arguments.
|
|
19
|
+
* The accuracy of this value depends on the shell integration implementation:
|
|
20
|
+
*
|
|
21
|
+
* - It may be undefined or the empty string until {@link onDidEndTerminalShellExecution} is
|
|
22
|
+
* fired.
|
|
23
|
+
* - It may be inaccurate initially if the command line is pulled from the buffer directly
|
|
24
|
+
* via the [`OSC 633/133 ; A`, `B` and `C` sequences](https://code.visualstudio.com/docs/terminal/shell-integration#_vs-code-custom-sequences-osc-633-st).
|
|
25
|
+
* - It may contain line continuation characters and/or parts of the right prompt.
|
|
26
|
+
* - It may be inaccurate if the shell integration does not support command line reporting
|
|
27
|
+
* via the [`OSC 633 ; E` sequence](https://code.visualstudio.com/docs/terminal/shell-integration#_vs-code-custom-sequences-osc-633-st).
|
|
28
|
+
*/
|
|
29
|
+
readonly commandLine: string | undefined;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The working directory that was reported by the shell when this command executed. This
|
|
33
|
+
* will be a {@link Uri} if the string reported by the shell can reliably be mapped to the
|
|
34
|
+
* connected machine. This requires the shell integration to support working directory
|
|
35
|
+
* reporting via the [`OSC 633 ; P`](https://code.visualstudio.com/docs/terminal/shell-integration#_vs-code-custom-sequences-osc-633-st)
|
|
36
|
+
* or `OSC 1337 ; CurrentDir=<Cwd> ST` sequences.
|
|
37
|
+
*/
|
|
38
|
+
readonly cwd: Uri | string | undefined;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The exit code reported by the shell.
|
|
42
|
+
*/
|
|
43
|
+
readonly exitCode: Thenable<number | undefined>;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Creates a stream of raw data (including escape sequences) that is written to the
|
|
47
|
+
* terminal. This will only include data that was written after `stream` was called for the
|
|
48
|
+
* first time, ie. you must call `dataStream` immediately after the command is executed via
|
|
49
|
+
* {@link executeCommand} or {@link onDidStartTerminalShellExecution} to not miss any data.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* // Log all data written to the terminal for a command
|
|
53
|
+
* const command = term.shellIntegration.executeCommand({ commandLine: 'echo "Hello world"' });
|
|
54
|
+
* const stream = command.createDataStream();
|
|
55
|
+
* for await (const data of stream) {
|
|
56
|
+
* console.log(data);
|
|
57
|
+
* }
|
|
58
|
+
*/
|
|
59
|
+
createDataStream(): AsyncIterable<string>;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface Terminal {
|
|
63
|
+
/**
|
|
64
|
+
* An object that contains [shell integration](https://code.visualstudio.com/docs/terminal/shell-integration)-powered
|
|
65
|
+
* features for the terminal. This will always be undefined immediately after the terminal
|
|
66
|
+
* is created. Listen to {@link window.onDidActivateTerminalShellIntegration} to be notified
|
|
67
|
+
* when shell integration is activated for a terminal.
|
|
68
|
+
*
|
|
69
|
+
* Note that this object may remain undefined if shell integation never activates. For
|
|
70
|
+
* example Command Prompt does not support shell integration and a user's shell setup could
|
|
71
|
+
* conflict with the automatic shell integration activation.
|
|
72
|
+
*/
|
|
73
|
+
readonly shellIntegration: TerminalShellIntegration | undefined;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface TerminalShellIntegration {
|
|
77
|
+
// TODO: Is this fine to share the TerminalShellIntegrationChangeEvent event?
|
|
78
|
+
/**
|
|
79
|
+
* The current working directory of the terminal. This will be a {@link Uri} if the string
|
|
80
|
+
* reported by the shell can reliably be mapped to the connected machine.
|
|
81
|
+
*/
|
|
82
|
+
readonly cwd: Uri | string | undefined;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Execute a command, sending ^C as necessary to interrupt any running command if needed.
|
|
86
|
+
*
|
|
87
|
+
* @param commandLine The command line to execute, this is the exact text that will be sent
|
|
88
|
+
* to the terminal.
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* // Execute a command in a terminal immediately after being created
|
|
92
|
+
* const myTerm = window.createTerminal();
|
|
93
|
+
* window.onDidActivateTerminalShellIntegration(async ({ terminal, shellIntegration }) => {
|
|
94
|
+
* if (terminal === myTerm) {
|
|
95
|
+
* const command = shellIntegration.executeCommand('echo "Hello world"');
|
|
96
|
+
* const code = await command.exitCode;
|
|
97
|
+
* console.log(`Command exited with code ${code}`);
|
|
98
|
+
* }
|
|
99
|
+
* }));
|
|
100
|
+
* // Fallback to sendText if there is no shell integration within 3 seconds of launching
|
|
101
|
+
* setTimeout(() => {
|
|
102
|
+
* if (!myTerm.shellIntegration) {
|
|
103
|
+
* myTerm.sendText('echo "Hello world"');
|
|
104
|
+
* // Without shell integration, we can't know when the command has finished or what the
|
|
105
|
+
* // exit code was.
|
|
106
|
+
* }
|
|
107
|
+
* }, 3000);
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* // Send command to terminal that has been alive for a while
|
|
111
|
+
* const commandLine = 'echo "Hello world"';
|
|
112
|
+
* if (term.shellIntegration) {
|
|
113
|
+
* const command = term.shellIntegration.executeCommand({ commandLine });
|
|
114
|
+
* const code = await command.exitCode;
|
|
115
|
+
* console.log(`Command exited with code ${code}`);
|
|
116
|
+
* } else {
|
|
117
|
+
* term.sendText(commandLine);
|
|
118
|
+
* // Without shell integration, we can't know when the command has finished or what the
|
|
119
|
+
* // exit code was.
|
|
120
|
+
* }
|
|
121
|
+
*/
|
|
122
|
+
executeCommand(commandLine: string): TerminalShellExecution;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Execute a command, sending ^C as necessary to interrupt any running command if needed.
|
|
126
|
+
*
|
|
127
|
+
* *Note* This is not guaranteed to work as [shell integration](https://code.visualstudio.com/docs/terminal/shell-integration)
|
|
128
|
+
* must be activated. Check whether {@link TerminalShellExecution.exitCode} is rejected to
|
|
129
|
+
* verify whether it was successful.
|
|
130
|
+
*
|
|
131
|
+
* @param command A command to run.
|
|
132
|
+
* @param args Arguments to launch the executable with which will be automatically escaped
|
|
133
|
+
* based on the executable type.
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* // Execute a command in a terminal immediately after being created
|
|
137
|
+
* const myTerm = window.createTerminal();
|
|
138
|
+
* window.onDidActivateTerminalShellIntegration(async ({ terminal, shellIntegration }) => {
|
|
139
|
+
* if (terminal === myTerm) {
|
|
140
|
+
* const command = shellIntegration.executeCommand({
|
|
141
|
+
* command: 'echo',
|
|
142
|
+
* args: ['Hello world']
|
|
143
|
+
* });
|
|
144
|
+
* const code = await command.exitCode;
|
|
145
|
+
* console.log(`Command exited with code ${code}`);
|
|
146
|
+
* }
|
|
147
|
+
* }));
|
|
148
|
+
* // Fallback to sendText if there is no shell integration within 3 seconds of launching
|
|
149
|
+
* setTimeout(() => {
|
|
150
|
+
* if (!myTerm.shellIntegration) {
|
|
151
|
+
* myTerm.sendText('echo "Hello world"');
|
|
152
|
+
* // Without shell integration, we can't know when the command has finished or what the
|
|
153
|
+
* // exit code was.
|
|
154
|
+
* }
|
|
155
|
+
* }, 3000);
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* // Send command to terminal that has been alive for a while
|
|
159
|
+
* const commandLine = 'echo "Hello world"';
|
|
160
|
+
* if (term.shellIntegration) {
|
|
161
|
+
* const command = term.shellIntegration.executeCommand({
|
|
162
|
+
* command: 'echo',
|
|
163
|
+
* args: ['Hello world']
|
|
164
|
+
* });
|
|
165
|
+
* const code = await command.exitCode;
|
|
166
|
+
* console.log(`Command exited with code ${code}`);
|
|
167
|
+
* } else {
|
|
168
|
+
* term.sendText(commandLine);
|
|
169
|
+
* // Without shell integration, we can't know when the command has finished or what the
|
|
170
|
+
* // exit code was.
|
|
171
|
+
* }
|
|
172
|
+
*/
|
|
173
|
+
executeCommand(executable: string, args: string[]): TerminalShellExecution;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export interface TerminalShellIntegrationChangeEvent {
|
|
177
|
+
/**
|
|
178
|
+
* The terminal that shell integration has been activated in.
|
|
179
|
+
*/
|
|
180
|
+
readonly terminal: Terminal;
|
|
181
|
+
/**
|
|
182
|
+
* The shell integration object.
|
|
183
|
+
*/
|
|
184
|
+
readonly shellIntegration: TerminalShellIntegration;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export namespace window {
|
|
188
|
+
/**
|
|
189
|
+
* Fires when shell integration activates or one of its properties changes in a terminal.
|
|
190
|
+
*/
|
|
191
|
+
export const onDidChangeTerminalShellIntegration: Event<TerminalShellIntegrationChangeEvent>;
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* This will be fired when a terminal command is started. This event will fire only when
|
|
195
|
+
* [shell integration](https://code.visualstudio.com/docs/terminal/shell-integration) is
|
|
196
|
+
* activated for the terminal.
|
|
197
|
+
*/
|
|
198
|
+
export const onDidStartTerminalShellExecution: Event<TerminalShellExecution>;
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* This will be fired when a terminal command is ended. This event will fire only when
|
|
202
|
+
* [shell integration](https://code.visualstudio.com/docs/terminal/shell-integration) is
|
|
203
|
+
* activated for the terminal.
|
|
204
|
+
*/
|
|
205
|
+
export const onDidEndTerminalShellExecution: Event<TerminalShellExecution>;
|
|
206
|
+
}
|
|
207
|
+
}
|