在 VS Code 中使用构建任务运行相同的终端实例

Jas*_*son 7 visual-studio-code

我有一个 build.bat 文件,当我尝试构建项目时,我希望 VS Code 运行该文件。要在 VS Code 中执行此操作,您需要设置一个 task.json 文件,我已经这样做了:

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "type": "shell",
            "windows": {
                "command": "${workspaceRoot}\\build.bat"
            },
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}
Run Code Online (Sandbox Code Playgroud)

我遇到的问题是每次运行任务时它似乎都会生成一个新的终端实例。有没有办法让 VS Code 继续重复使用相同的终端实例来执行其构建任务?

Meh*_*fat 1

您可以使用:

  terminal.integrated.automationShell
Run Code Online (Sandbox Code Playgroud)

设置用于设置 VS Code 中所有自动化的 shell,其中包括任务