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

Add an option complete_while_typing for terminal interactive shell #14003

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 10 additions & 1 deletion IPython/terminal/interactiveshell.py
Expand Up @@ -388,7 +388,9 @@ def _displayhook_class_default(self):
).tag(config=True)

enable_history_search = Bool(True,
help="Allows to enable/disable the prompt toolkit history search"
help="Allows to enable/disable the prompt toolkit history search. "
"This option conflicts with `complete_while_typing`. "
"If this is set to `True`, the option `complete_while_typing` will be ignored"
).tag(config=True)

autosuggestions_provider = Unicode(
Expand All @@ -401,6 +403,12 @@ def _displayhook_class_default(self):
allow_none=True,
).tag(config=True)

complete_while_typing = Bool(False,
help="Generate autocompletions while typing or when the tab key is pressed. "
"This option conflicts with `enable_history_search`. "
"If `enable_history_search` is `True`, this option will not take effect."
).tag(config=True)

def _set_autosuggestions(self, provider):
# disconnect old handler
if self.auto_suggest and isinstance(
Expand Down Expand Up @@ -639,6 +647,7 @@ def prompt():
history=history,
completer=IPythonPTCompleter(shell=self),
enable_history_search=self.enable_history_search,
complete_while_typing=self.complete_while_typing,
style=self.style,
include_default_pygments_style=False,
mouse_support=self.mouse_support,
Expand Down