Skip to content

feat: expose validate_while_typing in text, password, autocomplete, and path prompts - #533

Open
SaifAli-S wants to merge 1 commit into
tmbo:masterfrom
SaifAli-S:expose-validate-while-typing
Open

SaifAli-S wants to merge 1 commit into
tmbo:masterfrom
SaifAli-S:expose-validate-while-typing

Conversation

@SaifAli-S

Copy link
Copy Markdown

What is the problem that this PR addresses?

Closes #514

When computationally expensive validation functions (e.g. hashing passwords or complex regex checks) run on every keystroke, input typing can feel sluggish and delayed.

Prompt Toolkit's underlying PromptSession already supports validate_while_typing (which defaults to True), but it was not exposed across questionary prompts that utilize validators.

How did you solve it?

  • Expose validate_while_typing: bool = True in text(), password(), autocomplete(), and path() prompts.
  • Forward validate_while_typing to the internal PromptSession instantiation.
  • Added unit test test_text_validate_while_typing in tests/prompts/test_text.py.
  • Fully backwards compatible since the default value remains True.

Checklist

  • I have read the Contributor's Guide.
  • I will check that all automated PR checks pass before the PR gets reviewed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose validate_while_typing to disable per-keystroke validation

1 participant