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

Few tab completions on WSL2 takes 5-10 seconds #412

Open
NoelJacob opened this issue Sep 10, 2020 · 4 comments
Open

Few tab completions on WSL2 takes 5-10 seconds #412

NoelJacob opened this issue Sep 10, 2020 · 4 comments

Comments

@NoelJacob
Copy link

Description

In WSL2, tab completion is very slow on executable files and in certain directories

Steps to Reproduce

a<tab>
# Wait 5-10 seconds and it will eventually show the completion menu

The issue is much more evident when tab completing a specific file that is in the immediate directory and thus doesn't require the menu to appear:

cd ~
touch foo
chmod +x foo
./fo<tab>
# Wait 5-10 seconds and it will eventually complete the word foo

I'm not sure if this is a zsh issue or a prezto issue, however if I disable prezto and use vanilla zsh, the tab completion is instant. The vanilla tab completion doesn't use the menu however, so it could also be the menu's fault, but I'm not sure how to verify that.

I have noticed that WSL, by default, puts a lot of /mnt/c directories (such as /mnt/c/Windows/) on $PATH.

If I remove those directories, then tab completion is fast. For now, as a workaround I have the following in my profile which works:

export PATH=$(echo $PATH | tr ':' '\n' | grep -v "/mnt/c/" | tr '\n' ':')

With that workaround in place, everything is fast, however I can kind of force the issue anyway by doing:

cd /mnt/c/Windows/System32
a<tab>
# Wait 3-5 seconds for the completion menu to appear

My guess is something about these Windows directories is overloading completion, but I have no idea how to narrow this down any further.
I've also tried the following to no effect:
sudo updatedb
rm -rf ~/.zcompdump

Versions

Prezto commit: [de7b3b7](https://github.com/sorin-ionescu/prezto/commit/de7b3b7fdc99f8a67320dc64085dea44914969c7)
ZSH version: `zsh 5.4.2 (x86_64-ubuntu-linux-gnu)`
OS information: `Ubuntu 18.04.4 LTS \n \l` on WSL2 - `Microsoft Windows [Version 10.0.19592.1001]`

By @Fryguy source: sorin-ionescu/prezto#1820 (comment)

In a terminal, run zmanage info and paste the output below:

ZIM_HOME:      /root/.zim
Zsh version:   5.8
System info:   Linux JOEL 4.19.128-microsoft-standard #1 SMP Tue Jun 23 12:58:10 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Description

A tab completion problem seen in prezto with WSL2(above) is also present in zim. My zim config has only spaceship installed with the default git zmodule commented out.

Steps to reproduce

Detailed above

Images or other information

@NoelJacob NoelJacob changed the title Some tab completion on WSL2 takes 5-10 seconds Few tab completions on WSL2 takes 5-10 seconds Sep 10, 2020
@marciliocn
Copy link

Aditional info: disabling only zmodule completion the problem was solved.

@PatTheMav
Copy link

I might be mistaken, but I fail to see how this is an issue with zimfw, as the completion-feature is built-in to zsh and it seems to me the root cause is Windows adding a whole lot of directories to the path that the shell needs to walk through for completions.

@Fryguy
Copy link

Fryguy commented Jun 28, 2021

I'm not sure about zimfw, but when I reported this in prezto, the vanilla completion in zsh worked fine with all of the extra directories, but in prezto it was slow. See sorin-ionescu/prezto#1820 (comment)

@lnicola
Copy link
Contributor

lnicola commented Jun 28, 2021

Do you have syntax highlighting enabled? The original part here has a wrong link.

EDIT: yeah, PATH_DIRS sounds like trouble.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants