lsp 2025-07-24

My coworker and I are experiencing an issue where clojure-lsp isn't sending the "params" attribute on the diagnostics being published, resulting in a startup error on neovim:

[DEBUG][2025-07-22 18:16:20] .../vim/lsp/rpc.lua:391	"rpc.receive"	{ jsonrpc = "2.0", method = "textDocument/publishDiagnostics" }
is this a known recent change?

it's mixed in with good diagnostics, too. so some work OK, but some don't.

2025.03.07-17.42.36 colleague has fixed by rolling back to this version. I'm guessing ba40d3d51 is a likely candidate for the cause given taht.

e1f176b88c4af60563b9c0fb7fe88a7d100d5ffb git bisect is pointing at this commit

I'm guessing this is because we have a custom clj-kondo lint, that is now being read somehow and ending up empty or blank somehow?

Appears to be coming from the :used-underscored-binding lint. Creating a .clj-kondo/config.edn with {:linters {:used-underscored-binding {:level :warn}}} in a random clj project (java.jdbc, incidentally) resulted in this error appearing on my personal machine. Not sure why that particular SHA is interacting with that particular lint!

Figured it out, :warn isn't recognized by level->severity so ends up as nil and https://github.com/SevereOverfl0w/clojure-lsp/blob/387f7c8806840346febe5bcc800f38eccde5ef29/cli/src/clojure_lsp/server.clj#L139-L144 runs even if it doesn't conform.

:warning right?

I reckon that's a big part of our mistake, yep! If we'd correctly used :warning this wouldn't have been a problem. It didn't flag up before that e1f... sha because level->severity was a case and would throw if there was an unknown level, resulting in no publishDiagnostic with a bad value.

Ideally if failing to conform to a diagnostic, I imagine that clojure-lsp shouldn't send one!

I see, yeah, makes sense improve clojure-lsp to not send that

easy solution: Change ->> to some->>?

Given that conform-or-log results in a nil

would be nice a test for that

but I think we don't have for that specific part of the code

Approved, but you need to fix conflicts

@borkdude ha, we actually managed to encode :warn into our tests because kondo happily repeats whatever you give it.

@ericdallo Great, thanks. I'm surprised there were conflicts already, it should have been a fresh pull! 🙂

I think you just had a outdated local branch 😅

Yeah... I think I was using my fork as my origin. oops!

Fixed, the tests did pass prior to my force pushing.