prompt-toolkit / prompt-toolkit/python-prompt-toolkit
How to dynamically set complete_style?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10.6k
- Forks
- 815
- PR merge metrics
- No merged PRs in 30d
Description
According to the following code, I know how to set complete_style.
https://github.com/prompt-toolkit/python-prompt-toolkit/blob/511173b37bf0a98db9af2ca40492bba4a60072f9/examples/prompts/auto-completion/colored-completions.py#L35
Then is there a way to set the complete_style dynamically?
For example, when the get_completions function returns less than 10 elements, apply CompleteStyle.COLUMN, otherwise use CompleteStyle.READLINE_LIKE
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked examples/prompts/auto-completion/colored-completions.py example around line 35, then trace how CompleteStyle and get_completions are used. Done means establishing whether the completion style can be selected from the number of returned elements, with COLUMN used below 10 and READLINE_LIKE otherwise.
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
- Mostly clear
- Newbie friendliness
- 35/100