-
-
Notifications
You must be signed in to change notification settings - Fork 43
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 mode #92
Comments
This is probably an issue with your configuration. Try to reproduce this with a minimal configuration, starting from emacs -Q. The issue is probably that other modes eat up computation time, which starves Corfu. Corfu uses
What do you mean by odd matches? It seems that filtering does not work at all. I assume you use lsp-mode, maybe an outdated version? @jdtsmith told me that on his setup lsp-mode works well, but it requires some tweaks.
Thanks! |
Oh, I'm using flyspell. What was the solution? I have no idea how to profile this.
See the I think the configuration I can't seem to remember was something that made company re-filter the reply from lsp. Which would explain how it could figure out what matched where. I can't see how Corfu could know how the lsp server thought that a given candidate matched the prefix. |
First try if it helps if you disable flyspell. Then one can look into possible solutions. But I've heard often that flyspell is too costly, so one may want to enable it only occasionally. If flyspell is not the problem, try to disable all kinds of different modes you have enabled. Some of which may add post-command-hooks and costly timers which then compete with Corfu. Although I wonder why Company does not have this issue.
Yes. The filtering does not work. Do you use the newest lsp-mode and the newest Corfu? There was a bug in lsp-mode, but this should be fixed by now. |
Looks to me like what has happened is that corfu completion popped up on Check out kind-icon if you like the icons. I use the "orderless" completion style, which is strange but strangely amazing. If you are using the default lsp-passthrough style, you have discovered that it doesn't do much of anything, and that lsp-mode sadly does not recompute candidates from scratch correctly in this case. It works with company since company tends to drop completions on any new input and asks for new ones. I find local filtering to be much faster. @minad I know you were involved in getting lsp-passthrough setup, does that seem like a bug with that simple style? Update: just tested a new lsp-mode with it's lsp-passthrough set, and I can confirm a complete lack of client-side filtering (it does at least sort them!). |
@jdtsmith Oh right, lsp-passthrough defeats the filtering. I forgot this, I wasn't deeply involved into the lsp-mode fix. The user has to overwrite the completion style. This should be documented at some point, seee #71 (comment). We should document both configurations, one with builtin completion styles basic/substring/flex and one with orderless. Can you paste your config here, @jdtsmith? The part where you adjust the completion style. See #41 (comment) (defun my/lsp-mode-use-orderless ()
(setf (alist-get 'styles
(alist-get 'lsp-capf completion-category-defaults))
'(orderless))) |
I can confirm that disable flyspell would solve the auto problem. I only turn on flyspell for comments and strings in prog mode. The corfu auto mode can not work properly and will lead to big delay. |
Check the wiki for a new section on configuring corfu with lsp-mode. I've come to the conclusion that lsp-mode really works best with a style like orderless, so that's what's shown there. Other modes can work too (even |
@jdtsmith Thank you! This is a big help. I have two question:
|
In the config example, I have now setup orderless to use flex-matching for its first search term. This means you get absolutely positively every candidate the server returned. I honestly regard this as optional, since many people I think would regard those flex-matched "candidates" the server has supplied as basically clutter not very related to their search term. So normal orderless "style" is perfectly generous for me (and faster). I mean, how likely was it I meant Not very! |
@jdtsmith I expanded the wiki documentation slightly, such that we have three configuration examples, from basic to more advanced. I think it is helpful to give simpler examples first and I don't want to give the impression that Cape is strictly needed for this to work. Please take a look! Thank you again for your help - your documentation is well written! @xendk If you find time, please give it another try! See the documentation in the Wiki. The slowness issue in conjuction with flex mode should also be fixed if you use the newest Corfu version from git. I am looking forward to your feedback, if it indeed works well now. Closing. The issues should be fixed and documented. If there are further questions please let us know. |
Looks good, I fixed a few typos. But I see you added |
I removed the |
Excellent! This made me notice that my cursor doesn't blink while flyspell is doing its thing. It's rather a lot of resources it's using, innit? Hopefully someone will look into that some day. After updating lsp and setting the style to basic, things looks right. Thanks @minad and @jdtsmith Now on to fiddling with stuff! |
Corfu looks very promising, but I've run into a few problems early on.
Auto-mode is extremely slow for me. Even though it's configured with the 0.2 sec delay, when typing
(exec
in an elisp buffer it takes 3 seconds before the popup appears. However, if I move about and return to the same position (to get rid of the popup), runningcompletion-at-point
makes the popup appear instantaneously.In the scratch buffer I get no popup at all, though
completion-at-point
still works.Corfu doesn't know how to highlight odd matches:
Somehow company manages to get it right:
(and can filter out the non-matching, but I seem to recall having to set some odd variable, but bugger me if I can remember).
I'm a big fan of consult, embark and marginalia.
The text was updated successfully, but these errors were encountered: