Introducing the PowerShell Extension for Visual Studio Code

Doctor Scripto

Summary: Doug Finke, Microsoft MVP, introduces a new way to edit code.

There’s a new editor in town and as with any new shiny toy, it’s a good to download, kick the tires, and give it the seven day test. The seven day test is when you install it, try it, and see if you consistently come back to it over seven days. If you don’t, then uninstall it and move on.

Microsoft Visual Studio Code is code editing, redefined. It’s free, cross-platform, extensible, and it is open source. Plus, Microsoft has released PowerShell language support for it (see PowerShell Language Support for Visual Studio Code).

In addition, because it is open source, folks like me and others in the community (like you) can contribute updates directly to the extensions, which are packaged and delivered in the Visual Studio code gallery. I integrated PowerShell online Help into the Visual Studio code, here’s a short video:

Extension Development Host: vscode-powershell – Visual Studio Code

Getting Started

Install Visual Studio Code, then go to the PowerShell console and type code. This launches the editor. Next, you need to install the PowerShell extension. This is simple: press F1, type ext inst, and press ENTER. Wait while it gets the list of extensions, and then type power.

extension development studio

You can click the README and go to the online gallery to find out more, or click the download icon. After you click the download, the PowerShell extension is installed. The editor will show that you need to restart. Click the Restart button, and you are good to go. This is a one-time operation, so any time you fire up code, the PowerShell extension is ready to go.

Open a PowerShell file and you’re off to the races. Some of the features that this PowerShell extension for Visual Studio Code has include:

  • IntelliSense
  • Signature Help for parameter sets
  • Code navigations, for example, Go to Definition and Find References (even across files)
  • Viewing the list of symbols in the current script file or project path
  • Real-time script analysis using PowerShell Script Analyzer
  • Local script debugging

This is just a start. Both Visual Studio Code and the PowerShell Extension are in beta and Microsoft has delivered updates in the past few weeks.

Check out David Wilson’s announcement on the PowerShell blog for more information:

Announcing PowerShell language support for Visual Studio Code and more!

Next steps

I’m working to integrate the PowerShell Gallery features to find and install PowerShell modules. Check out this video:

Extension Development Host: Practical Astronomy – Visual Studio Code

The really good news is that all of this is open source and available on GitHub.

If you want to ask questions, report issues, request a feature, or try your hand at contributing, I encourage you to head over to GitHub and take a look.

Getting started resources

Here is how you can contact me:

~Doug

Thanks, Doug!

I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at scripter@microsoft.com, or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then, peace.

Ed Wilson, Microsoft Scripting Guy 

0 comments

Discussion is closed.

Feedback usabilla icon