ipython / ipython

Official repository for IPython itself. Other repos in the IPython organization contain things like the website, documentation builds, etc.
https://ipython.readthedocs.org
BSD 3-Clause "New" or "Revised" License
16.26k stars 4.43k forks source link

Issue when autocompleting after spaces #9316

Open Achifaifa opened 8 years ago

Achifaifa commented 8 years ago

This sounds similar to #8923, but I don't think they are related enough (Plus this happens on linux). I've seen some issues open regarding autocomplete but I haven't seen one describing this.

When I'm in a folder that contains multiple test files (like this is a test file 1), ipython successfully autocompletes the files in instructions like with open("this<tab> (It suggest some things that are not files, but whatever, close enough).

However, when pressing tab after a space, it autocompletes literally everything, which is not helpful (I'm not sure if that's the intended behaviour, but it's certainly not what I was expecting).

I can reproduce the issue every time I try to autocomplete a file name after a space.

takluyver commented 8 years ago

Readline has a list of 'delimiter' characters, which includes space. When you tab complete, it goes back to the last delimiter character to determine the token it's going to use for completions - so if you do a = b.<tab>, it's only completing on b..

We're moving away from readline in master, but for now completion still works like that. It has been that way as long as we've had tab completion, so it's not top priority.

Achifaifa commented 8 years ago

Oh nice to know, thank you.

anntzer commented 8 years ago

FWIW master (with prompt_toolkit) seems to have the same issues.

takluyver commented 8 years ago

Yep, the switch to prompt_toolkit has not directly changed this - the completion machinery needs some reworking.

Carreau commented 7 years ago

I doubt I can tackle that for 6.0, bumping to 7.