Fork me on GitHub
#lsp
<
2021-08-09
>
vemv23:08:19

Out of curiosity, can clojure-lsp do some interesting things "as you type"? i.e. prior to saving the given file would seem a good fit for clojure-lsp's approach. this is less conceivable in CIDER whch tends to depend on clojure.core/require etc

ericdallo23:08:04

Most features don't need a file saved or need the user to save :)

ericdallo23:08:10

It's part of the LSP spec

ericdallo23:08:17

Like, diagnostics, definition, reference and a lot of others just rely on server know that there is a buffer ( not really a saved file)

vemv23:08:43

oh wow, happy to learn this! as you might guess I'm not using lsp atm... would love to have an hybrid setup at some point

ericdallo23:08:15

Give it a try and let me know what you think :)

vemv23:08:33

a particularly tricky case (at least in my head) would be typing a letand getting an insight based on the let bindings before I save

ericdallo23:08:28

Just like completion?

vemv23:08:01

For example:

(letfn [f ([x] (* x x))]
  (f :wrong :number :of :args))
can clojure-lsp possibly know on the spot that f is receiving a wrong arity? Instantly? basically I'm asking if an analysis is being performed as-you-type. clj-kondo, being so fast, would seem to enable such an approach. but still it would be a pretty impressive feat I reckon

ericdallo00:08:54

Yes, clojure-lsp calls clj-kondo as you type (with a little debounce), so that would work

ericdallo00:08:12

This already happens ATM

ericdallo00:08:46

(just not sure if kondo invalid-arity linter works for this specific case)

vemv00:08:12

yeah that was just an example. again happy to read this!

vemv00:08:23

> Give it a try and let me know what you think :) maybe I'll set up another editor for lsp experimentation. my emacs has quite the backlog so it's a bit hard to move fast

ericdallo00:08:20

Cool, I suggest calva for a fast setup

ericdallo00:08:35

But I would go with vim if emacs was not available :p

vim 3
borkdude07:08:28

If your letfn syntax were correct, then clj-kondo will warn about it ;)