Merge pull request #183678 from microsoft/tyriar/135022

Force new terminal editor action to open in same locked group
This commit is contained in:
Daniel Imms 2023-06-01 15:33:52 -07:00 committed by GitHub
commit 73d3a29de5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 1 deletions

View file

@ -59,6 +59,7 @@ import { FileKind } from 'vs/platform/files/common/files';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
import { TerminalCapability } from 'vs/platform/terminal/common/capabilities/capabilities';
import { killTerminalIcon, newTerminalIcon } from 'vs/workbench/contrib/terminal/browser/terminalIcons';
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
export const switchTerminalActionViewItemSeparator = '\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500';
export const switchTerminalShowTabsTitle = localize('showTerminalTabs', "Show Tabs");
@ -227,6 +228,21 @@ export function registerTerminalActions() {
}
});
registerTerminalAction({
id: TerminalCommandId.CreateTerminalEditorSameGroup,
title: { value: localize('workbench.action.terminal.createTerminalEditor', "Create New Terminal in Editor Area"), original: 'Create New Terminal in Editor Area' },
f1: false,
run: async (c, accessor, args) => {
// Force the editor into the same editor group if it's locked. This command is only ever
// called when a terminal is the active editor
const editorGroupsService = accessor.get(IEditorGroupsService);
const instance = await c.service.createTerminal({
location: { viewColumn: editorGroupsService.activeGroup.index }
});
instance.focusWhenReady();
}
});
registerTerminalAction({
id: TerminalCommandId.CreateTerminalEditorSide,
title: { value: localize('workbench.action.terminal.createTerminalEditorSide', "Create New Terminal in Editor Area to the Side"), original: 'Create New Terminal in Editor Area to the Side' },

View file

@ -785,7 +785,7 @@ export function setupTerminalMenus(): void {
MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
command: {
id: TerminalCommandId.CreateTerminalEditor,
id: TerminalCommandId.CreateTerminalEditorSameGroup,
title: terminalStrings.new,
icon: Codicon.plus
},

View file

@ -527,6 +527,7 @@ export const enum TerminalCommandId {
FocusPreviousPane = 'workbench.action.terminal.focusPreviousPane',
ShowTabs = 'workbench.action.terminal.showTabs',
CreateTerminalEditor = 'workbench.action.createTerminalEditor',
CreateTerminalEditorSameGroup = 'workbench.action.createTerminalEditorSameGroup',
CreateTerminalEditorSide = 'workbench.action.createTerminalEditorSide',
FocusTabs = 'workbench.action.terminal.focusTabs',
FocusNextPane = 'workbench.action.terminal.focusNextPane',