Using Visual Studio Code for PowerShell development


Historically, developing PowerShell code (that is more than just a handful of lines) is done using the "Integrated Scripting Environment" (ISE) which is installed together with PowerShell by default - on Windows. 

Good ol' ISE

The ISE does a good job. It offers IntelliSense (Auto-completion of cmdlets), basic debugging (Break-Points and Variable-inspection), online cmdlet search and definitions. Interactive / graphical extensions for some actions (like graphical progress bars). It can be dynamically extended, for a good example have a look at the ISESteroids by Tobias Weltner.

Now, since PowerShell is since recently also available on other platforms than Windows and ISE does not meet the requirements of larger scale projects. For example, ISE has no understanding of projects consisting of multiple files (which is essential for creating modules or DSC ressources) or how to interact with version control system like Git.

Enter Visual Studio Code (VSCode); an code editor that runs smooth on Windows, Linux, Mac etc... and it's free and Open Source. WOW!

Simple editor view in VSCode

So, what is it? That is rather interesting and shows a new style of application, that we might meet more often in the future. It is not actually a classic (GUI-) application; it is rather a boxed web application server. ("??!?") Yupp, exactly. Let's have a closer look.

The core of VSCode is a node.js server, running the main logic and optionally installed extensions for VSCode. For those that dont't know node.js: It runs JavaScript code, but like a server not a browser and is based on the V8 Engine from Google that also is used for rendering JavaScript in the Chrome Browser. Yes, VSCode is mainly written in JavaScript. The actual, visual editor component is the browser based Monaco Editor by Microsoft (also JavaScript). The GUI bringing it all together is a Chromium frame, basically a Chrome browser window.

You can tell it uses node.js if you look at how VSCode starts up.
Or its node package description (look in the installation folder)

Sounds pretty wild, right? But it makes sense. All these components are basically platform agnostic. As long as you get a JavaScript-interpreter and a browser, you can port it. Since Chromium and node.js are readily available on MacOS and Linux, porting VSCode to those platforms was never an issue.

VSCode was intended as a first choice editor for HTML, JavaScript and CSS and you will easily find its strengths in these disciplines when using VSCode. Nevertheless VSCode was designed to be open and very extensible from the beginning. It has strong capabilities for many languages and tools through extensions.

Following posts will describe setting up VSCode for PowerShell and Git, at least on Windows for now. Stay tuned; I will add the permalinks to the following articles here when they are published.


Kommentare

Kommentar veröffentlichen

Beliebte Posts aus diesem Blog

Ubuntu on a Bitlocker-protected environment

Android for my MDA Compact IV (HTC Diamond)

Office 2010 Beta