In other text editors, such as Notepad++, if statements among other things had a vertical line connecting the if
to the else
, and the else
to the end
, which makes visual parsing much easier.
Example (Vertical lines highlighted by black boxes):
I was wondering if there was a way to do this in Visual Studio.
That's the wrap guide. It is a visual indicator of when your lines of code are getting too long. It defaults to the column that your Preferred Line Length is set to. If you want to turn it off, you can disable the wrap-guide package in the Settings View.
Navigate to Tools –> Options –-> Text Editor–> General, and then you will find “Show structure guide lines” option is Checked. Check / Uncheck the – find “Show structure guide lines” checkbox to turn the guided line on or off.
Open up your settings panel, usually by selecting the Preferences option in the Edit menu. Inside there, select the Editor submenu. In the Invisibles section, select the option titled Show Indent Guide . The vertical line indentation markers will then appear for you like in the image.
Highlight the lines of code you want to re-indent, and activate the re-indent command either through the command palette ( ctrl-shift-p ) or by using the keybinding ctrl-shift-r .
Have a look at the indent guides extension, this can do what I think you want.
This feature is now available as part of Visual Studio Productivity Power Tools. This is a free extension from Microsoft.
Productivity Power Tools 2013
Productivity Power Tools 2015
It comes bundled with a large number of other tools which you may or may not want. These features can be enabled or disabled in the Visual Studio options screen under Productivity Power Tools.
This is specifically part of the Structure Visualizer feature, which includes other sub features, such as code outlining in the margin, that can also be enabled or disabled individually.
(Contemporary update)
In Visual Studio 2017 / 2019 (C++, at least), this is the default:
To switch it Off/On: Tools (menu) -> Options -> Text Editor -> General -> Show structure guide lines (checkbox)
There is an easier way to get what you want in VS(not sure the versons preceding 2012 has it). For example if you write C++, it's:
Tools >> Options >> Text Editor >> C/C++ >> Outline Statement Blocks
, set it to True.
Then you can find a code block easily if you move mouse to the left column of the code editor. Here is what you get.
It doesn't show the block lines and it doesn't mark the block all the times unless you require it. When you need it, it will mark all the current block out.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With