visual-studio-codeterminalsettings

Is there any way of running VSCode tasks in the *current* integrated terminal?


By default running tasks inside Visual Studio Code opens a new integrated terminal over the current one, which then asks you to press a key to close it. I would really prefer if the current terminal was used instead, as it gets annoying when many new terminals stack over one another after running several tasks. Is there any way of configuring that? I find it hard to believe no one else dislikes the default behavior but can't seem to find anything online or in the settings.


Solution

  • The way I found to have the command copy-pasted on the current terminal is using keybindings.json command with "workbench.action.terminal.sendSequence" instead of tasks.json. As the following example:

    {
        "key": "<your hotkey here>",
        "command": "workbench.action.terminal.sendSequence",
        "args": {
            "text": "<your command here> \n"
        }
    }
    

    The \n at the end will make it actually send the command. Otherwise it will just paste and you will have the press enter.