我在为手表任务设置problemMatcher时遇到问题。regex似乎是正确的,但即使在控制台中显示错误,它也不会在问题选项卡中显示任何错误。我错过了什么?
"problemMatcher": {
"owner": "typescript",
"fileLocation": "autoDetect",
"pattern": [
{
"regexp": "(ERROR|WARNING) in (.+)\(",
"severity": 1,
"file": 2
},
{
"regexp": "^(\d+):(\d+) (.+)$",
"line": 1,
"column": 2,
"message": 3,
"loop": true
}
],
"background": {
"activeOnStart": false,
"beginsPattern": "Type checking in progress\.\.\.",
"endsPattern": "Time: \d+ms"
}
}
终端输出:
> Running compilation in watch mode
> Building component registry...
> Component registry built
> Starting type checking service...
> Type checking in progress...
> Type checking in progress...
× ERROR in C:/project/Shared/SizeGuide/index.tsx(180,8):
180:8 Cannot find name 'SizeGuideFlyout'. Did you mean 'SizeGuideInFlyout'?
178 | render() {
179 | return (
> 180 | <SizeGuideFlyout
| ^
181 | toggleFlyout={this.props.toggleSizeGuideFlyout}
182 | position={Position.Right}
183 | isOpen={this.props.isOpen}
> Version: typescript 3.7.2
> Time: 32ms
从文档
除了问题匹配器上的
background
属性外,任务本身还必须标记为isBackground
,以便任务在后台继续运行。