anki-code / xontrib-argcomplete

Argcomplete support to tab completion of python and xonsh scripts in xonsh shell.
BSD 2-Clause "Simplified" License
26 stars 5 forks source link

No completion for pipx, which is using argcomplete #9

Open paugier opened 1 month ago

paugier commented 1 month ago

pipx uses argcomplete.

On Linux (Debian 11), I install pipx, xonsh and xontrib-argcomplete with

python3 -m pip install pipx
python3 -m pipx ensurepath

In a new terminal, I can setup argcomplete for Bash and I get autocompletion for Bash. Then,

pipx install xonsh
xonsh
xpip install xontrib-argcomplete
echo 'xontrib load argcomplete' >> ~/.xonshrc

In a new terminal, I don't get autocompletion for pipx in xonsh.

anki-code commented 1 month ago

Hey @paugier ! Nice catch! As described in xontrib-argcomplete readme it's need to have PYTHON_ARGCOMPLETE_OK in the first lines of $(which pipx) file. After adding it I see the completion immediately:

image image

But how we can solve this. There is no way to understand that tool is using argcomplete.

I suggest to skip _python_argcomplete_scan_head in case tool name is in __xonsh__.env.get("XONTRIB_ARGCOMPLETE_TOOLS", []) and you can do $XONTRIB_ARGCOMPLETE_TOOLS=['pipx'] in your .xonshrc.

It will be cool if you can prepare PR for this. I can review and make release fast. Thanks!