I've noticed a weird syntax highlighting quirk recently: defs whose values are negative numbers aren't highlighted like numbers. For example, take this file:
-2000
(def y 2000)
(def x -2000)
In the middle of the first line, the constant.numeric.long.clojure and source.clojure textmate scopes are active. But in the middle of the "-2000" in the third line, the active scopes are entity.global.clojure, meta.definition.global.clojure, meta.expression.clojure, and source.clojure. The number in the second line has all the same scopes as the first, but with constant.numeric.long.clojure added.Ping @pez I probably won't have time to put together a patch, but I'm guessing this is a bug in the tmlanguage definition
Interesting. And broken. Please file an issue.
Filed! https://github.com/BetterThanTomorrow/calva/issues/3235
@jonurnieta filed a PR fix 8 hours ago 😃 https://github.com/BetterThanTomorrow/calva/pull/3232
What a guy
This will stall a bit on me. FYI. But the bug has been with us since before Calva was created, so maybe it’s OK with a days wait 😃
Yeah it's not that bad
I tried to link the issue and pr with a comment but I think it ignored me b/c I'm not in the repo
I realize Jon also created an issue, so closed yours as a dup. But good with two takes on it.
The more the merrier
Sorry, I didn’t see the issue so I created one with Max’s info
You have nothing to apologize for, https://media0.giphy.com/media/v1.Y2lkPTc5MGI3NjExdWlhZjRsc2dheDJsMHV2MjVobjl4Ym9rcTc5bnZoOTdnaTdhdGZveiZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/GVMhZwYv8U5NK/giphy.gif
wow! I hadn't noticed that in Markdown.
What are y'all seeing that I'm not? I'm kinda colorblind
the -2000 its not highlighted correctly inside the def (same as calva)
Opus says it best
> GitHub Linguist highlights Clojure with atom/language-clojure, the same upstream Calva forked, and upstream carries the identical over-broad entity.global rule inside the def block. So this isn’t a Calva-only divergence — it’s inherited straight from upstream atom-language-clojure.
is it that the x and y are colored the same as the numbers?
Not really, it is that the negative number is colored as a defined symbol.
2000 is blue in the color scheme, and -2000 is purple.
whatever those blue and purples are, I cannot tell them apart at all laughcry
I guess that's another tweak I should add to my github colorblindness accessibility stylesheet
> whatever those blue and purples are, I cannot tell them apart at all laughcry
Neither can the grammar. It’s treating everything in the def form’s arguments the same and just navigates tries to not not render numbers as symbols. Failing on the negative numbers, so @jonurnieta added a fix for that. Could probably be fixed by fixing the root cause, but I rather not go there at this point. The fix is surgical. I am going to merge it now.
In any case, @jonurnieta do you think it'd be worth upstreaming the fix?
I think it's worth upstreaming, the fix is just a negative lookahead, I think it doesn't break anything because as far as I know it doesn't affect any other patterns
Yeah, won’t break anything. But one of these days I will fix it the root cause. 😃