lsp

2026-01-13T10:09:47.375839Z

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…

ericdallo 2026-01-14T12:20:41.203489Z

oops! thanks Glad it worked!

ericdallo 2026-01-13T12:12:42.517359Z

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

2026-01-13T12:13:07.855609Z

I tried moving the config to .lsp/config.edn but this did not help

2026-01-13T12:13:12.906939Z

If that is what you mean?

ericdallo 2026-01-13T12:13:27.754269Z

yes

ericdallo 2026-01-13T12:13:53.194619Z

can you share a quick example so I can try?

2026-01-13T12:14:17.828509Z

I don’t have one at hand but I can certainly build something!

👍 1
2026-01-13T12:14:37.457829Z

I’ll be back 🙂

2026-01-13T12:42:50.420769Z

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…

ericdallo 2026-01-13T12:50:37.024059Z

ah no, we still get from settings

ericdallo 2026-01-13T12:50:45.849779Z

let me try your repro

ericdallo 2026-01-13T12:52:21.989019Z

we did have a optmization on that function in 2025.10

ericdallo 2026-01-13T12:56:55.118869Z

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

ericdallo 2026-01-13T12:58:07.266189Z

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

ericdallo 2026-01-13T12:58:18.542719Z

a tricky one

2026-01-13T13:00:08.164029Z

I’m not 100% sure I follow but I’m so glad you found something, because I am still very confused 😄

2026-01-13T13:00:35.674269Z

Looks like lsp hand-picks known meta keys and will not find the ones I configure?

2026-01-13T13:01:38.089799Z

Ah no, does that mean it reads the exclusions from the kondo config but not the lsp config?

ericdallo 2026-01-13T13:01:41.656319Z

yes, it's broken for .lsp/config.edn, I will fix it

2026-01-13T13:02:34.249579Z

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

2026-01-13T13:02:45.562839Z

Maybe there’s something else going on

ericdallo 2026-01-13T13:03:19.123109Z

yeah, do you have any :config-in-ns for that project?

2026-01-13T13:04:07.332769Z

Let me check

2026-01-13T13:04:13.773429Z

Yes

ericdallo 2026-01-13T13:04:47.175549Z

it might be related, since that function checks for that

ericdallo 2026-01-13T13:04:53.879169Z

try to add it to your minimal repro

2026-01-13T13:04:58.510359Z

Will do!

2026-01-13T13:06:01.005859Z

Bingo!

2026-01-13T13:06:25.703179Z

Blue: It’s :info level, albeit i configured :warning. And both should be excluded.

ericdallo 2026-01-13T13:06:57.010799Z

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

2026-01-13T13:07:09.048399Z

Just pushed it

2026-01-13T13:07:48.682699Z

Here is the difference between previous and latest version:

ericdallo 2026-01-13T13:08:13.646979Z

ok, I just pushed the fix of consider lsp/config.edn as well, let me check that now

🙌 1
ericdallo 2026-01-13T13:28:52.954719Z

I pushed the fix! can you try a #clojure-lsp-builds nightly build? available in ~5mins

🎉 1
2026-01-13T18:26:44.717489Z

Thanks! Will check it out first thing tomorrow!

2026-01-14T07:43:38.911799Z

Good morning! The nightly build indeed seems to fix it!

2026-01-14T07:46:53.008629Z

Not sure if you intended to commit this line though: https://github.com/clojure-lsp/clojure-lsp/commit/a9e3dec4d4b06fa94fcf7eca97e91b9d7e1ff603#r174590810

2026-01-14T07:47:28.642759Z

Thank you very much for your quick response and fixing this! gratitude-thank-you

JR 2026-01-13T16:37:08.235499Z

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?

ericdallo 2026-01-14T12:30:13.936699Z

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

👍 1
JR 2026-01-13T16:38:09.088049Z

This is what it looks like executing it

2026-01-13T19:40:37.066059Z

have you tried `M-x lsp-execute-code-action` ?

JR 2026-01-13T21:31:18.931529Z

Doh! It is there! I thought it wasn't, but sure enough it's in the list when I just tried. Thanks!