-
Notifications
You must be signed in to change notification settings - Fork 29k
/
terminalCommands.ts
30 lines (26 loc) · 1.16 KB
/
terminalCommands.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { ITerminalService } from 'vs/workbench/contrib/terminal/browser/terminal';
export function setupTerminalCommands(): void {
registerOpenTerminalAtIndexCommands();
}
function registerOpenTerminalAtIndexCommands(): void {
for (let i = 0; i < 9; i++) {
const terminalIndex = i;
const visibleIndex = i + 1;
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: `workbench.action.terminal.focusAtIndex${visibleIndex}`,
weight: KeybindingWeight.WorkbenchContrib,
when: undefined,
primary: 0,
handler: accessor => {
const terminalService = accessor.get(ITerminalService);
terminalService.setActiveInstanceByIndex(terminalIndex);
return terminalService.showPanel(true);
}
});
}
}