-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathterminal.js
26 lines (26 loc) · 916 Bytes
/
terminal.js
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
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.selectTerminal = exports.ensureTerminalExists = void 0;
const vscode = require("vscode");
const ensureTerminalExists = () => {
if (vscode.window.terminals.length === 0) {
vscode.window.showErrorMessage("No active terminals");
return false;
}
return true;
};
exports.ensureTerminalExists = ensureTerminalExists;
const selectTerminal = async () => {
const terminals = vscode.window.terminals;
if (terminals.length === 1) {
return terminals[0];
}
const items = vscode.window.terminals.map((terminal, index) => ({
label: `${index + 1}: ${terminal.name}`,
terminal: terminal
}));
const item = await vscode.window.showQuickPick(items);
return item ? item.terminal : undefined;
};
exports.selectTerminal = selectTerminal;
//# sourceMappingURL=terminal.js.map