Fanael / rainbow-delimiters

Emacs rainbow delimiters mode
GNU General Public License v3.0
685 stars 33 forks source link

Wrong unmatched braces highlighting in web-mode #19

Closed mbme closed 9 years ago

mbme commented 9 years ago

This code uses double quotes and its highlighting is ok:

console.log(")");

This code uses single quotes and last brace is highlighted as unmatched:

console.log(')');

Everything is ok when I use js-mode.

So probably rainbow-delimiters mode use some information provided by current major mode to detect if brace is inside string or not.

Reported this bug in web mode https://github.com/fxbois/web-mode/issues/584, but maybe @Fanael you have some suggestions what can be broken there?

Fanael commented 9 years ago

The highlighting is correct: in the first case the ) is inside a string, so it's ignored by rainbow-delimiters, in the second case it's not. Or at least, that's what web-mode tells Emacs.

The solution is to fix web-mode to mark (as in, give them appropriate syntax-table entries or text properties) string delimiters as string delimiters.

mbme commented 9 years ago

thanks, hope this helps!

fxbois commented 9 years ago

@mbme does the patch just pushed change anything ?