You may have noticed that PowerShell has suddenly started making some pretty remarkable suggestions while at the command prompt. It looks to my untrained eye that PowerShell 7.3 got pushed out broadly and with it they switched on something called Predictive IntelliSense by default. Predictive IntelliSense enhances tab completion at the command line by providing suggestions as you type.
This feature is awesome!
PowerShell completions enable you to recall, edit, and execute full commands based on matching predictions from your command history, even after starting a new PowerShell session it remembers! Check out the gif where I type “do” followed by the right arrow and I end up with a completed dotnet-monitor command.
Now this is unfortunately referred to as Tab completion in a bunch of notes, but by default you do not use the Tab, you use the Right Arrow. This was an initial source of frustration for me, in that I could see a set of really helpful commands that I could not select. Coming from the world of Visual Studio completions are all about the Tab key so this was driving me my muscle memory bonkers.
One more pleasant surprise, if you hit F2 then you will be presented with a intelligent list of past commands that you can quickly select from.
If this is not working for you (for whatever reason) you can switch it off using this command:
Set-PSReadLineOption -PredictionSource None
I for one welcome our intelligent command line suggestions and would advise switching it on!
Set-PSReadLineOption -PredictionSource History
For those hardcore command line fans this predictor feature has a plugin model that allows you create your own command-line predictors.
Comments are closed.