mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
Make terminal focus by index numbers names align with editor
Fixes #20133
This commit is contained in:
parent
720a3e2f76
commit
71efa3d238
|
@ -16,7 +16,7 @@ import { TERMINAL_DEFAULT_SHELL_LINUX, TERMINAL_DEFAULT_SHELL_OSX, TERMINAL_DEFA
|
|||
import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actionRegistry';
|
||||
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
|
||||
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { KillTerminalAction, CopyTerminalSelectionAction, CreateNewTerminalAction, FocusActiveTerminalAction, FocusNextTerminalAction, FocusPreviousTerminalAction, FocusTerminalByNumberAction, RunSelectedTextInTerminalAction, RunActiveFileInTerminalAction, ScrollDownTerminalAction, ScrollDownPageTerminalAction, ScrollToBottomTerminalAction, ScrollUpTerminalAction, ScrollUpPageTerminalAction, ScrollToTopTerminalAction, TerminalPasteAction, ToggleTerminalAction, ClearTerminalAction } from 'vs/workbench/parts/terminal/electron-browser/terminalActions';
|
||||
import { KillTerminalAction, CopyTerminalSelectionAction, CreateNewTerminalAction, FocusActiveTerminalAction, FocusNextTerminalAction, FocusPreviousTerminalAction, FocusTerminalAtIndexAction, RunSelectedTextInTerminalAction, RunActiveFileInTerminalAction, ScrollDownTerminalAction, ScrollDownPageTerminalAction, ScrollToBottomTerminalAction, ScrollUpTerminalAction, ScrollUpPageTerminalAction, ScrollToTopTerminalAction, TerminalPasteAction, ToggleTerminalAction, ClearTerminalAction } from 'vs/workbench/parts/terminal/electron-browser/terminalActions';
|
||||
import { Registry } from 'vs/platform/platform';
|
||||
import { ShowAllCommandsAction } from 'vs/workbench/parts/quickopen/browser/commandsHandler';
|
||||
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
|
||||
|
@ -145,15 +145,15 @@ configurationRegistry.registerConfiguration({
|
|||
FocusActiveTerminalAction.ID,
|
||||
FocusPreviousTerminalAction.ID,
|
||||
FocusNextTerminalAction.ID,
|
||||
FocusTerminalByNumberAction.getId(1),
|
||||
FocusTerminalByNumberAction.getId(2),
|
||||
FocusTerminalByNumberAction.getId(3),
|
||||
FocusTerminalByNumberAction.getId(4),
|
||||
FocusTerminalByNumberAction.getId(5),
|
||||
FocusTerminalByNumberAction.getId(6),
|
||||
FocusTerminalByNumberAction.getId(7),
|
||||
FocusTerminalByNumberAction.getId(8),
|
||||
FocusTerminalByNumberAction.getId(9),
|
||||
FocusTerminalAtIndexAction.getId(1),
|
||||
FocusTerminalAtIndexAction.getId(2),
|
||||
FocusTerminalAtIndexAction.getId(3),
|
||||
FocusTerminalAtIndexAction.getId(4),
|
||||
FocusTerminalAtIndexAction.getId(5),
|
||||
FocusTerminalAtIndexAction.getId(6),
|
||||
FocusTerminalAtIndexAction.getId(7),
|
||||
FocusTerminalAtIndexAction.getId(8),
|
||||
FocusTerminalAtIndexAction.getId(9),
|
||||
TerminalPasteAction.ID,
|
||||
RunSelectedTextInTerminalAction.ID,
|
||||
RunActiveFileInTerminalAction.ID,
|
||||
|
@ -208,7 +208,7 @@ actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(FocusActiveTermi
|
|||
actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(FocusNextTerminalAction, FocusNextTerminalAction.ID, FocusNextTerminalAction.LABEL), 'Terminal: Focus Next Terminal', category);
|
||||
actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(FocusPreviousTerminalAction, FocusPreviousTerminalAction.ID, FocusPreviousTerminalAction.LABEL), 'Terminal: Focus Previous Terminal', category);
|
||||
for (let i = 1; i < 10; i++) {
|
||||
actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(FocusTerminalByNumberAction, FocusTerminalByNumberAction.getId(i), FocusTerminalByNumberAction.getLabel(i)), 'Terminal: Focus Terminal ' + i, category);
|
||||
actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(FocusTerminalAtIndexAction, FocusTerminalAtIndexAction.getId(i), FocusTerminalAtIndexAction.getLabel(i)), 'Terminal: Focus Terminal ' + i, category);
|
||||
}
|
||||
actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(TerminalPasteAction, TerminalPasteAction.ID, TerminalPasteAction.LABEL, {
|
||||
primary: KeyMod.CtrlCmd | KeyCode.KEY_V,
|
||||
|
|
|
@ -141,8 +141,8 @@ export class FocusNextTerminalAction extends Action {
|
|||
}
|
||||
}
|
||||
|
||||
export class FocusTerminalByNumberAction extends Action {
|
||||
private static ID_PREFIX = 'workbench.action.terminal.focus';
|
||||
export class FocusTerminalAtIndexAction extends Action {
|
||||
private static ID_PREFIX = 'workbench.action.terminal.focusAtIndex';
|
||||
|
||||
constructor(
|
||||
id: string, label: string,
|
||||
|
@ -157,15 +157,15 @@ export class FocusTerminalByNumberAction extends Action {
|
|||
}
|
||||
|
||||
public static getId(n: number): string {
|
||||
return FocusTerminalByNumberAction.ID_PREFIX + n;
|
||||
return FocusTerminalAtIndexAction.ID_PREFIX + n;
|
||||
}
|
||||
|
||||
public static getLabel(n: number): string {
|
||||
return nls.localize('workbench.action.terminal.focusByNumber', 'Focus Terminal {0}', n);
|
||||
return nls.localize('workbench.action.terminal.focusAtIndex', 'Focus Terminal {0}', n);
|
||||
}
|
||||
|
||||
private getTerminalNumber(): number {
|
||||
return parseInt(this.id.substr(FocusTerminalByNumberAction.ID_PREFIX.length));
|
||||
return parseInt(this.id.substr(FocusTerminalAtIndexAction.ID_PREFIX.length));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue