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

标签 typescript visual-studio-code tsc vscode-tasks

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

tsc -b --verbose

但是我无法弄清楚如何在 vs 代码中配置默认​​构建任务来执行相同的操作。我在 tsconfig.jsontasks.json

中找不到任何相关条目

最佳答案

来自VSCode tasks documentation要运行 tsc 构建任务,有一个特定于 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
            }
        }
    ]
}

如果您想运行自己的命令参数或 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"
            }
        }
    ]
}

关于typescript - 在 VSCode Typescript 构建任务中设置 --verbose 选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54559165/

相关文章:

visual-studio-code - Visual Studio Code 调试控制台颜色

visual-studio-code - 如何将用户设置传递给调试适配器?

visual-studio-code - 烦人的未使用变量弹出窗口

TypeScript 编译器 : generated sources, 根目录、排除和符号链接(symbolic link)

node.js - 包含 node.d.ts 时出现 Typescript 编译器错误

javascript - 错误 "Property ' type' is missing in type 'typeof WithXXX' "

typescript - 如何在 Typescript 中索引特定数组元素?

typescript - 缺少无效分配的 TSC 警告

typescript - 为什么反射元数据仅在使用装饰器时才起作用?

javascript - 从另一个组件设置模型后,Angular2 View 不更新