zsh-autocomplete icon indicating copy to clipboard operation
zsh-autocomplete copied to clipboard

Available completions not shown for commands with slow `compdef` functions

Open ethantkoenig opened this issue 2 months ago • 0 comments

Environment

% typeset -p1 VENDOR OSTYPE ZSH_PATCHLEVEL _autocomplete__funcfiletrace
typeset VENDOR=apple
typeset OSTYPE=darwin23.0
typeset ZSH_PATCHLEVEL=zsh-5.9-0-g73d3173
typeset -a _autocomplete__funcfiletrace=(
  /var/folders/wn/hb12b9pd7vvcghywcg1npbgh0000gp/T/tmp.SOEDKKuKg2/zsh-autocomplete/zsh-autocomplete.plugin.zsh:4
  /var/folders/wn/hb12b9pd7vvcghywcg1npbgh0000gp/T/tmp.SOEDKKuKg2/.zshrc:5
  zsh:0
)
% git -C ~autocomplete log --oneline -n1
1968100 (grafted, HEAD -> main, origin/main, origin/HEAD) Fix bugs in `recent-paths` widget
  • Operating system: macOS Sonoma 14.4.1
  • Terminal emulator: Terminal.app

Steps to reproduce

% cd $(mktemp -d)
% git clone --depth 1 -- https://github.com/marlonrichert/zsh-autocomplete.git
<output>
% > .zshrc <<EOF
setopt interactivecomments transientrprompt
PS1='%# '
PS2=
RPS2='%^'
source $PWD/zsh-autocomplete/zsh-autocomplete.plugin.zsh
EOF
% env -i HOME=$PWD PATH=$PATH TERM=$TERM ${TERMINFO:+TERMINFO=$TERMINFO} zsh -d
% _fast_foo() { local -a subcmds; subcmds=('a:1' 'b:2'); _describe 'command' subcmds }
% _slow_foo() { sleep 1; _fast_foo }
% compdef _fast_foo fast_foo
% compdef _slow_foo slow_foo
% fast_foo  # <-- available completions are displayed after typing space past "fast_foo"
command
a  -- 1
b  -- 2
% slow_foo  # <-- available completions are not displayed

Verified that ~autocomplete-log/2024-04-08.log is empty (after running the above commands):

% ls -s ~autocomplete-log/2024-04-08.log
0 /var/folders/wn/hb12b9pd7vvcghywcg1npbgh0000gp/T/tmp.SOEDKKuKg2/.local/state/zsh-autocomplete/log/2024-04-08.log

ethantkoenig avatar Apr 09 '24 01:04 ethantkoenig