VS 代码 - 为 cpp 隐藏 build/echo 任务

VS code - Hide build/echo task for cpp

我正在为 运行 c++ 代码使用 VS Code。

每当我按 Ctrl + Shift + B 构建我的 .cpp 文件时,都会弹出一个 'echo' 选项卡,这会使整个底部面板出现,然后我被要求“终端将被任务重用, 按任意键关闭它。"

我根本不希望选项卡或面板弹出,并且希望整个构建过程静默进行,不弹出任何内容。

这是我的 tasks.json 文件

{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
    {
        "label": "echo",
        "type": "shell",
        "command": "gcc",
        "args":[
            "main.cpp","-lstdc++","-o" ,"main.exe"
        ],
        "group": {
            "kind": "build",
            "isDefault": true
        }
    }
]

}

通过将 VSCode 降级到 1.60 解决:https://code.visualstudio.com/updates/v1_60

这可以使用 "presentation": {...} 进行配置。以下对我有用:

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Test task",
            "type": "shell",
            "command": "echo Hello world",
            "presentation": {
                "echo": true,
                "reveal": "never",
                "showReuseMessage": false,
            }
        }
    ]
}