Skip to content

Conversation

Carreau
Copy link
Contributor

@Carreau Carreau commented Jan 7, 2025

Unlike inline completion; this is a bit more tricky to set up, in particular it is hard to choose default that will suit everyone – whether to shift existing line, how to accept/reject, show elision...

So we just for now add an example on how this can be used.

I will most likely make use of it in IPython in the next few weeks/month, and can report back on the usability.


This follows #1948, which enable multiline suggestion. Here I show how to use it with a custom preprocessor that will try to fill in multiline text by pushing the existing text down when rendering.

Screen.Recording.2025-01-07.at.14.41.36.mov

This is of course just an example as it does not handle accepting the suggestion; or marking that text has been pushed past the end of the buffer and is not shown.

All this rely on the return Transformation(ti.get_line(shift)), as get_line is only available since #1948

Unline inlne completion; this is a bit more tricky to set up,
in particular it is hard to choose default that will suit everyone –
whether to shift existing  line, how to accept/reject, show elision...

So we just for now add an example on how this can be used.

I will most likely make use of it in IPython in the next few
weeks/month, and  can report back on the usability.
@Carreau Carreau force-pushed the multiline-suggest-example branch from 42fb728 to 61188a9 Compare January 8, 2025 09:27
@jonathanslenders jonathanslenders merged commit 1b0efa1 into prompt-toolkit:master Jan 17, 2025
7 checks passed
@jonathanslenders
Copy link
Member

Thank you! Really appreciated!

I hope to do a release in the coming days.

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.

2 participants