There’s no shortage of code editors available and most coders have their favorite. I write PowerShell scripts for my job and until recently I used the standard PowerShell ISE to write my scripts. Microsoft Visual Studio Code has become the recommended script editor by Microsoft and here’s why.
Visual Studio Code Features
- Intellisense: one feature I really like is the Intellisense feature which gives you code completion while your writing.Which once your used to the code completion it can make writing code easier.
- In app debugging, allows you to debug your scripts from inside of visual Studio Code including the use of break points to help find which line of code is causing the error.
- Built in Git: You can easily connect vs code with git hub and review diffs and commit code right from the editor.
Visual Studio Code is open source product and is available on all platforms, Windows, Mac, Linux. That along with the extensible of all the addons you can use with Visual Studio Code it can turn into any editor you could want. You can also install themes and icons to make the editor look and feel the way you want. My favorite icon theme is Material theme which set a different material style icon for each of the different languages which makes it easy to determine what each file is in a folder.
Using Visual Studio Code
When you open Visual Studio Code you see the default layout for the code editor. On the far left side there are 5 icons. These icons are how you access most of the features of VS code. Starting at the top is Explorer which when click allows you to open a folder inside the application and access your scripts for there. This allows you to have project folder open in Visual Studio Code without having to go out of the editor to access files.
The next icon in the list is Search which is one of my favorite features in VS Code. The search box does more than a normal one. When you enter in a term in the box it searches through all files in the folder you have added to VS Code in the previous icon and looks through all the files in the folder for the search term entered. This can be anything from a variable entered in one of the scripts or a comment you entered. This makes life a lot easier than search each file individually.
The third icon is for Source Control and is where you can add source control providers for your scripts. This is another added benefit for coders who use source control with their scripts.
The fourth icon is Debug which is used anytime you run or debug a script, you can change settings like Breakpoints here or in the Debug menu. You can also install additional debuggers if needed through the VS Code extensions.
The last icon is for Extensions which is where you can see what extensions are installed or have an updated available. You can also search for and install new extensions from here. There also recommended extensions that are displayed which include the most used extensions.
Overall Microsoft Visual Studio Code is a powerful editor that is able to be used for many different languages. It can be tailored to the scripting language you want with one of the many extensions available to be installed. So even though I have only used Visual Studio Code for a few months I am very happy with the experience and recommend it to anyone writing scripts.