diff --git a/CHANGELOG.md b/CHANGELOG.md index eccef63..f58e45c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.5.0 - Column matching +- The linter now indicates the right column if indicated by `mzn2fzn` + ## 0.4.1 - Enables the user to disable linting in the package settings - Fixes problem in highlighting of numerical constants diff --git a/lib/linter-mzn.coffee b/lib/linter-mzn.coffee index 8207205..7f2e306 100644 --- a/lib/linter-mzn.coffee +++ b/lib/linter-mzn.coffee @@ -53,17 +53,20 @@ class LinterMZN generateMessage: (output, filePath) -> match = output[0].match(/:([0-9]+):/) line = parseInt(match[1]) - console.log line + '\n' + + startcol = 0 + endcol = 500; + if output.length > 2 and /\^/.test(output[2]) + startcol = output[2].match(/\^/).index + endcol = output[2].match(/\^(\s|$)/).index + 1 message = { type: 'Error', text: output[1..].join('\n').replace(/MiniZinc: /, ""), - range: [[line-1,0], [line-1,500]], + range: [[line-1,startcol], [line-1,endcol]], filePath: filePath, } - console.log message - return message