[英]vscode: how to clear both the console and the terminal using the same shortcut?
我正在尋找一個可以清除調試控制台 + 終端的快捷方式,當我的光標位於編輯器上時,它會起作用。
我在 keybindings.json 中嘗試了此代碼,它僅適用於終端,並且當光標位於終端上時(除非我刪除了“when”部分)。 但無論如何,這不會清除調試控制台。
{
"key": "ctrl+k",
"command": "workbench.action.terminal.clear",
"when": "terminalFocus"
},
{
"key": "ctrl+k",
"command": "workbench.debug.panel.action.clearReplAction",
"when": "inDebugRepl"
},
您可能必須使用像multi-command這樣的宏擴展,它允許您運行多個命令。
在您的 settings.json 中:
"multiCommand.commands": [
{
"command": "multiCommand.clearTerminalandDebugConsole",
"sequence": [
"workbench.action.terminal.clear",
"workbench.debug.panel.action.clearReplAction"
]
}
]
在 keybindings.json 中:
{
"key": "ctrl+alt+k",
"command": "extension.multiCommand.execute",
"args": { "command": "multiCommand.clearTerminalandDebugConsole" },
// below since you wanted it to work with editor focus
"when": "editorTextFocus"
},
您使用了Ctrl - K ,但這是許多已綁定的沖突命令中使用的序列,所以我使用了Ctrl - Alt - K 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.