March 13th, 2023

PSReadLine 2.3.0-beta0 Release

Steven Bucher
Product Manager

We’re pleased to announce the new preview release of PSReadLine 2.3.0-beta0. This release contains several bug fixes and improvements to the ListView Predictive IntelliSense.

Installing PSReadLine 2.3.0-beta0

The release is available from the PowerShell Gallery.

Use the following command to install PSReadLine using PowerShellGet v2.x:

Install-Module -Name PSReadLine -AllowPrerelease -Force

If you are using PowerShellGet v3, you can use the following command:

Install-PSResource -Name PSReadLine -AllowPrerelease -Force

You must include the Force parameter to install this version side by side with the default stable version.

Note

You must restart your PowerShell session to use the new version of PSReadLine.

Scrollable List View

A big feature of this prerelease is the scrollable list view. Previously, the ListView mode is limited to show up to just 10 results. With this release, PSReadLine can show up to 50 results. The view shows the first 10 results, but now you can use the UpArrow and DownArrow keys to scroll the list beyond the first 10 results.

Screenshot showing the scrollable view.

When you have multiple providers loaded the ordering of predictors is still based on the order that you imported the PowerShell modules. The previous screenshot shows that the Az.Tools.Predictor module was imported before the CompletionPredictor.

If the providers return more than 50 results combined, the prediction results are distributed as evenly as possible based on the amount each provider returned.

New key bindings

Scrolling one line at a time can be slow for large lists. For a faster scrolling, we added new key bindings to help navigate the ListView.

Key Binding Description Function
PageUp Move up a page ScrollDisplayUp
PageDown Move down a page ScrollDisplayDown
Ctrl+PageUp Move up to next predictor’s first result ScrollDisplayUpLine
Ctrl+PageDown Move down to the next predictor’s first result ScrollDisplayDownLine

These key bindings only apply in ListView. If ListView isn’t enabled, these key bindings do what they normally do. As with any key binding, you can reconfigure the binding for these functions using Set-PSReadLineKeyHandler.

Note

These functions are bound by default in Windows and Emacs EditModes but not in VI Mode.

Autoadjusting size

Since we now have the ability to scroll through different results, we can adjust the height of the ListView results with the shell’s window height. The maximum size is 10 lines, but it shrinks to 5 lines if the Console.BufferHeight is less than or equal 20 and to 3 lines when the height is less than or equal to 10. If the terminal width or height is too small, ListView displays a warning message that the size is too small.

Animated screenshot showing ListView adjusting its size when the terminal window changes.

This is particularly helpful when using Azure Cloud Shell, because the default terminal height is too small to show 10 results.

Metadata line

We’ve also included a new metadata line that show the line number of your selection the number of results available from each prediction source. The metadata line changes as you are scroll through the list.

Screenshot highlighting the metadata line descriptions.

Additional features

Deduplication of prediction results

As more and more predictors are created, we’ve noticed a few cases where the same prediction can come from multiple sources. To reduce the repetition of predictions, we’ve made a fix to remove results returned by the history predictor. This means that if history has a prediction that another predictor has, the result is only displayed from the history. This allows for more and different results to be displayed and reduces confusion between two predictions with the same exact syntax.

Change default color for inline prediction

We made a minor change to the inline prediction color to make it more easily readable on terminals that don’t use a pure black background, such as the VS Code terminal. The previous setting of dark black has been changed to dim white italic.

Screenshot showing the new inline predictor color.

Bug fixes and new features

This release includes the bug fixes and community contributions detailed below. We really appreciate and value community contributions!

  • Handle multi-line description for parameter help content (#3358)
  • Update module version in bot messages (#3361)
  • Add support for upcasing, downcasing, and capitalizing word (#3365) (Thanks @3N4N!)
  • Fix parameter dynamic help when the help content is specified in ParameterAttribute (#3370)
  • No list view prediction when the first line was scrolled up off the buffer (#3372)
  • Fix wrong cursor position in menu completion (#3373)
  • Fix ViModeIndicator = Cursor for Windows Terminal (#3374)
  • Fix the description of CapitalizeWord (#3384)
  • Place ViDGChord in the right group (#3422)
  • Update the samples in README.md (#3440, #3424)
  • Fix some typos in this repository (#3547) (Thanks @spaette!)
  • Fix to use the default member color for members (#3450)
  • Make tab completion show results whose ListItemText are different by case only (#3456) (Thanks @dkaszews!)
  • Fix the menu completion to better handle the backspace key (#3574)
  • Updating Fabric bot (#3540, #3576)
  • Use ‘Visual Studio 2022’ as the image for appveyor CI (#3594)

Feedback

As usual, we welcome feedback about this release! Since this is a beta release, designs and features are subject to change. You can submit bugs, feature requests, or questions to the PSReadLine repository. Your feedback is greatly appreciated!

Steven Bucher,

PowerShell Team

Category
PowerShell

Author

Steven Bucher
Product Manager

0 comments

Discussion are closed.