You are viewing an older version (9.11.0). Go to latest (9.13.0)
{ } Raw JSON

bundles / IPython 9.11.0 / IPython / terminal / shortcuts / auto_suggest / AppendAutoSuggestionInAnyLine / apply_transformation

function

IPython.terminal.shortcuts.auto_suggest:AppendAutoSuggestionInAnyLine.apply_transformation

source: /IPython/terminal/shortcuts/auto_suggest.py :52

Signature

def   apply_transformation ( self ti : TransformationInput )  →  Transformation

Summary

Apply transformation to the line that is currently being edited.

Extended Summary

This is a variation of the original implementation in prompt toolkit that allows to not only append suggestions to any line, but also to show multi-line suggestions.

As transformation are applied on a line-by-line basis; we need to trick a bit, and elide any line that is after the line we are currently editing, until we run out of completions. We cannot shift the existing lines

There are multiple cases to handle:

The completions ends before the end of the buffer:

We can resume showing the normal line, and say that some code may be hidden.

The completions ends at the end of the buffer

We can just say that some code may be hidden.

And separately:

The completions ends beyond the end of the buffer

We need to both say that some code may be hidden, and that some lines are not shown.

Aliases

  • IPython.terminal.interactiveshell.AppendAutoSuggestionInAnyLine.apply_transformation