如何在tasks.json(VS代码)中定义问题匹配器的波形范围



我在tasks.json中编写了一个problemMatcher,如下所示:

"problemMatcher": {
"owner": "myFileExtension",
"pattern": {
"regexp": "myRegExp",
"file": 1,
"line": 2,
"severity": 3,
"message": 4,
"location": 2
}
}

我正在使用这个问题匹配器来扭曲在我运行构建任务后出现问题的行。然而,我不想扭曲整条线,而是想根据问题的实际来源扭曲一个特定的范围。在阅读了文档之后,我仍然不确定如何做到这一点。

如何在tasks.json中扭曲范围?

请参阅文档中的最后一个示例。

位置可以是()中包含的1、2或4个数字

  • 1:(line)
  • 2:(line,char)
  • 4:(lineStart,charStart,lineEnd,charEnd)
{
"version": "2.0.0",
"tasks": [
{
"label": "watch",
"command": "tsc",
"args": ["--watch"],
"isBackground": true,
"problemMatcher": {
"owner": "typescript",
"fileLocation": "relative",
"pattern": {
"regexp": "^([^\s].*)\((\d+|\d+,\d+|\d+,\d+,\d+,\d+)\):\s+(error|warning|info)\s+(TS\d+)\s*:\s*(.*)$",
"file": 1,
"location": 2,
"severity": 3,
"code": 4,
"message": 5
},
"background": {
"activeOnStart": true,
"beginsPattern": "^\s*\d{1,2}:\d{1,2}:\d{1,2}(?: AM| PM)? - File change detected\. Starting incremental compilation\.\.\.",
"endsPattern": "^\s*\d{1,2}:\d{1,2}:\d{1,2}(?: AM| PM)? - Compilation complete\. Watching for file changes\."
}
}
}
]
}```

最新更新