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
{{ message }}
Repository navigation
Provide keyword analysis for keywords in the ns form #1609
To upvote this issue, give it a thumbs up. See this list for the most upvoted issues.
Is your feature request related to a problem? Please describe.
Keywords in the ns form doesn't get the same treatment as other keywords from the analysis. This results in clojure-lsp being unable to apply things like semantic tokens to these, making them render differently in clients that have semantic tokens enabled.
Here are two screenshots from Calva, showing the difference:
Describe the solution you'd like
If clj-kondo provides the keyword analysis for the ns form, that's be great!
Describe alternatives you've considered / Additional context
Semantic tokens for keywords help the users since more themes will highlight them in a special way. Previously Calva solved this by giving them a non-standard TextMate grammar scope, but that causes other problems, so we have changed to use proper TM grammar scopes for keywords.
We didn't analyze those keywords since keyword analysis initially was more about being able to consistently rename (user-defined) keywords. Renaming :require in an ns form almost never makes sense. But I'm open to do that.
Activity
PEZ commentedon Mar 9, 2022
Having a look at
test/clj_kondo/analysis_test.cljI realize there are some related questions that should be sorted out.top level require
:asis not analyzed as a keyword. It probably should?destructuring keywords
Kaywords in the binding boxes are analysed as variables. Maybe they should... I didn't even know you could do this.
borkdude commentedon Mar 9, 2022
We didn't analyze those keywords since keyword analysis initially was more about being able to consistently rename (user-defined) keywords. Renaming
:requirein an ns form almost never makes sense. But I'm open to do that.borkdude commentedon Mar 9, 2022
Yes, this is supported by Clojure, although maybe not idiomatic, lots of people use it.
Bump clj-kondo to `2022.04.08` fixing semantic tokens for `:require`,…
ericdallo commentedon Apr 8, 2022
@PEZ fixed on clj-kondo and clojure-lsp!
PEZ commentedon Apr 8, 2022
Thanks!
fix clj-kondo#1609: keyword analysis for ns + require