Path completion in IPython proposes many non paths

34 views Asked by At

Tab-completion of a path in IPython 6.1.0 (on Ubuntu 16.04) proposes many non-relevant options (actual paths are at the end of the list).

Am I missing something ?

enter image description here

1

There are 1 answers

0
Matt On BEST ANSWER

This is dues to historical baggage of IPython, it is on the process of being fixed. Initially IPython used to use readline to get user input, unfortunately readline define its own delimiter, and / is one of them. Thus IPython would only "see" the part after the last slash. So in your case, IPython does not see you are in a string, and thus think you may be in a division, where abs() and other make sens. This is on the wishlist of features to improve, and contributions to this are welcome.

Technically, even with partial inputs like the example above, as IPython uses jedi it may be a matter of asking jedi wether the cursor is in a string, and skip some completer providers. If you want to attempt a fix, I'm pretty sure the IPython developers will be happy to guide you.