The Microsoft development team recently updated the PowerShell extension for Visual Studio Code, a major update about two years in the making, driven by users who submitted feedback via GitHub issues.
Sydney Smith, a Microsoft official, stated in a blog post that
This update represents a complete overhaul of the PowerShell engine at the heart of PowerShell Editor Services, designed to create a more reliable and stable user experience. This release represents nearly two years of work, and it is our response to many of the issues that users have raised over the past few years.
The aforementioned PowerShell Editor Services is the tool’s language server and utilizes the language server protocol to provide programming language-specific features such as auto-completion, IntelliSense, and go-to definitions.
In order to achieve the goals of increased reliability/stability, testing, and functional equivalency with previous versions, the team focused on the tool’s threaded model.
While the previous Integrated Console, the shell provided by the PowerShell extension, ran by setting up thread pool tasks on a shared main run space, LSP’s services were done via PowerShell idle events. This led to overhead, threading issues, and complex implementations, and this update addresses the asymmetry between PowerShell as a synchronous, single-threaded runtime and the Language Server as an asynchronous, multi-threaded service.
This change revolutionizes the way we service LSP requests, the way the Integrated Console works, the way PSReadLine is integrated, the way debugging is implemented, the way remotes are handled, and other long-tail features in PowerShell Editor Services.
Microsoft has added a total of 6,000 lines of code and removed 12,000 lines of code in this update. According to officials, the update not only brings new features, but also makes the extension’s backend easier to maintain, more efficient, and easier to understand.
In order to bring better stability to the PowerShell extension, the Microsoft development team has released 13 PowerShell previews over the past 6 months for testing.
A look at the ratings for PowerShell and PowerShell Preview in the VS Code Marketplace also shows how satisfied users are with the update, with the former having a long history of about 5.8 million installs and an average score of 3.7 out of 5. The latter has been installed more than 200,000 times and received an average score of 4.6.
The complete changes to the PowerShell extension can be found in the changelog. Any bug and feature feedback from developers can be submitted on the project’s GitHub page.