Back when I first started dabbling with Powershell in late 2015 I began using the Powershell ISE and used it for quite a while. At the time it did everything I needed it to, I could run console code right by my editor, had nice shortcuts like ctrl + j to bring up the quick template menu, your scripts are tabbed, and finally it had IntelliSense. For everything it did right it had 1 major flaw, it tends to freeze literally at the worst times for no apparent reason. 

For a while I looked around at things like Notepad++, Ultraedit, and even Sapien products. All of those had flaws of their own. Then came Visual Studio Code, a free program from Microsoft that allows you to do all the things I was used to and presented things in a way that I could completely control. VS Code definitely looks a lot sharper than the ISE does, is quick, doesn’t freeze randomly, and just does things better. There is even an ISE theme if you miss it that much. Check out the feature list for the Powershell Extension:

features.png

Of course even without the Powershell extension you get all the built in things that VS Code brings to the table like Git integration, a project explorer, and a debugger. Obviously you know what syntax highlighting, code snippets, and IntelliSense are. However, some areas where VS Code really shines are the next 3 features. It’s not like these are complete game changers, but they’re the types of things that just make things that much easier and let you focus on what you opened the application in the first place for, writing code. PS Script Analyzer will actively check your script for certain rules such as declaring a variable but never using it, using unapproved verb-noun function names, etc. It feels like you’ve got someone subtly looking out for you while you write your code, and if you so choose you can completely ignore it. 

Go to definition and find references are features that I’ve been able to convince people that this is why they need to make the switch. I can’t tell you how many times I’ve gotten an unexpected result from a function in an external library and felt like I needed to dig into it to understand why. ‘Go to definition’ does exactly that, or if you just need a quick at a glance view to make a quick edit it has a peek feature that brings up the function without even losing your spot in your code. Maybe you need to do some damage control and find all the times a particular function is being called across an entire folder of scripts to make a change or see how widespread something may be, with a single click you can get all of those references without having to open each script individually and dig through it.

Quickly peek function definitions or find all references without ever losing your place.

If you still aren’t convinced, you’re probably not using Powershell Core yet, which is completely fine! I am primarily a Windows Powershell user myself, but am actively thinking about ways to dip my toe into the Powershell Core world and you should be too. One of the biggest things about VS Code is that is it cross-platform. This means you can have a consistent experience regardless of what OS you are using. I have a Windows 10 desktop and a MacBook Pro and surprisingly I find myself switching between the 2 more than you might think. It’s really nice to have the option to switch to my Mac while I am on the go and still be able to efficiently get some work done. 

This really just scratches the surface on Visual Studio Code, and I do think its the type of thing you just have to start using and you’ll love it. Do you absolutely have to use VS Code? Absolutely not. However we can all use a nice little quality of life enhancement every once in a while and I highly suggest you check this one out for yourself.