-
-
Notifications
You must be signed in to change notification settings - Fork 645
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
cider-enable-flex-completion
is not a sufficient replacement for cider-company-enable-fuzzy-completion
#3653
Comments
Overall, the less the frontend (editor) tries to be smart about the completion candidates, the better. We can control the UX match better on the backend. And if there are users that want |
Thanks for the issue! We should tread carefully here because we shouldn't necessarily be smarter than (or reinvent) Emacs' mechanisms. Most of all, it's a concern of simplicity - Emacs has an abundance of styles, and there's also an abundance of Emacs packages building up on those, so creating our own standards can possibly make things even messier for everyone involved. I don't have a specific suggestion/stance except: we can try first hard at adhering at Emacs standards and squeezing performance out of them. If we document reasoning/facts reflecting that that's impossible, we could keep exploring solutions. |
Quick q - would it make sense to pass the completion style to Compliment? In my mind it would make sense - then Compliment could infer what's wanted and return fewer / more relevant results. |
I'll repeat just in case: the problem is Emacs not displaying valid completion candidates returned by Compliment. Some of those are really important (like completing a class by its short name). What you've proposed, if I understand correctly, would be to pass say |
What if we passed So it would include (among other stuff) these 3 things:
|
I think we should be smarter than Emacs mechanisms. I don't see mainline Emacs as the frontier in completion solutions; e.g., |
Then Compliment doesn't really need to know that it was |
I think I understood what you mean. So we would return the same "preferred" result twice, for normal prefix, and for the empty prefix, and let Emacs show the candidates that we want to show in the empty prefix case. I mean, that would work, but it feels like a bigger hack to me than what |
Well we (certainly you and me) use Company but many others user Corfu and whatnot. That's where adhering to standards show their value - supporting a large divesity of users
Then we have a potential solution, right? Have CIDER pass the actual user input as an additional k-v (passing flex might be worthwhile for further trimming results, but I'd understand if you didn't want that duplicated work) |
Yes
It seems a clean, low-effort, low-complection solution to me. Pass additional properties from the frontend and act on them on the backend. To me (as someone who strives to support a diverse set of users) there's high value in adhering to Emacs standards, so I'd vote for this solution unless there was a huge factual drawback. |
Actually, I tried it again, and I see two identical messages are sent to nrepl for each completion attempt:
How would passing extra arguments to Compliment help here? |
Please describe what's wrong in the nrepl interaction above |
The problem is that Emacs sends two identical requests to the backend (with prefix "InputS"). Compliment returns the correct result both times, but Emacs refuses to render it. |
Why does that happen? |
Do you ask me? :) However, if the prefix is all-lowercase, then it sends the second request with an empty prefix:
|
Basically, if CIDER can control what is sent to Compliment, then you don't really have to pass |
Okay, we'd have to look into this first - could plausibly be a bad implementation on our end Without this information there's not really much decision-making to do. |
I thought it was Emacs completion engine that controls it. If not, then it would make things easier, I suppose. |
As long as |
Fixing the issue would seem a good course of action - having churn in the docs can easily be confusing. We can add a For clarity - would you be interested into digging into the Elisp part? |
Maybe later – looks like quite a bit digging is required.
I think it's fine, enough people have the context now. |
Yeah, I'm reasonably sure the Emacs completion engine controls it. But there's always the chance we've messed something up on our end. 😅
Sure. Feel free to update the docs to reflect your findings. I guess I haven't used the new flex completion, so I didn't notice the issues with it. (I switched from Company to Corfu a while ago and I was too lazy to customize it to my liking so I went back to the basics) |
I see we also have a bunch of notes about missing functionality here:
That might be related to the problems that @alexander-yakushev has observed. |
Yes, surely if we implemented the other styles, other issues would become more evident. |
Title / OP in #3006 hints that our current state isn't quite polished. |
Ah, yeah - I had forgotten about it. |
After I enabled
cider-enable-flex-completion
instead ofcider-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 offlex
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 inflex
:(cider-complete "cji")
=>(#("clojure.java.io" 0 1 (ns nil type "namespace")))
Tab
withflex
=> no completions.(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.(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.The text was updated successfully, but these errors were encountered: