Clojure w/ LSP & Cider does not autocomplete in source buffers
I confirm that...
-
[X] I have searched the issue tracker, documentation, FAQ, Discourse, and Google, in case this issue has already been reported/resolved.
-
[X] I have read "How to Debug Issues", and will use it to provide as much information about this issue as possible.
-
[X] The issue can be reproduced on the latest available commit of Doom.
-
[X] The issue can be reproduced on a stable release of Emacs, such as 27 or 28. (Doom does not support development builds like 29+ or any version ending in .50 or .9x)
Expected behavior
When I type a symbol in my source buffer, a dropdown menu should display completion options as I type.
Current behavior
When I type in the nrepl buffer I can see completion options in a dropdown. When my TAB is set to use company-indent-or-complete-common I can see completion options in my minibuffer after hitting tab.
When I type in a source buffer, I see no completion options at any point even if setting my TAB to use the company-indent-or-complete-common function. The message I see is "No Completion" even when I know one exists.
When enabling nrepl-toggle-message-logging, I see that when I'm typing in the repl. I get these messages:
(-->
id "183"
op "complete"
session "f96cd993-b963-445a-a91b-1ed72abc0ef6"
time-stamp "2023-08-29 06:07:33.562218426"
context ":same"
enhanced-cljs-completion? "t"
ns "io.testproj"
prefix "gr"
)
(<--
id "183"
session "f96cd993-b963-445a-a91b-1ed72abc0ef6"
time-stamp "2023-08-29 06:07:33.585709800"
completions ((dict "candidate" "greet" "ns" "io.testproj" "type" "function")
(dict "candidate" "group-by" "ns" "clojure.core" "type" "function"))
status ("done")
)
However, when I type in a source buffer, I never see these complete ops and only see eldoc ops.
No backtrace is available because there are no error messages.
No concerning output in *Messages*.
After reading through some additional online posts today, I did see that folks were saying that lsp mode loads some stuff that overrides the cider-mode completion so I went ahead and removed the +lsp from my init.el and re-sync'ed my doom and that did solve the issue.
Steps to reproduce
- Set up doom config to only have lsp & clojure +lsp enabled.
- Open a clojure project
- cider-jack-in
- visit the repl and type some function/namespace name.
- Visit a source buffer and type some function/namespace name.
System Information
https://pastebin.com/3ecvdGmx
I had the same problem, but it turned out I was using an old version of clojure-lsp. Upgrading the clojure-lsp and ensuring that lsp-clojure-custom-server-command points to the correct version seems to have fixed autocompletion for me.
I had the same problem, but it turned out I was using an old version of clojure-lsp. Upgrading the clojure-lsp and ensuring that
lsp-clojure-custom-server-commandpoints to the correct version seems to have fixed autocompletion for me.
@mjmeintjes if you don't mind me asking, do you recall the versions before and after? I have the same issue, but I'm currently on the most recent clojure-lsp (2023.08.06-00.28.06). Thanks!
I'm
I had the same problem, but it turned out I was using an old version of clojure-lsp. Upgrading the clojure-lsp and ensuring that
lsp-clojure-custom-server-commandpoints to the correct version seems to have fixed autocompletion for me.@mjmeintjes if you don't mind me asking, do you recall the versions before and after? I have the same issue, but I'm currently on the most recent
clojure-lsp(2023.08.06-00.28.06). Thanks!
I'm currently using the following versions:
clojure-lsp --version
clojure-lsp 2023.05.04-19.38.01
clj-kondo 2023.04.15-SNAPSHOT
They seem to work ok.
Not sure what version I was using previously, but it was a couple of years old.
Note that I had the latest version installed, but my lsp-clojure-custom-server-command variable was still pointing to the old version for some reason.
I put this in the original post but will re add here that it does seem like +lsp in my init.el does seem to interfere with cider mode so when I removed that everything started working. If the version upgrade doesn't work for you I suggest giving that a try.
Spacemacs user here. Thanks to this thread I found the following observing similar issues https://github.com/emacs-lsp/lsp-mode/issues/4526
I either:
- Disable
lsp-completion-modewhich solves my issue. - Add the snippet and rerun
clojure-modewhich resets it instead of toggling... https://github.com/emacs-lsp/lsp-mode/issues/4526#issuecomment-2282924124
Just upgraded the following from 2023 versions, no difference.
clojure-lsp --version
clojure-lsp 2024.08.05-18.16.00
clj-kondo 2024.08.01