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

"end" completion if unique

Open
#595 2 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

How can I achieve this behavior? Probably this only applies for complete_while_typing=True.

Usually, while the completion is not unique, the list of completions is shown. If I type something more that list is updated to show the now-matching completions.

This is all great. :)

However, if what I've typed (so far) only has a single completion (i.e. it's unique) - and I press TAB - I want that completion to be filled in and the completion list to go away.

I can't seem to find any "end completion" function, or something like that...?

Additionally I'd like a to a space after the completion to be inserted, but that's a grammar-specific thing. Similar to a shell when completing a unique file name. Thus, pressing TAB directly afterwards it would show completions for the next grammatical item (whatever that may be).

I'm using 2.0, bleeding edge :)

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 tracing the completion handling used when complete_while_typing=True; the issue names no file, entry point, or test. Done means a unique completion can be accepted with TAB, the list closes, and the requested grammar-specific spacing behavior has a defined outcome.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.