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

Auto completion is not reliable after switching to cider-nrepl 0.45.0 #3613

Closed
rrudakov opened this issue Jan 29, 2024 · 4 comments · Fixed by #3614
Closed

Auto completion is not reliable after switching to cider-nrepl 0.45.0 #3613

rrudakov opened this issue Jan 29, 2024 · 4 comments · Fixed by #3614

Comments

@rrudakov
Copy link
Contributor

Expected behavior

Code completion works consistently.

Actual behavior

Relevant completion candidates disappear from the list randomly (I noticed this at least for local bindings and keywords).

Steps to reproduce the problem

This is tricky, because sometimes it works and sometimes not.

  1. Create a simple deps.edn project and define some function with local bindings:
(defn foo
  [bar]
  (let [my-local-variable "Hello"]
    (println __poin-is-here__)))
  1. Start typing slowly my-local-variable (maybe remove some characters then type again)
  2. At some point my-local-variable won't be in the list of company/cofru candidates.

Relevant nREPL messages:

(-->
  id                        "29"
  op                        "complete"
  session                   "b73b77fd-9a14-47a3-9d5b-d6daeead5e1a"
  time-stamp                "2024-01-29 12:30:02.303359000"
  context                   "(defn foo
  [bar]
  (let [my-local-variable "Hello"]
    (pr..."
  enhanced-cljs-completion? "t"
  ns                        #("com.example.app" 0 15 (face font-lock-type-face cider-block-dynamic-font-lock t cider-locals nil fontified t))
  prefix                    "my-"
)
(<--
  id          "29"
  session     "b73b77fd-9a14-47a3-9d5b-d6daeead5e1a"
  time-stamp  "2024-01-29 12:30:02.309337000"
  completions ((dict "candidate" "my-map" "ns" "com.example.app" "type" "var")
 (dict "candidate" "my-local-variable" "type" "local"))
  status      ("done")
)
(-->
  id                        "30"
  op                        "complete"
  session                   "b73b77fd-9a14-47a3-9d5b-d6daeead5e1a"
  time-stamp                "2024-01-29 12:30:07.146519000"
  context                   ":same"
  enhanced-cljs-completion? "t"
  ns                        #("com.example.app" 0 15 (face font-lock-type-face cider-block-dynamic-font-lock t cider-locals nil fontified t))
  prefix                    "my-l"
)
(<--
  id          "30"
  session     "b73b77fd-9a14-47a3-9d5b-d6daeead5e1a"
  time-stamp  "2024-01-29 12:30:07.151185000"
  completions nil
  status      ("done")
)

On first request with prefix = my- the variable is present in the list of candidates, on the second request with prefix my-l the list of candidates is empty.

Other observations

  • After downgrading cider-nrepl to version 0.44.0 the problem is not reproducible.

  • The problem is reproducible for both: Clojure and ClojureScript projects. Maybe it's related to the upgrade of compliment, but I'm not sure and I don't know how to debug it.

  • I can reproduce it with default CIDER settings with emacs -q.

Screencast

screencast.mov

Environment & Version information

CIDER version information

;; CIDER 1.14.0-snapshot (package: 20240121.2104), nREPL 1.0.0
;; Clojure 1.11.1, Java 17.0.9

Lein / Clojure CLI version

Clojure CLI 1.11.1

Emacs version

29.2

Operating system

MacOS 14 & Arch Linux (reproducible on both)

JDK distribution

openjdk version "17.0.9" 2023-10-17
OpenJDK Runtime Environment Homebrew (build 17.0.9+0)
OpenJDK 64-Bit Server VM Homebrew (build 17.0.9+0, mixed mode, sharing)

@vemv
Copy link
Member

vemv commented Jan 29, 2024

Thanks! There's been a batch of Compliment changes with cider-nrepl 0.45.

@alexander-yakushev , does this report ring a bell?

@alexander-yakushev
Copy link
Member

Damn it, yes, my bad. I broke context caching compatibility in Compliment and forgot to update it in CIDER. Will a CIDER fix suffice or should I revert the breaking change?

@vemv
Copy link
Member

vemv commented Jan 29, 2024

Thanks much for the detailed report @rrudakov and the quick response @alexander-yakushev 🙌

@rrudakov
Copy link
Contributor Author

Thanks for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants