@codingame/monaco-vscode-xterm-common 33.0.9 → 34.0.1
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/src/vs/platform/agentHost/common/state/protocol/common/notifications.d.ts +51 -0
- package/vscode/src/vs/platform/agentHost/common/state/protocol/common/notifications.js +9 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/agentHostPty.js +14 -13
- package/vscode/src/vs/workbench/contrib/terminal/browser/agentHostTerminalService.js +8 -8
- package/vscode/src/vs/workbench/contrib/terminal/browser/environmentVariableInfo.js +5 -5
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalActions.js +61 -61
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalInstance.js +42 -31
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalProcessManager.js +9 -3
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalResizeDebouncer.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalResizeDebouncer.js +7 -16
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalTabsList.js +5 -5
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalTooltip.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminal/common/terminalEnvironment.d.ts +38 -0
- package/vscode/src/vs/workbench/contrib/terminal/common/terminalEnvironment.js +321 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChat.d.ts +78 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChat.js +83 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollColorRegistry.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollOverlay.js +3 -3
- package/vscode/src/vs/platform/agentHost/common/state/protocol/notifications.d.ts +0 -179
- package/vscode/src/vs/platform/agentHost/common/state/protocol/notifications.js +0 -16
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
|
|
2
|
+
import { isAbsolute, join, basename } from '@codingame/monaco-vscode-api/vscode/vs/base/common/path';
|
|
3
|
+
import { URI, uriToFsPath } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
4
|
+
import { sanitizeProcessEnvironment } from '@codingame/monaco-vscode-api/vscode/vs/base/common/processes';
|
|
5
|
+
import { WindowsShellType, TerminalSettingId, ShellIntegrationTimeoutOverride } from '@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/terminal';
|
|
6
|
+
import { isWindows, isMacintosh, language, OperatingSystem } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
|
|
7
|
+
import { sanitizeCwd, escapeNonWindowsPath } from '@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/terminalEnvironment';
|
|
8
|
+
import { isString, isNumber } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
|
|
9
|
+
|
|
10
|
+
function mergeEnvironments(parent, other) {
|
|
11
|
+
if (!other) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
if (isWindows) {
|
|
15
|
+
for (const configKey in other) {
|
|
16
|
+
let actualKey = configKey;
|
|
17
|
+
for (const envKey in parent) {
|
|
18
|
+
if (configKey.toLowerCase() === envKey.toLowerCase()) {
|
|
19
|
+
actualKey = envKey;
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const value = other[configKey];
|
|
24
|
+
if (value !== undefined) {
|
|
25
|
+
_mergeEnvironmentValue(parent, actualKey, value);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
} else {
|
|
29
|
+
( Object.keys(other)).forEach(key => {
|
|
30
|
+
const value = other[key];
|
|
31
|
+
if (value !== undefined) {
|
|
32
|
+
_mergeEnvironmentValue(parent, key, value);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function _mergeEnvironmentValue(env, key, value) {
|
|
38
|
+
if (isString(value)) {
|
|
39
|
+
env[key] = value;
|
|
40
|
+
} else {
|
|
41
|
+
delete env[key];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function addTerminalEnvironmentKeys(env, version, locale, detectLocale) {
|
|
45
|
+
env["TERM_PROGRAM"] = "vscode";
|
|
46
|
+
if (version) {
|
|
47
|
+
env["TERM_PROGRAM_VERSION"] = version;
|
|
48
|
+
}
|
|
49
|
+
if (shouldSetLangEnvVariable(env, detectLocale)) {
|
|
50
|
+
env["LANG"] = getLangEnvVariable(locale);
|
|
51
|
+
}
|
|
52
|
+
env["COLORTERM"] = "truecolor";
|
|
53
|
+
}
|
|
54
|
+
function mergeNonNullKeys(env, other) {
|
|
55
|
+
if (!other) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
for (const key of ( Object.keys(other))) {
|
|
59
|
+
const value = other[key];
|
|
60
|
+
if (value !== undefined && value !== null) {
|
|
61
|
+
env[key] = value;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
async function resolveConfigurationVariables(variableResolver, env) {
|
|
66
|
+
await Promise.all(( Object.entries(env).map(async ([key, value]) => {
|
|
67
|
+
if (isString(value)) {
|
|
68
|
+
try {
|
|
69
|
+
env[key] = await variableResolver(value);
|
|
70
|
+
} catch (e) {
|
|
71
|
+
env[key] = value;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
})));
|
|
75
|
+
return env;
|
|
76
|
+
}
|
|
77
|
+
function shouldSetLangEnvVariable(env, detectLocale) {
|
|
78
|
+
if (detectLocale === "on") {
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
if (detectLocale === "auto") {
|
|
82
|
+
const lang = env["LANG"];
|
|
83
|
+
return !lang || (lang.search(/\.UTF\-8$/) === -1 && lang.search(/\.utf8$/) === -1 && lang.search(/\.euc.+/) === -1);
|
|
84
|
+
}
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
function getLangEnvVariable(locale) {
|
|
88
|
+
const parts = locale ? locale.split("-") : [];
|
|
89
|
+
const n = parts.length;
|
|
90
|
+
if (n === 0) {
|
|
91
|
+
return "en_US.UTF-8";
|
|
92
|
+
}
|
|
93
|
+
if (n === 1) {
|
|
94
|
+
const languageVariants = {
|
|
95
|
+
af: "ZA",
|
|
96
|
+
am: "ET",
|
|
97
|
+
be: "BY",
|
|
98
|
+
bg: "BG",
|
|
99
|
+
ca: "ES",
|
|
100
|
+
cs: "CZ",
|
|
101
|
+
da: "DK",
|
|
102
|
+
de: "DE",
|
|
103
|
+
el: "GR",
|
|
104
|
+
en: "US",
|
|
105
|
+
es: "ES",
|
|
106
|
+
et: "EE",
|
|
107
|
+
eu: "ES",
|
|
108
|
+
fi: "FI",
|
|
109
|
+
fr: "FR",
|
|
110
|
+
he: "IL",
|
|
111
|
+
hr: "HR",
|
|
112
|
+
hu: "HU",
|
|
113
|
+
hy: "AM",
|
|
114
|
+
is: "IS",
|
|
115
|
+
it: "IT",
|
|
116
|
+
ja: "JP",
|
|
117
|
+
kk: "KZ",
|
|
118
|
+
ko: "KR",
|
|
119
|
+
lt: "LT",
|
|
120
|
+
nl: "NL",
|
|
121
|
+
no: "NO",
|
|
122
|
+
pl: "PL",
|
|
123
|
+
pt: "BR",
|
|
124
|
+
ro: "RO",
|
|
125
|
+
ru: "RU",
|
|
126
|
+
sk: "SK",
|
|
127
|
+
sl: "SI",
|
|
128
|
+
sr: "YU",
|
|
129
|
+
sv: "SE",
|
|
130
|
+
tr: "TR",
|
|
131
|
+
uk: "UA",
|
|
132
|
+
zh: "CN"
|
|
133
|
+
};
|
|
134
|
+
if (Object.prototype.hasOwnProperty.call(languageVariants, parts[0])) {
|
|
135
|
+
parts.push(languageVariants[parts[0]]);
|
|
136
|
+
}
|
|
137
|
+
} else {
|
|
138
|
+
parts[1] = parts[1].toUpperCase();
|
|
139
|
+
}
|
|
140
|
+
return parts.join("_") + ".UTF-8";
|
|
141
|
+
}
|
|
142
|
+
async function getCwd(shell, userHome, variableResolver, root, customCwd, logService) {
|
|
143
|
+
if (shell.cwd) {
|
|
144
|
+
const unresolved = (typeof shell.cwd === "object") ? shell.cwd.fsPath : shell.cwd;
|
|
145
|
+
const resolved = await _resolveCwd(unresolved, variableResolver);
|
|
146
|
+
return sanitizeCwd(resolved || unresolved);
|
|
147
|
+
}
|
|
148
|
+
let cwd;
|
|
149
|
+
if (!shell.ignoreConfigurationCwd && customCwd) {
|
|
150
|
+
if (variableResolver) {
|
|
151
|
+
customCwd = await _resolveCwd(customCwd, variableResolver, logService);
|
|
152
|
+
}
|
|
153
|
+
if (customCwd) {
|
|
154
|
+
if (isAbsolute(customCwd)) {
|
|
155
|
+
cwd = customCwd;
|
|
156
|
+
} else if (root) {
|
|
157
|
+
cwd = join(root.fsPath, customCwd);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
if (!cwd) {
|
|
162
|
+
cwd = root ? root.fsPath : userHome || "";
|
|
163
|
+
}
|
|
164
|
+
return sanitizeCwd(cwd);
|
|
165
|
+
}
|
|
166
|
+
async function _resolveCwd(cwd, variableResolver, logService) {
|
|
167
|
+
if (variableResolver) {
|
|
168
|
+
try {
|
|
169
|
+
return await variableResolver(cwd);
|
|
170
|
+
} catch (e) {
|
|
171
|
+
logService?.error("Could not resolve terminal cwd", e);
|
|
172
|
+
return undefined;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return cwd;
|
|
176
|
+
}
|
|
177
|
+
function createVariableResolver(lastActiveWorkspace, env, configurationResolverService) {
|
|
178
|
+
if (!configurationResolverService) {
|
|
179
|
+
return undefined;
|
|
180
|
+
}
|
|
181
|
+
return str => configurationResolverService.resolveWithEnvironment(env, lastActiveWorkspace, str);
|
|
182
|
+
}
|
|
183
|
+
async function createTerminalEnvironment(
|
|
184
|
+
shellLaunchConfig,
|
|
185
|
+
envFromConfig,
|
|
186
|
+
variableResolver,
|
|
187
|
+
version,
|
|
188
|
+
detectLocale,
|
|
189
|
+
baseEnv
|
|
190
|
+
) {
|
|
191
|
+
const env = {};
|
|
192
|
+
if (shellLaunchConfig.strictEnv) {
|
|
193
|
+
mergeNonNullKeys(env, shellLaunchConfig.env);
|
|
194
|
+
} else {
|
|
195
|
+
mergeNonNullKeys(env, baseEnv);
|
|
196
|
+
const allowedEnvFromConfig = {
|
|
197
|
+
...envFromConfig
|
|
198
|
+
};
|
|
199
|
+
if (variableResolver) {
|
|
200
|
+
if (allowedEnvFromConfig) {
|
|
201
|
+
await resolveConfigurationVariables(variableResolver, allowedEnvFromConfig);
|
|
202
|
+
}
|
|
203
|
+
if (shellLaunchConfig.env) {
|
|
204
|
+
await resolveConfigurationVariables(variableResolver, shellLaunchConfig.env);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
if (isMacintosh) {
|
|
208
|
+
if (env["VSCODE_NODE_OPTIONS"]) {
|
|
209
|
+
env["NODE_OPTIONS"] = env["VSCODE_NODE_OPTIONS"];
|
|
210
|
+
delete env["VSCODE_NODE_OPTIONS"];
|
|
211
|
+
}
|
|
212
|
+
if (env["VSCODE_NODE_REPL_EXTERNAL_MODULE"]) {
|
|
213
|
+
env["NODE_REPL_EXTERNAL_MODULE"] = env["VSCODE_NODE_REPL_EXTERNAL_MODULE"];
|
|
214
|
+
delete env["VSCODE_NODE_REPL_EXTERNAL_MODULE"];
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
sanitizeProcessEnvironment(env, "VSCODE_IPC_HOOK_CLI");
|
|
218
|
+
mergeEnvironments(env, allowedEnvFromConfig);
|
|
219
|
+
mergeEnvironments(env, shellLaunchConfig.env);
|
|
220
|
+
addTerminalEnvironmentKeys(env, version, language, detectLocale);
|
|
221
|
+
}
|
|
222
|
+
return env;
|
|
223
|
+
}
|
|
224
|
+
async function preparePathForShell(
|
|
225
|
+
resource,
|
|
226
|
+
executable,
|
|
227
|
+
title,
|
|
228
|
+
shellType,
|
|
229
|
+
backend,
|
|
230
|
+
os,
|
|
231
|
+
isWindowsFrontend = isWindows
|
|
232
|
+
) {
|
|
233
|
+
let originalPath;
|
|
234
|
+
if (isString(resource)) {
|
|
235
|
+
originalPath = resource;
|
|
236
|
+
} else {
|
|
237
|
+
originalPath = resource.fsPath;
|
|
238
|
+
if (isWindowsFrontend && os !== OperatingSystem.Windows) {
|
|
239
|
+
originalPath = originalPath.replace(/\\/g, "/");
|
|
240
|
+
} else if (!isWindowsFrontend && os === OperatingSystem.Windows) {
|
|
241
|
+
originalPath = originalPath.replace(/\//g, "\\");
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
if (!executable) {
|
|
245
|
+
return originalPath;
|
|
246
|
+
}
|
|
247
|
+
const hasSpace = originalPath.includes(" ");
|
|
248
|
+
const hasParens = originalPath.includes("(") || originalPath.includes(")");
|
|
249
|
+
const pathBasename = basename(executable, ".exe");
|
|
250
|
+
const isPowerShell = pathBasename === "pwsh" || title === "pwsh" || pathBasename === "powershell" || title === "powershell";
|
|
251
|
+
if (isPowerShell && (hasSpace || originalPath.includes("'"))) {
|
|
252
|
+
return `& '${originalPath.replace(/'/g, "''")}'`;
|
|
253
|
+
}
|
|
254
|
+
if (hasParens && isPowerShell) {
|
|
255
|
+
return `& '${originalPath}'`;
|
|
256
|
+
}
|
|
257
|
+
if (os === OperatingSystem.Windows) {
|
|
258
|
+
if (shellType !== undefined) {
|
|
259
|
+
if (shellType === WindowsShellType.GitBash) {
|
|
260
|
+
return escapeNonWindowsPath(originalPath.replace(/\\/g, "/"), shellType);
|
|
261
|
+
} else if (shellType === WindowsShellType.Wsl) {
|
|
262
|
+
return backend?.getWslPath(originalPath, "win-to-unix") || originalPath;
|
|
263
|
+
} else if (hasSpace) {
|
|
264
|
+
return `"${originalPath}"`;
|
|
265
|
+
}
|
|
266
|
+
return originalPath;
|
|
267
|
+
}
|
|
268
|
+
const lowerExecutable = executable.toLowerCase();
|
|
269
|
+
if (lowerExecutable.includes("wsl") || (lowerExecutable.includes("bash.exe") && !lowerExecutable.toLowerCase().includes("git"))) {
|
|
270
|
+
return backend?.getWslPath(originalPath, "win-to-unix") || originalPath;
|
|
271
|
+
} else if (hasSpace) {
|
|
272
|
+
return `"${originalPath}"`;
|
|
273
|
+
}
|
|
274
|
+
return originalPath;
|
|
275
|
+
}
|
|
276
|
+
return escapeNonWindowsPath(originalPath, shellType);
|
|
277
|
+
}
|
|
278
|
+
function getWorkspaceForTerminal(cwd, workspaceContextService, historyService) {
|
|
279
|
+
const cwdUri = isString(cwd) ? ( URI.parse(cwd)) : cwd;
|
|
280
|
+
let workspaceFolder = cwdUri ? workspaceContextService.getWorkspaceFolder(cwdUri) ?? undefined : undefined;
|
|
281
|
+
if (!workspaceFolder) {
|
|
282
|
+
const activeWorkspaceRootUri = historyService.getLastActiveWorkspaceRoot();
|
|
283
|
+
workspaceFolder = activeWorkspaceRootUri ? workspaceContextService.getWorkspaceFolder(activeWorkspaceRootUri) ?? undefined : undefined;
|
|
284
|
+
}
|
|
285
|
+
return workspaceFolder;
|
|
286
|
+
}
|
|
287
|
+
async function getUriLabelForShell(uri, backend, shellType, os, isWindowsFrontend = isWindows) {
|
|
288
|
+
let path = isString(uri) ? uri : uri.fsPath;
|
|
289
|
+
if (os === OperatingSystem.Windows) {
|
|
290
|
+
if (shellType === WindowsShellType.Wsl) {
|
|
291
|
+
return backend.getWslPath(path.replaceAll("/", "\\"), "win-to-unix");
|
|
292
|
+
} else if (shellType === WindowsShellType.GitBash) {
|
|
293
|
+
return path.replaceAll("\\", "/").replace(/^([a-zA-Z]):\//, "/$1/");
|
|
294
|
+
} else {
|
|
295
|
+
path = isString(uri) ? path : uriToFsPath(uri, true);
|
|
296
|
+
return !isWindowsFrontend ? path.replaceAll("/", "\\") : path;
|
|
297
|
+
}
|
|
298
|
+
} else {
|
|
299
|
+
return isWindowsFrontend ? path.replaceAll("\\", "/") : path;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
function getShellIntegrationTimeout(configurationService, siInjectionEnabled, isRemote, processReadyTimestamp) {
|
|
303
|
+
const timeoutValue = configurationService.getValue(TerminalSettingId.ShellIntegrationTimeout);
|
|
304
|
+
let timeoutMs;
|
|
305
|
+
if (isNumber(timeoutValue) && timeoutValue === ShellIntegrationTimeoutOverride.DisableForTests) {
|
|
306
|
+
timeoutMs = 0;
|
|
307
|
+
} else if (!isNumber(timeoutValue) || timeoutValue < 0) {
|
|
308
|
+
timeoutMs = siInjectionEnabled ? 5000 : (isRemote ? 3000 : 2000);
|
|
309
|
+
} else if (timeoutValue === 0) {
|
|
310
|
+
timeoutMs = 0;
|
|
311
|
+
} else {
|
|
312
|
+
timeoutMs = Math.max(timeoutValue, 500);
|
|
313
|
+
}
|
|
314
|
+
if (processReadyTimestamp !== undefined) {
|
|
315
|
+
const elapsed = Date.now() - processReadyTimestamp;
|
|
316
|
+
timeoutMs = Math.max(0, timeoutMs - elapsed);
|
|
317
|
+
}
|
|
318
|
+
return timeoutMs;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
export { addTerminalEnvironmentKeys, createTerminalEnvironment, createVariableResolver, getCwd, getLangEnvVariable, getShellIntegrationTimeout, getUriLabelForShell, getWorkspaceForTerminal, mergeEnvironments, preparePathForShell, shouldSetLangEnvVariable };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { MenuId } from "@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions";
|
|
2
|
+
import { RawContextKey } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey";
|
|
3
|
+
export declare enum TerminalChatCommandId {
|
|
4
|
+
Start = "workbench.action.terminal.chat.start",
|
|
5
|
+
Close = "workbench.action.terminal.chat.close",
|
|
6
|
+
MakeRequest = "workbench.action.terminal.chat.makeRequest",
|
|
7
|
+
Cancel = "workbench.action.terminal.chat.cancel",
|
|
8
|
+
RunCommand = "workbench.action.terminal.chat.runCommand",
|
|
9
|
+
RunFirstCommand = "workbench.action.terminal.chat.runFirstCommand",
|
|
10
|
+
InsertCommand = "workbench.action.terminal.chat.insertCommand",
|
|
11
|
+
InsertFirstCommand = "workbench.action.terminal.chat.insertFirstCommand",
|
|
12
|
+
ViewInChat = "workbench.action.terminal.chat.viewInChat",
|
|
13
|
+
RerunRequest = "workbench.action.terminal.chat.rerunRequest",
|
|
14
|
+
ViewHiddenChatTerminals = "workbench.action.terminal.chat.viewHiddenChatTerminals",
|
|
15
|
+
OpenTerminalSettingsLink = "workbench.action.terminal.chat.openTerminalSettingsLink",
|
|
16
|
+
DisableSessionAutoApproval = "workbench.action.terminal.chat.disableSessionAutoApproval",
|
|
17
|
+
FocusMostRecentChatTerminalOutput = "workbench.action.terminal.chat.focusMostRecentChatTerminalOutput",
|
|
18
|
+
FocusMostRecentChatTerminal = "workbench.action.terminal.chat.focusMostRecentChatTerminal",
|
|
19
|
+
ToggleChatTerminalOutput = "workbench.action.terminal.chat.toggleChatTerminalOutput",
|
|
20
|
+
FocusChatInstanceAction = "workbench.action.terminal.chat.focusChatInstance",
|
|
21
|
+
ContinueInBackground = "workbench.action.terminal.chat.continueInBackground"
|
|
22
|
+
}
|
|
23
|
+
export declare const MENU_TERMINAL_CHAT_WIDGET_INPUT_SIDE_TOOLBAR: MenuId;
|
|
24
|
+
export declare const MENU_TERMINAL_CHAT_WIDGET_STATUS: MenuId;
|
|
25
|
+
export declare const MENU_TERMINAL_CHAT_WIDGET_TOOLBAR: MenuId;
|
|
26
|
+
export declare const MENU_CHAT_TERMINAL_TOOL_PROGRESS: MenuId;
|
|
27
|
+
export declare enum TerminalChatContextKeyStrings {
|
|
28
|
+
ChatFocus = "terminalChatFocus",
|
|
29
|
+
ChatVisible = "terminalChatVisible",
|
|
30
|
+
ChatActiveRequest = "terminalChatActiveRequest",
|
|
31
|
+
ChatInputHasText = "terminalChatInputHasText",
|
|
32
|
+
ChatAgentRegistered = "terminalChatAgentRegistered",
|
|
33
|
+
ChatResponseEditorFocused = "terminalChatResponseEditorFocused",
|
|
34
|
+
ChatResponseContainsCodeBlock = "terminalChatResponseContainsCodeBlock",
|
|
35
|
+
ChatResponseContainsMultipleCodeBlocks = "terminalChatResponseContainsMultipleCodeBlocks",
|
|
36
|
+
ChatResponseSupportsIssueReporting = "terminalChatResponseSupportsIssueReporting",
|
|
37
|
+
ChatSessionResponseVote = "terminalChatSessionResponseVote",
|
|
38
|
+
ChatHasTerminals = "hasChatTerminals",
|
|
39
|
+
ChatHasHiddenTerminals = "hasHiddenChatTerminals",
|
|
40
|
+
ChatToolHasInstance = "chatTerminalToolHasInstance",
|
|
41
|
+
ChatToolCanContinueInBackground = "chatTerminalToolCanContinueInBackground",
|
|
42
|
+
ChatToolHasOutput = "chatTerminalToolHasOutput",
|
|
43
|
+
ChatToolUsesCollapsible = "chatTerminalToolUsesCollapsible",
|
|
44
|
+
ChatToolIsHiddenTerminal = "chatTerminalToolIsHiddenTerminal",
|
|
45
|
+
ChatToolOutputExpanded = "chatTerminalToolOutputExpanded"
|
|
46
|
+
}
|
|
47
|
+
export declare namespace TerminalChatContextKeys {
|
|
48
|
+
/** Whether the chat widget is focused */
|
|
49
|
+
const focused: RawContextKey<boolean>;
|
|
50
|
+
/** Whether the chat widget is visible */
|
|
51
|
+
const visible: RawContextKey<boolean>;
|
|
52
|
+
/** Whether there is an active chat request */
|
|
53
|
+
const requestActive: RawContextKey<boolean>;
|
|
54
|
+
/** Whether the chat input has text */
|
|
55
|
+
const inputHasText: RawContextKey<boolean>;
|
|
56
|
+
/** The chat response contains at least one code block */
|
|
57
|
+
const responseContainsCodeBlock: RawContextKey<boolean>;
|
|
58
|
+
/** The chat response contains multiple code blocks */
|
|
59
|
+
const responseContainsMultipleCodeBlocks: RawContextKey<boolean>;
|
|
60
|
+
/** A chat agent exists for the terminal location */
|
|
61
|
+
const hasChatAgent: RawContextKey<boolean>;
|
|
62
|
+
/** Has terminals created via chat */
|
|
63
|
+
const hasChatTerminals: RawContextKey<boolean>;
|
|
64
|
+
/** Has hidden chat terminals */
|
|
65
|
+
const hasHiddenChatTerminals: RawContextKey<boolean>;
|
|
66
|
+
/** Whether the per-instance terminal tool progress part has a terminal instance attached */
|
|
67
|
+
const chatToolHasInstance: RawContextKey<boolean>;
|
|
68
|
+
/** Whether the continue-in-background action is available */
|
|
69
|
+
const chatToolCanContinueInBackground: RawContextKey<boolean>;
|
|
70
|
+
/** Whether terminal output is available for display */
|
|
71
|
+
const chatToolHasOutput: RawContextKey<boolean>;
|
|
72
|
+
/** Whether the terminal tool uses a collapsible wrapper */
|
|
73
|
+
const chatToolUsesCollapsible: RawContextKey<boolean>;
|
|
74
|
+
/** Whether the associated terminal is hidden from the user */
|
|
75
|
+
const chatToolIsHiddenTerminal: RawContextKey<boolean>;
|
|
76
|
+
/** Whether the terminal output section is currently expanded */
|
|
77
|
+
const chatToolOutputExpanded: RawContextKey<boolean>;
|
|
78
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
|
|
2
|
+
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
3
|
+
import { MenuId } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions';
|
|
4
|
+
import { RawContextKey } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey';
|
|
5
|
+
|
|
6
|
+
var TerminalChatCommandId;
|
|
7
|
+
(function(TerminalChatCommandId) {
|
|
8
|
+
TerminalChatCommandId["Start"] = "workbench.action.terminal.chat.start";
|
|
9
|
+
TerminalChatCommandId["Close"] = "workbench.action.terminal.chat.close";
|
|
10
|
+
TerminalChatCommandId["MakeRequest"] = "workbench.action.terminal.chat.makeRequest";
|
|
11
|
+
TerminalChatCommandId["Cancel"] = "workbench.action.terminal.chat.cancel";
|
|
12
|
+
TerminalChatCommandId["RunCommand"] = "workbench.action.terminal.chat.runCommand";
|
|
13
|
+
TerminalChatCommandId["RunFirstCommand"] = "workbench.action.terminal.chat.runFirstCommand";
|
|
14
|
+
TerminalChatCommandId["InsertCommand"] = "workbench.action.terminal.chat.insertCommand";
|
|
15
|
+
TerminalChatCommandId["InsertFirstCommand"] = "workbench.action.terminal.chat.insertFirstCommand";
|
|
16
|
+
TerminalChatCommandId["ViewInChat"] = "workbench.action.terminal.chat.viewInChat";
|
|
17
|
+
TerminalChatCommandId["RerunRequest"] = "workbench.action.terminal.chat.rerunRequest";
|
|
18
|
+
TerminalChatCommandId["ViewHiddenChatTerminals"] = "workbench.action.terminal.chat.viewHiddenChatTerminals";
|
|
19
|
+
TerminalChatCommandId["OpenTerminalSettingsLink"] = "workbench.action.terminal.chat.openTerminalSettingsLink";
|
|
20
|
+
TerminalChatCommandId["DisableSessionAutoApproval"] = "workbench.action.terminal.chat.disableSessionAutoApproval";
|
|
21
|
+
TerminalChatCommandId["FocusMostRecentChatTerminalOutput"] = "workbench.action.terminal.chat.focusMostRecentChatTerminalOutput";
|
|
22
|
+
TerminalChatCommandId["FocusMostRecentChatTerminal"] = "workbench.action.terminal.chat.focusMostRecentChatTerminal";
|
|
23
|
+
TerminalChatCommandId["ToggleChatTerminalOutput"] = "workbench.action.terminal.chat.toggleChatTerminalOutput";
|
|
24
|
+
TerminalChatCommandId["FocusChatInstanceAction"] = "workbench.action.terminal.chat.focusChatInstance";
|
|
25
|
+
TerminalChatCommandId["ContinueInBackground"] = "workbench.action.terminal.chat.continueInBackground";
|
|
26
|
+
})(TerminalChatCommandId || (TerminalChatCommandId = {}));
|
|
27
|
+
const MENU_TERMINAL_CHAT_WIDGET_INPUT_SIDE_TOOLBAR = MenuId.for("terminalChatWidget");
|
|
28
|
+
const MENU_TERMINAL_CHAT_WIDGET_STATUS = MenuId.for("terminalChatWidget.status");
|
|
29
|
+
MenuId.for("terminalChatWidget.toolbar");
|
|
30
|
+
MenuId.for("chatTerminalToolProgress");
|
|
31
|
+
var TerminalChatContextKeyStrings;
|
|
32
|
+
(function(TerminalChatContextKeyStrings) {
|
|
33
|
+
TerminalChatContextKeyStrings["ChatFocus"] = "terminalChatFocus";
|
|
34
|
+
TerminalChatContextKeyStrings["ChatVisible"] = "terminalChatVisible";
|
|
35
|
+
TerminalChatContextKeyStrings["ChatActiveRequest"] = "terminalChatActiveRequest";
|
|
36
|
+
TerminalChatContextKeyStrings["ChatInputHasText"] = "terminalChatInputHasText";
|
|
37
|
+
TerminalChatContextKeyStrings["ChatAgentRegistered"] = "terminalChatAgentRegistered";
|
|
38
|
+
TerminalChatContextKeyStrings["ChatResponseEditorFocused"] = "terminalChatResponseEditorFocused";
|
|
39
|
+
TerminalChatContextKeyStrings["ChatResponseContainsCodeBlock"] = "terminalChatResponseContainsCodeBlock";
|
|
40
|
+
TerminalChatContextKeyStrings["ChatResponseContainsMultipleCodeBlocks"] = "terminalChatResponseContainsMultipleCodeBlocks";
|
|
41
|
+
TerminalChatContextKeyStrings["ChatResponseSupportsIssueReporting"] = "terminalChatResponseSupportsIssueReporting";
|
|
42
|
+
TerminalChatContextKeyStrings["ChatSessionResponseVote"] = "terminalChatSessionResponseVote";
|
|
43
|
+
TerminalChatContextKeyStrings["ChatHasTerminals"] = "hasChatTerminals";
|
|
44
|
+
TerminalChatContextKeyStrings["ChatHasHiddenTerminals"] = "hasHiddenChatTerminals";
|
|
45
|
+
TerminalChatContextKeyStrings["ChatToolHasInstance"] = "chatTerminalToolHasInstance";
|
|
46
|
+
TerminalChatContextKeyStrings["ChatToolCanContinueInBackground"] = "chatTerminalToolCanContinueInBackground";
|
|
47
|
+
TerminalChatContextKeyStrings["ChatToolHasOutput"] = "chatTerminalToolHasOutput";
|
|
48
|
+
TerminalChatContextKeyStrings["ChatToolUsesCollapsible"] = "chatTerminalToolUsesCollapsible";
|
|
49
|
+
TerminalChatContextKeyStrings["ChatToolIsHiddenTerminal"] = "chatTerminalToolIsHiddenTerminal";
|
|
50
|
+
TerminalChatContextKeyStrings["ChatToolOutputExpanded"] = "chatTerminalToolOutputExpanded";
|
|
51
|
+
})(TerminalChatContextKeyStrings || (TerminalChatContextKeyStrings = {}));
|
|
52
|
+
var TerminalChatContextKeys;
|
|
53
|
+
(function(TerminalChatContextKeys) {
|
|
54
|
+
TerminalChatContextKeys.focused = ( new RawContextKey(TerminalChatContextKeyStrings.ChatFocus, false, ( localize(14584, "Whether the chat view is focused."))));
|
|
55
|
+
TerminalChatContextKeys.visible = ( new RawContextKey(TerminalChatContextKeyStrings.ChatVisible, false, ( localize(14585, "Whether the chat view is visible."))));
|
|
56
|
+
TerminalChatContextKeys.requestActive = ( new RawContextKey(TerminalChatContextKeyStrings.ChatActiveRequest, false, ( localize(14586, "Whether there is an active chat request."))));
|
|
57
|
+
TerminalChatContextKeys.inputHasText = ( new RawContextKey(TerminalChatContextKeyStrings.ChatInputHasText, false, ( localize(14587, "Whether the chat input has text."))));
|
|
58
|
+
TerminalChatContextKeys.responseContainsCodeBlock = ( new RawContextKey(
|
|
59
|
+
TerminalChatContextKeyStrings.ChatResponseContainsCodeBlock,
|
|
60
|
+
false,
|
|
61
|
+
( localize(14588, "Whether the chat response contains a code block."))
|
|
62
|
+
));
|
|
63
|
+
TerminalChatContextKeys.responseContainsMultipleCodeBlocks = ( new RawContextKey(
|
|
64
|
+
TerminalChatContextKeyStrings.ChatResponseContainsMultipleCodeBlocks,
|
|
65
|
+
false,
|
|
66
|
+
( localize(14589, "Whether the chat response contains multiple code blocks."))
|
|
67
|
+
));
|
|
68
|
+
TerminalChatContextKeys.hasChatAgent = ( new RawContextKey(TerminalChatContextKeyStrings.ChatAgentRegistered, false, ( localize(14590, "Whether a chat agent is registered for the terminal location."))));
|
|
69
|
+
TerminalChatContextKeys.hasChatTerminals = ( new RawContextKey(TerminalChatContextKeyStrings.ChatHasTerminals, false, ( localize(14591, "Whether there are any chat terminals."))));
|
|
70
|
+
TerminalChatContextKeys.hasHiddenChatTerminals = ( new RawContextKey(
|
|
71
|
+
TerminalChatContextKeyStrings.ChatHasHiddenTerminals,
|
|
72
|
+
false,
|
|
73
|
+
( localize(14592, "Whether there are any hidden chat terminals."))
|
|
74
|
+
));
|
|
75
|
+
TerminalChatContextKeys.chatToolHasInstance = ( new RawContextKey(TerminalChatContextKeyStrings.ChatToolHasInstance, false));
|
|
76
|
+
TerminalChatContextKeys.chatToolCanContinueInBackground = ( new RawContextKey(TerminalChatContextKeyStrings.ChatToolCanContinueInBackground, false));
|
|
77
|
+
TerminalChatContextKeys.chatToolHasOutput = ( new RawContextKey(TerminalChatContextKeyStrings.ChatToolHasOutput, false));
|
|
78
|
+
TerminalChatContextKeys.chatToolUsesCollapsible = ( new RawContextKey(TerminalChatContextKeyStrings.ChatToolUsesCollapsible, false));
|
|
79
|
+
TerminalChatContextKeys.chatToolIsHiddenTerminal = ( new RawContextKey(TerminalChatContextKeyStrings.ChatToolIsHiddenTerminal, false));
|
|
80
|
+
TerminalChatContextKeys.chatToolOutputExpanded = ( new RawContextKey(TerminalChatContextKeyStrings.ChatToolOutputExpanded, false));
|
|
81
|
+
})(TerminalChatContextKeys || (TerminalChatContextKeys = {}));
|
|
82
|
+
|
|
83
|
+
export { MENU_TERMINAL_CHAT_WIDGET_INPUT_SIDE_TOOLBAR, MENU_TERMINAL_CHAT_WIDGET_STATUS, TerminalChatCommandId, TerminalChatContextKeyStrings, TerminalChatContextKeys };
|
|
@@ -3,7 +3,7 @@ import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
|
3
3
|
import { registerColor } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colorUtils';
|
|
4
4
|
|
|
5
5
|
const terminalStickyScrollBackground = registerColor("terminalStickyScroll.background", null, ( localize(
|
|
6
|
-
|
|
6
|
+
15018,
|
|
7
7
|
"The background color of the sticky scroll overlay in the terminal."
|
|
8
8
|
)));
|
|
9
9
|
const terminalStickyScrollHoverBackground = registerColor("terminalStickyScrollHover.background", {
|
|
@@ -12,7 +12,7 @@ const terminalStickyScrollHoverBackground = registerColor("terminalStickyScrollH
|
|
|
12
12
|
hcDark: "#E48B39",
|
|
13
13
|
hcLight: "#0f4a85"
|
|
14
14
|
}, ( localize(
|
|
15
|
-
|
|
15
|
+
15019,
|
|
16
16
|
"The background color of the sticky scroll overlay in the terminal when hovered."
|
|
17
17
|
)));
|
|
18
18
|
registerColor("terminalStickyScroll.border", {
|
|
@@ -20,6 +20,6 @@ registerColor("terminalStickyScroll.border", {
|
|
|
20
20
|
light: null,
|
|
21
21
|
hcDark: "#6fc3df",
|
|
22
22
|
hcLight: "#0f4a85"
|
|
23
|
-
}, ( localize(
|
|
23
|
+
}, ( localize(15020, "The border of the sticky scroll overlay in the terminal.")));
|
|
24
24
|
|
|
25
25
|
export { terminalStickyScrollBackground, terminalStickyScrollHoverBackground };
|
|
@@ -304,19 +304,19 @@ let TerminalStickyScrollOverlay = class TerminalStickyScrollOverlay extends Disp
|
|
|
304
304
|
this._element = $(".terminal-sticky-scroll", undefined, hoverOverlay);
|
|
305
305
|
this._xterm.raw.element.parentElement.append(this._element);
|
|
306
306
|
this._register(toDisposable(() => this._element?.remove()));
|
|
307
|
-
let hoverTitle = ( localize(
|
|
307
|
+
let hoverTitle = ( localize(15021, "Navigate to Command"));
|
|
308
308
|
const scrollToPreviousCommandKeybinding = this._keybindingService.lookupKeybinding(TerminalCommandId.ScrollToPreviousCommand);
|
|
309
309
|
if (scrollToPreviousCommandKeybinding) {
|
|
310
310
|
const label = scrollToPreviousCommandKeybinding.getLabel();
|
|
311
311
|
if (label) {
|
|
312
|
-
hoverTitle += "\n" + ( localize(
|
|
312
|
+
hoverTitle += "\n" + ( localize(15022, "{0} ({1})", terminalStrings.scrollToPreviousCommand.value, label));
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
315
|
const scrollToNextCommandKeybinding = this._keybindingService.lookupKeybinding(TerminalCommandId.ScrollToNextCommand);
|
|
316
316
|
if (scrollToNextCommandKeybinding) {
|
|
317
317
|
const label = scrollToNextCommandKeybinding.getLabel();
|
|
318
318
|
if (label) {
|
|
319
|
-
hoverTitle += "\n" + ( localize(
|
|
319
|
+
hoverTitle += "\n" + ( localize(15022, "{0} ({1})", terminalStrings.scrollToNextCommand.value, label));
|
|
320
320
|
}
|
|
321
321
|
}
|
|
322
322
|
hoverOverlay.title = hoverTitle;
|