Fork me on GitHub
#spacemacs
<
2020-04-08
>
niveauverleih10:04:54

I'd like to use the clj-kondo in lsp mode on spacemacs (reason: graal doesn't compile to armv8 yet). There is documentation on how to use clj-kondo in vanilla emacs here https://github.com/borkdude/clj-kondo/blob/master/doc/editor-integration.md and documentation on the lsp layer config in spacemacs here https://develop.spacemacs.org/layers/+tools/lsp/README.html . I am too much of a newbie to put these pieces together. Has anyone done this before?

practicalli-john11:04:30

I would be interested to hear if anyone has a Language Server Protocol setup for Clojure too. I would like to understand how it benefits the development workflow, beyond doing some of the CIDER functions without using a REPL. I always run the REPL, so have never understood what I missing. As most language don't have a tool like CIDER, it easy to see the added benefit for them. It's curious that some have suggested using clj-kondo as the basis of a Clojure language server protocol server.

borkdude11:04:17

@jr0cket The reason clj-kondo has an LSP server originates in support for VSCode and poor Windows support in the beginning.

borkdude11:04:40

Now you can install a clj-kondo extension in VSCode that doesn't need any external installation of a binary as long as you have Java installed

borkdude11:04:19

But later on some people also started using the LSP server for IntelliJ, Emacs and Sublime

borkdude11:04:39

The clj-kondo LSP server only gives diagnostic and no other IDE functionality

practicalli-john11:04:23

@borkdude Okay, that's interesting, thanks. So if I have clj-kondo giving me live feedback on my code as I type (via flycheck in Emacs) it that the same information as I get from LSP? It seems like there is a little more (otherwise why use it other than not having to run a repl). Maybe I should just read up on this more, it's all a bit vague to me. Thanks.

borkdude11:04:39

exactly the same

👍 4
borkdude11:04:33

the main use case for LSP for clj-kondo is that some environments cannot run the binary, such as armv8, see the question above

practicalli-john11:04:37

Perfect, thanks.

OrdoFlammae13:04:43

Personally, it seems like REPL abrogates the need for LSP, since REPL does the same thing, but adds on live code-eval.

practicalli-john16:04:32

@ordoflammae yes, the Language Server Protocol is simply that, a project to standardize the protocol development tools use to communicate with a language server process. So if you were to compare Clojure implementations of LSP then it seems more relevant to compare that protocol with nREPL. You could consider CIDER an LSP implementation, except it does not follow this recent protocol definition. Its no surpise that Microsoft are helping to drive this standard, as it will greatly help VS Code provide more features as the various language communities start implementing plugins and services that use the LSP communication specification. It is really helpful for developers that build tools to have a standard protocol, however, as CIDER already provides more features than LSP (in Clojure and in other languages) so I am not sure how much effort is being put into building a defacto LSP imprlementation for Clojure (there seem to be a few fledgling projects. That said, there is no reason someone could not provide LSP for CIDER, as I believe it can already use different protocols other than nrepl.

OrdoFlammae16:04:01

Would it be possible/practical to build a LSP implementation for Clojure on top of nREPL? Or have I just misunderstood something?

practicalli-john16:04:39

Looking at https://github.com/snoe/clojure-lsp/blob/master/deps.edn it gives the impression that LSP over nrepl is what they are doing (but I havent read through the project in any detail).

OrdoFlammae16:04:18

Yeah, it does seem like that's what they're doing. I may look into that project if I have any time..