pants zsh completion troubleshooting :question: I...
# general
b
pants zsh completion troubleshooting ❓ I recently tried to setup
zsh
completions with
pants complete
and it doesn't seem to have made any difference. I'm wondering if anyone else noticed this? Or am I doing something wrong? More specifically, if I type
pants
in the repo root and hit tab, it only suggests the local files and folders to autocomplete. If I type something like
pant fm
or
pants li
and hit tab, it does not auto-complete the goal names
My setup steps
Copy code
% pants complete --shell=zsh > ~/.zsh/completions/pants-completions.zsh
Added to `.zshrc`:
Copy code
fpath=(/Users/gregory.fast/.zsh/completions $fpath)
autoload -Uz compinit
compinit
and then created a new shell. I also tried directly doing
source  ~/.zsh/completions/pants-completions.zsh
w
Hmmm, I wonder if it broke somehow?
Do the bash completions work?
Oh, the compdef at the top is commented out of the zsh one... I recall that might work, but now I'm questioning myself as to how it's getting registered correctly when you source it directly (e.g. outside of the whole compinit structure)
b
I'll uncomment the top line and report back
w
The bash ones work for me, and zsh when I sourced it works after I uncomment. Needs to work out of the box, so there is still a problem
b
ah yup, uncommenting did the trick for me too
w
🤦‍♂️ Goddamn, need to look into it
b
elaborating on
ah yup, uncommenting did the trick for me too
I had to
source
the script with the
compdef
line uncommented
also the completions aren't the most intuitive. once I type
pants test
and hit tab, I'd like to get file path auto completions so that I can more easily get something like
pants test path/to/my/targets:
w
I commented on the ticket. Try
pants test ./<tab>
It's not great, but I didn't spend much time working on interactions between autocomplete and the filesystem, as target completion could also work well (and covers more cases)
b
ahh yup that works
w
👍
So yeah, still some work in progress - but I've been a bit more focused on the call-by-name migration which will boost our startup perf. On large projects, when something changes, autocomplete is a slow nightmare for the first run. The startup perf will also help with the VSCode plugin - so, yeah, I think it's a good distraction for me 🙂