Skip to content

Commit 867b1d0

Browse files
committed
feat: add new and kill terminal option in terminal docs
1 parent b3a8b95 commit 867b1d0

2 files changed

Lines changed: 16 additions & 4 deletions

File tree

src/extensionsIntegrated/Terminal/main.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ define(function (require, exports, module) {
5858
const CMD_TERMINAL_COPY = "terminal.copy";
5959
const CMD_TERMINAL_PASTE = "terminal.paste";
6060
const CMD_TERMINAL_SELECT_ALL = "terminal.selectAll";
61+
const CMD_TERMINAL_KILL = "terminal.kill";
6162
const CMD_TERMINAL_CLEAR = "terminal.clear";
6263
const TERMINAL_CONTEXT_MENU_ID = "terminal-context-menu";
6364
const PANEL_ID = "terminal-panel";
@@ -109,7 +110,7 @@ define(function (require, exports, module) {
109110
function _createPanel() {
110111
const templateVars = {
111112
Strings: {
112-
CMD_NEW_TERMINAL: "New Terminal",
113+
CMD_NEW_TERMINAL: Strings.CMD_NEW_TERMINAL,
113114
TERMINAL_CLEAR: "Clear",
114115
TERMINAL_KILL: "Kill",
115116
CMD_HIDE_TERMINAL: "Close Panel"
@@ -578,7 +579,7 @@ define(function (require, exports, module) {
578579
}
579580

580581
$item.append($('<span class="terminal-flyout-close"></span>')
581-
.attr("title", Strings.TERMINAL_CLOSE_TAB_TOOLTIP)
582+
.attr("title", Strings.CMD_KILL_TERMINAL)
582583
.append('<i class="fa-solid fa-xmark"></i>'));
583584
$item.append('<span class="terminal-flyout-icon"><i class="fa-solid fa-terminal"></i></span>');
584585
$item.append($('<span class="terminal-flyout-title"></span>').text(label));
@@ -822,7 +823,7 @@ define(function (require, exports, module) {
822823
}
823824

824825
// Register commands
825-
CommandManager.register("New Terminal", CMD_NEW_TERMINAL, _createNewTerminal, { supportsDesignMode: true });
826+
CommandManager.register(Strings.CMD_NEW_TERMINAL, CMD_NEW_TERMINAL, _createNewTerminal, { supportsDesignMode: true });
826827
CommandManager.register(Strings.CMD_VIEW_TERMINAL, CMD_VIEW_TERMINAL, _showTerminal, { supportsDesignMode: true });
827828
CommandManager.register(Strings.CMD_OPEN_IN_INTEGRATED_TERMINAL,
828829
Commands.NAVIGATE_OPEN_IN_INTEGRATED_TERMINAL, function () {
@@ -865,6 +866,12 @@ define(function (require, exports, module) {
865866
active.focus();
866867
}
867868
});
869+
CommandManager.register(Strings.CMD_KILL_TERMINAL, CMD_TERMINAL_KILL, function () {
870+
const active = _getActiveTerminal();
871+
if (active) {
872+
_closeTerminal(active.id);
873+
}
874+
});
868875
CommandManager.register(Strings.TERMINAL_CLEAR, CMD_TERMINAL_CLEAR, function () {
869876
_clearActiveTerminal();
870877
const active = _getActiveTerminal();
@@ -879,6 +886,9 @@ define(function (require, exports, module) {
879886
terminalContextMenu.addMenuItem(CMD_TERMINAL_PASTE);
880887
terminalContextMenu.addMenuItem(CMD_TERMINAL_SELECT_ALL);
881888
terminalContextMenu.addMenuDivider();
889+
terminalContextMenu.addMenuItem(CMD_NEW_TERMINAL);
890+
terminalContextMenu.addMenuItem(CMD_TERMINAL_KILL);
891+
terminalContextMenu.addMenuDivider();
882892
terminalContextMenu.addMenuItem(CMD_TERMINAL_CLEAR);
883893

884894
// Enable/disable Copy based on terminal selection
@@ -888,6 +898,7 @@ define(function (require, exports, module) {
888898
CommandManager.get(CMD_TERMINAL_COPY).setEnabled(hasSelection);
889899
CommandManager.get(CMD_TERMINAL_PASTE).setEnabled(active && active.isAlive);
890900
CommandManager.get(CMD_TERMINAL_SELECT_ALL).setEnabled(!!active);
901+
CommandManager.get(CMD_TERMINAL_KILL).setEnabled(!!active);
891902
CommandManager.get(CMD_TERMINAL_CLEAR).setEnabled(!!active);
892903
});
893904

src/nls/root/strings.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1821,7 +1821,8 @@ define({
18211821
"TERMINAL_FOCUS_HINT": "Press {0} to switch between editor and terminal",
18221822
"TERMINAL_CLEAR": "Clear Terminal",
18231823
"TERMINAL_CLEAR_BUFFER_HINT": "💡 Press {0} to clear terminal buffer",
1824-
"TERMINAL_CLOSE_TAB_TOOLTIP": "Kill Terminal",
1824+
"CMD_NEW_TERMINAL": "New Terminal",
1825+
"CMD_KILL_TERMINAL": "Kill Terminal",
18251826
"EXTENDED_COMMIT_MESSAGE": "EXTENDED",
18261827
"GETTING_STAGED_DIFF_PROGRESS": "Getting diff of staged files\u2026",
18271828
"GIT_COMMIT": "Git commit\u2026",

0 commit comments

Comments
 (0)