Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

Guidelines in Visual Studio 2010

📅 2012-Mar-15 ⬩ ✍️ Ashwin Nanjappa ⬩ 📚 Archive

 

Guidelines are a good visual reminder to stop oneself from creating code that is highly nested. I typically keep a guideline at a width of 80 characters in all my editors. In older versions of Visual Studio, you could add a guideline using Registry entries. However, these tricks no longer work in Visual Studio 2010.

The most convenient way to get guidelines in Visual Studio 2010 is to install the Productivity Power Tools extension. The specific feature in Productivity Power Tools that you need for guidelines is called Column Guides. (Why name it differently? I have no idea! 😁 )

To insert a guideline at (say) column 80, hover your mouse in the editor window at column 80 and right-click. Choose Guidelines → Add Guideline and a guideline is added at column 80. In this way, you can add as many guidelines as you wish.

To remove a guideline, follow the same procedure and choose Remove Guideline. If you find that this option is blanked out, here is a trick to get it working. Type in a long line of text that hits the guideline. Right-click on this line of text at the guideline column and you should be able to get the Remove Guideline option.

(For information on how to insert guidelines in Vim, see here.)

Tried with: Visual Studio 2010 and Productivity Power Tools 10.0.20626.18