zsh-users / zsh-autosuggestions

Fish-like autosuggestions for zsh
MIT License
31.54k stars 1.87k forks source link

Broken by zsh-autocomplete on Zsh 5.9 #751

Open ccostello97 opened 1 year ago

ccostello97 commented 1 year ago

I originally had posted this as an issue on marlonrichert/zsh-autocomplete but it was pointed out that this would be better classified as an issue in zsh-autosuggestions.

If you have zsh-autosuggestions and set ZSH_AUTOSUGGEST_STRATEGY=(history completion), autosuggest will first try to find a suggestion from your history, but, if it can't find a match, will find a suggestion from the completion engine.

With zsh-autocomplete installed, autosuggest will still show history suggestions, but ignore completion suggestions.

Expected behavior is that zsh-autosuggestions would continue to respect configuration set by ZSH_AUTOSUGGEST_STRATEGY.

System:

M1 Mac
macOS Ventura 13.4.1
zsh 5.9

Working for history:

248826225-dc98c6e3-1b63-4aec-8529-e3ad3f475a85

Not working for completion which is not in history:

248826350-0a622076-0e18-484b-9870-22d8b8e235e0

I have another laptop with the same specs and same exact Zsh configurations running 5.8 where both plugins work in tandem, which makes me think this is related to changes to completions engine between Zsh versions.

ccostello97 commented 1 year ago

Upgraded my second mac, which had been running 5.8, and it had been working, to 5.9, and can confirm Zsh version is integral in this not working

Sirix1995 commented 1 year ago

Looks like it's broken on my Mageia 8 too. It's enabled on Oh-my-zsh, but when I type something, nothing happens. It's completely inactive.

beatreichenbach commented 1 year ago

As a workaround add autoload -Uz compinit && compinit into .zshrc and completions work again.

edit: Unfortunately I don't know much about zsh and the build process to contribute a merge request but if someone knows more, here's what I inserted before here: https://github.com/zsh-users/zsh-autosuggestions/blob/c3d4e576c9c86eac62884bd47c01f6faed043fc5/src/start.zsh#L21

# Initialize completion for the current session
if (( ${+ZSH_AUTOSUGGEST_STRATEGY[(ie)completion]} )); then
    autoload -Uz compinit && compinit
fi