powershellautocompletepowershell-7.3

Powershell 7.3.0 Tab completion not working


I've recently upgraded PowerShell to version 7.3.0 version and now, when I type a command, I see its suggestions like when I'm typing pip it adds list like in this image. Or when I type start of the command it suggests its full name.

The problem is that when I press Tab it doesn't complete the command, instead it just starts listing current directories, i.e. here is an image after pressing Tab once. Also even when I start typing the full name of the command like pip li it still shows the ending, but when pressing Tab it just does nothing.

I expected this to complete the current command with the suggestion after Tab is pressed.

I've tried to google this problem but haven't found the exact same case I have with 7.3.0 version.


Solution

  • Just press -> (right arrow) key

    If you want to change key bindings: source: https://devblogs.microsoft.com/powershell/announcing-psreadline-2-1-with-predictive-intellisense/

    Key Bindings for Predictions

    Key bindings control cursor movement and additional features within the prediction. To support users running Predictive IntelliSense on multiple platforms, key bindings are user-settable from the command line or your profile script.

    PSReadLine contains functions to navigate and accept predictions. As an example, to accept a displayed prediction, PSReadLine contains functions:

    • AcceptSuggestion – Accept the current inline suggestion
    • AcceptNextSuggestionWord – Accept the next word of the inline suggestion

    AcceptSuggestion is built within ForwardChar, which by default is bound to RightArrow. Pressing RightArrow accepts an inline suggestion when the cursor is at the end of the current line.

    AcceptNextSuggestionWord is built within the function ForwardWord, which can be bound with Ctrl+f by Set-PSReadLineKeyHandler -Chord "Ctrl+f" -Function ForwardWord. Pressing Ctrl+f accepts the next word of an inline suggestion when the cursor is at the end of current editing line.

    As a user, you can bound other keys to AcceptSuggestion and AcceptNextSuggestionWord for similar functionalities. Search for ForwardCharAndAcceptNextSuggestionWord in SamplePSReadLineProfile.ps1 for an example to make RightArrow accept the next word from inline suggestion, instead of the whole suggestion line.

    List of additional suggested key bindings defined in PSReadLine SamplePSReadLineProfile.ps1