prompt-toolkit / prompt-toolkit/python-prompt-toolkit
how to implement a custom validator for a custom TokenListControl
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10.6k
- Forks
- 815
- PR merge metrics
- No merged PRs in 30d
Description
I am writing a custom checkbox widget based on prompt-toolkit. So far it works great. Now I want to add a validator so I can validate that for example at least one checkbox has been selected.
I understand that prompt-toolkit validators work on a Document which in turn is part of a Buffer. A TokenListControl has none of that. I could raise a ValidationError from my validator which runs in own scope - so it does not help much...
Any suggestions on how to best approach this? Are there any hooks I can use, do I use a bottom_toolbar (additional TokenListControl) to implement the validation message display myself?
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 by tracing how TokenListControl differs from the Document and Buffer validation path, and review the suggested bottom_toolbar approach for displaying feedback. Done means identifying and documenting a supported hook or a clear validation-message pattern for custom checkbox controls.
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