-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Improve completion suggestions #350
Conversation
There is a problem with this patch which already happened sometimes with auto-fu.zsh: In contrast to auto-fu.zsh, after a Ctrl-C in such a situation the shell can become unusable.
|
I should add that this message appeared already sometimes without this patch, but I was not able to reproduce it like now. (And it did not make the shell unusable). |
8334877
to
fc8c034
Compare
Interesting. I was seeing this locally before, but it was fixed for me with this patch. I was seeing it most reliably when typing a space after Have you found a case that reproduces the problem consistently? Can you provide more details? |
Also, I did just force push a small change that fixed a problem using autosuggest with zsh-syntax-highlighting after this patch. Maybe it would help with auto-fu as well. Can you try the most recent commit 6a3e310? |
It seems that there are 2 things involved.
Concerning the completion which takes ages: This happens also with ordinary completion (i.e. without zsh-autosuggestions). The strange thing is that the delay happens after the completion function finishes, i.e. somewhere in zsh itself. If zsh-autosuggest is not loaded, then pressing Ctrl-C has no effect, but eventually zsh becomes usable again. I needed quite some time to find a minimal example, since it is hard to produce: If the number of completions is reduced from 40000 to 10000, there is almost delay; so maybe there is some memory issue involved (if you have much more ram maybe you have to increase until you hit the "critical" limit). Also, the delay does not appear if the _description command is omitted
|
After removing the line
from my .zshrc due to #342 it turns out that the delay disappeared. |
Thank you so much for your effort reproducing and bisecting your zshrc to find the offending zstyle. I've pushed a new commit 156ae5e that ensures that the zpty is always destroyed (even on ctrl-c) so that it can be recreated without issue the next time around. Please try the latest and let me know if it solves the issue for you. As an aside, if you have completions that take a long time, you can use |
Indeed, 156ae5e fixes the problem. I had tried ZSH_AUTOSUGGEST_USE_ASYNC=true before, but it had not changed anything. |
That's not good. Can you reproduce this using
|
Aha. Again it was a setting in my zshrc. This time the harmless looking |
I have opened a new PR #352 for the latter. Async mode now works great! Maybe it should become the default. |
Just insert the first completion directly into the buffer and read the whole buffer from the zpty.
If running in sync mode and a completion takes a long time, the user can ^C out of it. Without this patch, the pty will not be destroyed in this case and the next time we go to create it, it will fail, making the shell unusable.
To prevent the suggestion from not starting with the buffer string. Example: `ls / /[cursor left][cursor left]b` Before the patch, suggests `ls /b /ls /bin/ /` After the patch, suggests `ls /b /bin/`. #343 (comment)
2743a2e
to
f1c3b98
Compare
Yes, it will eventually become the default. The implementation was just completely rewritten on |
Just insert the first completion directly into the buffer and read the whole buffer from the zpty.
Should fix a couple issues reported in #342.