从命令行编译时我可以指定
tsc -b --verbose
但是,我无法弄清楚如何在vs代码中配置默认构建任务来执行相同操作。我在tsconfig.json或tasks.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"
}
}
]
}