VSCode 中不断弹出“选择要运行的构建任务”

cer*_*rou 7 visual-studio-code

每次我在 VS Code 中运行代码(使用 Ctrl-Shift+B 运行 Python 代码)时,VS Code 都会不断要求我“选择要运行的构建任务”,而不是仅仅运行脚本(像以前一样)。我确实只定义了一项任务。如何解决这个问题呢?

Seb*_* Ax 1

在tasks.json中创建一个虚拟任务:

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558 
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "type": "shell",
            "label": "dummy-task to not get the 'Select the build task to run'-popup",
            "command": "exit",
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "isBackground": true,
            "presentation": {
                "echo": false,
                "reveal": "never",
                "panel": "shared",
            }
        }
    ]
}
Run Code Online (Sandbox Code Playgroud)

注意: 右下角会出现一个小窗口,但会立即关闭,因为执行退出命令后无需执行任何操作。