Skip to content

Commit 78892ed

Browse files
authored
Merge pull request microsoft#258896 from microsoft/copilot/fix-258895
Add command to open terminal in new window
2 parents 0351991 + 98db55e commit 78892ed

File tree

4 files changed

+25
-3
lines changed

4 files changed

+25
-3
lines changed

src/vs/workbench/contrib/terminal/browser/terminalActions.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ import { IConfigurationResolverService } from '../../../services/configurationRe
4747
import { ConfigurationResolverExpression } from '../../../services/configurationResolver/common/configurationResolverExpression.js';
4848
import { editorGroupToColumn } from '../../../services/editor/common/editorGroupColumn.js';
4949
import { IEditorGroupsService } from '../../../services/editor/common/editorGroupsService.js';
50-
import { SIDE_GROUP } from '../../../services/editor/common/editorService.js';
50+
import { AUX_WINDOW_GROUP, SIDE_GROUP } from '../../../services/editor/common/editorService.js';
5151
import { IWorkbenchEnvironmentService } from '../../../services/environment/common/environmentService.js';
5252
import { IPreferencesService } from '../../../services/preferences/common/preferences.js';
5353
import { IRemoteAgentService } from '../../../services/remote/common/remoteAgentService.js';
@@ -344,6 +344,25 @@ export function registerTerminalActions() {
344344
}
345345
});
346346

347+
registerTerminalAction({
348+
id: TerminalCommandId.NewInNewWindow,
349+
title: terminalStrings.newInNewWindow,
350+
precondition: sharedWhenClause.terminalAvailable,
351+
keybinding: {
352+
primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyMod.Alt | KeyCode.Backquote,
353+
mac: { primary: KeyMod.WinCtrl | KeyMod.Shift | KeyMod.Alt | KeyCode.Backquote },
354+
weight: KeybindingWeight.WorkbenchContrib
355+
},
356+
run: async (c) => {
357+
const instance = await c.service.createTerminal({
358+
location: {
359+
viewColumn: AUX_WINDOW_GROUP,
360+
}
361+
});
362+
await instance.focusWhenReady();
363+
}
364+
});
365+
347366
registerContextualInstanceAction({
348367
id: TerminalCommandId.MoveToEditor,
349368
title: terminalStrings.moveToEditor,

src/vs/workbench/contrib/terminal/common/terminal.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,7 @@ export const enum TerminalCommandId {
480480
MoveToEditor = 'workbench.action.terminal.moveToEditor',
481481
MoveToTerminalPanel = 'workbench.action.terminal.moveToTerminalPanel',
482482
MoveIntoNewWindow = 'workbench.action.terminal.moveIntoNewWindow',
483+
NewInNewWindow = 'workbench.action.terminal.newInNewWindow',
483484
SetDimensions = 'workbench.action.terminal.setDimensions',
484485
FocusHover = 'workbench.action.terminal.focusHover',
485486
ShowEnvironmentContributions = 'workbench.action.terminal.showEnvironmentContributions',
@@ -513,6 +514,7 @@ export const DEFAULT_COMMANDS_TO_SKIP_SHELL: string[] = [
513514
TerminalCommandId.MoveToTerminalPanel,
514515
TerminalCommandId.NewInActiveWorkspace,
515516
TerminalCommandId.New,
517+
TerminalCommandId.NewInNewWindow,
516518
TerminalCommandId.Paste,
517519
TerminalCommandId.PasteSelection,
518520
TerminalCommandId.ResizePaneDown,

src/vs/workbench/contrib/terminal/common/terminalStrings.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export const terminalStrings = {
2525
},
2626
moveToEditor: localize2('moveToEditor', "Move Terminal into Editor Area"),
2727
moveIntoNewWindow: localize2('moveIntoNewWindow', "Move Terminal into New Window"),
28+
newInNewWindow: localize2('newInNewWindow', "New Terminal in New Window"),
2829
moveToTerminalPanel: localize2('workbench.action.terminal.moveToTerminalPanel', "Move Terminal into Panel"),
2930
changeIcon: localize2('workbench.action.terminal.changeIcon', "Change Icon..."),
3031
changeColor: localize2('workbench.action.terminal.changeColor', "Change Color..."),

src/vs/workbench/services/editor/common/editorGroupColumn.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import { IConfigurationService } from '../../../../platform/configuration/common/configuration.js';
77
import { GroupIdentifier } from '../../../common/editor.js';
88
import { IEditorGroupsService, GroupsOrder, IEditorGroup, preferredSideBySideGroupDirection } from './editorGroupsService.js';
9-
import { ACTIVE_GROUP, ACTIVE_GROUP_TYPE, SIDE_GROUP, SIDE_GROUP_TYPE } from './editorService.js';
9+
import { ACTIVE_GROUP, ACTIVE_GROUP_TYPE, AUX_WINDOW_GROUP, SIDE_GROUP, SIDE_GROUP_TYPE } from './editorService.js';
1010

1111
/**
1212
* A way to address editor groups through a column based system
@@ -16,7 +16,7 @@ import { ACTIVE_GROUP, ACTIVE_GROUP_TYPE, SIDE_GROUP, SIDE_GROUP_TYPE } from './
1616
export type EditorGroupColumn = number;
1717

1818
export function columnToEditorGroup(editorGroupService: IEditorGroupsService, configurationService: IConfigurationService, column = ACTIVE_GROUP): GroupIdentifier | ACTIVE_GROUP_TYPE | SIDE_GROUP_TYPE {
19-
if (column === ACTIVE_GROUP || column === SIDE_GROUP) {
19+
if (column === ACTIVE_GROUP || column === SIDE_GROUP || column === AUX_WINDOW_GROUP) {
2020
return column; // return early for when column is well known
2121
}
2222

0 commit comments

Comments
 (0)