Visual Studio Code (VSCode) and PowerShell

This is my setup for using VSCode with powershell as a replacement for Windows PowerShell ISE.

1. Install VSCode, get the latest version from: VSCode Download
2. Add PowerShell Addin
– Press CTRL+SHIFT+X
– Type PowerShell
– Click the green install button
– When installed, click the blue Reload button
– A few modifications needs to be done in the editor USER settings, press CTRL+,
Add these lines if you like to the right hand side

    "editor.rulers": [ 120 ],
    "editor.renderWhitespace": "all",
    "editor.renderControlCharacters": true,
    "editor.lineNumbers": "on",
    "editor.fontSize": 14,
    "editor.wordWrap": "on",
    "omnisharp.projectLoadTimeout": 120,
    "csharp.suppressDotnetRestoreNotification": true,
    "files.trimTrailingWhitespace": true,
    "files.defaultLanguage": "powershell",
    "terminal.integrated.shell.windows":
    "C:\\WINDOWS\\sysnative\\WindowsPowerShell\\v1.0\\powershell.exe"

So it looks a bit like this:

3. Save, by pressing CTRL+S
4. Restart VSCode and the settings should kick in, with Powershell being the default language.

As it is with Windows PowerShell and Windows PowerShell ISE, VSCode can also have a profile.
find the path in the terminal by typing $profile and press ENTER, if your PC is following the standard, the profile is most likely to be found in:
C:\Users\[USERNAME]\Documents\WindowsPowerShell\ and should be named Microsoft.VSCode_profile.ps1
So if you have some functions that should be loaded upon start of VSCode, then please update the file or create it and add what you need in there.

I hope you find it usefull.
Clicketyclick

Leave a Reply

Your email address will not be published. Required fields are marked *