Visual Studio Code Survival Guide for PowerShell Coders

In this series I will share information on how to use Microsoft’s Visual Studio Code for PowerShell coding. The article contains tips/tricks to be better able to use VS Code. It’s a personal log that I keep in my learning process for VS Code. Hopefully it helps you too!

Useful Links

Change the Default Language Mode to PowerShell

When you install VS Code, the default language mode for new files is set to plaintext. If you’re used to PowerShell ISE, this is quite annoying. In the way I work is that I open a new file, type my commands and then execute the code.

In VS Code you had to save the file first as a PowerShell file, or change the language mode before you could do this. David Wilson made it now possible to change this behaviour. He build in a new configuration setting called “files.defaultLanguage” which allows you to change the language mode for new, unsaved files.

Be carefull, that you specify the setting in lowercase powershell, otherwise it will not work.