@codingame/monaco-vscode-xterm-common 25.1.1 → 26.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/src/vs/platform/terminal/common/capabilities/naiveCwdDetectionCapability.js +2 -2
- package/vscode/src/vs/platform/terminal/common/environmentVariableCollection.js +20 -16
- package/vscode/src/vs/platform/terminal/common/terminalRecorder.js +20 -11
- package/vscode/src/vs/workbench/contrib/terminal/browser/environmentVariableInfo.js +15 -21
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalActions.js +386 -301
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalContextMenu.js +11 -2
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalIconPicker.js +4 -8
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalInstance.d.ts +0 -4
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalInstance.js +793 -549
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalProcessManager.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalProcessManager.js +225 -128
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalResizeDebouncer.js +14 -5
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalStatusList.js +23 -19
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalTabsList.js +174 -126
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalTooltip.js +29 -22
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/lineDataEventAddon.js +3 -1
- package/vscode/src/vs/workbench/contrib/terminal/common/terminalEnvironment.js +112 -114
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChat.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChat.js +16 -15
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollColorRegistry.js +14 -14
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollContribution.js +33 -23
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollOverlay.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollOverlay.js +115 -84
|
@@ -63,7 +63,7 @@ import { ResourceContextKey } from '@codingame/monaco-vscode-api/vscode/vs/workb
|
|
|
63
63
|
import { SeparatorSelectOption } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/selectBox/selectBox';
|
|
64
64
|
import Severity from '@codingame/monaco-vscode-api/vscode/vs/base/common/severity';
|
|
65
65
|
|
|
66
|
-
const switchTerminalShowTabsTitle = ( localize(
|
|
66
|
+
const switchTerminalShowTabsTitle = ( localize(11827, "Show Tabs"));
|
|
67
67
|
const category = terminalStrings.actionCategory;
|
|
68
68
|
const sharedWhenClause = (() => {
|
|
69
69
|
const terminalAvailable = ( ContextKeyExpr.or(
|
|
@@ -80,48 +80,45 @@ const sharedWhenClause = (() => {
|
|
|
80
80
|
})();
|
|
81
81
|
async function getCwdForSplit(instance, folders, commandService, configService) {
|
|
82
82
|
switch (configService.config.splitCwd) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
return undefined;
|
|
95
|
-
}
|
|
96
|
-
return Promise.resolve(workspace.uri);
|
|
83
|
+
case "workspaceRoot":
|
|
84
|
+
if (folders !== undefined && commandService !== undefined) {
|
|
85
|
+
if (folders.length === 1) {
|
|
86
|
+
return folders[0].uri;
|
|
87
|
+
} else if (folders.length > 1) {
|
|
88
|
+
const options = {
|
|
89
|
+
placeHolder: ( localize(11828, "Select current working directory for new terminal"))
|
|
90
|
+
};
|
|
91
|
+
const workspace = await commandService.executeCommand(PICK_WORKSPACE_FOLDER_COMMAND_ID, [options]);
|
|
92
|
+
if (!workspace) {
|
|
93
|
+
return undefined;
|
|
97
94
|
}
|
|
95
|
+
return Promise.resolve(workspace.uri);
|
|
98
96
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
97
|
+
}
|
|
98
|
+
return "";
|
|
99
|
+
case "initial":
|
|
100
|
+
return instance.getInitialCwd();
|
|
101
|
+
case "inherited":
|
|
102
|
+
return instance.getSpeculativeCwd();
|
|
104
103
|
}
|
|
105
104
|
}
|
|
106
105
|
let TerminalLaunchHelpAction = class TerminalLaunchHelpAction extends Action {
|
|
107
106
|
constructor(_openerService) {
|
|
108
|
-
super(
|
|
107
|
+
super("workbench.action.terminal.launchHelp", ( localize(11829, "Open Help")));
|
|
109
108
|
this._openerService = _openerService;
|
|
110
109
|
}
|
|
111
110
|
async run() {
|
|
112
|
-
this._openerService.open(
|
|
111
|
+
this._openerService.open("https://aka.ms/vscode-troubleshoot-terminal-launch");
|
|
113
112
|
}
|
|
114
113
|
};
|
|
115
|
-
TerminalLaunchHelpAction = ( __decorate([
|
|
116
|
-
( __param(0, IOpenerService))
|
|
117
|
-
], TerminalLaunchHelpAction));
|
|
114
|
+
TerminalLaunchHelpAction = ( __decorate([( __param(0, IOpenerService))], TerminalLaunchHelpAction));
|
|
118
115
|
function registerTerminalAction(options) {
|
|
119
116
|
options.f1 = options.f1 ?? true;
|
|
120
117
|
options.category = options.category ?? category;
|
|
121
118
|
options.precondition = options.precondition ?? TerminalContextKeys.processSupported;
|
|
122
119
|
const runFunc = options.run;
|
|
123
120
|
const strictOptions = options;
|
|
124
|
-
delete strictOptions[
|
|
121
|
+
delete strictOptions["run"];
|
|
125
122
|
return registerAction2(class extends Action2 {
|
|
126
123
|
constructor() {
|
|
127
124
|
super(strictOptions);
|
|
@@ -136,8 +133,7 @@ function parseActionArgs(args) {
|
|
|
136
133
|
if (args.every(e => e instanceof InstanceContext)) {
|
|
137
134
|
return args;
|
|
138
135
|
}
|
|
139
|
-
}
|
|
140
|
-
else if (args instanceof InstanceContext) {
|
|
136
|
+
} else if (args instanceof InstanceContext) {
|
|
141
137
|
return [args];
|
|
142
138
|
}
|
|
143
139
|
return undefined;
|
|
@@ -149,11 +145,7 @@ function registerContextualInstanceAction(options) {
|
|
|
149
145
|
run: async (c, accessor, focusedInstanceArgs, allInstanceArgs) => {
|
|
150
146
|
let instances = getSelectedViewInstances2(accessor, allInstanceArgs);
|
|
151
147
|
if (!instances) {
|
|
152
|
-
const activeInstance = (options.activeInstanceType ===
|
|
153
|
-
? c.groupService
|
|
154
|
-
: options.activeInstanceType === 'editor' ?
|
|
155
|
-
c.editorService
|
|
156
|
-
: c.service).activeInstance;
|
|
148
|
+
const activeInstance = (options.activeInstanceType === "view" ? c.groupService : options.activeInstanceType === "editor" ? c.editorService : c.service).activeInstance;
|
|
157
149
|
if (!activeInstance) {
|
|
158
150
|
return;
|
|
159
151
|
}
|
|
@@ -213,10 +205,12 @@ function getTerminalServices(accessor) {
|
|
|
213
205
|
function registerTerminalActions() {
|
|
214
206
|
registerTerminalAction({
|
|
215
207
|
id: TerminalCommandId.NewInActiveWorkspace,
|
|
216
|
-
title: ( localize2(
|
|
217
|
-
run: async
|
|
208
|
+
title: ( localize2(11830, "Create New Terminal (In Active Workspace)")),
|
|
209
|
+
run: async c => {
|
|
218
210
|
if (c.service.isProcessSupportRegistered) {
|
|
219
|
-
const instance = await c.service.createTerminal({
|
|
211
|
+
const instance = await c.service.createTerminal({
|
|
212
|
+
location: c.configService.defaultLocation
|
|
213
|
+
});
|
|
220
214
|
if (!instance) {
|
|
221
215
|
return;
|
|
222
216
|
}
|
|
@@ -228,25 +222,29 @@ function registerTerminalActions() {
|
|
|
228
222
|
refreshTerminalActions([]);
|
|
229
223
|
registerTerminalAction({
|
|
230
224
|
id: TerminalCommandId.CreateTerminalEditor,
|
|
231
|
-
title: ( localize2(
|
|
225
|
+
title: ( localize2(11831, "Create New Terminal in Editor Area")),
|
|
232
226
|
run: async (c, _, args) => {
|
|
233
227
|
function isCreateTerminalOptions(obj) {
|
|
234
|
-
return isObject(obj) &&
|
|
228
|
+
return isObject(obj) && "location" in obj;
|
|
235
229
|
}
|
|
236
|
-
const options = isCreateTerminalOptions(args) ? args : {
|
|
230
|
+
const options = isCreateTerminalOptions(args) ? args : {
|
|
231
|
+
location: {
|
|
232
|
+
viewColumn: ACTIVE_GROUP
|
|
233
|
+
}
|
|
234
|
+
};
|
|
237
235
|
const instance = await c.service.createTerminal(options);
|
|
238
236
|
await instance.focusWhenReady();
|
|
239
237
|
}
|
|
240
238
|
});
|
|
241
239
|
registerTerminalAction({
|
|
242
240
|
id: TerminalCommandId.CreateTerminalEditorSameGroup,
|
|
243
|
-
title: ( localize2(
|
|
241
|
+
title: ( localize2(11831, "Create New Terminal in Editor Area")),
|
|
244
242
|
f1: false,
|
|
245
243
|
run: async (c, accessor, args) => {
|
|
246
244
|
const editorGroupsService = accessor.get(IEditorGroupsService);
|
|
247
245
|
const instance = await c.service.createTerminal({
|
|
248
246
|
location: {
|
|
249
|
-
viewColumn: editorGroupToColumn(editorGroupsService, editorGroupsService.activeGroup)
|
|
247
|
+
viewColumn: editorGroupToColumn(editorGroupsService, editorGroupsService.activeGroup)
|
|
250
248
|
}
|
|
251
249
|
});
|
|
252
250
|
await instance.focusWhenReady();
|
|
@@ -254,10 +252,12 @@ function registerTerminalActions() {
|
|
|
254
252
|
});
|
|
255
253
|
registerTerminalAction({
|
|
256
254
|
id: TerminalCommandId.CreateTerminalEditorSide,
|
|
257
|
-
title: ( localize2(
|
|
258
|
-
run: async
|
|
255
|
+
title: ( localize2(11832, "Create New Terminal in Editor Area to the Side")),
|
|
256
|
+
run: async c => {
|
|
259
257
|
const instance = await c.service.createTerminal({
|
|
260
|
-
location: {
|
|
258
|
+
location: {
|
|
259
|
+
viewColumn: SIDE_GROUP
|
|
260
|
+
}
|
|
261
261
|
});
|
|
262
262
|
await instance.focusWhenReady();
|
|
263
263
|
}
|
|
@@ -268,15 +268,19 @@ function registerTerminalActions() {
|
|
|
268
268
|
precondition: sharedWhenClause.terminalAvailable,
|
|
269
269
|
keybinding: {
|
|
270
270
|
primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyMod.Alt | KeyCode.Backquote,
|
|
271
|
-
mac: {
|
|
271
|
+
mac: {
|
|
272
|
+
primary: KeyMod.WinCtrl | KeyMod.Shift | KeyMod.Alt | KeyCode.Backquote
|
|
273
|
+
},
|
|
272
274
|
weight: KeybindingWeight.WorkbenchContrib
|
|
273
275
|
},
|
|
274
|
-
run: async
|
|
276
|
+
run: async c => {
|
|
275
277
|
const instance = await c.service.createTerminal({
|
|
276
278
|
location: {
|
|
277
279
|
viewColumn: AUX_WINDOW_GROUP,
|
|
278
|
-
auxiliary: {
|
|
279
|
-
|
|
280
|
+
auxiliary: {
|
|
281
|
+
compact: true
|
|
282
|
+
}
|
|
283
|
+
}
|
|
280
284
|
});
|
|
281
285
|
await instance.focusWhenReady();
|
|
282
286
|
}
|
|
@@ -285,16 +289,16 @@ function registerTerminalActions() {
|
|
|
285
289
|
id: TerminalCommandId.MoveToEditor,
|
|
286
290
|
title: terminalStrings.moveToEditor,
|
|
287
291
|
precondition: sharedWhenClause.terminalAvailable_and_opened,
|
|
288
|
-
activeInstanceType:
|
|
292
|
+
activeInstanceType: "view",
|
|
289
293
|
run: (instance, c) => c.service.moveToEditor(instance),
|
|
290
|
-
runAfter:
|
|
294
|
+
runAfter: instances => instances.at(-1)?.focus()
|
|
291
295
|
});
|
|
292
296
|
registerContextualInstanceAction({
|
|
293
297
|
id: TerminalCommandId.MoveIntoNewWindow,
|
|
294
298
|
title: terminalStrings.moveIntoNewWindow,
|
|
295
299
|
precondition: sharedWhenClause.terminalAvailable_and_opened,
|
|
296
300
|
run: (instance, c) => c.service.moveIntoNewEditor(instance),
|
|
297
|
-
runAfter:
|
|
301
|
+
runAfter: instances => instances.at(-1)?.focus()
|
|
298
302
|
});
|
|
299
303
|
registerTerminalAction({
|
|
300
304
|
id: TerminalCommandId.MoveToTerminalPanel,
|
|
@@ -309,7 +313,7 @@ function registerTerminalActions() {
|
|
|
309
313
|
});
|
|
310
314
|
registerTerminalAction({
|
|
311
315
|
id: TerminalCommandId.FocusPreviousPane,
|
|
312
|
-
title: ( localize2(
|
|
316
|
+
title: ( localize2(11833, "Focus Previous Terminal in Terminal Group")),
|
|
313
317
|
keybinding: {
|
|
314
318
|
primary: KeyMod.Alt | KeyCode.LeftArrow,
|
|
315
319
|
secondary: [KeyMod.Alt | KeyCode.UpArrow],
|
|
@@ -321,14 +325,14 @@ function registerTerminalActions() {
|
|
|
321
325
|
weight: KeybindingWeight.WorkbenchContrib + 1
|
|
322
326
|
},
|
|
323
327
|
precondition: sharedWhenClause.terminalAvailable,
|
|
324
|
-
run: async
|
|
328
|
+
run: async c => {
|
|
325
329
|
c.groupService.activeGroup?.focusPreviousPane();
|
|
326
330
|
await c.groupService.showPanel(true);
|
|
327
331
|
}
|
|
328
332
|
});
|
|
329
333
|
registerTerminalAction({
|
|
330
334
|
id: TerminalCommandId.FocusNextPane,
|
|
331
|
-
title: ( localize2(
|
|
335
|
+
title: ( localize2(11834, "Focus Next Terminal in Terminal Group")),
|
|
332
336
|
keybinding: {
|
|
333
337
|
primary: KeyMod.Alt | KeyCode.RightArrow,
|
|
334
338
|
secondary: [KeyMod.Alt | KeyCode.DownArrow],
|
|
@@ -340,56 +344,68 @@ function registerTerminalActions() {
|
|
|
340
344
|
weight: KeybindingWeight.WorkbenchContrib + 1
|
|
341
345
|
},
|
|
342
346
|
precondition: sharedWhenClause.terminalAvailable,
|
|
343
|
-
run: async
|
|
347
|
+
run: async c => {
|
|
344
348
|
c.groupService.activeGroup?.focusNextPane();
|
|
345
349
|
await c.groupService.showPanel(true);
|
|
346
350
|
}
|
|
347
351
|
});
|
|
348
352
|
registerTerminalAction({
|
|
349
353
|
id: TerminalCommandId.ResizePaneLeft,
|
|
350
|
-
title: ( localize2(
|
|
354
|
+
title: ( localize2(11835, "Resize Terminal Left")),
|
|
351
355
|
keybinding: {
|
|
352
|
-
linux: {
|
|
353
|
-
|
|
356
|
+
linux: {
|
|
357
|
+
primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.LeftArrow
|
|
358
|
+
},
|
|
359
|
+
mac: {
|
|
360
|
+
primary: KeyMod.CtrlCmd | KeyMod.WinCtrl | KeyCode.LeftArrow
|
|
361
|
+
},
|
|
354
362
|
when: TerminalContextKeys.focus,
|
|
355
363
|
weight: KeybindingWeight.WorkbenchContrib
|
|
356
364
|
},
|
|
357
365
|
precondition: sharedWhenClause.terminalAvailable,
|
|
358
|
-
run:
|
|
366
|
+
run: c => c.groupService.activeGroup?.resizePane(Direction.Left)
|
|
359
367
|
});
|
|
360
368
|
registerTerminalAction({
|
|
361
369
|
id: TerminalCommandId.ResizePaneRight,
|
|
362
|
-
title: ( localize2(
|
|
370
|
+
title: ( localize2(11836, "Resize Terminal Right")),
|
|
363
371
|
keybinding: {
|
|
364
|
-
linux: {
|
|
365
|
-
|
|
372
|
+
linux: {
|
|
373
|
+
primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.RightArrow
|
|
374
|
+
},
|
|
375
|
+
mac: {
|
|
376
|
+
primary: KeyMod.CtrlCmd | KeyMod.WinCtrl | KeyCode.RightArrow
|
|
377
|
+
},
|
|
366
378
|
when: TerminalContextKeys.focus,
|
|
367
379
|
weight: KeybindingWeight.WorkbenchContrib
|
|
368
380
|
},
|
|
369
381
|
precondition: sharedWhenClause.terminalAvailable,
|
|
370
|
-
run:
|
|
382
|
+
run: c => c.groupService.activeGroup?.resizePane(Direction.Right)
|
|
371
383
|
});
|
|
372
384
|
registerTerminalAction({
|
|
373
385
|
id: TerminalCommandId.ResizePaneUp,
|
|
374
|
-
title: ( localize2(
|
|
386
|
+
title: ( localize2(11837, "Resize Terminal Up")),
|
|
375
387
|
keybinding: {
|
|
376
|
-
mac: {
|
|
388
|
+
mac: {
|
|
389
|
+
primary: KeyMod.CtrlCmd | KeyMod.WinCtrl | KeyCode.UpArrow
|
|
390
|
+
},
|
|
377
391
|
when: TerminalContextKeys.focus,
|
|
378
392
|
weight: KeybindingWeight.WorkbenchContrib
|
|
379
393
|
},
|
|
380
394
|
precondition: sharedWhenClause.terminalAvailable,
|
|
381
|
-
run:
|
|
395
|
+
run: c => c.groupService.activeGroup?.resizePane(Direction.Up)
|
|
382
396
|
});
|
|
383
397
|
registerTerminalAction({
|
|
384
398
|
id: TerminalCommandId.ResizePaneDown,
|
|
385
|
-
title: ( localize2(
|
|
399
|
+
title: ( localize2(11838, "Resize Terminal Down")),
|
|
386
400
|
keybinding: {
|
|
387
|
-
mac: {
|
|
401
|
+
mac: {
|
|
402
|
+
primary: KeyMod.CtrlCmd | KeyMod.WinCtrl | KeyCode.DownArrow
|
|
403
|
+
},
|
|
388
404
|
when: TerminalContextKeys.focus,
|
|
389
405
|
weight: KeybindingWeight.WorkbenchContrib
|
|
390
406
|
},
|
|
391
407
|
precondition: sharedWhenClause.terminalAvailable,
|
|
392
|
-
run:
|
|
408
|
+
run: c => c.groupService.activeGroup?.resizePane(Direction.Down)
|
|
393
409
|
});
|
|
394
410
|
registerTerminalAction({
|
|
395
411
|
id: TerminalCommandId.Focus,
|
|
@@ -404,8 +420,10 @@ function registerTerminalActions() {
|
|
|
404
420
|
weight: KeybindingWeight.WorkbenchContrib
|
|
405
421
|
},
|
|
406
422
|
precondition: sharedWhenClause.terminalAvailable,
|
|
407
|
-
run: async
|
|
408
|
-
const instance = c.service.activeInstance || (await c.service.createTerminal({
|
|
423
|
+
run: async c => {
|
|
424
|
+
const instance = c.service.activeInstance || (await c.service.createTerminal({
|
|
425
|
+
location: TerminalLocation.Panel
|
|
426
|
+
}));
|
|
409
427
|
if (!instance) {
|
|
410
428
|
return;
|
|
411
429
|
}
|
|
@@ -415,18 +433,18 @@ function registerTerminalActions() {
|
|
|
415
433
|
});
|
|
416
434
|
registerTerminalAction({
|
|
417
435
|
id: TerminalCommandId.FocusTabs,
|
|
418
|
-
title: ( localize2(
|
|
436
|
+
title: ( localize2(11839, "Focus Terminal Tabs View")),
|
|
419
437
|
keybinding: {
|
|
420
438
|
primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.Backslash,
|
|
421
439
|
weight: KeybindingWeight.WorkbenchContrib,
|
|
422
|
-
when: ( ContextKeyExpr.or(TerminalContextKeys.tabsFocus, TerminalContextKeys.focus))
|
|
440
|
+
when: ( ContextKeyExpr.or(TerminalContextKeys.tabsFocus, TerminalContextKeys.focus))
|
|
423
441
|
},
|
|
424
442
|
precondition: sharedWhenClause.terminalAvailable,
|
|
425
|
-
run:
|
|
443
|
+
run: c => c.groupService.focusTabs()
|
|
426
444
|
});
|
|
427
445
|
registerTerminalAction({
|
|
428
446
|
id: TerminalCommandId.FocusNext,
|
|
429
|
-
title: ( localize2(
|
|
447
|
+
title: ( localize2(11840, "Focus Next Terminal Group")),
|
|
430
448
|
precondition: sharedWhenClause.terminalAvailable,
|
|
431
449
|
keybinding: {
|
|
432
450
|
primary: KeyMod.CtrlCmd | KeyCode.PageDown,
|
|
@@ -436,14 +454,14 @@ function registerTerminalActions() {
|
|
|
436
454
|
when: ( ContextKeyExpr.and(TerminalContextKeys.focus, ( TerminalContextKeys.editorFocus.negate()))),
|
|
437
455
|
weight: KeybindingWeight.WorkbenchContrib
|
|
438
456
|
},
|
|
439
|
-
run: async
|
|
457
|
+
run: async c => {
|
|
440
458
|
c.groupService.setActiveGroupToNext();
|
|
441
459
|
await c.groupService.showPanel(true);
|
|
442
460
|
}
|
|
443
461
|
});
|
|
444
462
|
registerTerminalAction({
|
|
445
463
|
id: TerminalCommandId.FocusPrevious,
|
|
446
|
-
title: ( localize2(
|
|
464
|
+
title: ( localize2(11841, "Focus Previous Terminal Group")),
|
|
447
465
|
precondition: sharedWhenClause.terminalAvailable,
|
|
448
466
|
keybinding: {
|
|
449
467
|
primary: KeyMod.CtrlCmd | KeyCode.PageUp,
|
|
@@ -453,27 +471,28 @@ function registerTerminalActions() {
|
|
|
453
471
|
when: ( ContextKeyExpr.and(TerminalContextKeys.focus, ( TerminalContextKeys.editorFocus.negate()))),
|
|
454
472
|
weight: KeybindingWeight.WorkbenchContrib
|
|
455
473
|
},
|
|
456
|
-
run: async
|
|
474
|
+
run: async c => {
|
|
457
475
|
c.groupService.setActiveGroupToPrevious();
|
|
458
476
|
await c.groupService.showPanel(true);
|
|
459
477
|
}
|
|
460
478
|
});
|
|
461
479
|
registerTerminalAction({
|
|
462
480
|
id: TerminalCommandId.RunSelectedText,
|
|
463
|
-
title: ( localize2(
|
|
481
|
+
title: ( localize2(11842, "Run Selected Text In Active Terminal")),
|
|
464
482
|
run: async (c, accessor) => {
|
|
465
483
|
const codeEditorService = accessor.get(ICodeEditorService);
|
|
466
484
|
const editor = codeEditorService.getActiveCodeEditor();
|
|
467
485
|
if (!editor || !editor.hasModel()) {
|
|
468
486
|
return;
|
|
469
487
|
}
|
|
470
|
-
const instance = await c.service.getActiveOrCreateInstance({
|
|
488
|
+
const instance = await c.service.getActiveOrCreateInstance({
|
|
489
|
+
acceptsInput: true
|
|
490
|
+
});
|
|
471
491
|
const selection = editor.getSelection();
|
|
472
492
|
let text;
|
|
473
493
|
if (selection.isEmpty()) {
|
|
474
494
|
text = editor.getModel().getLineContent(selection.selectionStartLineNumber).trim();
|
|
475
|
-
}
|
|
476
|
-
else {
|
|
495
|
+
} else {
|
|
477
496
|
const endOfLinePreference = isWindows ? EndOfLinePreference.LF : EndOfLinePreference.CRLF;
|
|
478
497
|
text = editor.getModel().getValueInRange(selection, endOfLinePreference);
|
|
479
498
|
}
|
|
@@ -483,7 +502,7 @@ function registerTerminalActions() {
|
|
|
483
502
|
});
|
|
484
503
|
registerTerminalAction({
|
|
485
504
|
id: TerminalCommandId.RunActiveFile,
|
|
486
|
-
title: ( localize2(
|
|
505
|
+
title: ( localize2(11843, "Run Active File In Active Terminal")),
|
|
487
506
|
precondition: sharedWhenClause.terminalAvailable,
|
|
488
507
|
run: async (c, accessor) => {
|
|
489
508
|
const codeEditorService = accessor.get(ICodeEditorService);
|
|
@@ -493,11 +512,13 @@ function registerTerminalActions() {
|
|
|
493
512
|
if (!editor || !editor.hasModel()) {
|
|
494
513
|
return;
|
|
495
514
|
}
|
|
496
|
-
const instance = await c.service.getActiveOrCreateInstance({
|
|
515
|
+
const instance = await c.service.getActiveOrCreateInstance({
|
|
516
|
+
acceptsInput: true
|
|
517
|
+
});
|
|
497
518
|
const isRemote = instance ? instance.hasRemoteAuthority : (workbenchEnvironmentService.remoteAuthority ? true : false);
|
|
498
519
|
const uri = editor.getModel().uri;
|
|
499
520
|
if ((!isRemote && uri.scheme !== Schemas.file && uri.scheme !== Schemas.vscodeUserData) || (isRemote && uri.scheme !== Schemas.vscodeRemote)) {
|
|
500
|
-
notificationService.warn(( localize(
|
|
521
|
+
notificationService.warn(( localize(11844, "Only files on disk can be run in the terminal")));
|
|
501
522
|
return;
|
|
502
523
|
}
|
|
503
524
|
await instance.sendPath(uri, true);
|
|
@@ -506,80 +527,92 @@ function registerTerminalActions() {
|
|
|
506
527
|
});
|
|
507
528
|
registerActiveXtermAction({
|
|
508
529
|
id: TerminalCommandId.ScrollDownLine,
|
|
509
|
-
title: ( localize2(
|
|
530
|
+
title: ( localize2(11845, "Scroll Down (Line)")),
|
|
510
531
|
keybinding: {
|
|
511
532
|
primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.PageDown,
|
|
512
|
-
linux: {
|
|
533
|
+
linux: {
|
|
534
|
+
primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.DownArrow
|
|
535
|
+
},
|
|
513
536
|
when: sharedWhenClause.focusInAny_and_normalBuffer,
|
|
514
537
|
weight: KeybindingWeight.WorkbenchContrib
|
|
515
538
|
},
|
|
516
539
|
precondition: sharedWhenClause.terminalAvailable,
|
|
517
|
-
run:
|
|
540
|
+
run: xterm => xterm.scrollDownLine()
|
|
518
541
|
});
|
|
519
542
|
registerActiveXtermAction({
|
|
520
543
|
id: TerminalCommandId.ScrollDownPage,
|
|
521
|
-
title: ( localize2(
|
|
544
|
+
title: ( localize2(11846, "Scroll Down (Page)")),
|
|
522
545
|
keybinding: {
|
|
523
546
|
primary: KeyMod.Shift | KeyCode.PageDown,
|
|
524
|
-
mac: {
|
|
547
|
+
mac: {
|
|
548
|
+
primary: KeyCode.PageDown
|
|
549
|
+
},
|
|
525
550
|
when: sharedWhenClause.focusInAny_and_normalBuffer,
|
|
526
551
|
weight: KeybindingWeight.WorkbenchContrib
|
|
527
552
|
},
|
|
528
553
|
precondition: sharedWhenClause.terminalAvailable,
|
|
529
|
-
run:
|
|
554
|
+
run: xterm => xterm.scrollDownPage()
|
|
530
555
|
});
|
|
531
556
|
registerActiveXtermAction({
|
|
532
557
|
id: TerminalCommandId.ScrollToBottom,
|
|
533
|
-
title: ( localize2(
|
|
558
|
+
title: ( localize2(11847, "Scroll to Bottom")),
|
|
534
559
|
keybinding: {
|
|
535
560
|
primary: KeyMod.CtrlCmd | KeyCode.End,
|
|
536
|
-
linux: {
|
|
561
|
+
linux: {
|
|
562
|
+
primary: KeyMod.Shift | KeyCode.End
|
|
563
|
+
},
|
|
537
564
|
when: sharedWhenClause.focusInAny_and_normalBuffer,
|
|
538
565
|
weight: KeybindingWeight.WorkbenchContrib
|
|
539
566
|
},
|
|
540
567
|
precondition: sharedWhenClause.terminalAvailable,
|
|
541
|
-
run:
|
|
568
|
+
run: xterm => xterm.scrollToBottom()
|
|
542
569
|
});
|
|
543
570
|
registerActiveXtermAction({
|
|
544
571
|
id: TerminalCommandId.ScrollUpLine,
|
|
545
|
-
title: ( localize2(
|
|
572
|
+
title: ( localize2(11848, "Scroll Up (Line)")),
|
|
546
573
|
keybinding: {
|
|
547
574
|
primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.PageUp,
|
|
548
|
-
linux: {
|
|
575
|
+
linux: {
|
|
576
|
+
primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.UpArrow
|
|
577
|
+
},
|
|
549
578
|
when: sharedWhenClause.focusInAny_and_normalBuffer,
|
|
550
579
|
weight: KeybindingWeight.WorkbenchContrib
|
|
551
580
|
},
|
|
552
581
|
precondition: sharedWhenClause.terminalAvailable,
|
|
553
|
-
run:
|
|
582
|
+
run: xterm => xterm.scrollUpLine()
|
|
554
583
|
});
|
|
555
584
|
registerActiveXtermAction({
|
|
556
585
|
id: TerminalCommandId.ScrollUpPage,
|
|
557
|
-
title: ( localize2(
|
|
586
|
+
title: ( localize2(11849, "Scroll Up (Page)")),
|
|
558
587
|
f1: true,
|
|
559
588
|
keybinding: {
|
|
560
589
|
primary: KeyMod.Shift | KeyCode.PageUp,
|
|
561
|
-
mac: {
|
|
590
|
+
mac: {
|
|
591
|
+
primary: KeyCode.PageUp
|
|
592
|
+
},
|
|
562
593
|
when: sharedWhenClause.focusInAny_and_normalBuffer,
|
|
563
594
|
weight: KeybindingWeight.WorkbenchContrib
|
|
564
595
|
},
|
|
565
596
|
precondition: sharedWhenClause.terminalAvailable,
|
|
566
|
-
run:
|
|
597
|
+
run: xterm => xterm.scrollUpPage()
|
|
567
598
|
});
|
|
568
599
|
registerActiveXtermAction({
|
|
569
600
|
id: TerminalCommandId.ScrollToTop,
|
|
570
|
-
title: ( localize2(
|
|
601
|
+
title: ( localize2(11850, "Scroll to Top")),
|
|
571
602
|
keybinding: {
|
|
572
603
|
primary: KeyMod.CtrlCmd | KeyCode.Home,
|
|
573
|
-
linux: {
|
|
604
|
+
linux: {
|
|
605
|
+
primary: KeyMod.Shift | KeyCode.Home
|
|
606
|
+
},
|
|
574
607
|
when: sharedWhenClause.focusInAny_and_normalBuffer,
|
|
575
608
|
weight: KeybindingWeight.WorkbenchContrib
|
|
576
609
|
},
|
|
577
610
|
precondition: sharedWhenClause.terminalAvailable,
|
|
578
|
-
run:
|
|
611
|
+
run: xterm => xterm.scrollToTop()
|
|
579
612
|
});
|
|
580
613
|
registerActiveXtermAction({
|
|
581
614
|
id: TerminalCommandId.ClearSelection,
|
|
582
|
-
title: ( localize2(
|
|
615
|
+
title: ( localize2(11851, "Clear Selection")),
|
|
583
616
|
keybinding: {
|
|
584
617
|
primary: KeyCode.Escape,
|
|
585
618
|
when: ( ContextKeyExpr.and(
|
|
@@ -590,7 +623,7 @@ function registerTerminalActions() {
|
|
|
590
623
|
weight: KeybindingWeight.WorkbenchContrib
|
|
591
624
|
},
|
|
592
625
|
precondition: sharedWhenClause.terminalAvailable,
|
|
593
|
-
run:
|
|
626
|
+
run: xterm => {
|
|
594
627
|
if (xterm.hasSelection()) {
|
|
595
628
|
xterm.clearSelection();
|
|
596
629
|
}
|
|
@@ -609,7 +642,7 @@ function registerTerminalActions() {
|
|
|
609
642
|
precondition: sharedWhenClause.terminalAvailable_and_singularSelection,
|
|
610
643
|
run: async (c, accessor, args) => {
|
|
611
644
|
let icon;
|
|
612
|
-
if (c.groupService.lastAccessedMenu ===
|
|
645
|
+
if (c.groupService.lastAccessedMenu === "inline-tab") {
|
|
613
646
|
getResourceOrActiveInstance(c, args)?.changeIcon();
|
|
614
647
|
return;
|
|
615
648
|
}
|
|
@@ -632,7 +665,7 @@ function registerTerminalActions() {
|
|
|
632
665
|
run: async (c, accessor, args) => {
|
|
633
666
|
let color;
|
|
634
667
|
let i = 0;
|
|
635
|
-
if (c.groupService.lastAccessedMenu ===
|
|
668
|
+
if (c.groupService.lastAccessedMenu === "inline-tab") {
|
|
636
669
|
getResourceOrActiveInstance(c, args)?.changeColor();
|
|
637
670
|
return;
|
|
638
671
|
}
|
|
@@ -670,7 +703,7 @@ function registerTerminalActions() {
|
|
|
670
703
|
if (!firstInstance) {
|
|
671
704
|
return;
|
|
672
705
|
}
|
|
673
|
-
if (terminalGroupService.lastAccessedMenu ===
|
|
706
|
+
if (terminalGroupService.lastAccessedMenu === "inline-tab") {
|
|
674
707
|
return renameWithQuickPick(c, accessor, firstInstance);
|
|
675
708
|
}
|
|
676
709
|
c.editingService.setEditingTerminal(firstInstance);
|
|
@@ -688,8 +721,7 @@ function registerTerminalActions() {
|
|
|
688
721
|
}
|
|
689
722
|
try {
|
|
690
723
|
await Promise.all(promises);
|
|
691
|
-
}
|
|
692
|
-
catch (e) {
|
|
724
|
+
} catch (e) {
|
|
693
725
|
notificationService.error(e);
|
|
694
726
|
}
|
|
695
727
|
}
|
|
@@ -699,12 +731,12 @@ function registerTerminalActions() {
|
|
|
699
731
|
});
|
|
700
732
|
registerActiveInstanceAction({
|
|
701
733
|
id: TerminalCommandId.DetachSession,
|
|
702
|
-
title: ( localize2(
|
|
703
|
-
run:
|
|
734
|
+
title: ( localize2(11852, "Detach Session")),
|
|
735
|
+
run: activeInstance => activeInstance.detachProcessAndDispose(TerminalExitReason.User)
|
|
704
736
|
});
|
|
705
737
|
registerTerminalAction({
|
|
706
738
|
id: TerminalCommandId.AttachToSession,
|
|
707
|
-
title: ( localize2(
|
|
739
|
+
title: ( localize2(11853, "Attach to Session")),
|
|
708
740
|
run: async (c, accessor) => {
|
|
709
741
|
const quickInputService = accessor.get(IQuickInputService);
|
|
710
742
|
const labelService = accessor.get(ILabelService);
|
|
@@ -723,18 +755,22 @@ function registerTerminalActions() {
|
|
|
723
755
|
return {
|
|
724
756
|
label: term.title,
|
|
725
757
|
detail: term.workspaceName ? `${term.workspaceName} \u2E31 ${cwdLabel}` : cwdLabel,
|
|
726
|
-
description: term.pid ? String(term.pid) :
|
|
758
|
+
description: term.pid ? String(term.pid) : "",
|
|
727
759
|
term
|
|
728
760
|
};
|
|
729
761
|
}));
|
|
730
762
|
if (items.length === 0) {
|
|
731
|
-
notificationService.info(( localize(
|
|
763
|
+
notificationService.info(( localize(11854, "There are no unattached terminals to attach to")));
|
|
732
764
|
return;
|
|
733
765
|
}
|
|
734
|
-
const selected = await quickInputService.pick(items, {
|
|
766
|
+
const selected = await quickInputService.pick(items, {
|
|
767
|
+
canPickMany: false
|
|
768
|
+
});
|
|
735
769
|
if (selected) {
|
|
736
770
|
const instance = await c.service.createTerminal({
|
|
737
|
-
config: {
|
|
771
|
+
config: {
|
|
772
|
+
attachPersistentProcess: selected.term
|
|
773
|
+
}
|
|
738
774
|
});
|
|
739
775
|
c.service.setActiveInstance(instance);
|
|
740
776
|
await focusActiveTerminal(instance, c);
|
|
@@ -751,23 +787,20 @@ function registerTerminalActions() {
|
|
|
751
787
|
},
|
|
752
788
|
precondition: sharedWhenClause.terminalAvailable,
|
|
753
789
|
icon: Codicon.arrowUp,
|
|
754
|
-
menu: [
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
}))),
|
|
769
|
-
],
|
|
770
|
-
run: (activeInstance) => activeInstance.xterm?.markTracker.scrollToPreviousMark(undefined, undefined, ( activeInstance.capabilities.has(TerminalCapability.CommandDetection)))
|
|
790
|
+
menu: [{
|
|
791
|
+
id: MenuId.ViewTitle,
|
|
792
|
+
group: "navigation",
|
|
793
|
+
order: 4,
|
|
794
|
+
when: ( ContextKeyExpr.equals("view", TERMINAL_VIEW_ID)),
|
|
795
|
+
isHiddenByDefault: true
|
|
796
|
+
}, ...( [MenuId.EditorTitle, MenuId.CompactWindowEditorTitle].map(id => ({
|
|
797
|
+
id,
|
|
798
|
+
group: "1_shellIntegration",
|
|
799
|
+
order: 4,
|
|
800
|
+
when: ( ResourceContextKey.Scheme.isEqualTo(Schemas.vscodeTerminal)),
|
|
801
|
+
isHiddenByDefault: true
|
|
802
|
+
})))],
|
|
803
|
+
run: activeInstance => activeInstance.xterm?.markTracker.scrollToPreviousMark(undefined, undefined, ( activeInstance.capabilities.has(TerminalCapability.CommandDetection)))
|
|
771
804
|
});
|
|
772
805
|
registerActiveInstanceAction({
|
|
773
806
|
id: TerminalCommandId.ScrollToNextCommand,
|
|
@@ -779,58 +812,55 @@ function registerTerminalActions() {
|
|
|
779
812
|
},
|
|
780
813
|
precondition: sharedWhenClause.terminalAvailable,
|
|
781
814
|
icon: Codicon.arrowDown,
|
|
782
|
-
menu: [
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
}))),
|
|
797
|
-
],
|
|
798
|
-
run: (activeInstance) => {
|
|
815
|
+
menu: [{
|
|
816
|
+
id: MenuId.ViewTitle,
|
|
817
|
+
group: "navigation",
|
|
818
|
+
order: 5,
|
|
819
|
+
when: ( ContextKeyExpr.equals("view", TERMINAL_VIEW_ID)),
|
|
820
|
+
isHiddenByDefault: true
|
|
821
|
+
}, ...( [MenuId.EditorTitle, MenuId.CompactWindowEditorTitle].map(id => ({
|
|
822
|
+
id,
|
|
823
|
+
group: "1_shellIntegration",
|
|
824
|
+
order: 5,
|
|
825
|
+
when: ( ResourceContextKey.Scheme.isEqualTo(Schemas.vscodeTerminal)),
|
|
826
|
+
isHiddenByDefault: true
|
|
827
|
+
})))],
|
|
828
|
+
run: activeInstance => {
|
|
799
829
|
activeInstance.xterm?.markTracker.scrollToNextMark();
|
|
800
830
|
activeInstance.focus();
|
|
801
831
|
}
|
|
802
832
|
});
|
|
803
833
|
registerActiveInstanceAction({
|
|
804
834
|
id: TerminalCommandId.SelectToPreviousCommand,
|
|
805
|
-
title: ( localize2(
|
|
835
|
+
title: ( localize2(11855, "Select to Previous Command")),
|
|
806
836
|
keybinding: {
|
|
807
837
|
primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.UpArrow,
|
|
808
838
|
when: TerminalContextKeys.focus,
|
|
809
839
|
weight: KeybindingWeight.WorkbenchContrib
|
|
810
840
|
},
|
|
811
841
|
precondition: sharedWhenClause.terminalAvailable,
|
|
812
|
-
run:
|
|
842
|
+
run: activeInstance => {
|
|
813
843
|
activeInstance.xterm?.markTracker.selectToPreviousMark();
|
|
814
844
|
activeInstance.focus();
|
|
815
845
|
}
|
|
816
846
|
});
|
|
817
847
|
registerActiveInstanceAction({
|
|
818
848
|
id: TerminalCommandId.SelectToNextCommand,
|
|
819
|
-
title: ( localize2(
|
|
849
|
+
title: ( localize2(11856, "Select to Next Command")),
|
|
820
850
|
keybinding: {
|
|
821
851
|
primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.DownArrow,
|
|
822
852
|
when: TerminalContextKeys.focus,
|
|
823
853
|
weight: KeybindingWeight.WorkbenchContrib
|
|
824
854
|
},
|
|
825
855
|
precondition: sharedWhenClause.terminalAvailable,
|
|
826
|
-
run:
|
|
856
|
+
run: activeInstance => {
|
|
827
857
|
activeInstance.xterm?.markTracker.selectToNextMark();
|
|
828
858
|
activeInstance.focus();
|
|
829
859
|
}
|
|
830
860
|
});
|
|
831
861
|
registerActiveXtermAction({
|
|
832
862
|
id: TerminalCommandId.SelectToPreviousLine,
|
|
833
|
-
title: ( localize2(
|
|
863
|
+
title: ( localize2(11857, "Select to Previous Line")),
|
|
834
864
|
precondition: sharedWhenClause.terminalAvailable,
|
|
835
865
|
run: async (xterm, _, instance) => {
|
|
836
866
|
xterm.markTracker.selectToPreviousLine();
|
|
@@ -839,7 +869,7 @@ function registerTerminalActions() {
|
|
|
839
869
|
});
|
|
840
870
|
registerActiveXtermAction({
|
|
841
871
|
id: TerminalCommandId.SelectToNextLine,
|
|
842
|
-
title: ( localize2(
|
|
872
|
+
title: ( localize2(11858, "Select to Next Line")),
|
|
843
873
|
precondition: sharedWhenClause.terminalAvailable,
|
|
844
874
|
run: async (xterm, _, instance) => {
|
|
845
875
|
xterm.markTracker.selectToNextLine();
|
|
@@ -852,22 +882,24 @@ function registerTerminalActions() {
|
|
|
852
882
|
metadata: {
|
|
853
883
|
description: terminalStrings.newWithCwd.value,
|
|
854
884
|
args: [{
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
},
|
|
885
|
+
name: "args",
|
|
886
|
+
schema: {
|
|
887
|
+
type: "object",
|
|
888
|
+
required: ["cwd"],
|
|
889
|
+
properties: {
|
|
890
|
+
cwd: {
|
|
891
|
+
description: ( localize(11859, "The directory to start the terminal at")),
|
|
892
|
+
type: "string"
|
|
893
|
+
}
|
|
865
894
|
}
|
|
866
|
-
}
|
|
895
|
+
}
|
|
896
|
+
}]
|
|
867
897
|
},
|
|
868
898
|
run: async (c, _, args) => {
|
|
869
899
|
const cwd = args ? toOptionalString(args.cwd) : undefined;
|
|
870
|
-
const instance = await c.service.createTerminal({
|
|
900
|
+
const instance = await c.service.createTerminal({
|
|
901
|
+
cwd
|
|
902
|
+
});
|
|
871
903
|
if (!instance) {
|
|
872
904
|
return;
|
|
873
905
|
}
|
|
@@ -881,19 +913,19 @@ function registerTerminalActions() {
|
|
|
881
913
|
metadata: {
|
|
882
914
|
description: terminalStrings.renameWithArgs.value,
|
|
883
915
|
args: [{
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
}
|
|
916
|
+
name: "args",
|
|
917
|
+
schema: {
|
|
918
|
+
type: "object",
|
|
919
|
+
required: ["name"],
|
|
920
|
+
properties: {
|
|
921
|
+
name: {
|
|
922
|
+
description: ( localize(11860, "The new name for the terminal")),
|
|
923
|
+
type: "string",
|
|
924
|
+
minLength: 1
|
|
894
925
|
}
|
|
895
926
|
}
|
|
896
|
-
}
|
|
927
|
+
}
|
|
928
|
+
}]
|
|
897
929
|
},
|
|
898
930
|
precondition: sharedWhenClause.terminalAvailable,
|
|
899
931
|
f1: false,
|
|
@@ -901,7 +933,7 @@ function registerTerminalActions() {
|
|
|
901
933
|
const notificationService = accessor.get(INotificationService);
|
|
902
934
|
const name = args ? toOptionalString(args.name) : undefined;
|
|
903
935
|
if (!name) {
|
|
904
|
-
notificationService.warn(( localize(
|
|
936
|
+
notificationService.warn(( localize(11861, "No name argument provided")));
|
|
905
937
|
return;
|
|
906
938
|
}
|
|
907
939
|
activeInstance.rename(name);
|
|
@@ -909,8 +941,8 @@ function registerTerminalActions() {
|
|
|
909
941
|
});
|
|
910
942
|
registerActiveInstanceAction({
|
|
911
943
|
id: TerminalCommandId.Relaunch,
|
|
912
|
-
title: ( localize2(
|
|
913
|
-
run:
|
|
944
|
+
title: ( localize2(11862, "Relaunch Active Terminal")),
|
|
945
|
+
run: activeInstance => activeInstance.relaunch()
|
|
914
946
|
});
|
|
915
947
|
registerTerminalAction({
|
|
916
948
|
id: TerminalCommandId.Split,
|
|
@@ -938,11 +970,22 @@ function registerTerminalActions() {
|
|
|
938
970
|
if (!activeInstance) {
|
|
939
971
|
return;
|
|
940
972
|
}
|
|
941
|
-
const cwd = await getCwdForSplit(
|
|
973
|
+
const cwd = await getCwdForSplit(
|
|
974
|
+
activeInstance,
|
|
975
|
+
workspaceContextService.getWorkspace().folders,
|
|
976
|
+
commandService,
|
|
977
|
+
c.configService
|
|
978
|
+
);
|
|
942
979
|
if (cwd === undefined) {
|
|
943
980
|
return;
|
|
944
981
|
}
|
|
945
|
-
const instance = await c.service.createTerminal({
|
|
982
|
+
const instance = await c.service.createTerminal({
|
|
983
|
+
location: {
|
|
984
|
+
parentTerminal: activeInstance
|
|
985
|
+
},
|
|
986
|
+
config: options?.config,
|
|
987
|
+
cwd
|
|
988
|
+
});
|
|
946
989
|
await focusActiveTerminal(instance, c);
|
|
947
990
|
}
|
|
948
991
|
});
|
|
@@ -965,7 +1008,11 @@ function registerTerminalActions() {
|
|
|
965
1008
|
const promises = [];
|
|
966
1009
|
for (const t of instances) {
|
|
967
1010
|
promises.push((async () => {
|
|
968
|
-
await c.service.createTerminal({
|
|
1011
|
+
await c.service.createTerminal({
|
|
1012
|
+
location: {
|
|
1013
|
+
parentTerminal: t
|
|
1014
|
+
}
|
|
1015
|
+
});
|
|
969
1016
|
await c.groupService.showPanel(true);
|
|
970
1017
|
})());
|
|
971
1018
|
}
|
|
@@ -986,7 +1033,7 @@ function registerTerminalActions() {
|
|
|
986
1033
|
});
|
|
987
1034
|
registerTerminalAction({
|
|
988
1035
|
id: TerminalCommandId.JoinActiveTab,
|
|
989
|
-
title: ( localize2(
|
|
1036
|
+
title: ( localize2(11863, "Join Terminals")),
|
|
990
1037
|
precondition: ( ContextKeyExpr.and(sharedWhenClause.terminalAvailable, ( TerminalContextKeys.tabsSingularSelection.toNegated()))),
|
|
991
1038
|
run: async (c, accessor) => {
|
|
992
1039
|
const instances = getSelectedViewInstances(accessor);
|
|
@@ -997,7 +1044,7 @@ function registerTerminalActions() {
|
|
|
997
1044
|
});
|
|
998
1045
|
registerTerminalAction({
|
|
999
1046
|
id: TerminalCommandId.Join,
|
|
1000
|
-
title: ( localize2(
|
|
1047
|
+
title: ( localize2(11864, "Join Terminals...")),
|
|
1001
1048
|
precondition: sharedWhenClause.terminalAvailable,
|
|
1002
1049
|
run: async (c, accessor) => {
|
|
1003
1050
|
const themeService = accessor.get(IThemeService);
|
|
@@ -1005,7 +1052,7 @@ function registerTerminalActions() {
|
|
|
1005
1052
|
const quickInputService = accessor.get(IQuickInputService);
|
|
1006
1053
|
const picks = [];
|
|
1007
1054
|
if (c.groupService.instances.length <= 1) {
|
|
1008
|
-
notificationService.warn(( localize(
|
|
1055
|
+
notificationService.warn(( localize(11865, "Insufficient terminals for the join action")));
|
|
1009
1056
|
return;
|
|
1010
1057
|
}
|
|
1011
1058
|
const otherInstances = c.groupService.instances.filter(i => i.instanceId !== c.groupService.activeInstance?.instanceId);
|
|
@@ -1031,7 +1078,7 @@ function registerTerminalActions() {
|
|
|
1031
1078
|
}
|
|
1032
1079
|
}
|
|
1033
1080
|
if (picks.length === 0) {
|
|
1034
|
-
notificationService.warn(( localize(
|
|
1081
|
+
notificationService.warn(( localize(11866, "All terminals are joined already")));
|
|
1035
1082
|
return;
|
|
1036
1083
|
}
|
|
1037
1084
|
const result = await quickInputService.pick(picks, {});
|
|
@@ -1042,9 +1089,13 @@ function registerTerminalActions() {
|
|
|
1042
1089
|
});
|
|
1043
1090
|
registerActiveInstanceAction({
|
|
1044
1091
|
id: TerminalCommandId.SplitInActiveWorkspace,
|
|
1045
|
-
title: ( localize2(
|
|
1092
|
+
title: ( localize2(11867, "Split Terminal (In Active Workspace)")),
|
|
1046
1093
|
run: async (instance, c) => {
|
|
1047
|
-
const newInstance = await c.service.createTerminal({
|
|
1094
|
+
const newInstance = await c.service.createTerminal({
|
|
1095
|
+
location: {
|
|
1096
|
+
parentTerminal: instance
|
|
1097
|
+
}
|
|
1098
|
+
});
|
|
1048
1099
|
if (newInstance?.target !== TerminalLocation.Editor) {
|
|
1049
1100
|
await c.groupService.showPanel(true);
|
|
1050
1101
|
}
|
|
@@ -1052,19 +1103,21 @@ function registerTerminalActions() {
|
|
|
1052
1103
|
});
|
|
1053
1104
|
registerActiveXtermAction({
|
|
1054
1105
|
id: TerminalCommandId.SelectAll,
|
|
1055
|
-
title: ( localize2(
|
|
1106
|
+
title: ( localize2(11868, "Select All")),
|
|
1056
1107
|
precondition: sharedWhenClause.terminalAvailable,
|
|
1057
1108
|
keybinding: [{
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1109
|
+
primary: 0,
|
|
1110
|
+
mac: {
|
|
1111
|
+
primary: KeyMod.CtrlCmd | KeyCode.KeyA
|
|
1112
|
+
},
|
|
1113
|
+
weight: KeybindingWeight.WorkbenchContrib,
|
|
1114
|
+
when: TerminalContextKeys.focusInAny
|
|
1115
|
+
}],
|
|
1116
|
+
run: xterm => xterm.selectAll()
|
|
1064
1117
|
});
|
|
1065
1118
|
registerTerminalAction({
|
|
1066
1119
|
id: TerminalCommandId.New,
|
|
1067
|
-
title: ( localize2(
|
|
1120
|
+
title: ( localize2(11869, "Create New Terminal")),
|
|
1068
1121
|
precondition: ( ContextKeyExpr.or(
|
|
1069
1122
|
TerminalContextKeys.processSupported,
|
|
1070
1123
|
TerminalContextKeys.webExtensionContributedProfile
|
|
@@ -1072,7 +1125,9 @@ function registerTerminalActions() {
|
|
|
1072
1125
|
icon: newTerminalIcon,
|
|
1073
1126
|
keybinding: {
|
|
1074
1127
|
primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.Backquote,
|
|
1075
|
-
mac: {
|
|
1128
|
+
mac: {
|
|
1129
|
+
primary: KeyMod.WinCtrl | KeyMod.Shift | KeyCode.Backquote
|
|
1130
|
+
},
|
|
1076
1131
|
weight: KeybindingWeight.WorkbenchContrib
|
|
1077
1132
|
},
|
|
1078
1133
|
run: async (c, accessor, args) => {
|
|
@@ -1082,19 +1137,24 @@ function registerTerminalActions() {
|
|
|
1082
1137
|
const editorGroupsService = accessor.get(IEditorGroupsService);
|
|
1083
1138
|
const folders = workspaceContextService.getWorkspace().folders;
|
|
1084
1139
|
if (eventOrOptions && isMouseEvent(eventOrOptions) && (eventOrOptions.altKey || eventOrOptions.ctrlKey)) {
|
|
1085
|
-
await c.service.createTerminal({
|
|
1140
|
+
await c.service.createTerminal({
|
|
1141
|
+
location: {
|
|
1142
|
+
splitActiveTerminal: true
|
|
1143
|
+
}
|
|
1144
|
+
});
|
|
1086
1145
|
return;
|
|
1087
1146
|
}
|
|
1088
1147
|
if (c.service.isProcessSupportRegistered) {
|
|
1089
1148
|
eventOrOptions = !eventOrOptions || isMouseEvent(eventOrOptions) ? {} : eventOrOptions;
|
|
1090
1149
|
if (isAuxiliaryWindow(getActiveWindow()) && !eventOrOptions.location) {
|
|
1091
|
-
eventOrOptions.location = {
|
|
1150
|
+
eventOrOptions.location = {
|
|
1151
|
+
viewColumn: editorGroupToColumn(editorGroupsService, editorGroupsService.activeGroup)
|
|
1152
|
+
};
|
|
1092
1153
|
}
|
|
1093
1154
|
let instance;
|
|
1094
1155
|
if (folders.length <= 1) {
|
|
1095
1156
|
instance = await c.service.createTerminal(eventOrOptions);
|
|
1096
|
-
}
|
|
1097
|
-
else {
|
|
1157
|
+
} else {
|
|
1098
1158
|
const cwd = (await pickTerminalCwd(accessor))?.cwd;
|
|
1099
1159
|
if (!cwd) {
|
|
1100
1160
|
return;
|
|
@@ -1104,12 +1164,10 @@ function registerTerminalActions() {
|
|
|
1104
1164
|
}
|
|
1105
1165
|
c.service.setActiveInstance(instance);
|
|
1106
1166
|
await focusActiveTerminal(instance, c);
|
|
1107
|
-
}
|
|
1108
|
-
else {
|
|
1167
|
+
} else {
|
|
1109
1168
|
if (c.profileService.contributedProfiles.length > 0) {
|
|
1110
1169
|
commandService.executeCommand(TerminalCommandId.NewWithProfile);
|
|
1111
|
-
}
|
|
1112
|
-
else {
|
|
1170
|
+
} else {
|
|
1113
1171
|
commandService.executeCommand(TerminalCommandId.Toggle);
|
|
1114
1172
|
}
|
|
1115
1173
|
}
|
|
@@ -1126,24 +1184,24 @@ function registerTerminalActions() {
|
|
|
1126
1184
|
}
|
|
1127
1185
|
registerTerminalAction({
|
|
1128
1186
|
id: TerminalCommandId.Kill,
|
|
1129
|
-
title: ( localize2(
|
|
1187
|
+
title: ( localize2(11870, "Kill the Active Terminal Instance")),
|
|
1130
1188
|
precondition: ( ContextKeyExpr.or(sharedWhenClause.terminalAvailable, TerminalContextKeys.isOpen)),
|
|
1131
1189
|
icon: killTerminalIcon,
|
|
1132
|
-
run: async
|
|
1190
|
+
run: async c => killInstance(c, c.groupService.activeInstance)
|
|
1133
1191
|
});
|
|
1134
1192
|
registerTerminalAction({
|
|
1135
1193
|
id: TerminalCommandId.KillViewOrEditor,
|
|
1136
1194
|
title: terminalStrings.kill,
|
|
1137
1195
|
f1: false,
|
|
1138
1196
|
precondition: ( ContextKeyExpr.or(sharedWhenClause.terminalAvailable, TerminalContextKeys.isOpen)),
|
|
1139
|
-
run: async
|
|
1197
|
+
run: async c => killInstance(c, c.service.activeInstance)
|
|
1140
1198
|
});
|
|
1141
1199
|
registerTerminalAction({
|
|
1142
1200
|
id: TerminalCommandId.KillAll,
|
|
1143
|
-
title: ( localize2(
|
|
1201
|
+
title: ( localize2(11871, "Kill All Terminals")),
|
|
1144
1202
|
precondition: ( ContextKeyExpr.or(sharedWhenClause.terminalAvailable, TerminalContextKeys.isOpen)),
|
|
1145
1203
|
icon: Codicon.trash,
|
|
1146
|
-
run: async
|
|
1204
|
+
run: async c => {
|
|
1147
1205
|
const disposePromises = [];
|
|
1148
1206
|
for (const instance of c.service.instances) {
|
|
1149
1207
|
disposePromises.push(c.service.safeDisposeTerminal(instance));
|
|
@@ -1153,11 +1211,14 @@ function registerTerminalActions() {
|
|
|
1153
1211
|
});
|
|
1154
1212
|
registerTerminalAction({
|
|
1155
1213
|
id: TerminalCommandId.KillEditor,
|
|
1156
|
-
title: ( localize2(
|
|
1214
|
+
title: ( localize2(11872, "Kill the Active Terminal in Editor Area")),
|
|
1157
1215
|
precondition: sharedWhenClause.terminalAvailable,
|
|
1158
1216
|
keybinding: {
|
|
1159
1217
|
primary: KeyMod.CtrlCmd | KeyCode.KeyW,
|
|
1160
|
-
win: {
|
|
1218
|
+
win: {
|
|
1219
|
+
primary: KeyMod.CtrlCmd | KeyCode.F4,
|
|
1220
|
+
secondary: [KeyMod.CtrlCmd | KeyCode.KeyW]
|
|
1221
|
+
},
|
|
1161
1222
|
weight: KeybindingWeight.WorkbenchContrib,
|
|
1162
1223
|
when: ( ContextKeyExpr.and(TerminalContextKeys.focus, TerminalContextKeys.editorFocus))
|
|
1163
1224
|
},
|
|
@@ -1195,36 +1256,41 @@ function registerTerminalActions() {
|
|
|
1195
1256
|
weight: KeybindingWeight.WorkbenchContrib,
|
|
1196
1257
|
when: ( ContextKeyExpr.or(TerminalContextKeys.tabsFocus, TerminalContextKeys.focus))
|
|
1197
1258
|
},
|
|
1198
|
-
run:
|
|
1259
|
+
run: c => c.groupService.focusHover()
|
|
1199
1260
|
});
|
|
1200
1261
|
registerActiveInstanceAction({
|
|
1201
1262
|
id: TerminalCommandId.Clear,
|
|
1202
|
-
title: ( localize2(
|
|
1263
|
+
title: ( localize2(11873, "Clear")),
|
|
1203
1264
|
precondition: sharedWhenClause.terminalAvailable,
|
|
1204
1265
|
keybinding: [{
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1266
|
+
primary: 0,
|
|
1267
|
+
mac: {
|
|
1268
|
+
primary: KeyMod.CtrlCmd | KeyCode.KeyK
|
|
1269
|
+
},
|
|
1270
|
+
weight: KeybindingWeight.WorkbenchContrib + 1,
|
|
1271
|
+
when: ( ContextKeyExpr.or(( ContextKeyExpr.and(TerminalContextKeys.focus, ( CONTEXT_ACCESSIBILITY_MODE_ENABLED.negate()))), ( ContextKeyExpr.and(CONTEXT_ACCESSIBILITY_MODE_ENABLED, accessibleViewIsShown, ( accessibleViewCurrentProviderId.isEqualTo(AccessibleViewProviderId.Terminal))))))
|
|
1272
|
+
}],
|
|
1273
|
+
run: activeInstance => activeInstance.clearBuffer()
|
|
1211
1274
|
});
|
|
1212
1275
|
registerTerminalAction({
|
|
1213
1276
|
id: TerminalCommandId.SelectDefaultProfile,
|
|
1214
|
-
title: ( localize2(
|
|
1215
|
-
run:
|
|
1277
|
+
title: ( localize2(11874, "Select Default Profile")),
|
|
1278
|
+
run: c => c.service.showProfileQuickPick("setDefault")
|
|
1216
1279
|
});
|
|
1217
1280
|
registerTerminalAction({
|
|
1218
1281
|
id: TerminalCommandId.ConfigureTerminalSettings,
|
|
1219
|
-
title: ( localize2(
|
|
1282
|
+
title: ( localize2(11875, "Configure Terminal Settings")),
|
|
1220
1283
|
precondition: sharedWhenClause.terminalAvailable,
|
|
1221
|
-
run: (c, accessor) => accessor.get(IPreferencesService).openSettings({
|
|
1284
|
+
run: (c, accessor) => accessor.get(IPreferencesService).openSettings({
|
|
1285
|
+
jsonEditor: false,
|
|
1286
|
+
query: "@feature:terminal"
|
|
1287
|
+
})
|
|
1222
1288
|
});
|
|
1223
1289
|
registerActiveInstanceAction({
|
|
1224
1290
|
id: TerminalCommandId.SetDimensions,
|
|
1225
|
-
title: ( localize2(
|
|
1291
|
+
title: ( localize2(11876, "Set Fixed Dimensions")),
|
|
1226
1292
|
precondition: sharedWhenClause.terminalAvailable_and_opened,
|
|
1227
|
-
run:
|
|
1293
|
+
run: activeInstance => activeInstance.setFixedDimensions()
|
|
1228
1294
|
});
|
|
1229
1295
|
registerContextualInstanceAction({
|
|
1230
1296
|
id: TerminalCommandId.SizeToContentWidth,
|
|
@@ -1235,11 +1301,11 @@ function registerTerminalActions() {
|
|
|
1235
1301
|
weight: KeybindingWeight.WorkbenchContrib,
|
|
1236
1302
|
when: TerminalContextKeys.focus
|
|
1237
1303
|
},
|
|
1238
|
-
run:
|
|
1304
|
+
run: instance => instance.toggleSizeToContentWidth()
|
|
1239
1305
|
});
|
|
1240
1306
|
registerTerminalAction({
|
|
1241
1307
|
id: TerminalCommandId.SwitchTerminal,
|
|
1242
|
-
title: ( localize2(
|
|
1308
|
+
title: ( localize2(11877, "Switch Terminal")),
|
|
1243
1309
|
precondition: sharedWhenClause.terminalAvailable,
|
|
1244
1310
|
run: async (c, accessor, args) => {
|
|
1245
1311
|
const item = toOptionalString(args);
|
|
@@ -1269,12 +1335,10 @@ function registerTerminalActions() {
|
|
|
1269
1335
|
config: profile
|
|
1270
1336
|
});
|
|
1271
1337
|
c.service.setActiveInstance(instance);
|
|
1272
|
-
}
|
|
1273
|
-
else {
|
|
1338
|
+
} else {
|
|
1274
1339
|
console.warn(`No profile with name "${profileSelection}"`);
|
|
1275
1340
|
}
|
|
1276
|
-
}
|
|
1277
|
-
else {
|
|
1341
|
+
} else {
|
|
1278
1342
|
console.warn(`Unmatched terminal item: "${item}"`);
|
|
1279
1343
|
}
|
|
1280
1344
|
}
|
|
@@ -1303,7 +1367,7 @@ function getSelectedViewInstances(accessor, args, args2) {
|
|
|
1303
1367
|
const result = [];
|
|
1304
1368
|
const list = listService.lastFocusedList instanceof TerminalTabList ? listService.lastFocusedList : undefined;
|
|
1305
1369
|
const selections = list?.getSelection();
|
|
1306
|
-
if (terminalGroupService.lastAccessedMenu ===
|
|
1370
|
+
if (terminalGroupService.lastAccessedMenu === "inline-tab" && !selections?.length) {
|
|
1307
1371
|
const instance = terminalGroupService.activeInstance;
|
|
1308
1372
|
return instance ? [terminalGroupService.activeInstance] : undefined;
|
|
1309
1373
|
}
|
|
@@ -1324,18 +1388,21 @@ function getSelectedViewInstances(accessor, args, args2) {
|
|
|
1324
1388
|
function validateTerminalName(name) {
|
|
1325
1389
|
if (!name || name.trim().length === 0) {
|
|
1326
1390
|
return {
|
|
1327
|
-
content: ( localize(
|
|
1391
|
+
content: ( localize(11878, "Providing no name will reset it to the default value")),
|
|
1328
1392
|
severity: Severity.Info
|
|
1329
1393
|
};
|
|
1330
1394
|
}
|
|
1331
1395
|
return null;
|
|
1332
1396
|
}
|
|
1333
1397
|
function isTerminalProfile(obj) {
|
|
1334
|
-
return isObject(obj) &&
|
|
1398
|
+
return isObject(obj) && "profileName" in obj;
|
|
1335
1399
|
}
|
|
1336
1400
|
function convertOptionsOrProfileToOptions(optionsOrProfile) {
|
|
1337
1401
|
if (isTerminalProfile(optionsOrProfile)) {
|
|
1338
|
-
return {
|
|
1402
|
+
return {
|
|
1403
|
+
config: optionsOrProfile,
|
|
1404
|
+
location: optionsOrProfile.location
|
|
1405
|
+
};
|
|
1339
1406
|
}
|
|
1340
1407
|
return optionsOrProfile;
|
|
1341
1408
|
}
|
|
@@ -1347,7 +1414,7 @@ function refreshTerminalActions(detectedProfiles) {
|
|
|
1347
1414
|
constructor() {
|
|
1348
1415
|
super({
|
|
1349
1416
|
id: TerminalCommandId.NewWithProfile,
|
|
1350
|
-
title: ( localize2(
|
|
1417
|
+
title: ( localize2(11879, "Create New Terminal (With Profile)")),
|
|
1351
1418
|
f1: true,
|
|
1352
1419
|
precondition: ( ContextKeyExpr.or(
|
|
1353
1420
|
TerminalContextKeys.processSupported,
|
|
@@ -1356,30 +1423,27 @@ function refreshTerminalActions(detectedProfiles) {
|
|
|
1356
1423
|
metadata: {
|
|
1357
1424
|
description: TerminalCommandId.NewWithProfile,
|
|
1358
1425
|
args: [{
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
( localize(11556, 'Create the terminal in the terminal view')),
|
|
1376
|
-
( localize(11557, 'Create the terminal in the editor')),
|
|
1377
|
-
]
|
|
1378
|
-
}
|
|
1426
|
+
name: "args",
|
|
1427
|
+
schema: {
|
|
1428
|
+
type: "object",
|
|
1429
|
+
required: ["profileName"],
|
|
1430
|
+
properties: {
|
|
1431
|
+
profileName: {
|
|
1432
|
+
description: ( localize(11880, "The name of the profile to create")),
|
|
1433
|
+
type: "string",
|
|
1434
|
+
enum: profileEnum.values,
|
|
1435
|
+
markdownEnumDescriptions: profileEnum.markdownDescriptions
|
|
1436
|
+
},
|
|
1437
|
+
location: {
|
|
1438
|
+
description: ( localize(11881, "Where to create the terminal")),
|
|
1439
|
+
type: "string",
|
|
1440
|
+
enum: ["view", "editor"],
|
|
1441
|
+
enumDescriptions: [( localize(11882, "Create the terminal in the terminal view")), ( localize(11883, "Create the terminal in the editor"))]
|
|
1379
1442
|
}
|
|
1380
1443
|
}
|
|
1381
|
-
}
|
|
1382
|
-
|
|
1444
|
+
}
|
|
1445
|
+
}]
|
|
1446
|
+
}
|
|
1383
1447
|
});
|
|
1384
1448
|
}
|
|
1385
1449
|
async run(accessor, eventOrOptionsOrProfile, profile) {
|
|
@@ -1390,44 +1454,53 @@ function refreshTerminalActions(detectedProfiles) {
|
|
|
1390
1454
|
let options;
|
|
1391
1455
|
let instance;
|
|
1392
1456
|
let cwd;
|
|
1393
|
-
if (isObject(eventOrOptionsOrProfile) && eventOrOptionsOrProfile && hasKey(eventOrOptionsOrProfile, {
|
|
1457
|
+
if (isObject(eventOrOptionsOrProfile) && eventOrOptionsOrProfile && hasKey(eventOrOptionsOrProfile, {
|
|
1458
|
+
profileName: true
|
|
1459
|
+
})) {
|
|
1394
1460
|
const config = c.profileService.availableProfiles.find(profile => profile.profileName === eventOrOptionsOrProfile.profileName);
|
|
1395
1461
|
if (!config) {
|
|
1396
1462
|
throw ( new Error(`Could not find terminal profile "${eventOrOptionsOrProfile.profileName}"`));
|
|
1397
1463
|
}
|
|
1398
|
-
options = {
|
|
1464
|
+
options = {
|
|
1465
|
+
config
|
|
1466
|
+
};
|
|
1399
1467
|
function isSimpleArgs(obj) {
|
|
1400
|
-
return isObject(obj) &&
|
|
1468
|
+
return isObject(obj) && "location" in obj;
|
|
1401
1469
|
}
|
|
1402
1470
|
if (isSimpleArgs(eventOrOptionsOrProfile)) {
|
|
1403
1471
|
switch (eventOrOptionsOrProfile.location) {
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1472
|
+
case "editor":
|
|
1473
|
+
options.location = TerminalLocation.Editor;
|
|
1474
|
+
break;
|
|
1475
|
+
case "view":
|
|
1476
|
+
options.location = TerminalLocation.Panel;
|
|
1477
|
+
break;
|
|
1410
1478
|
}
|
|
1411
1479
|
}
|
|
1412
|
-
}
|
|
1413
|
-
else if (isMouseEvent(eventOrOptionsOrProfile) || isPointerEvent(eventOrOptionsOrProfile) || isKeyboardEvent(eventOrOptionsOrProfile)) {
|
|
1480
|
+
} else if (isMouseEvent(eventOrOptionsOrProfile) || isPointerEvent(eventOrOptionsOrProfile) || isKeyboardEvent(eventOrOptionsOrProfile)) {
|
|
1414
1481
|
event = eventOrOptionsOrProfile;
|
|
1415
|
-
options = profile ? {
|
|
1416
|
-
|
|
1417
|
-
|
|
1482
|
+
options = profile ? {
|
|
1483
|
+
config: profile
|
|
1484
|
+
} : undefined;
|
|
1485
|
+
} else {
|
|
1418
1486
|
options = convertOptionsOrProfileToOptions(eventOrOptionsOrProfile);
|
|
1419
1487
|
}
|
|
1420
1488
|
if (event && (event.altKey || event.ctrlKey)) {
|
|
1421
1489
|
const parentTerminal = c.service.activeInstance;
|
|
1422
1490
|
if (parentTerminal) {
|
|
1423
|
-
await c.service.createTerminal({
|
|
1491
|
+
await c.service.createTerminal({
|
|
1492
|
+
location: {
|
|
1493
|
+
parentTerminal
|
|
1494
|
+
},
|
|
1495
|
+
config: options?.config
|
|
1496
|
+
});
|
|
1424
1497
|
return;
|
|
1425
1498
|
}
|
|
1426
1499
|
}
|
|
1427
1500
|
const folders = workspaceContextService.getWorkspace().folders;
|
|
1428
1501
|
if (folders.length > 1) {
|
|
1429
1502
|
const options = {
|
|
1430
|
-
placeHolder: ( localize(
|
|
1503
|
+
placeHolder: ( localize(11828, "Select current working directory for new terminal"))
|
|
1431
1504
|
};
|
|
1432
1505
|
const workspace = await commandService.executeCommand(PICK_WORKSPACE_FOLDER_COMMAND_ID, [options]);
|
|
1433
1506
|
if (!workspace) {
|
|
@@ -1438,9 +1511,8 @@ function refreshTerminalActions(detectedProfiles) {
|
|
|
1438
1511
|
if (options) {
|
|
1439
1512
|
options.cwd = cwd;
|
|
1440
1513
|
instance = await c.service.createTerminal(options);
|
|
1441
|
-
}
|
|
1442
|
-
|
|
1443
|
-
instance = await c.service.showProfileQuickPick('createInstance', cwd);
|
|
1514
|
+
} else {
|
|
1515
|
+
instance = await c.service.showProfileQuickPick("createInstance", cwd);
|
|
1444
1516
|
}
|
|
1445
1517
|
if (instance) {
|
|
1446
1518
|
c.service.setActiveInstance(instance);
|
|
@@ -1474,13 +1546,11 @@ async function pickTerminalCwd(accessor, cancel) {
|
|
|
1474
1546
|
}
|
|
1475
1547
|
const folderPicks = ( shrinkedPairs.map(pair => {
|
|
1476
1548
|
const label = pair.folder.name;
|
|
1477
|
-
const description = pair.isOverridden
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
))
|
|
1483
|
-
: labelService.getUriLabel(dirname(pair.cwd), { relative: true });
|
|
1549
|
+
const description = pair.isOverridden ? ( localize(11884, "(Overriden) {0}", labelService.getUriLabel(pair.cwd, {
|
|
1550
|
+
relative: !pair.isAbsolute
|
|
1551
|
+
}))) : labelService.getUriLabel(dirname(pair.cwd), {
|
|
1552
|
+
relative: true
|
|
1553
|
+
});
|
|
1484
1554
|
return {
|
|
1485
1555
|
label,
|
|
1486
1556
|
description: description !== label ? description : undefined,
|
|
@@ -1489,23 +1559,41 @@ async function pickTerminalCwd(accessor, cancel) {
|
|
|
1489
1559
|
};
|
|
1490
1560
|
}));
|
|
1491
1561
|
const options = {
|
|
1492
|
-
placeHolder: ( localize(
|
|
1562
|
+
placeHolder: ( localize(11828, "Select current working directory for new terminal")),
|
|
1493
1563
|
matchOnDescription: true,
|
|
1494
|
-
canPickMany: false
|
|
1564
|
+
canPickMany: false
|
|
1495
1565
|
};
|
|
1496
1566
|
const token = CancellationToken.None;
|
|
1497
1567
|
const pick = await quickInputService.pick(folderPicks, options, token);
|
|
1498
1568
|
return pick?.pair;
|
|
1499
1569
|
}
|
|
1500
1570
|
async function resolveWorkspaceFolderCwd(folder, configurationService, configurationResolverService) {
|
|
1501
|
-
const cwdConfig = configurationService.getValue(TerminalSettingId.Cwd, {
|
|
1571
|
+
const cwdConfig = configurationService.getValue(TerminalSettingId.Cwd, {
|
|
1572
|
+
resource: folder.uri
|
|
1573
|
+
});
|
|
1502
1574
|
if (!isString(cwdConfig) || cwdConfig.length === 0) {
|
|
1503
|
-
return {
|
|
1575
|
+
return {
|
|
1576
|
+
folder,
|
|
1577
|
+
cwd: folder.uri,
|
|
1578
|
+
isAbsolute: false,
|
|
1579
|
+
isOverridden: false
|
|
1580
|
+
};
|
|
1504
1581
|
}
|
|
1505
1582
|
const resolvedCwdConfig = await configurationResolverService.resolveAsync(folder, cwdConfig);
|
|
1506
|
-
return isAbsolute(resolvedCwdConfig) || resolvedCwdConfig.startsWith(ConfigurationResolverExpression.VARIABLE_LHS)
|
|
1507
|
-
|
|
1508
|
-
|
|
1583
|
+
return isAbsolute(resolvedCwdConfig) || resolvedCwdConfig.startsWith(ConfigurationResolverExpression.VARIABLE_LHS) ? {
|
|
1584
|
+
folder,
|
|
1585
|
+
isAbsolute: true,
|
|
1586
|
+
isOverridden: true,
|
|
1587
|
+
cwd: ( URI.from({
|
|
1588
|
+
...folder.uri,
|
|
1589
|
+
path: resolvedCwdConfig
|
|
1590
|
+
}))
|
|
1591
|
+
} : {
|
|
1592
|
+
folder,
|
|
1593
|
+
isAbsolute: false,
|
|
1594
|
+
isOverridden: true,
|
|
1595
|
+
cwd: URI.joinPath(folder.uri, resolvedCwdConfig)
|
|
1596
|
+
};
|
|
1509
1597
|
}
|
|
1510
1598
|
function shrinkWorkspaceFolderCwdPairs(pairs) {
|
|
1511
1599
|
const map = ( new Map());
|
|
@@ -1521,10 +1609,7 @@ function shrinkWorkspaceFolderCwdPairs(pairs) {
|
|
|
1521
1609
|
return selectedPairsInOrder;
|
|
1522
1610
|
}
|
|
1523
1611
|
async function focusActiveTerminal(instance, c) {
|
|
1524
|
-
const target = instance
|
|
1525
|
-
?? c.service.activeInstance
|
|
1526
|
-
?? c.editorService.activeInstance
|
|
1527
|
-
?? c.groupService.activeInstance;
|
|
1612
|
+
const target = instance ?? c.service.activeInstance ?? c.editorService.activeInstance ?? c.groupService.activeInstance;
|
|
1528
1613
|
if (!target) {
|
|
1529
1614
|
if (c.groupService.instances.length > 0) {
|
|
1530
1615
|
await c.groupService.showPanel(true);
|
|
@@ -1541,7 +1626,7 @@ async function renameWithQuickPick(c, accessor, resource) {
|
|
|
1541
1626
|
if (instance) {
|
|
1542
1627
|
const title = await accessor.get(IQuickInputService).input({
|
|
1543
1628
|
value: instance.title,
|
|
1544
|
-
prompt: ( localize(
|
|
1629
|
+
prompt: ( localize(11885, "Enter terminal name"))
|
|
1545
1630
|
});
|
|
1546
1631
|
if (title) {
|
|
1547
1632
|
instance.rename(title);
|