VSCode TypeScript problemMatcher 不工作
VSCode TypeScript problemMatcher not working
我想要一个报告两种问题的问题匹配器:
- 打字稿编译问题
- tslint 问题
这在我的一个项目中不起作用,但在其他项目中起作用。这是 .vscode/tasks.json
:
中的问题匹配器行
"problemMatcher": [
"$tsc",
{
"owner": "tslint",
"fileLocation": "relative",
"severity": "error",
"pattern": {
"regexp": "^ERROR:\s*(.*\.ts)\[(\d+), (\d+)\]: (.*)$",
"file": 1,
"line": 2,
"column": 3,
"message": 4
}
}
]
我相信问题没有被解决,因为它们被前缀为 browserify
或 tsify
。
以下配置解决了这个问题,并且应该报告常规 tsc
编译、browserify/tsify 编译和 tslint 的问题:
"problemMatcher": [
"$tsc",
{
"owner": "typescript",
"fileLocation": ["relative", "${workspaceRoot}"],
"pattern": {
"regexp": "^TypeScript (warning|error): (.*)\((\d+),(\d+)\): (.*)$",
"severity": 1,
"file": 2,
"line": 3,
"column": 4,
"message": 5
}
},
{
"owner": "tslint",
"fileLocation": "relative",
"severity": "error",
"pattern": {
"regexp": "^ERROR:\s*(.*\.ts)\[(\d+), (\d+)\]: (.*)$",
"file": 1,
"line": 2,
"column": 3,
"message": 4
}
}
]
我想要一个报告两种问题的问题匹配器:
- 打字稿编译问题
- tslint 问题
这在我的一个项目中不起作用,但在其他项目中起作用。这是 .vscode/tasks.json
:
"problemMatcher": [
"$tsc",
{
"owner": "tslint",
"fileLocation": "relative",
"severity": "error",
"pattern": {
"regexp": "^ERROR:\s*(.*\.ts)\[(\d+), (\d+)\]: (.*)$",
"file": 1,
"line": 2,
"column": 3,
"message": 4
}
}
]
我相信问题没有被解决,因为它们被前缀为 browserify
或 tsify
。
以下配置解决了这个问题,并且应该报告常规 tsc
编译、browserify/tsify 编译和 tslint 的问题:
"problemMatcher": [
"$tsc",
{
"owner": "typescript",
"fileLocation": ["relative", "${workspaceRoot}"],
"pattern": {
"regexp": "^TypeScript (warning|error): (.*)\((\d+),(\d+)\): (.*)$",
"severity": 1,
"file": 2,
"line": 3,
"column": 4,
"message": 5
}
},
{
"owner": "tslint",
"fileLocation": "relative",
"severity": "error",
"pattern": {
"regexp": "^ERROR:\s*(.*\.ts)\[(\d+), (\d+)\]: (.*)$",
"file": 1,
"line": 2,
"column": 3,
"message": 4
}
}
]