Error column is off by one for each emoji (non-BMP character) earlier on the line: CoffeeScript counts UTF-16 units
Version: SublimeLinter-coffee 3.x from Package Control, coffeescript 2.7.0, CoffeeScript syntax package, SublimeLinter 4, Sublime Text 4215 on Windows. Reproduced in a clean install.
b.coffee (UTF-8):
coffee --compile --stdio < b.coffee:
[stdin]:1:25: error: missing )
s = "😀😀" ; foo bar baz(
^
The error is at the ( of baz(, which is character 23 (1-based) of the line as Sublime counts, but CoffeeScript says 25, because each 😀 (U+1F600) is two UTF-16 code units in JavaScript strings. In Sublime the highlight lands two characters too far to the right, on the line break at the end of the line (start 23, expected 22, 0-based).
The same with one emoji, a.coffee:
[stdin]:1:13: error: missing )
The error is at the ( (character 12 in Sublime), and the plugin highlights the 1 after it (start 12, expected 11, 0-based). é (one UTF-16 unit) does not shift anything.
The col group of the regex is used as it is. Suggested fix: override reposition_match(self, line, col, m, vv), take the line via vv.select_line(line), and convert the UTF-16 offset to a character offset by walking the line and counting every character above U+FFFF twice. The same fix was just merged for SublimeLinter-xmllint (bytes) and is proposed for SublimeLinter-tslint and -javac (UTF-16). I can prepare a PR if you would like one.
Error column is off by one for each emoji (non-BMP character) earlier on the line: CoffeeScript counts UTF-16 units
Version: SublimeLinter-coffee 3.x from Package Control, coffeescript 2.7.0, CoffeeScript syntax package, SublimeLinter 4, Sublime Text 4215 on Windows. Reproduced in a clean install.
b.coffee(UTF-8):coffee --compile --stdio < b.coffee:The error is at the
(ofbaz(, which is character 23 (1-based) of the line as Sublime counts, but CoffeeScript says 25, because each😀(U+1F600) is two UTF-16 code units in JavaScript strings. In Sublime the highlight lands two characters too far to the right, on the line break at the end of the line (start 23, expected 22, 0-based).The same with one emoji,
a.coffee:The error is at the
((character 12 in Sublime), and the plugin highlights the1after it (start 12, expected 11, 0-based).é(one UTF-16 unit) does not shift anything.The
colgroup of the regex is used as it is. Suggested fix: overridereposition_match(self, line, col, m, vv), take the line viavv.select_line(line), and convert the UTF-16 offset to a character offset by walking the line and counting every character above U+FFFF twice. The same fix was just merged for SublimeLinter-xmllint (bytes) and is proposed for SublimeLinter-tslint and -javac (UTF-16). I can prepare a PR if you would like one.