Skip to content
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

Freezes for a few seconds on entering a command #736

Open
Mosazghi opened this issue Jul 2, 2024 · 3 comments
Open

Freezes for a few seconds on entering a command #736

Mosazghi opened this issue Jul 2, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@Mosazghi
Copy link

Mosazghi commented Jul 2, 2024

Environment

% typeset -p1 VENDOR OSTYPE ZSH_PATCHLEVEL _autocomplete__funcfiletrace
<output>
typeset VENDOR=ubuntu
typeset OSTYPE=linux-gnu
typeset ZSH_PATCHLEVEL=ubuntu/5.9-6ubuntu2
typeset -a _autocomplete__funcfiletrace=(
  /home/mosa/.oh-my-zsh/custom/plugins/zsh-autocomplete/zsh-autocomplete.plugin.zsh:4
  /home/mosa/.oh-my-zsh/oh-my-zsh.sh:175
  /home/mosa/.oh-my-zsh/oh-my-zsh.sh:204
  /home/mosa/.zshrc:27
  zsh:0
)
<output>

config file

 export ZSH="$HOME/.oh-my-zsh"

 ZSH_THEME="amuse"

 source $ZSH/oh-my-zsh.sh



 # Path to your oh-my-zsh installation.
 export ZSH="$HOME/.oh-my-zsh"
 export PATH="/usr/local/MATLAB/R2023b/bin:$PATH"
 export DOTNET_ROOT=$HOME/.dotnet
 export PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools
 export PATH="$PATH:/opt/nvim-linux64/bin"
 export VCPKG_ROOT="$HOME/vcpkg"
 export PATH=$VCPKG_ROOT:$PATH

 zstyle ':omz:update' frequency 13

 ENABLE_CORRECTION="true"

  DISABLE_UNTRACKED_FILES_DIRTY="true"

 HIST_STAMPS="mm/dd/yyyy"

plugins=(git themes zsh-autosuggestions zsh-syntax-highlighting fast-syntax-highlighting zsh-autocomplete)
source $ZSH/oh-my-zsh.sh
#
# # User configuration
 
  export MANPATH="/usr/local/man:$MANPATH"
 
  _dotnet_zsh_complete()
  {
    local completions=("$(dotnet complete "$words")")
 
    # If the completion list is empty, just continue with filename selection
    if [ -z "$completions" ]
    then
      _arguments '*::arguments: _normal'
      return
    fi
 
    # This is not a variable assignment, don't remove spaces!
    _values = "${(ps:\n:)completions}"
  }

  compdef _dotnet_zsh_complete dotnet
  #source "$HOME/.cargo/env"
  . "$HOME/.cargo/env"   
  export PATH="$PATH:/home/mosa/.local/bin"

  export NVM_DIR="$HOME/.nvm"
  [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
  [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
  export HISTFILESIZE=10000000
  export HISTSIZE=10000000
  export HISTFILE=~/.zsh_history

  setopt HIST_FIND_NO_DUPS
  # following should be turned off, if sharing history via setopt SHARE_HISTORY
  setopt INC_APPEND_HISTORY

zstyle ':completion:*' list-prompt   ''
zstyle ':completion:*' select-prompt ''
  zstyle ':fzf-tab:complete:cd:*' fzf-preview "ls --color $realpath"
  fpath+=${ZDOTDIR:-~}/.zsh_functions
  export BAT_THEME=gruvbox-dark
  export QT_QPA_PLATFORM=xcb
  export IDF_PATH=~/esp/esp-idf
  export PATH=~/esp/xtensa-esp32-elf/bin:$PATH
  export PATH=/path/to/mxe/usr/bin:$PATH
  [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
 #
 #
  # Aliases 
  alias zshconfig="mate ~/.zshrc"
  alias ohmyzsh="mate ~/.oh-my-zsh"
  alias n="nvim"
  # alias ls="ls --color"
  alias cat="batcat"
  alias kittyupdate="curl -L https://sw.kovidgoyal.net/kitty/installer.sh | sh /dev/stdin"
  alias get_idf='. $HOME/esp/esp-idf/export.sh'
  alias idf="idf.py"
  alias lg="lazygit"
  alias idfb="idf build -DCMAKE_EXPORT_COMPILE_COMMANDS=1"
  alias idff="idf flash"
  alias idfr="idfb && idff"
  alias idfrm="idfr && idf monitor"
  alias lg="lazygit"
  alias mr="mosquitto -v -c /etc/mosquitto/conf.conf"
  • Operating system:
    Ubuntu 24.04 LTS
  • Terminal emulator:
    Kitty

Steps to reproduce

So when typing commands like
sudo apt update <space>
git clone <space>
sudo apt upgrade <space>
It freezes for a few seconds. But it gets annoying so i just CTRL + C and this is the output.
image

% 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
% <inputs>
<output>

^ Do the above. I notice the freezes only last about 1 second now, but still noticeable.

Contents of ~autocomplete-log/YYYY-MM-DD.log (click to expand)
$ cat 2024-07-01.log 
───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
       │ File: 2024-07-01.log
───────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1   │ .autocomplete:async:pty:zle-widget:15: completion cannot be used recursively (yet)
   2   │ .autocomplete:async:complete:fd-widget:35: completion cannot be used recursively (yet)
   3   │ .autocomplete:async:complete:fd-widget:35: completion cannot be used recursively (yet)
@Mosazghi Mosazghi added the bug Something isn't working label Jul 2, 2024
@S-Yuan137
Copy link

S-Yuan137 commented Jul 11, 2024

I have similar things when I use rsync and tab to complete the folder names.

@jo3-l
Copy link

jo3-l commented Jul 17, 2024

I bisected the issue locally to bbbefed, which seems a plausible cause as the commit adjusts the main completion logic. At the previous commit, adfade3, completion works as expected without any freezing for me. So a potential workaround for this bug is to git checkout adfade3 in one's installation of zsh-autocomplete.

Unfortunately, I am not familiar enough with shell or zsh plugins to suggest a fix, but hopefully this helps with investigation.

@michaeldebetaz
Copy link

michaeldebetaz commented Oct 25, 2024

Hi, I also experience some freezing in my shell, especially when typing npm r. It indeed disappears when disabling zsh-autocompletion.

I am unsure about how to checkout from zsh-autocomplete latest commit to a previous commit. I tried going to plugins/marlonrichert/zsh-autocomplete and typing git checkout adfade3, but it didn't find the branch.

EDIT : okay, I found how to revert back to the adfade3 commit and it indeed solves the new problems I encounter with the latest commits.

  1. First, cd to your zsh-autocomplete (e. g. for me ~/.config/zsh/plugins/marlonrichert/zsh-autocomplete
  2. Because we use git clone --depth 1 when installing the module with the recommanded script, we don't clone the previous commits. So we have to git fetch --unshallow to get the complete clone of the repo.
  3. Only after that can we git checkout adfade3
  4. For me, it solved the freezes and the unwanted tilde tab expansion.

dre1080 added a commit to dre1080/dotfiles that referenced this issue Nov 5, 2024
For now, we download a specific previous version that does not have this
bug yet.

See:
marlonrichert/zsh-autocomplete#736 (comment)
k14lb3 added a commit to k14lb3/dotfiles that referenced this issue Dec 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants