Skip to content

Commit

Permalink
Add support for leading '>' in structured diagnostic messages. (#47)
Browse files Browse the repository at this point in the history
* Add support for leading '>' in structured diagnostic messages.
* added support for structured errors to the log  regex

Co-authored-by: quantimnot <[email protected]>
  • Loading branch information
quantimnot and quantimnot authored Jul 10, 2021
1 parent babec4d commit 13e4fc1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@
"fileLocation": "absolute",
"severity": "error",
"pattern": {
"regexp": "(?!^(\\.+|Hint|\\s+$))(.*)\\((\\d+),\\s(\\d+)\\)\\s+((Error|Warning|Hint):\\s(.*)|(template/generic instantiation from here.*))(\\s\\[.*\\])?",
"file": 2,
"line": 3,
"column": 4,
"severity": 6,
"message": 7
"regexp": "(?!^(\\.+|Hint|\\s+$))(>+ )?(.*)\\((\\d+),\\s(\\d+)\\)\\s+((Error|Warning|Hint):\\s(.*)|(template/generic instantiation from here.*))(\\s\\[.*\\])?",
"file": 3,
"line": 4,
"column": 5,
"severity": 7,
"message": 8
}
},
{
Expand Down
12 changes: 6 additions & 6 deletions src/nimvscode/nimBuild.nim
Original file line number Diff line number Diff line change
Expand Up @@ -135,18 +135,18 @@ proc parseErrors(lines: seq[cstring]): seq[CheckResult] =
if line.startsWith("Hint:") or line == "" or dots.test(line):
continue

let match = newRegExp(r"^([^(]*)?\((\d+)(,\s(\d+))?\)( (\w+):)? (.*)")
let match = newRegExp(r"^(>+ )?([^(]*)?\((\d+)(,\s(\d+))?\)( (\w+):)? (.*)")
.exec(line)
if not match.toJs().to(bool):
if messageText.len < 1024:
messageText &= nodeOs.eol & line
else:
let
file = match[1]
lineStr = match[2]
charStr = match[4]
severity = match[6]
msg = match[7]
file = match[2]
lineStr = match[3]
charStr = match[5]
severity = match[7]
msg = match[8]

if severity == nil:
stacktrace.add(CheckStacktrace(
Expand Down

0 comments on commit 13e4fc1

Please sign in to comment.