VS Code PowerShell Tool Gets Major Feedback-Based Overhaul – Visual Studio Magazine


VS Code PowerShell tool gets a major feedback-based overhaul

Microsoft’s development team for the PowerShell extension for Visual Studio Code updated the tool in a major overhaul that took about two years to complete, driven by user feedback submitted via GitHub issues.

“This update represents a complete overhaul of the PowerShell Editor Services core PowerShell engine, with the goal of creating a more reliable and stable user experience,” program manager Sydney Smith said in a May 3 blog post.

As such, it features a long list of highlights, from “Rewrite of PowerShell pipeline execution with cancellable and ordered tasks” to “Performance improvements with better cancellation logic”.

The PowerShell extension in VS Code Marketplace has been installed some 5.7 million times, earning an average rating of 3.7 (0-5 scale) from 142 reviewers. It helps users develop PowerShell modules, commands and scripts in the popular VS Code editor.

VS Code PowerShell Extension
[Click on image for larger view.] VS Code PowerShell Extension (source: Microsoft).

The new updates were tested in the Marketplace PowerShell Preview tool, which has been installed over 200,000 times, earning an average rating of 4.6 from five reviewers.

The aforementioned PowerShell editor services are the tool’s language server, leveraging the language server protocol, which is used to provide programming language-specific features such as auto-completion, IntelliSense, go to the definition, find all the references, etc.

To achieve goals such as improved reliability/stability, testing, feature parity with previous releases and more, the team focused on the tool’s threading model.

“Previously, the integrated console, the shell provided by the PowerShell extension, was executed by setting thread pool tasks on a shared main execution space, and where LSP, Language Server Protocol, maintenance was done with events PowerShell idle time,” Smith said. “This resulted in overhead, threading issues, and a complex implementation intended to work around the asymmetry between PowerShell as a single-threaded synchronous execution and a language server as an asynchronous, multi-threaded service.”

These asymmetry issues have been addressed by a new dedicated pipeline thread that borrows from the JavaScript event loop so that code runs synchronously on the correct thread, preventing many race conditions with more reliable code and bug free.

“This change overhauled the way we handle LSP requests, the way the integrated console works, the PSReadLine integration, the implementation of debugging, the handling of remote communication, and a long suite of other features in PowerShell Editor Services,” Smith said.

A complete list of changes is available in the update’s changelog.

Going forward, detailed work items in the associated GitHub Projects page will show what is available.

About the Author

David Ramel is an editor and writer for Converge360.

Comments are closed.