New release of PowerShell Preview for Visual Studio Code!

This post was originally published on this site

An updated version of our PowerShell Preview extension is now available on the Visual Studio Code marketplace.

This update represents a complete overhaul of the core PowerShell engine of PowerShell Editor services, with the intention of create a more reliable and stable user experience. This release represents over a year’s work, tracked in PSES #1295 and implemented in PSES #1459, and is our response to many issues opened by users over the last few years. Thank you to all of the community members who opened issues which helped motivate this major update.

For information on getting started with the PowerShell extension for Visual Studio Code refer to our documentation.

More about the update

Previously the Integrated Console, the shell that is provided by the PowerShell extension, was run by setting threadpool tasks on a shared main runspace, and where LSP, Language Server Protocol, servicing was done with PowerShell idle events. This lead to overhead, threading issues and a complex implementation intended to work around the asymmetry between PowerShell as a synchronous, single-threaded runtime and a language server as an asynchronous, multi-threaded service.

Now, PowerShell Editor Services maintains its own dedicated pipeline thread, which is able to service requests similar to JavaScript’s event loop, meaning we can run everything synchronously on the correct thread. This prevents an entire class of race conditions, leading to more reliable and bug-free code. We also get more efficiency because we can directly call PowerShell APIs and code written in C# from this thread, without the overhead of a PowerShell pipeline.

This change has overhauled how we service LSP requests, how the Integrated Console works, how PSReadLine is integrated, how debugging is implemented, how remoting is handled, and a long tail of other features in PowerShell Editor Services.

Also, in making it, while 6,000 lines of code were added, we removed 12,000, for a more maintainable, more efficient and easier to understand extension backend.

We also want to thank Patrick Meinecke for his help and knowledge as we’ve made this migration.

For an overview of the specific work items please refer to the changelog.

What’s next for the extension

With help from the community we’ve already found and fixed several bugs, and intend to move this preview to stable once we have fixed all the new bugs and covered them with regression tests. This will require a bit of work as our existing tests need to be migrated to use the new pipeline code, so please continue to run the Preview if you’re able and help us test!

Once that release is complete our intention is to remain focused on incremental improvements to the stability and reliability of the extension. These next work items are enumerated in our GitHub Projects.

In particular we plan to focus on known issues with debugging and start-up.

Feedback and Support

While we hope the new implementation provides a much better user experience, there are bound to be issues. Please let us know if you run into anything.

If you encounter any issues with the PowerShell extension in Visual Studio Code or have feature requests, the best place to get support is through our GitHub repository.

The post New release of PowerShell Preview for Visual Studio Code! appeared first on PowerShell Team.