在 VSCode Typescript 构建任务中设置 --verbose 选项

gri*_*rim 4 typescript tsc visual-studio-code vscode-tasks

从命令行编译时,我可以指定

tsc -b --verbose
Run Code Online (Sandbox Code Playgroud)

但是我不知道如何在 vs 代码中配置默认​​构建任务来做同样的事情。我在tsconfig.jsontasks.json 中找不到任何相关条目

Spe*_*ock 7

从运行 tsc 构建任务的VSCode 任务文档中,有一个 TypeScript 特定布局:

{
    // 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
            }
        }
    ]
}
Run Code Online (Sandbox Code Playgroud)

如果您想运行自己的命令参数或 shell 命令,我建议使用 shell 脚本,因为它提供了更多选项,并且可以特定于您想要运行的内容:

{
    // 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"
            }
        }
    ]
}
Run Code Online (Sandbox Code Playgroud)