anki-code / xontrib-argcomplete

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

Importing 'pathlib' in a script disabled autocompletion #4

Open brechtm opened 3 years ago

brechtm commented 3 years ago

For some reason xontrib-argcomplete wasn't working for my script. I've finally been able to identify that importing pathlib in my script somehow prevents tab completion from working! I have not yet investigated what the root cause is for this, however.

anki-code commented 3 years ago

hi! Could you please add the minimal example to repeat the issue?

brechtm commented 3 years ago

To reproduce this, just add "import pathlib" to one of the proto scripts in the xontrib-argcomplete/tests directory. But do note that the issue seems to depend on the version of Python (3.69) and/or argcomplete (1.8.1). I couldn't reproduce this on Python 3.9.5 with argcomplete 1.12.3. Is there a check that the argcomplete versions used by the script and the one by xontrib-argcomplete are compatible?

Running my script (proprietary, can't share) on Python 3.9.2 with argcomplete 1.12.3, completion suggestions are shown, but they include the help string shown after the arguments as well as other text output by <script> --help. But now, on another attempt in a fresh shell, again I don't get any completion suggestions.

Unfortunately, this is proving very difficult to debug and I can't spend more time on this...