I hope to take another look at Clojure LSP with Spacemacs at the weekend. I have a basic configuration but have a few challenges to solve, especially auto-formatting and aligning arguments and forms. I have switched off some of the cljfmt rules. LSP does seem to change some of the key bindings too, so a bit of a learning curve there. I am not sure how much benefit I will eventually get from LSP, but its an interesting journey.
Lassooing in @ericdallo - heβll likely have tips and guidance for your adventure!
Good to hear @jr0cket π This could help you: https://emacs-lsp.github.io/lsp-mode/tutorials/clojure-guide/ I'm doom-emacs user not a spaceemacs user, but I heard that there is no way to use lsp and cider together in spaceemacs because of its config, it'd be nice to confirm that or fix that on spaceemacs side π
@ericdallo Thanks. I am using Spacemacs which does have LSP for Clojure (added in November 2020). LSP is the default backend for Clojure in Spacemacs if the lsp layer is added. https://github.com/syl20bnr/spacemacs/commit/6d39cd5548768bed63cc18d51b74efb78f39963d There are certainly conflicts with the additional configuration I use for my Clojure setup. This was due to aggressive-intend which I had hooked into clojure-mode. This conflicts with the cljfmt that LSP continually runs. As I've been using my setup for several years, I have disabled cljfmt until I can configure it to give the same results. Even without the conflict with aggressive-indent, I would have disabled some of the rules of cljfmt as they dont provide the readability I need for my code.
The biggest challege is finding the parts of lsp that I find useful. This seems mostly in the configuration of the lsp UI and the automatic formatting (I like to align forms). Having not used an IDE for most of the last decade I have enjoyed clutter free editing. I do find the default UI configuration very noisy and am spending some time surfacing just those parts of the lsp ui that give the most value. The biggest challenge with using clojure-lsp with CIder is deciding which tool is going to do what. There is a lot of cross-over in functionality, so hope to create an lsp config that complements the features of Cider without over-riding features I have relied on for a long time. Where there are improvements on the Cider features from LSP, then I would use LSP. It just takes a bit of time to understand what those parts are.
@jumar I think LSP is pretty reliable, I havent experience any issues recently. I think it really comes down to knowing what you want (and do not want) to experience with LSP (and CIDER). Much of the journey for me is trying to understand what the features of LSP are and how they can be helpful.
Exactly @jr0cket, I use LSP for almost every feature and Cider for runing tests/eval things
I stopped using clj-refactor as it turns out that LSP replaced the features that I used
About align-forms, There is a open feature request for that on cljfmt so the recommended way to do that is still using clojure-align
from clojure-mode (I use that too π
)
I agree lsp-ui is noisy, we from lsp-mode are thinking in ways to improve that too, with better defaults maybe
Happy to share my minimal defaults when I figure them out. Could be useful to have 2-3 example configs, one very minimal, one with everything and one with the most common - if that is known.
I agree that clj-refactor should not be used (or needed) if using LSP. I stopped using clj-refactor a while ago though. Clojure-mode has a few useful refactorings. I use helm-ag and iedit to refactor across projects, although this is a candidate for LSP instead, to reduce the steps required. clj-refactor hotloading of libraries was a very useful feature, although I believe its still broken. However, its easy to do hotloading with add-libs if using Clojure CLI tools.
Yes! Just FYI, we added support for a nice iedit integration too on lsp-mode: https://emacs-lsp.github.io/lsp-mode/page/integration/iedit/ It merge the power of iedit with LSP π