You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code below (Javascript) doesn’t get highlighted properly. We should have all stringN be highlighted with string color, but only string1 and string4 are.
What is supposed to be happening is that the whole string gets the string face, then the template substitution gets the embedded face, then the nested string gets (again) the string face, the nested substitution gets the embedded face, and so on.
The problem is that (as far as I understand) the priority of the queries is defined by the ordering in the queries file, but here we want both queries to have the same priority (more exactly we want shorter matches to have priority above longer matches). I'm not even sure if that's something that is supposed to work in upstream tree-sitter?
Anyway, I managed to fix it somehow (not tested very much) by ordering the matches by length (using cl-stable-sort) before applying the text properties, but I'm not sure if that's what we're supposed to do?
There could also be performance issues by sorting the matches at every keystroke (although I tried a bit on a 3500 lines file and couldn’t see any issue so far).
Any thoughts?
The text was updated successfully, but these errors were encountered:
The code below (Javascript) doesn’t get highlighted properly. We should have all
stringN
be highlighted with string color, but onlystring1
andstring4
are.What is supposed to be happening is that the whole string gets the
string
face, then the template substitution gets theembedded
face, then the nested string gets (again) thestring
face, the nested substitution gets theembedded
face, and so on.The problem is that (as far as I understand) the priority of the queries is defined by the ordering in the queries file, but here we want both queries to have the same priority (more exactly we want shorter matches to have priority above longer matches). I'm not even sure if that's something that is supposed to work in upstream
tree-sitter
?Anyway, I managed to fix it somehow (not tested very much) by ordering the matches by length (using
cl-stable-sort
) before applying the text properties, but I'm not sure if that's what we're supposed to do?There could also be performance issues by sorting the matches at every keystroke (although I tried a bit on a 3500 lines file and couldn’t see any issue so far).
Any thoughts?
The text was updated successfully, but these errors were encountered: