0

Can anyone clarify the exact algorithm used for the VS code multi-line problem matcher? Specifically curious what the behavior is when there are more than 2 patterns defined.

The context is that I'm trying to write a multi-line problem matcher in VS Code for a rollup task. A sample of the output would look like:

(!) Plugin typescript: @rollup/plugin-typescript TS2345: Argument of type 'FirstType' is not assignable to parameter of type 'SecondType'.
 Types of property 'PropertyOne' are incompatible.
   Type 'FirstType' is missing the following properties from type 'PropertyOne': X, Y
src/main/pathToFile/file.ts: (174:37)

I've tried a number of options. Here's the most recent attempt:

"pattern": [
{
     "regexp":"^[(][!][)](.*)$",
     "message": 1
},
{
     "regexp":"^\\s+(.*)$",
},

{
     "regexp": "^([^:\\s]+):\\s+\\((\\d+):(\\d+)\\)$",
     "file": 1,
     "line": 2,
     "column":3
}],

I would expect this to match the output described, but it doesn't match at all.

If I remove the first pattern, I'm able to get a match, but this doesn't give me all of the information I need.

Scott
  • 1
  • 1
  • At least from the text you've showed, now that I've properly formatted it, it's four lines. Your matcher is only three lines and doesn't seem to handle one of the middle lines. Is that not the problem? Just add another `"regexp":"^\\s+(.*)$"` in the midle? – starball Feb 11 '23 at 00:14
  • Unfortunately, I don't believe that's the problem, as I've tried that as well. As another test, I remove the first patten, leaving 2 "regexp":"^\\s+(.*)$" and the last pattern, "^([^:\\s]+):\\s+\\((\\d+):(\\d+)\\)$". I then moved the message capture between the two "regexp":"^\\s+(.*)$" patterns to see what would happen. This does end up creating Problem entries. However, regardless of where I put the message pattern, the message in the problem was always the same line - specifically the line right before the filename. – Scott Feb 12 '23 at 15:16
  • You you please fix the text example you've shown? It has no leading spaces for the middle lines, but your regex seems to expect there to be some. So either your regex is wrong, or your text example is wrong. – starball Feb 12 '23 at 18:51
  • Fixed. It was edited by either a bot or an administrator before it was posted and the spaces were removed. – Scott Feb 14 '23 at 21:07

0 Answers0