-
Notifications
You must be signed in to change notification settings - Fork 311
Suggestion: support inline previews of tab completions #741
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Duplicate of #687 |
Thanks, @felixfbecker - hadn't seen yours. Certainly closely related, but your suggestion is about completions from the history, whereas this one is about the standard, syntax-based tab completions. Both behaviors are useful, but I'm unclear on if and how they could be rolled into a single feature: when would you choose which completion source? |
It appears that https://github.com/PowerShell/CompletionPredictor delivers this feature via Prediction. The default keys are different because it's Prediction (being fed from Completion) rather than Completion, but that does also resolve the question in #741 (comment), because you get suggestions from both history and plugins by default, and in the list view (but not inline, see #1945) it tells you where the prediction came from. |
This comment was marked as resolved.
This comment was marked as resolved.
The ask of this issue can be achieved by using the Here is a GIF to show the asked behavior (using Given this, I will mark the issue as fixed. |
The plugin https://github.com/PowerShell/CompletionPredictor adds (If I understand correctly) "syntax-based completions". In PSReadLine 2.2.6, (And I can see that's happening in parallel as I comment) |
This comment was marked as resolved.
This comment was marked as resolved.
One more thing, because it may not be obvious (should someone in the future stumble upon this thread): plugins (completer modules) must be imported explicitly into every session (via |
Note: The suggested feature may have to be constrained to certain types of completions, and it is debatable whether it should be the default behavior or opt-in via a new option, but overall I think it would greatly streamline the tab-completion experience.
Imagine if PSReadLine showed you a preview of what the token you're currently typing would expand to if you pressed Tab at that moment; e.g.:
That is, having typed parameter-name prefix
-Fo
, PSReadLine would show you, via the differently colored - "rce" part, that if you pressed Tab at that moment you'd end up with-Force
.If the preview doesn't indicate the desired parameter, simply keep typing until the desired one is suggested; e.g., additionally type an
l
to make the preview show "lowSymlink" to inform you that pressing Tab then would complete to-FollowSymlink
.This makes for a very convenient experience if you know what exactly what completion you're looking for : just keep typing - without interruption - until you see what you want, then press Tab.
A challenge is how to handle transitioning to reviewing all possible completions at a given point, given that pressing Tab in this scenario would have to result in instant completion (whereas currently you can use it to cycle through the candidate completions).
If technically feasible, pressing Tab right after a completion would still be aware of what prefix was actually typed and would still allow cycling through the possible completions.
Alternatively / complementarily, a separate key chord such as Ctrl + Tabcould be used to show all possibly completions in a menu, via built-in function
MenuComplete
.As an aside: If someone prefers the current tab-completion behavior in principle, but would like to show a menu of possible completions in case of ambiguity, they can add the following to your
$PROFILE
:Environment data
The text was updated successfully, but these errors were encountered: