Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove built-in names and magic from tab completion? #11538

Open
mimakaev opened this issue Dec 26, 2018 · 2 comments
Open

Remove built-in names and magic from tab completion? #11538

mimakaev opened this issue Dec 26, 2018 · 2 comments

Comments

@mimakaev
Copy link

Tab completion list is seriously polluted by builtin names, especially those 3-5 symbols long, such as abs, all, bool, dict, chr, list. These words are faster to type than to select with the completion menu, and most of us know them well.

On a similar note, having ipython magic in the completion menu is not very useful. I mostly write Python code, and only occasionally use magic.

Is there a way to remove/reduce the set of built-ins that is included in autocomplete? I wouldn't mind removing all of them, but it would be better to keep a short list of particularly long built-ins, such as DeprecationWarning.

@thomasaarholt
Copy link

I fully agree that this should happen in a more intelligent manner. For instance, if one is hitting shift-tab in something like mydict[|] (where | is where the cursor is), it would be great if it could list the dictionary keys first.

Personally I feel that the private variables (_something and __something) should only be visible if a single underscore has already been entered. I would love to help, but I'm not sure if I should be looking to jedi or the IPython completer code.

@RuRo
Copy link

RuRo commented Aug 11, 2020

For anybody coming from google. It doesn't seem like the IPython devs care about basic usability of their autocompletion, so here is an awful, ugly hack instead.

Put the following code in your IPython "startup" scripts directory
(i.e. ~/.ipython/profile_default/startup/00-no-magic-matches.py)

import IPython.core.completer

def _no_magic_matches(self, text):
    return []

IPython.core.completer.IPCompleter.magic_matches = _no_magic_matches

This hack touches the internal IPython implementation details, so it might break some day, but the %% completions are so insanely annoying, that I really don't care.

FYI, you could probably also try to override IPython.core.completer.IPCompleter.global_matches similarly (I haven't tested it as the global completions don't seem to be as annoying in the recent IPython versions).

And IPython.core.completer.completions_sorting_key to modify, how the completions are sorted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants