VisualStudio and ISE Steroids Vertical Guides

To make it easier for reviewers and other programmers to read PowerShell code it is recommended that lines of PowerShell code don’t exceed 100 characters. If you run past this limit you should usually split the line using a backtick (`). I also find that this limit prompts me to rethink my code logic if the line gets too long. Besides, no one wants to have to scroll several pages horizontally to be able to read your whole line of code.

However, one of the most common issues I run into when reviewing (or writing my own) PowerShell DSC resources is going over the 100 character limit. For your own projects you’re most welcome to use any styles that you want (although I’d still recommend this one for the reasons above). However, if you’re going to commit this code to the PowerShell DSC community resources you’ll need to ensure your code meets this requirement, otherwise reviewers will likely ask you change it.

But there is an easy way to help identify this problem if you’re using Visual Studio Code or PowerShell ISE Steroids: Setup a vertical guide/ruler at 100 characters.


A nice easy to see vertical ruler/guide tells us when our lines get too long… oh dear this line is too long.

To Set up a Vertical Ruler in Visual Studio Code

  1. Select User Settings (you can use Workspace Settings if you want) from Preferences in the File menu:
  2. Your user settings.json file will load on the right, with the Default Settings on the left:
  3. Add the following line to your settings.json file in between the braces:
    "editor.rulers": [100]


  4. Save the file and restart Visual Studio Code.

To Set up a Vertical Ruler in ISE Steroids

  1. Select Show Secondary Toolbar from the View menu.ss_verticalruler_isesteroidsmenu
  2. Click the Vertical Guides button and select Global Guide…ss_verticalruler_isesteroidsverticalguidebutton
  3. Enter 100 in the input box and press enter.


    The vertical guide is added – better fix that long line!

That is all there is to using vertical guides. Having them setup if you’re planning on committing code to a community project might save you some extra commits and help the community reviewers merge your code faster.

Happy coding!



Markdown Preview in Visual Studio Code

I used to keep around a copy of Markdown Pad to enable me to preview any markdown files I created. However, after an update to a Awesomium SDK Markdown Pad stopped working. I reported the issue but it hasn’t been resolved yet.

But after Irwin Strachan mentioned using Visual Studio Code as a Markdown editor, I wondered if there was an extension that allowed it to Preview the Markdown as well – because that was really all that was missing for me to do away with Markdown Pad. So I went and did a search for Markdown extensions in VS Code:


Want to install extensions in VS Code? Press F1 and type ‘ext install’.

I found a few, but after playing around with them a bit I noticed a small button in the latest version of Visual Studio Code at the top right corner when a markdown file is open:


The Preview button!

I wonder what that might do?


That is a great looking markdown preview.

Oh, now look at that! Just what I needed. I don’t know which version of Visual Studio Code this was added in, but it is fantastic!

You can also use the Visual Studio Code split window function to edit and Preview at the same time:


Changing the markdown automatically updates the preview – nice!

While we’re on the topic of markdown, Irwin also pointed me at this awesome markdown tutorial – it makes learning markdown fun!

Now, Visual Studio Code is not on par with ISE Steroids when it comes to editing PowerShell files, but when you’re dealing with lots of different types of files (including PS files) it can be a real time saver. I highly recommend downloading a copy of Visual Studio Code, installing the PowerShell Extension and giving it a try.



PowerShell Language Support in Visual Studio Code

I feel like my birthday has come early: Microsoft has added PowerShell language support in Visual Studio Code:


I mainly use PowerShell ISE with ISE Steroids for most of my coding, but I find when I’m needing to switch between working on multiple files of different types Visual Studio Code is so much faster and slicker. Visual Studio 2015 with PoSH tools would be the ideal way to go, but the PoSH extension is quite slow with any files larger than 20KB. So I’m really excited with what this can do.