Closed davidpham87 closed 3 years ago
Can you try M-x cider-find-var
manually? By default, lsp-mode
replaces eldoc and xref to use the language server, so that is probably used instead. You can add the following to your config before lsp-mode
is loaded (you'll need to restart Emacs):
(setq lsp-enable-xref nil)
to disable lsp-xref
. You can use lsp-find-definition
instead. lsp-eldoc
can currently not be disabled though.
Thanks a lot. the lsp-enable-xref
trick worked like a charm with cider-find-var
. However, the other issue (cider not displaying the arities in the message bar at the bottom) is not disappearing.
The issue is that lsp-managed-mode
adds lsp-eldoc-function
unconditionally, with no way for the user to control that. We'd need something like lsp-eldoc-mode
+ a defcustom
so this can be changed. However, I'd assume that cider-mode
does the same, so a temporary workaround would be to somehow make cider-mode
turn on after lsp-mode
.
@yyoncho shouldn't we have a option to disable lsp-eldoc ?
@yyoncho shouldn't we have a option to disable lsp-eldoc ?
Yes.
@nbfalcon The trick of loading cider after lsp works like a charm! I could close the issue, but it would be interesting to have this documented, maybe?
Yes @davidpham87, I'll try to create a documentation section "integrating lsp with cider" on clojure language docs or a tutorial page
IMHO, more parts of lsp-mode need to be exposed as modes:
lsp-eldoc-mode
lsp-document-highlight-mode
lsp-semantic-highlighting-mode
)?This way, lsp-mode
would be more emacs-y.
@yyoncho what do you think?
@nbfalcon I'm opening a PR right now about the semantic tokens :sweat_smile:
@nbfalcon ATM we are refactoring to minor modes + a flag. Initially, everything was just a flag. @ericdallo did that refactoring for a few features.
Is someone working on lsp-eldoc-mode
and lsp-document-highlight-mode
already? There are lots of other fun new features in lsp-mode
; I especially like monikers, since that would give us live-rename as can be found in Eclipse CDT and IntelliJ.
Is someone working on
lsp-eldoc-mode
andlsp-document-highlight-mode
already? There are lots of other fun new features inlsp-mode
; I especially like monikers, since that would give us live-rename as can be found in Eclipse CDT and IntelliJ.
AFAIK no. What do you mean by monikers? I think that the new protocol has live rename.
The "monikers" are the live rename, unless I confused something. It works like this: in lsp-rename
we can request a list of all regions that have the symbol being renamed. They could then be edited in parallel, like iedit-mode
. We could probably also add something to the minibufer-style lsp-rename
so that they are all changed as the minibuffer contents change.
@nbfalcon IMHO that won't work, since rename might take several seconds. Here is what you are describing in the new protocol: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_linkedEditingRange
Sorry, I meant textDocument/linkedEditingRange
.
I can actually be more precise in the cider mesasge tool behavior: when applying the options {:show-docs-arity-on-same-line? true}
in ~/.lsp/config.edn
, lsp mode replace the cider message on the bottom bar with one line arity. However, cider usually displays the version of the repl doc, which I find more relevant. Is it still ignore by removeing eldoc?
That's a good idea for clojure-lsp
displays the version too ;)
No, if you in the future disable the lsp-eldoc feature, it will not override cider eldoc messages.
Do we have more work on that?
This conflict still exists, but clojure-lsp was improved a lot and do most of those things:
✅ "wheras LSP only displays the first in the UI": This could be fixed with show-docs-arity-on-same-line?
true
✅ "it seems LSP confuses cider and cider can't lookup any core docs or definition": this probably could happen in frameworks like doom or spaceemacs and it depends on how they configure the find-definition, using lsp-find-definition
will probably don't cause that issue.
❓ "However, cider usually displays the version of the repl doc, which I find more relevant.": I didn't find any repl doc version on cider docs display, if you meant the file path which includes the lib version, clojure-lsp started to include this as well.
cider
lsp-describe-thing-at-point
How about this as a way to avoid blatting the CIDER eldoc info?…
(defun nomis/lsp-eldoc ()
;; Don't blat signatures from CIDER.
(unless (ignore-errors (cider-repls))
(lsp-hover)))
(setq lsp-eldoc-hook '(nomis/lsp-eldoc))
Closing based on https://github.com/emacs-lsp/lsp-mode/issues/2445#issuecomment-831924422 . Please reopen or file another issue if there are more things to be adressed.
Describe the bug Cider and lsp-mode for clojure conflicts and lsp-mode effects negatively the behavior of Cider.
One of which is when inside a function call, cider displays the signature of the verb in the bottom message bar. (For example for max-keys, cider would show the 3 arities, wheras LSP only displays the first in the UI). Moreover, it seems LSP confuses cider and cider can't lookup any core docs or definition.
To Reproduce
Download from cider melpa, and install the lsp-server for clojure.
Activate both of them.
Download and install babashka
, and launch a nrepl-server
Alternatively, one can download clojure and launch a nrepl.
Write this file somewhere:
Connect the cider session to the clojure file.
Expected behavior Normally, when the cursor is on the space of the cursor, cider displays
clojure.core/reduce
and several of the arities in the bottom message bar. However, with LSP, this is not the case. Moreover, when using the fullclojure-cli
version (ie. java + clojure.jar + nrepl) and with LSP is activated, one can not usecider-find-var
onreduce
(shortcut is M-.).Which Language Server did you use lsp-clojure.
OS Ubuntu. Emacs GUI. Emacs version 28.0.50 native compiled.