Thursday, December 1, 2011

Show Indentation Lines in Visual Studio 2010

Have you found yourself wondering if your HTML tags have matching closing tags?
Wouldn’t it be great to have a visual aid to help you read your code and verify that is aligned properly and the tags match?

There is a great Visual Studio extension named Indent Guides which you can download from CodePlex, @ once installed, restart Visual Studio and you can easily notice that your source code has now a visual line that you can use to ensure indentation is correct and to match tags. See screenshot below.

Speaking of Visual Studio tips and tricks, here are another couple of tricks to improve the editor experience:

- You can use Ctrl+E, D to format the selected text. This would add indentation to your code so it is easier to read, although you may want to use with caution because the indentation can be excessive for some people. You can find this option on the Edit -> Advanced menu.
- A common question is how to display Line number on the Visual Studio 2010 editor. To do so, go to the Tools menu, click on Options -> Expand Text Editor, select a language, for example C# and click on General if is not selected automatically. Then on the last section of the window named “Display” enable the Line Numbers checkbox.
- What if the code you are reading is all collapsed because somebody else used the Outline feature? Well you can quickly turn off the Outline by pressing Ctrl+M, P, you can find all the Outline options on the Edit menu Outlining

Hope this helps somebody out there,