spacemacs

Spacemacs docs: http://develop.spacemacs.org/doc/DOCUMENTATION.html http://develop.spacemacs.org/layers/+lang/clojure/README.html https://practicalli.github.io/spacemacs/
practicalli-john 2021-02-19T17:59:29.144300Z

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.

πŸ‘ 2
1
lread 2021-02-20T14:31:25.002Z

Lassooing in @ericdallo - he’ll likely have tips and guidance for your adventure!

1
ericdallo 2021-02-20T14:36:14.002700Z

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 πŸ™‚

practicalli-john 2021-02-20T18:12:33.003Z

@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.

πŸ‘ 1
practicalli-john 2021-02-20T18:19:36.003300Z

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.

practicalli-john 2021-02-20T18:23:31.003700Z

@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.

ericdallo 2021-02-20T18:24:40.003900Z

Exactly @jr0cket, I use LSP for almost every feature and Cider for runing tests/eval things

ericdallo 2021-02-20T18:25:50.004200Z

I stopped using clj-refactor as it turns out that LSP replaced the features that I used

ericdallo 2021-02-20T18:26:58.004500Z

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 πŸ˜…)

ericdallo 2021-02-20T18:27:40.004700Z

I agree lsp-ui is noisy, we from lsp-mode are thinking in ways to improve that too, with better defaults maybe

practicalli-john 2021-02-20T19:02:06.005Z

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.

1
practicalli-john 2021-02-20T19:25:00.005300Z

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.

ericdallo 2021-02-20T19:26:54.005500Z

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 πŸ˜„