Archive for August 8, 2017

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
– 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 ],</div>
    "editor.renderWhitespace": "all",</div>
    "editor.renderControlCharacters": true,</div>
    "editor.lineNumbers": "on",</div>
    "editor.fontSize": 14,</div>
    "editor.wordWrap": "on",</div>
    "editor.wordSeparators": "`~!@#%^&*()-=+[{]}\\|;:'\",.<>/?",</div>
    "omnisharp.projectLoadTimeout": 120,</div>
    "csharp.suppressDotnetRestoreNotification": true,</div>
    "files.trimTrailingWhitespace": true,</div>
    "files.defaultLanguage": "powershell",</div>
    "launch": {</div>
<pre class="crayon-selected">

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.