Add Guidelines to your code!

Over 5 years ago, I wrote my very first tip about Visual Studio on Guidelines, a hidden feature to enable visual column indicators to the editor.

Finally, through this extension, we have a way to set and customize guidelines through the UI without manually changing registry keys.

Editor showing a guideline and its UI

The registry key will work on versions 2002, 2003, 2005, and 2008. However, the registry key will not work on VS 2010 without this extension.

To Install

This write-up is for two extensions:

  • Editor Guidelines – This extension puts the guidelines feature back
  • Editor Guidelines UI – This extension extends the Editor Guidelines extension such that UI can be used instead of manually editing the registry.

Please see my post How To Install Visual Studio Extensions.

To Use

If you’re just using the first extension, you’ll have to manually edit the registry yourself, so use at own risk. The key is the same as previous versions, which is [HKCU]\Software\Microsoft\VisualStudio\10.0\Text Editor. You’ll create a new REG_SZ string with for example “RGB(0,255,0) 100” to set a green guideline on column 100.

If you’re using the second extension, things are a lot simpler.

Just right-click wherever you wish to place the guideline, and from the context menu, select Add guideline. To remove, put your cursor on the column where you wish to remove the guideline, and right-click, and select Remove guideline.

To Customize

From the same context menu, you can select Guideline Color and get the standard color palette control.

standard color palette

Apologies for the delayed post. I was giving talks on Visual Studio and some of the extensions in Europe last week, but never had a chance to blog about them!