cider icon indicating copy to clipboard operation
cider copied to clipboard

`cider-enable-flex-completion` is not a sufficient replacement for `cider-company-enable-fuzzy-completion`

Open alexander-yakushev opened this issue 3 months ago • 26 comments

After I enabled cider-enable-flex-completion instead of cider-company-enable-fuzzy-completion, I noticed that my completion was acting up. Certain prefixes that used to complete correctly now failed to complete, and weird suggestions were popping up. The weird suggestions are understandable because of flex aggressive fuzzy policy, but that's not that big of an issue. The issue is the following completion scenarios supported by compliment that don't work in flex:

  1. Namespace completion by first letters of namespaces:
  • (cider-complete "cji") => (#("clojure.java.io" 0 1 (ns nil type "namespace")))
  • Tab with flex => no completions.
  1. FQ classname completions by first word:
  • (cider-complete "InputSt") => (#("java.io.InputStream" 0 1 (ns nil type "class")) #("java.io.InputStreamReader" 0 1 (ns nil type "class")) ...
  • Tab with flex => no completions.
  1. Fuzzy completion behind namespace prefix:
  • (cider-complete "str/sl") => (#("str/split-lines" 0 1 (ns "clojure.string" type "function")))
  • Tab with flex => no completions.

There are a couple of others but they are not as important as these.

Additionally, Emacs achieves this flex behavior by sending two requests to the backend: one with the normal prefix and one with empty prefix (""). Since we have no upper bound on the number of candidates we return, this may add some extra overhead/delay for the completion because CIDER has to deserialize all that output.

alexander-yakushev avatar May 05 '24 18:05 alexander-yakushev