Announcing PowerShell language support for Visual Studio Code and more!

PowerShell Team

Today I am very happy to announce Developer Preview releases of two new projects that I hope will take your PowerShell development experience to the next level.

Write and debug PowerShell scripts in Visual Studio Code!

The first release is a new extension for Visual Studio Code which provides improved PowerShell language support including IntelliSense, code navigation, real-time script analysis, and local script debugging.  Previous releases of Visual Studio Code have provided basic PowerShell syntax highlighting support and code snippets.  This summer I started working with a PowerShell team intern, Kayla Davis, to bring PowerShell to parity with the in-box C# and TypeScript support.  This new extension takes the feature set much further:

[The following images are animated GIFs, click to play!]

IntelliSense and signature help for parameter sets

 

 

Code navigations like “Go to Definition” and “Find References”

 

…even across dot-sourced files!

 

Viewing the list of symbols in the current script file or project path

This feature is our first community contribution by PowerShell MVP Keith Hill!  I am really excited to be able to ship this extension with a community contribution already in the box.

 

Real-time script analysis using PowerShell Script Analyzer


Local script debugging

 

You can even set variables to be watched!

 


Basic interactive script console


…and this is only the beginning!

In the near future we intend to add even more great features:

  • Better support for advanced language features like workflows, classes, and DSC configurations
  • Remote debugging support
  • Improved interactive console support
  • Quick fixes for common syntax rules
  • PowerShell Gallery integration for finding and installing PowerShell modules from within the editor (a contribution by PowerShell MVP Doug Finke)
  • Support for PowerShell v3 and v4
We would love to hear your feedback about this extension and would love even more to have you contribute to the code!  Check out the vscode-powershell GitHub repository for more details.

Installing the extension

To install this extension, make sure you have the latest Visual Studio Code update installed (version 0.10.1, just released today!).  You will also need to have PowerShell 5 either by using Windows 10 or by installing Windows Management Framework 5.0 Production Preview.  While running Visual Studio Code, open the command palette by pressing Ctrl+Shift+P and then type “Extension” then select “Install Extensions”.  Once the extensions list loads, type PowerShell and press Enter.  That’s it!  Restart Visual Studio Code and open folder containing PowerShell script files to get started.  

 

If you don’t have a folder of PowerShell script files (shame on you!)  I’ve included one with the extension and some instructions on features to try out.  Open this file path in VS Code and look at the README.md file:

 

c:\Users\<yourusername>\.vscode\extensions\ms-vscode.PowerShell\examples

 

Enabling PowerShell development support in any editor

The second release is a new project called PowerShell Editor Services.  This project provides a new common platform for enabling rich PowerShell development support in any editor.  It is composed of two parts: a .NET library which provides core PowerShell language intelligence and debugging features and a hostable process with JSON API for integration into editors that are written on a development platform other than .NET.  The goal of this project is to enable other code editors like Sublime Text, Atom, Emacs, Vim and others to have the same level of PowerShell development support as Visual Studio Code, customized to the strengths of each editor.  All of the features that you see in the Visual Studio Code extension are provided by this project!  I’ll be publishing packages to NuGet in the next couple of days so keep an eye out for that.

These APIs should be considered very new, unstable, and likely to change as we learn more about usage scenarios and feature set.  We will be working with the PowerShell community to get things stabilized and documented to 1.0 release quality in 2016.

We are actively looking for contributors to this project, especially to help with integrations with the editors that you care about.  Please check out the PowerShellEditorServices GitHub repository for more details.

 

One last thing: Fans of PowerShell ISE, stay tuned for another great announcement next month!

 

David Wilson @daviwil
Software Engineer
Windows PowerShell Team

1 comment

Discussion is closed. Login to edit/delete existing comments.

  • Gerhard Brueckl 0

    Hi,

    I just starting PowerShell development using VSCode coming from a PowerShell ISE and the feature I am missing the most is the ability to view currently defined variables and their values WITHOUT having to start a debug session and using break points.

    Ideally the debug pane is visible showing local variables in the current PowerShell session and I can execute code from my ps1 file using F8 or write my code directly in the PowerShell terminal to e.g. modify variables

    Is this possible at all?

    kind regards,
    -gerhard

Feedback usabilla icon