1
0

Improve the error message parsing for underlined errors

This commit is contained in:
Jip J. Dekker 2017-11-16 19:13:46 +11:00
parent fc961a9a21
commit 6ee8ade534
No known key found for this signature in database
GPG Key ID: 9CB1B58997DD0D58
2 changed files with 9 additions and 4 deletions

View File

@ -1,3 +1,6 @@
## WIP
- Improved error message parsing
## 0.7.0 - Split grammar definitions
- Create seperate definitions for FlatZinc + Output models and DZN files.
- Fixes linting error when opening DZN files

View File

@ -53,16 +53,18 @@ class LinterMZN
generateMessage: (output, filePath) ->
match = output[0].match(/:([0-9]+):/)
line = parseInt(match[1])
output = output[1..]
startcol = 0
endcol = 500;
if output.length > 2 and /\^/.test(output[2])
startcol = output[2].match(/\^/).index
endcol = output[2].match(/\^(\s|$)/).index + 1
if output.length > 1 and /\^/.test(output[1])
startcol = output[1].match(/\^/).index
endcol = output[1].match(/\^(\s|$)/).index + 1
output = output[2..]
message = {
severity: 'error',
excerpt: output[1..].join('\n').replace(/MiniZinc: /, ""),
excerpt: output.join('\n').replace(/MiniZinc: /, ""),
location:{
file: filePath,
position: [[line-1,startcol], [line-1,endcol]],