Is it possible that the latest clojure-lsp release broke :exclude-when-contains-meta for :clojure-lsp/unused-public-var? Or maybe even the whole linter configuration?
We use clojure-lsp CLI to lint in CI. In .clj-kondo/config.edn, we have:
:linters {:clojure-lsp/unused-public-var {:level :warning
:exclude-when-contains-meta #{:init/name
:init/tags
:init/inject
:init/stops}
:ignore-test-references? true}
With version 2025.08.25-14.21.46, this config seems be honoured and works as expected: Public vars with :init/inject metadata are not considered “unused”.
When upgrading to version 2025.11.28-12.47.43, I see a lot of info: [clojure-lsp/unused-public-var] Unused public var issues.
It seems that the whole config is ignored, including the :level. I tried putting this in .lsp/config.edn as well, with no success…oops! thanks Glad it worked!
I will take a look, but keep in mind this is a old way since this linter was migrated completely to clojure-lsp some versions ago, but we should be backward compatible tho. https://clojure-lsp.io/settings/#clojure-lspunused-public-var
I tried moving the config to .lsp/config.edn but this did not help
If that is what you mean?
yes
can you share a quick example so I can try?
I don’t have one at hand but I can certainly build something!
I’ll be back 🙂
OK, I’m so confused now. In a minimal example, I get consistent behaviour with both versions.
Here it is:
https://github.com/ferdinand-beyer/clojure-lsp-unused-public-var
However, both versions require the linter settings in .clj-kondo/config.edn, not .lsp/config.edn.
In our much larger real repo, the latest version seems to not pick up any of the configs…
we get it https://github.com/clojure-lsp/clojure-lsp/blob/178afb3b8e166d7ad3b92b0a1c2a9a2a334c15c4/lib/src/clojure_lsp/feature/diagnostics/built_in.clj#L140 using this https://github.com/clojure-lsp/clojure-lsp/blob/178afb3b8e166d7ad3b92b0a1c2a9a2a334c15c4/lib/src/clojure_lsp/feature/diagnostics/built_in.clj#L127-L134, but there is a tricky, if the ns has config-in-ns we consider that only, trying to remember why
ah no, we still get from settings
let me try your repro
we did have a optmization on that function in 2025.10
kinda found the issue, it seems that for kondo the meta comes in the definition but not for lsp, let me take a closer look
ah yeah, the bug is https://github.com/clojure-lsp/clojure-lsp/blob/178afb3b8e166d7ad3b92b0a1c2a9a2a334c15c4/lib/src/clojure_lsp/kondo.clj#L269-L272 and it seems that always existed since this linter migration, we say to kondo bring metas of what's in the config of only the kondo config, not lsp
a tricky one
I’m not 100% sure I follow but I’m so glad you found something, because I am still very confused 😄
Looks like lsp hand-picks known meta keys and will not find the ones I configure?
Ah no, does that mean it reads the exclusions from the kondo config but not the lsp config?
yes, it's broken for .lsp/config.edn, I will fix it
OK, cool! But that means it should still support the config from kondo? Because for our “real” project, it seemed to not pick it up from there either
Maybe there’s something else going on
yeah, do you have any :config-in-ns for that project?
Let me check
Yes
it might be related, since that function checks for that
try to add it to your minimal repro
Will do!
Bingo!
Blue: It’s :info level, albeit i configured :warning. And both should be excluded.
yeah, I'm still not sure why config-in-ns is making that not work, but if you could add to your minimal repro I could take a look to understand
Just pushed it
Here is the difference between previous and latest version:
ok, I just pushed the fix of consider lsp/config.edn as well, let me check that now
I pushed the fix! can you try a #clojure-lsp-builds nightly build? available in ~5mins
Thanks! Will check it out first thing tomorrow!
Good morning! The nightly build indeed seems to fix it!
Not sure if you intended to commit this line though: https://github.com/clojure-lsp/clojure-lsp/commit/a9e3dec4d4b06fa94fcf7eca97e91b9d7e1ff603#r174590810
Thank you very much for your quick response and fixing this! gratitude-thank-you
I have the inline-function refactoring working well enough to test it in emacs - and it seems that there was no way to execute it? I ended up defining:
(defun lsp-clojure-inline-function ()
"Apply inline-function refactoring at point."
(interactive)
(lsp-clojure--refactoring-call "inline-function"))
and hit c-x c-e to test it. I assume this is because I defined it in code_actions.clj as :refactor-inline instead of refactor-extract
(defn ^:private inline-function-action [uri line character]
{:title "Inline function"
:kind :refactor-inline
:command {:title "Inline function"
:command "inline-function"
:arguments [uri line character]}})
1. Did I define the action correctly? If so -
2. Is this something that the lsp-clojure.el would eventually need to add? yeah, back on ~2020, we didn't have most of commands in code actions, but I changed that and ATM code actions are the best way to reach commands since some of them are only available when they are gonna work for real, also they have better wording of what will do to the code, so I always recommend using it instead of direct commands
This is what it looks like executing it
have you tried `M-x lsp-execute-code-action` ?
Doh! It is there! I thought it wasn't, but sure enough it's in the list when I just tried. Thanks!