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?
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
example
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.
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
Is there a configurable delay for LSP insight?
what is LSP insight?
Insight. Hint. Whatever you call the warnings it gives.
Got it, it's called diagnostics in LSP. AFAIK no
In VS Code, you can configure a delay on some of these actions/integrations.
does it have for diagnostics?
Dunno. It would be something in the Emacs integration, not LSP itself.
I mean in vscode
But yeah, it should be something to be supported in client indeed
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' 😞
this config should live in client, in this case lsp-mode/eglot, not clojure-lsp or kondo
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
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.
interesting idea, thanks @magnars
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
hum, yes, sounds like a good quick win
actually
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\
yes, clojure-lsp finds the reference, but it doesn't count it as a usage
hum, I see
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