Skip to content

Allow autosuggestions to be configurable.#13475

Merged
Carreau merged 5 commits into
ipython:masterfrom
asteppke:master
Jan 18, 2022
Merged

Allow autosuggestions to be configurable.#13475
Carreau merged 5 commits into
ipython:masterfrom
asteppke:master

Conversation

@asteppke
Copy link
Copy Markdown
Contributor

The new autosuggestion feature can save a lot of typing and allows a quicker workflow in REPL but as this is a prominent UI change this should be configurable.

This patch allows via the normal configuration mechanisms to enable / disable the autosuggestion feature while keeping the current default value.

This would address #13451.

Of course glad about any feedback!

Comment thread IPython/terminal/interactiveshell.py Outdated
Comment on lines +320 to +324
enable_autosuggestions = Bool(True,
help="Allows to enable/disable the prompt autosuggestions based on "
"the prompt toolkit history.",
).tag(config=True)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just thinking at loud, do you think there might be other source of autosuggestions we could have latter ? Would it make sens to make that a string, so we can select from multiple sources later ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that is a possibility. I had a look at prompt_toolkit and they have the infrastructure in place but as that are of their code has not changed in the last two years it feels like that might not happen in the near future.

Of course there are other autosuggestion sources under development (Kite, IntelliCode) but I guess that requires a much larger integration effort and then this configuration option has to change in any case.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So to make this a bit more future-proof I changed this to a string. That was definitely a good suggestion.

Additionally it can be changed in a running terminal which might be useful as well.

Comment thread IPython/terminal/interactiveshell.py Outdated
@Carreau Carreau added this to the 8.1 milestone Jan 18, 2022
@Carreau
Copy link
Copy Markdown
Member

Carreau commented Jan 18, 2022

Yep, I think that's good.

@Carreau
Copy link
Copy Markdown
Member

Carreau commented Jan 18, 2022

(just removed a bit of code that was likely copy-pasted by mistake), will mege once test are apssing.

@asteppke
Copy link
Copy Markdown
Contributor Author

asteppke commented Jan 18, 2022

Great, thanks for catching that. It should all work now as intended.

@Carreau Carreau merged commit 97e3d9e into ipython:master Jan 18, 2022
@2sn
Copy link
Copy Markdown

2sn commented Jan 27, 2022

Thanks for adding this feature to the next release.

@MarkMoretto
Copy link
Copy Markdown

MarkMoretto commented Mar 11, 2023

HI, can autosuggest_provider be off or None by default for new installs?

Or, do I have to rework the setting each time I install and use IPython -- which will be less and less if this is the case -- when setting up a new virtual environment?

Is there something wrong with using Ctrl + Space or Tab, to get a suggestion? Or, a quick ? to see the doc string? Those are pretty powerful features that aren't invasive as something constantly popping up telling users what they should be typing, which is fairly distracting.

@Carreau
Copy link
Copy Markdown
Member

Carreau commented Mar 13, 2023

Issues with having it opt-in is it's non discoverable. You do not need to do it on a per-env basis, you can use a global config file.

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

Successfully merging this pull request may close these issues.

4 participants