cider
cider copied to clipboard
Compatibility with clojure-lsp?
Is the functionality in CIDER compatible with https://github.com/snoe/clojure-lsp ? I figure that would allow all of the CIDER goodies to work across platforms/editors if it was under LSP.
Is the functionality in CIDER compatible with https://github.com/snoe/clojure-lsp ?
Compatible in what sense? You can run an LSP server alongside nREPL if that's what you're asking for, but you'll have to be careful with cider-mode
and lsp-mode
interfering with one another.
I figure that would allow all of the CIDER goodies to work across platforms/editors if it was under LSP.
CIDER's backend is already portable, as nREPL is an open protocol and everything's just nREPL middleware. We can certainly implement LSP in terms of nREPL and provide a runtime-powered alternative to clojure-lsp
, but that's not a priority for me and someone will have to tackle it if they want to see it happen.
I use lsp alongside of CIDER. They work fine together but i have the following config. It mainly makes CIDER in charge of indentation and completion.
(use-package lsp-mode
:init
(setq lsp-clojure-server-command '("bash" "-c" "cd ~/projects/clojure/clojure-lsp && lein run"))
(setq lsp-enable-indentation nil)
(setq lsp-enable-completion-at-point nil)
;; (setq indent-region-function #'clojure-indent-function)
(add-hook 'clojure-mode-hook #'lsp)
(add-hook 'clojurec-mode-hook #'lsp)
(add-hook 'clojurescript-mode-hook #'lsp)
:config
(require 'lsp-clojure)
(add-to-list 'lsp-language-id-configuration '(clojure-mode . "clojure"))
(add-to-list 'lsp-language-id-configuration '(clojurec-mode . "clojure"))
(add-to-list 'lsp-language-id-configuration '(clojurescript-mode . "clojurescript")))
@dpsutton Alternatively you can disable the LSP indentation/completion when cider-mode
kicks in and enable them when it's turned off.
@bbatsov oh i like that! i'm gonna switch it over
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution and understanding!
@dpsutton did you manage to make them play well together?
I'm trying to use LSP + Cider and one problem I see is that Cider redefines the key mappings for things like <M-.> and <C-.>. I'd prefer to be able to tell Cider not to be xref and imenu provider because I prefer LSP for that. Right now the only way to achieve this is to re-set these bindings to what I want after cider-mode is enabled or maybe sth. else.
Hey all, I hope this helps :) https://emacs-lsp.github.io/lsp-mode/tutorials/clojure-guide/
that's pretty cool, thanks. One problem I keep having is alternating the formatting between cider and lsp. I'm using latest stable releases for both while your example seems to use unstable versions?
Yes, @gdanov they should not conflict with each other AFAIK, lsp formatting is achieved via lsp-format-buffer
or lsp-format-region
, while cider use ident-region
, what exactly you do to conflict?
lsp seems to be interacting with indent-region by advising it. Not sure how and why
- paredit-forward-slurp-sexp 99 15%
- paredit-forward-slurp-into-list 99 15%
- indent-region 99 15%
- apply 99 15%
- ad-Advice-indent-region 99 15%
- #<compiled 0x4346481f> 99 15%
- lsp-format-region 99 15%