calva

Max 2026-05-29T18:16:59.967109Z

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.

Max 2026-06-03T01:51:03.212449Z

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

pez 2026-06-03T05:34:14.506829Z

Interesting. And broken. Please file an issue.

Max 2026-06-03T14:23:38.741099Z

Filed! https://github.com/BetterThanTomorrow/calva/issues/3235

pez 2026-06-03T14:42:19.009519Z

@jonurnieta filed a PR fix 8 hours ago 😃 https://github.com/BetterThanTomorrow/calva/pull/3232

Max 2026-06-03T14:42:39.997439Z

What a guy

🔥 1
pez 2026-06-03T14:44:38.052079Z

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 😃

Max 2026-06-03T14:44:49.358939Z

Yeah it's not that bad

Max 2026-06-03T14:45:07.769389Z

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

pez 2026-06-03T14:46:44.453829Z

I realize Jon also created an issue, so closed yours as a dup. But good with two takes on it.

Max 2026-06-03T14:54:18.484889Z

The more the merrier

jramosg 2026-06-03T16:45:27.870749Z

Sorry, I didn’t see the issue so I created one with Max’s info

jramosg 2026-06-03T19:46:40.902229Z

wow! I hadn't noticed that in Markdown.

Max 2026-06-03T19:47:38.775469Z

What are y'all seeing that I'm not? I'm kinda colorblind

jramosg 2026-06-03T19:48:44.633939Z

the -2000 its not highlighted correctly inside the def (same as calva)

pez 2026-06-03T19:48:46.434789Z

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.

Max 2026-06-03T19:51:13.087449Z

is it that the x and y are colored the same as the numbers?

pez 2026-06-03T19:51:56.636179Z

Not really, it is that the negative number is colored as a defined symbol.

pez 2026-06-03T19:52:28.857509Z

2000 is blue in the color scheme, and -2000 is purple.

Max 2026-06-03T19:52:31.892219Z

whatever those blue and purples are, I cannot tell them apart at all laughcry

Max 2026-06-03T19:54:18.774579Z

I guess that's another tweak I should add to my github colorblindness accessibility stylesheet

pez 2026-06-03T19:55:54.024429Z

> 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.

🔥 1
Max 2026-06-03T19:56:20.316119Z

In any case, @jonurnieta do you think it'd be worth upstreaming the fix?

jramosg 2026-06-03T19:59:20.606409Z

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

pez 2026-06-03T20:02:03.706149Z

Yeah, won’t break anything. But one of these days I will fix it the root cause. 😃

🙌🏿 1