Enable Predictive IntelliSense in PowerShell

Image Description

Daily PowerShell #33

Daily PowerShell

November 18, 2021

quote Discuss this Article

Predictive IntelliSense is a feature of PSReadline and available in PowerShell 7.2.

The feature takes advantage of the PSReadline history to recommend completions based on previous commands you have types rather than just the context of the commands you are typing. Predictive IntelliSense works in standard terminals, Windows Terminal and Visual Studio Code.

Enable Predictive IntelliSense

You can enable the predictive IntelliSense feature with the option cmdlet for PSReadline.

Set-PSReadlineOption -PredictionSource History

To disable the feature, set the source back to none.

Set-PSReadlineOption -PredictionSource None

Using Predictive IntelliSense

Predictive IntelliSense works a little differently than existing command completion. Suggestions begin to show up as you type as grey text after the cursor.

To accept the proposed completion, you can press the right arrow key rather than the tab key.