marlonrichert / zsh-autocomplete

🤖 Real-time type-ahead completion for Zsh. Asynchronous find-as-you-type autocompletion.
MIT License
5.3k stars 147 forks source link

Auto completion has stopped working after upgrade to "e327674" #600

Closed Pilgrim1379 closed 1 year ago

Pilgrim1379 commented 1 year ago

I updated zsh-autocomplete today and since the update I don't get auto completion anymore. Even pressing tab doesn't trigger auto completion. If I however comment out ource $ZDOTDIR/plugins/zsh-autocomplete/zsh-autocomplete.plugin.zsh and replace it with the following config - copied from somewhere - I get at least tab auto completion.

Click to expand ```zsh # Should be called before compinit zmodload zsh/complist autoload -U compinit; compinit _comp_options+=(globdots) # With hidden files autoload -U bashcompinit; bashcompinit # setopt GLOB_COMPLETE # Show autocompletion menu with globs setopt MENU_COMPLETE # Automatically highlight first element of completion menu setopt AUTO_LIST # Automatically list choices on ambiguous completion. setopt COMPLETE_IN_WORD # Complete from both ends of a word. # Define completers zstyle ':completion:*' completer _extensions _complete _approximate # Use cache for commands using cache zstyle ':completion:*' use-cache on zstyle ':completion:*' cache-path "$XDG_CACHE_HOME/zsh/.zcompcache" # Complete the alias when _expand_alias is used as a function zstyle ':completion:*' complete true zle -C alias-expension complete-word _generic bindkey '^Xa' alias-expension zstyle ':completion:alias-expension:*' completer _expand_alias # Allow you to select in a menu zstyle ':completion:*' menu select # Autocomplete options for cd instead of directory stack zstyle ':completion:*' complete-options true zstyle ':completion:*' file-sort modification zstyle ':completion:*:*:*:*:corrections' format '%F{yellow}!- %d (errors: %e) -!%f' zstyle ':completion:*:*:*:*:descriptions' format '%F{blue}-- %D %d --%f' zstyle ':completion:*:*:*:*:messages' format ' %F{purple} -- %d --%f' zstyle ':completion:*:*:*:*:warnings' format ' %F{red}-- no matches found --%f' # zstyle ':completion:*:default' list-prompt '%S%M matches%s' # Colors for files and directory zstyle ':completion:*:*:*:*:default' list-colors ${(s.:.)LS_COLORS} # Only display some tags for the command cd zstyle ':completion:*:*:cd:*' tag-order local-directories directory-stack path-directories # zstyle ':completion:*:complete:git:argument-1:' tag-order !aliases # Required for completion to be in good groups (named after the tags) zstyle ':completion:*' group-name '' zstyle ':completion:*:*:-command-:*:*' group-order aliases builtins functions commands # See ZSHCOMPWID "completion matching control" zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' zstyle ':completion:*' keep-prefix true ```

Not sure it's even a bug on zsh-autocomplete's part and frankly I'm not hopeful on getting a solution but hey.

Environment

% typeset -p1 VENDOR OSTYPE ZSH_PATCHLEVEL _autocomplete__funcfiletrace
<output>
typeset VENDOR=apple
typeset OSTYPE=darwin21.3.0
typeset ZSH_PATCHLEVEL=zsh-5.9-0-g73d3173
typeset -a _autocomplete__funcfiletrace=(
  /Users/nqa/.config/zsh/plugins/zsh-autocomplete/zsh-autocomplete.plugin.zsh:4
  /Users/nqa/.config/zsh/completion.zsh:96
  /Users/nqa/.config/zsh/.zshrc:74
  zsh:0
)

% git -C ~autocomplete log --oneline -n1
<output>
e327674 (HEAD -> main, origin/main, origin/HEAD) Don't overwrite Autosuggest's default ignore list

Steps to reproduce

Well here's the thing. If I install zsh-autocomplete in the isolated environment it works as expected.

Contents of ~autocomplete-log/2023-06-13.log (click to expand)
The file is empty
Pilgrim1379 commented 1 year ago

Yeah I'm convinced there's something that doesn't agree with my zsh config in commit e327674 or some other commit before that because I reinstalled release 2023-05-24 and without changing anything else I have autocompletion working again as before.

lask79 commented 1 year ago

I am having the same issue when using Antidote plugin manager. Arrow Down and Up is working but no direct autocomplete or Ctrl+R for history search anymore.

Pilgrim1379 commented 1 year ago

Glad I'm not alone. I'll leave my laptop alone then as I've been messing about with it believing there's something wrong with it. Hopefully someone can magic a fix. I'm back on the last release for now which is working as expected.

sa-mendez commented 1 year ago

I am also having this issue, and thanks to the suggestions here, have rolled back to tag 23.05.24, and was able to restore the auto-completion behavior that I was used to.

By the way, i was able to get auto-completion to at least trigger the displaying of suggestions by holding down the Tab key. Of course, it was basically useless as the moment I took my finger of the key, it went back to showing nothing.

zoni commented 1 year ago

I was also affected by this. I've narrowed it down to having been introduced in either 2de12263ec57bd4c453b0770c695b240f3ce63cb or e327674284e753c16021976fcbdd178eef2bcdcf.

(I couldn't revert/cherry-pick these in isolation without getting merge conflicts, and didn't feel like sorting that out just to narrow it down from 2 to 1 candidate)

marlonrichert commented 1 year ago

@Pilgrim1379 @lask79 @sa-mendez @zoni Please provide me with a minimal test case with which I can reproduce the bug. If I cannot reproduce it, I cannot fix it.

Pilgrim1379 commented 1 year ago

@marlonrichert So I went though my config section by section and I believe the line export KEYTIMEOUT=1 in my vi keymap section is the culprit. When I comment it out real-time type-ahead autocompletion works and the opposite happens when I uncomment it so I've now commented it out and all is good.

I don't understand why that is the case though. Will appreciate some education on why it could impact real-time type-ahead autocompletion that way.

marlonrichert commented 1 year ago

Ah, I see now what is the problem. Autocomplete uses $KEYTIMEOUT as the basis for its default timeout value: https://github.com/marlonrichert/zsh-autocomplete/blob/93df12ea525478608a3321b6d69a8d2209237336/Functions/Init/.autocomplete%3Aasync#L243C31-L243C38

Perhaps that's not the smartest thing to do. I'll change it.

sa-mendez commented 1 year ago

Just grabbed this and tested it. Behavior is back to how it was. Thank you.

lask79 commented 1 year ago

Also thx from my side. Thanks for the great plugin.