Search code examples
typescriptvisual-studio-codetscvscode-tasks

Set --verbose option in VSCode Typescript build task


When compiling from the command line I can specify

tsc -b --verbose

However I can't figure out how to configure the default build task in vs code to do the same. I can't find any related entry in tsconfig.json or in tasks.json


Solution

  • From the VSCode tasks documentation to run a tsc build task, there is a TypeScript specific layout:

    {
        // See https://go.microsoft.com/fwlink/?LinkId=733558
        // for the documentation about the tasks.json format
        "version": "2.0.0",
        "tasks": [
            {
                "type": "typescript",
                "tsconfig": "tsconfig.json",
                "problemMatcher": [
                    "$tsc"
                ],
                "group": {
                    "kind": "build",
                    "isDefault": true
                }
            }
        ]
    }
    

    If you would like to run your own command arguments or shell commands, I recommend using the shell script, as it gives a bit more options and can be specific to what you'd like to run:

    {
        // See https://go.microsoft.com/fwlink/?LinkId=733558
        // for the documentation about the tasks.json format
        "version": "2.0.0",
        "tasks": [
            {
                "label": "Run tsc verbosely",
                "type": "shell",
                "command": "tsc -b --verbose",
                "group": "test",
                "presentation": {
                    "reveal": "always",
                    "panel": "new"
                }
            }
        ]
    }