I have written a problemMatcher
in tasks.json
that looks like this:
"problemMatcher": {
"owner": "myFileExtension",
"pattern": {
"regexp": "myRegExp",
"file": 1,
"line": 2,
"severity": 3,
"message": 4,
"location": 2
}
}
I am using this problem matcher to squiggle the lines that have problems after I run my build task. However, instead of squiggling the whole line, I would like to squiggle a particular range, based on where the problem actually comes from. After reading the documentation, I am still not sure how this can be done.
How can I squiggle a range in tasks.json
?
CodePudding user response:
See last example in the doc.
The location can be 1, 2 or 4 numbers enclosed in ()
- 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\\."
}
}
}
]
}```