##// END OF EJS Templates
Merge pull request #13475 from asteppke/master...
Matthias Bussonnier -
r27460:97e3d9ec merge
parent child Browse files
Show More
@@ -317,6 +317,29 b' class TerminalInteractiveShell(InteractiveShell):'
317 317 help="Allows to enable/disable the prompt toolkit history search"
318 318 ).tag(config=True)
319 319
320 autosuggestions_provider = Unicode(
321 "AutoSuggestFromHistory",
322 help="Specifies from which source automatic suggestions are provided. "
323 "Can be set to `'AutoSuggestFromHistory`' or `None` to disable"
324 "automatic suggestions. Default is `'AutoSuggestFromHistory`'.",
325 allow_none=True,
326 ).tag(config=True)
327
328 def _set_autosuggestions(self, provider):
329 if provider is None:
330 self.auto_suggest = None
331 elif provider == "AutoSuggestFromHistory":
332 self.auto_suggest = AutoSuggestFromHistory()
333 else:
334 raise ValueError("No valid provider.")
335 if self.pt_app:
336 self.pt_app.auto_suggest = self.auto_suggest
337
338 @observe("autosuggestions_provider")
339 def _autosuggestions_provider_changed(self, change):
340 provider = change.new
341 self._set_autosuggestions(provider)
342
320 343 prompt_includes_vi_mode = Bool(True,
321 344 help="Display the current vi mode (when using vi editing mode)."
322 345 ).tag(config=True)
@@ -374,7 +397,7 b' class TerminalInteractiveShell(InteractiveShell):'
374 397
375 398 self.pt_loop = asyncio.new_event_loop()
376 399 self.pt_app = PromptSession(
377 auto_suggest=AutoSuggestFromHistory(),
400 auto_suggest=self.auto_suggest,
378 401 editing_mode=editing_mode,
379 402 key_bindings=key_bindings,
380 403 history=history,
@@ -576,6 +599,7 b' class TerminalInteractiveShell(InteractiveShell):'
576 599
577 600 def __init__(self, *args, **kwargs):
578 601 super(TerminalInteractiveShell, self).__init__(*args, **kwargs)
602 self._set_autosuggestions(self.autosuggestions_provider)
579 603 self.init_prompt_toolkit_cli()
580 604 self.init_term_title()
581 605 self.keep_running = True
General Comments 0
You need to be logged in to leave comments. Login now