Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clojure w/ LSP & Cider does not autocomplete in source buffers #7381

Open
4 tasks done
JonsSpaghetti opened this issue Aug 29, 2023 · 5 comments
Open
4 tasks done

Clojure w/ LSP & Cider does not autocomplete in source buffers #7381

JonsSpaghetti opened this issue Aug 29, 2023 · 5 comments
Labels
is:bug Something isn't working as intended needs-triage Issue hasn't been assessed yet

Comments

@JonsSpaghetti
Copy link

JonsSpaghetti commented Aug 29, 2023

I confirm that...

  • I have searched the issue tracker, documentation, FAQ, Discourse, and Google, in case this issue has already been reported/resolved.

  • I have read "How to Debug Issues", and will use it to provide as much information about this issue as possible.

  • The issue can be reproduced on the latest available commit of Doom.

  • 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

  1. Set up doom config to only have lsp & clojure +lsp enabled.
  2. Open a clojure project
  3. cider-jack-in
  4. visit the repl and type some function/namespace name.
  5. Visit a source buffer and type some function/namespace name.

System Information

https://pastebin.com/3ecvdGmx

@JonsSpaghetti JonsSpaghetti added is:bug Something isn't working as intended needs-triage Issue hasn't been assessed yet labels Aug 29, 2023
@mjmeintjes
Copy link

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.

@runejuhl
Copy link

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.

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

@mjmeintjes
Copy link

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-command points 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.

@JonsSpaghetti
Copy link
Author

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.

@dmg46664
Copy link

dmg46664 commented Oct 5, 2024

Spacemacs user here. Thanks to this thread I found the following observing similar issues
emacs-lsp/lsp-mode#4526

I either:

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
is:bug Something isn't working as intended needs-triage Issue hasn't been assessed yet
Projects
None yet
Development

No branches or pull requests

4 participants