This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-02-11
Channels
is it still the case that clojure-lsp can not be informed of macros that turn into def/defn etc?
LSP gets that data from clj-kondo, and clj-kondo can definitely be told about how to resolve macros -- all sorts of macros, not just defn-like ones.
Increasingly, libraries are providing exported clj-kondo configurations that provide insight into macros, so that users of those libraries also get the clj-kondo configuration in their editor.
ok so given this is a library that I cant make open source can I just provide my own clj-kondo config or what not? I will dig into that realm then! thanks
Yeah, if the library doesn't provide its own config, you can define your own. There's :lint-as
and for more complex macros, there are "hooks" to provide pseudo-expansions.
oh I see - I was already doing this for r/with-let!
Here's an example of a library defining clj-kondo hooks that are exported for users of the library https://github.com/seancorfield/next-jdbc/blob/develop/resources/clj-kondo.exports/com.github.seancorfield/next.jdbc/hooks/com/github/seancorfield/next_jdbc.clj_kondo
And here's the actual configuration, including some :lint-as
stuff https://github.com/seancorfield/next-jdbc/blob/develop/resources/clj-kondo.exports/com.github.seancorfield/next.jdbc/config.edn
oh what a reflief to be free of the squiggly nightmare
now I just have to figure out how to get it to be ok with a macro that takes a vector of symbols but I am sure what you linked to probably points in that direction
because I really dont like living in the land of squiggly underlines because I have such macros
but thats 4 years old so I was hoping there was like meta data or some other convention