8

PSReadLine 2.2.6 enables Predictive Intellisense by default

 1 year ago
source link: https://devblogs.microsoft.com/powershell/psreadline-2-2-6-enables-predictive-intellisense-by-default/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

PSReadLine 2.2.6 enables Predictive Intellisense by default

JasonHelmickDrawingPhoto-150x150.jpg

Jason Helmick

June 27th, 20222

PSReadLine first introduced Predictive IntelliSense using History based suggestions as a customer enabled feature in November 2020. Since its introduction, two new predictors have become available:

Today, we are announcing that PSReadLine 2.2.6 enables Predictive IntelliSense by default.

Based on community feedback and successful early releases, customers no longer need to manually enable predictions. This release is supported on Windows PowerShell 5.1 and higher.

Predictions are enabled by default

Previously, to enable predictions, customers were required to add the following to their PowerShell profile:

Set-PSReadLineOption -PredictionSource HistoryAndPlugin

Today, the PredictionSource is enabled by default as HistoryAndPlugin for PowerShell 7.2 and higher or History downlevel to Windows PowerShell 5.1 . Customers can verify this setting using the following command:

Get-PSReadLineOption | Select-Object -Property PredictionSource

Note – Plug-ins are only supported in PowerShell 7.2 or higher.

Installing PSReadLine 2.2.6

The release is now available for download on the PowerShell Gallery.

To install PSReadLine:

Install-Module -Name PSReadLine

To install PSReadLine using the new PowerShellGet.v3:

Install-PSResource -Name PSReadLine

Managing Predictive IntelliSense

Some customers may prefer to disable Predictive IntelliSense. To change the prediction source, add the Set-PSRedLineOption cmdlet to your profile with one of the following values:

To disable all predictions:

Set-PSReadLineOption -PredictionSource None

To only enable history-based suggestions:

Set-PSReadLineOption -PredictionSource History

To only enable additional plugins without history:

Set-PSReadLineOption -PredictionSource Plugin

Setting the prediction color

By default, predictions appear in light grey text on the same line the user is typing. To support accessibility needs, the prediction color is customizable from the command line or your profile script.

For more information about setting prediction color and other PSReadLine settings, see Set-PSReadLineOption

Example of setting prediction background color to Blue using $PSStyle:

Set-PSReadLineOption -Colors @{ InlinePrediction = $PSStyle.Background.blue }

The default light-grey prediction text color can be restored using:

Set-PSReadLineOption -Colors @{ InlinePrediction = "`e[38;5;238m" }

Future plans

We value your ideas and feedback for this release. Stop by the PSReadLine GitHub repository and let us know of any issues you find or features you would like added.

Jason Helmick PROGRAM MANAGER 2, Control Plane-JWINTER-OPEX-1010

Follow


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK