Search code examples
c++visual-studio-codevscode-tasks

g++ custom task opens in external terminal intead of vs code internal terminal


I have the following task in VSCode to build C++ programs.

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build my app",
            "type": "shell",
            "command": "g++",
            "args": [
                "-std=gnu++0x", "-Wall", "-Werror", "-g", "tutorial.cpp"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}

However each time I run this the output opens in an external terminal. I would like to run my builds and see the output in the internal terminal. Is this possible and if so what do I need to change?


Solution

  • The integrated terminal panel behavior is controlled through a presentation property of a task. Add the following:

    "presentation": {
                    "reveal": "always",
                    "panel": "new"
    }
    

    It offers the following options:

    • reveal
    • focus
    • echo
    • panel