Clojure-Sublimed icon indicating copy to clipboard operation
Clojure-Sublimed copied to clipboard

Syntax highlightning incorrectly recognizes def form

Open KGOH opened this issue 1 year ago • 6 comments

Syntax highlightning incorrectly recognizes def form and highlights the first argument of any function which name starts with "def". Notice the highlight of the 'k argument on the screenshot below Screenshot 2024-10-06 at 14 07 18

KGOH avatar Oct 06 '24 12:10 KGOH

That is unfortunate, but that’s part of design. This way we can support all past and future def* forms. Any suggestions?

tonsky avatar Oct 06 '24 20:10 tonsky

maybe make a setting? like ["*.def.*"] And I'll change it in my config to ["*.defn", "*.def", "*.deftest", "*.defn-"]

KGOH avatar Oct 07 '24 13:10 KGOH

Can’t, this goes into syntax highlighting, no settings there

tonsky avatar Oct 07 '24 13:10 tonsky

let's see ~paul allen's card~ how emacs works this around... https://github.com/clojure-emacs/clojure-mode/blob/59888c84b61081e9b0085e388f55132925a66e7a/clojure-mode.el#L898-L927

KGOH avatar Oct 07 '24 13:10 KGOH

This wouldn’t work for rum/defc, rum/defcs and humble’s ui/defcomp for example

tonsky avatar Oct 07 '24 13:10 tonsky

@tonsky add them too :) this will make a subtle advert for your libs

And then wait for requests to add some other def* forms to your syntax rules. I doubt that this will be a frequent chore

KGOH avatar Oct 07 '24 14:10 KGOH