Fork me on GitHub
#spacemacs
<
2021-03-28
>
practicalli-johnny00:03:08

After a month or so of experimenting with the clojure-lsp and Cider, I've created a minimally invasive LSP client and server configuration that seems to work well with Cider. The lsp configuration has been added to practicalli/spacemacs.d configuration for Spacemacs. https://github.com/practicalli/spacemacs.d/ Details of the configuration can be found at https://practicalli.github.io/spacemacs/install-spacemacs/clojure-lsp/configure-lsp-and-cider.html • lsp-ui with minimal decoration ◦ lense - shows number of times a function definition of var is referenced (useful for code archaeology) ◦ hidden sideline (as I find it very distracting - set to t if you wish to see that information constantly ◦ customise doom-gruvbox-light theme using theming layer to set a subtle lsp syntax highlight face • Use cider-mode formatting rather than lsp - disable lsp formatting and indentation If you are using this configuration and do not wish to use lsp yet, then remove the comment from the two variables in the clojure layer configuration

;; clojure-backend 'cider               ;; use cider and disable lsp
    ;; clojure-enable-linters 'clj-kondo    ;; clj-kondo included in lsp
This will disable LSP for cider, although LSP can still be used with other languages. I still have a lot to learn about LSP, so welcome feedback and suggestions. If you do suggest enabling other features, it would be helpful to know the details of why you find it useful (rather than just saying its useful - which I'm afraid isn't that useful).

👍 3
ericdallo00:03:02

I think LSP format can be disabled on client side with just (setq lsp-enable-identation nil) instead of manually changing lsp cljfmt server config 🙂

ericdallo00:03:26

in LSP layer variables, lsp-modeline--enable-diagnostics is a internal function, I think you meant lsp-modeline-diagnostics-enable variable

practicalli-johnny00:03:13

I am not sure I understand, sorry. I have set lsp-enable-identation nil when adding LSP. The only thing I believe I am doing in .lsp/config.edn is to disable cljfmt. Are you saying that lsp-enable-identation nil will disable cljfmt?

ericdallo00:03:10

you are already disabling on client-side, so no need to change any server config

ericdallo00:03:13

disabling on client side will make lsp-mode don't request any format method to server, what means that server will not use cljfmt

ericdallo00:03:28

less user config, resulting on the same

practicalli-johnny00:03:22

For the practicalli/spacemacs.d project, I would like to make the configuration as self-contained as possible. Then its just a single clone to configure Emacs.

ericdallo00:03:40

alright, and why my suggestion doesn't fit that? it'll achieve the same result you want without the need to change .lsp/config.edn

practicalli-johnny00:03:54

I think you are saying I can drop the dot-lsp/config.edn file completely, if I use lsp-enable-identation nil . I will try this out on Sunday. Thanks.

ericdallo00:03:03

exactly 🙂

practicalli-johnny00:03:15

Okay, I understand now. Thanks.

👍 3