Introducing the PowerShell Extension for Visual Studio Code
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:
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.
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:
- 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:
I’m working to integrate the PowerShell Gallery features to find and install PowerShell modules. Check out this video:
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
- Getting Started with Visual Studio Code
- The Basics of Visual Studio Code
- Key Bindings for Visual Studio Code
- More shortcuts (think sublime text): alexandrudima/keybindings
- Introducing Visual Studio Code
Here is how you can contact me:
- Blog: Development in a Blink
- Twitter: https://twitter.com/dfinke
- Book: Windows PowerShell for Developers: Enhance your productivity and enable rapid application development
I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at email@example.com, or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then, peace.
Ed Wilson, Microsoft Scripting Guy