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

Ability to set suggestion for empty prompt or an argument with suggestion to prompt()

Open
#2,044 1 comment 2 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

The feature request came from xonsh shell - https://github.com/xonsh/xonsh/discussions/6044

When we call prompt() method we can't set default buffer suggestion. But it would be very helpful for AI suggesters or extracting next command from history, etc.

The minimal example of use case:

prompt> echo 1
prompt> echo 2
prompt> echo 3
prompt> echo 1
prompt> <cursor>echo 2  # Here `echo 2` is the suggestion (grey text).

For community

⬇️ Please click the 👍 reaction instead of leaving a +1 or 👍 comment

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 with the prompt() call in xonsh's ptk_shell/init.py and the default buffer suggestion behavior referenced in prompt_toolkit's buffer.py. Trace how prompt() creates or configures its buffer, including the empty-prompt and suggestion argument cases. Done means callers can provide a grey default suggestion for the cursor without inserting it as entered text.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.