BetterThanTomorrow / calva

Clojure & ClojureScript Interactive Programming for VS Code
https://marketplace.visualstudio.com/items?itemName=betterthantomorrow.calva
Other
1.64k stars 214 forks source link

Left parenthesis character literal messes up following syntax highlighting #1195

Open Anders-E opened 3 years ago

Anders-E commented 3 years ago

Might be a bit hard to see but notice how the nil after \( has a different color than the nil after \). Using Calva 2.0.199.

( nil ) nil
PEZ commented 3 years ago

Thanks. I tested this in Atom where it behaves the same, so that means the error lives in the tmLanguage grammar. Probably here:

https://github.com/BetterThanTomorrow/calva/blob/dedfd2c406f1cd201d2c81e5029972a6c3eebe39/src/calva-fmt/atom-language-clojure/grammars/clojure.cson#L341

Not completely sure but it looks like it treats the opening paren as the start of a list and then nil is in function position and it gets tokenized as being a function call. I think I've seen similar idiosyncrasies with what we treat as being a function call.

If you want to help fix it, please see https://github.com/BetterThanTomorrow/calva/wiki/How-to-Hack-on-Calva#updating-the-tmlanguge-grammar

It is pretty well covered with tests so once the tests for this fix runs and the other tests run it is very likely fixed properly. 😄

Anders-E commented 3 years ago

Thank you for the quick and detailed reply! I'll see if I can spare some time to have a look at it this weekend.

Thank you for the pointers and for making Calva, I really enjoy using it.