prompt-toolkit / prompt-toolkit/python-prompt-toolkit

Using auto_suggest for copilot-like completions

Open
#1,913 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
10.6k
Forks
815
PR merge metrics
No merged PRs in 30d

Description

I'd like to use auto_suggest for copilot like AI auto-completions. However, there seem to be some complications with doing this:

  • auto_suggest only supports completing at the end of the prompt.
  • auto_suggest doesn't really seem to work with multiline suggestions. Any newlines in the suggestions are printed as ^J. Additionally, the transformers seem to work line-by-line, so it's not so clear how to even write something that could suggest multiple lines.
  • The AppendAutoSuggestions processor is hard-coded in the input processors https://github.com/prompt-toolkit/python-prompt-toolkit/blob/669541123c9a72da1fda662cbd0a18ffe9e6d113/src/prompt_toolkit/widgets/base.py#L240. Meaning even if I write my own processor to handle the above issues, I can't really use AutoSuggest as that processor would try to handle any suggestion that is put on the buffer.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading auto_suggest, AppendAutoSuggestions, and the input-processor setup in src/prompt_toolkit/widgets/base.py. Trace how suggestions are limited to the prompt end and how multiline text is transformed and rendered. Done would require a clear design for copilot-like, multiline or custom suggestion handling, including how the hard-coded processor should interact with it.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.