Description
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
:
- Namespace completion by first letters of namespaces:
(cider-complete "cji")
=>(#("clojure.java.io" 0 1 (ns nil type "namespace")))
Tab
withflex
=> no completions.
- 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
withflex
=> no completions.
- Fuzzy completion behind namespace prefix:
(cider-complete "str/sl")
=>(#("str/split-lines" 0 1 (ns "clojure.string" type "function")))
Tab
withflex
=> 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.