kislyuk / argcomplete

Python and tab completion, better together.
https://kislyuk.github.io/argcomplete/
Apache License 2.0
1.39k stars 129 forks source link

Generate zsh completion functions #455

Open mil-ad opened 7 months ago

mil-ad commented 7 months ago

Is it possible to use argcomplete to generate the actual zsh completion functions for a program? My app startup is quite slow thanks to some imports that take a long time, and that load time finds its way to argcomplete as well. It seems like every time I press tab it's going through my program so it's super slow.

kislyuk commented 7 months ago

Hello, thanks for your interest in argcomplete.

No, argcomplete does not support the generation of static completions. While possible, this would be a complex set of extra logic and it would lose the key advantage that argcomplete offers and is typically used for (dynamic completion of values).

maurerle commented 7 months ago

@mil-ad maybe you have your python startup script inside your module folder. If you put it outside, and put the app import statements after argcomplete.autocomplete(parser) it works fine and fast (yes do not put the input statement at the top of the file like you normally should do) :)

I had a similar problem with that