1

When I press F7, cargo test runs in the terminal in the background. I can't make F7 command both to run cargo test also open the terminal where it ran that command.

This is what I tried:

[ {
      "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"
       }
    }
]
Destroy666
  • 12,350
facebook
  • 229

1 Answers1

0

You need to use a runCommands macro which executes multiple commands one after another for a single key combination. Example:

{
    "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"
                }
            }
        ]
    }
}
Destroy666
  • 12,350