1
votes

I am learning C++ using vscode on mac BigSur. Terminal always prints "Terminal will be reused by tasks, press any key to close it." And after trying adding on 'presentation' with property 'panel:new'. This issue still happens.

this is my task.json

{
"tasks": [
    {
        "type": "cppbuild",
        "label": "C/C++: g++ build active file",
        "command": "/usr/bin/g++",
        "args": [
            "-g",
            "${file}",
            "-o",
            "${fileDirname}/${fileBasenameNoExtension}"
        ],
        "options": {
            "cwd": "/usr/bin"
        },
        "problemMatcher": [
            "$gcc"
        ],
        "group": {
            "kind": "build",
            "isDefault": true
        },
        "presentation": {
            "echo": true,
            "reveal": "always",
            "focus": true,
            "panel": "new"
        },
        "detail": "Generated task by Debugger"
    }
],
"version": "2.0.0"}

this is my launch.json

{

"version": "0.2.0",
"configurations": [
    {
        "name": "g++ - Build and debug active file",
        "type": "cppdbg",
        "request": "launch",
        "program": "${fileDirname}/${fileBasenameNoExtension}",
        "args": [],
        "stopAtEntry": false,
        "cwd": "${workspaceFolder}",
        "environment": [],
        "externalConsole": false,
        "MIMode": "lldb",
        "preLaunchTask": "C/C++: g++ build active file"
    }
]}

enter image description here

1

1 Answers

0
votes

The message "Terminal will be reused by tasks, press any key to close it." can be avoided by adding the property "showReuseMessage": false inside the "presentation" block.

"presentation": {
        "echo": true,
        "reveal": "always",
        "focus": true,
        "panel": "new",
        "showReuseMessage": false
    },

However, we still need to press the enter key to get back to command prompt. To avoid pressing the enter key, another property "close": true should also be added inside the "presentation" block.

"presentation": {
        "echo": true,
        "reveal": "always",
        "focus": true,
        "panel": "new",
        "showReuseMessage": false,
        "close": true
    },

I have tested above in Visual Studio Code version 1.68.0 in Windows 10, 64 bit platform.