Atom package to provide syntax highlighting for the MiniZinc constraint modelling language

Improve the error message parsing for underlined errors

+9 -4
+3
CHANGELOG.md
··· 1 ## 0.7.0 - Split grammar definitions 2 - Create seperate definitions for FlatZinc + Output models and DZN files. 3 - Fixes linting error when opening DZN files
··· 1 + ## WIP 2 + - Improved error message parsing 3 + 4 ## 0.7.0 - Split grammar definitions 5 - Create seperate definitions for FlatZinc + Output models and DZN files. 6 - Fixes linting error when opening DZN files
+6 -4
lib/linter-mzn.coffee
··· 53 generateMessage: (output, filePath) -> 54 match = output[0].match(/:([0-9]+):/) 55 line = parseInt(match[1]) 56 57 startcol = 0 58 endcol = 500; 59 - if output.length > 2 and /\^/.test(output[2]) 60 - startcol = output[2].match(/\^/).index 61 - endcol = output[2].match(/\^(\s|$)/).index + 1 62 63 message = { 64 severity: 'error', 65 - excerpt: output[1..].join('\n').replace(/MiniZinc: /, ""), 66 location:{ 67 file: filePath, 68 position: [[line-1,startcol], [line-1,endcol]],
··· 53 generateMessage: (output, filePath) -> 54 match = output[0].match(/:([0-9]+):/) 55 line = parseInt(match[1]) 56 + output = output[1..] 57 58 startcol = 0 59 endcol = 500; 60 + if output.length > 1 and /\^/.test(output[1]) 61 + startcol = output[1].match(/\^/).index 62 + endcol = output[1].match(/\^(\s|$)/).index + 1 63 + output = output[2..] 64 65 message = { 66 severity: 'error', 67 + excerpt: output.join('\n').replace(/MiniZinc: /, ""), 68 location:{ 69 file: filePath, 70 position: [[line-1,startcol], [line-1,endcol]],