Optionally defer completions until N characters have been typed#1547
Optionally defer completions until N characters have been typed#1547rolandwalker merged 1 commit intomainfrom
Conversation
391c1ba to
ed2f090
Compare
scottnemes
left a comment
There was a problem hiding this comment.
Good option for anyone who wants to change it anyway! Tested out various values of the new option and works as expected.
have been typed. A strong effort is taken for efficiency on reading the trailing characters, since this prompt_toolkit Filter will run on every keystroke. Though the cost of running the Pygments lexer on every keystroke surely dwarfs this. If fewer than N characters have been typed, the suggestions can still be summoned by control-space (does not advance into the candidates) or tab (does immediately advance into the candidates). The motivation is to both reduce distractions and to reduce lag when typing. There is another way to do this by passing thresholds into `mycli/sqlcompleter.py`, but it doesn't preserve the ability to summon completions when below the trigger threshold.
ed2f090 to
735fbb8
Compare
|
Findings
Open questions / assumptions
If you want, I can suggest a minimal test strategy that avoids full prompt_toolkit integration. |
Description
A strong effort is taken for efficiency on reading the trailing characters, since this prompt_toolkit Filter will run on every keystroke. Though the cost of running the Pygments lexer on every keystroke surely dwarfs this.
If fewer than N characters have been typed, the suggestions can still be summoned by control-space (does not advance into the candidates) or tab (does immediately advance into the candidates).
The motivation is to both reduce distractions and to reduce lag when typing.
There is another way to do this by passing thresholds into
mycli/sqlcompleter.py, but it doesn't preserve the ability to summon completions when below the trigger threshold.Tests are a challenge again because we would need a custom myclirc.
I could almost be convinced to change the default trigger threshold to
3for all users. It's better! But changing defaults is a bad practice in principle.xref #1548
Checklist
changelog.mdfile.AUTHORSfile (or it's already there).