lsp

enn 2025-08-11T13:57:53.090419Z

Good morning! I'm trying clojure-lsp again for the first time in a few years and really enjoying it. One issue I keep running into: I lean a lot on eldoc-mode to see function docstrings and arglists, but if I type something like (foo |) (where | represents the point), I see a brief flash of the arg list for foo in the minibuffer but then lsp (kondo?) replaces it with foo is called with 0 args but expects 2 [invalid-arity]. I know it expects more args, I'm not done typing yet! 🙂 Is there a way to tell lsp/kondo not to warn when I'm introducing a new form, or for innermost form my point is inside of, or something like that?

ericdallo 2025-08-11T13:59:47.092479Z

I believe that's a bad emacs XP where eldoc and diagnostics are show in the same place, my suggestion would be to use flymake or flycheck to show diagnostics on different places

ericdallo 2025-08-11T14:00:43.975009Z

example

enn 2025-08-11T14:02:10.003659Z

That's a fair point and I can work on tweaking where the output goes. But in general it feels very aggressive to be warned immediately that my function invocation is wrong before I have finished typing it, and I would like to suppress that behavior no matter where the warning displays.

ericdallo 2025-08-11T14:04:49.178549Z

That's a IDE behavior, how it works on most if not all LSPs. I'm sure there must be a way in lsp-mode to improve that via some variable but I don't know

seancorfield 2025-08-11T15:03:20.301099Z

Is there a configurable delay for LSP insight?

ericdallo 2025-08-11T15:03:39.490919Z

what is LSP insight?

seancorfield 2025-08-11T15:04:33.860409Z

Insight. Hint. Whatever you call the warnings it gives.

ericdallo 2025-08-11T15:05:05.479449Z

Got it, it's called diagnostics in LSP. AFAIK no

seancorfield 2025-08-11T15:05:10.815989Z

In VS Code, you can configure a delay on some of these actions/integrations.

ericdallo 2025-08-11T15:05:21.330369Z

does it have for diagnostics?

seancorfield 2025-08-11T15:06:12.625219Z

Dunno. It would be something in the Emacs integration, not LSP itself.

ericdallo 2025-08-11T15:06:29.689459Z

I mean in vscode

ericdallo 2025-08-11T15:06:42.759269Z

But yeah, it should be something to be supported in client indeed

seancorfield 2025-08-11T15:08:54.415429Z

VS Code has a control for when arglist/docs show up (as hover text -- you don't have the Emacs problem of things wanting to display in the minibuffer). C Spell also has a configurable delay in VS Code. Doesn't look like there's anything similar for LSP/kondo tho' 😞

ericdallo 2025-08-11T15:28:50.131729Z

this config should live in client, in this case lsp-mode/eglot, not clojure-lsp or kondo

2025-08-11T17:07:16.352839Z

I have "solved this", @enn in my Emacs settings by changing how often flycheck runs dependening on whether there are any errors in the buffer already: https://github.com/magnars/emacsd-reboot/blob/main/packages/setup-flycheck.el#L6-L13

2025-08-11T17:08:04.221179Z

With these settings, flycheck is only run when you save the buffer in pristine buffers, but once there are errors it will validate on idle.

enn 2025-08-11T17:26:30.812219Z

interesting idea, thanks @magnars

borkdude 2025-08-11T15:20:51.818719Z

Hey @ericdallo, here's an idea, we could make (requiring-resolve 'nextjournal.clerk.render.hashing/dynamic-asset-map) count as a var usage so functions don't appear to have 0 usages. Perhaps (probably) this only needs support on the clj-kondo side

ericdallo 2025-08-11T15:32:25.212629Z

hum, yes, sounds like a good quick win

ericdallo 2025-08-11T15:32:33.713099Z

actually

ericdallo 2025-08-11T15:33:01.873839Z

that is a symbol right? it was supposed to be resolved as a reference as we resolve symbol usages as well like in deps.edn etc\

borkdude 2025-08-11T15:46:11.599379Z

yes, clojure-lsp finds the reference, but it doesn't count it as a usage

ericdallo 2025-08-11T15:58:22.801759Z

hum, I see

ericdallo 2025-08-11T15:58:48.765679Z

yeah we could try to fix on clojure-lsp side if we have some flag to know that symbol is a usage or just register as a var-usage