Skip to content

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

Closed
@rrudakov

Description

@rrudakov

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions