
当我按下 时F7,cargo test 会在后台的终端中运行。我无法F7同时运行 cargo test 和打开运行该命令的终端。
这是我尝试过的:
[ {
"key": "f7",
"command": "+workbench.action.terminal.toggleTerminal",
"when": "editorTextFocus && editorLangId == rust",
},
{
"key": "f7",
"command": "workbench.action.terminal.sendSequence",
"when": "editorTextFocus && editorLangId == rust",
"args": {
"text": "cargo test\n"
}
}
]
答案1
您需要使用runCommands
宏,它使用单个组合键依次执行多个命令。例如:
{
"key": "f7",
"command": "runCommands",
"when": "editorTextFocus && editorLangId == rust",
"args": {
"commands": [
{
"command": "workbench.action.terminal.toggleTerminal"
},
{
"command": "workbench.action.terminal.sendSequence",
"args": {
"text": "cargo test\n"
}
}
]
}
}