hi, a couple of issues with clojure-lsp
• SOLVED is there a way to tell it not to touch my
• I already have .clj-kondo/imports?:inline-def {:level :off} in .clj-kondo/config.edn but clojure-lsp ignores it and warns with Unused public var '[clojure-lsp/unused-public-var]
yes: https://clojure-lsp.io/settings/ you can tell lsp to not copy configs
:copy-kondo-configs?why would you ignore inline def tho...?
it was the very first linter I ever wrote in clj-kondo :)
the codebase I'm working on uses them for the capturing/debugging purposes extensively
you could use something like https://github.com/borkdude/deflet to still have capturing/debugging, but no real vars in production. it also has a clj-kondo configuration.
Yeah, thanks. I'm aware of that and other alternatives. It's just happened that def is already here, on fingertips and doesn't require any additional setup. Plus, we have a lot of repos to work on.
There might be a performance penalty to this and also the chance that you're using same-named vars in different functions of the same namespace, causing concurrency trouble. But up to you of course.
I know, that's why we use different names 🙂
You could write a small macro called (def* ...) which elides the calls in production using some system variable or whatever. And then you could also write a clj-kondo hook for it that basically just does nothing
Anyway, the clojure-lsp bug is something to discuss with other people here
(partially) SOLVED by moving linters to .clj-kondo/config.edn ok, now I have these settings in my .lsp/config.edn
{:copy-kondo-configs? false
:linters {:clojure-lsp/unused-public-var
{:exclude-when-contains-meta #{:external?}}}}
but I'm still getting a message about unused public var for
(defn ^{:external? true} data-generator []have you tried:
(defn data-generator {:external? true} [])
?the first one should work too of course, but just checking
yes, the same issue
perhaps move this configuration to .clj-kondo/config.edn
I remember lsp supporting that too
yes, thanks, that works. The only thing is I had to disconnect and connect to lsp again to see the changes, but probably it's the Emacs issue
so maybe both work and that was the issue then
no, it didn't work with :linters expressions in .lsp/config.edn
k
Anyway, I don't really care where the settings are as long as they work. Thank you again for your help!