Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Text editor vertical lines on statements

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): enter image description here

I was wondering if there was a way to do this in Visual Studio.

like image 558
Postman Avatar asked Jul 09 '13 00:07

Postman


People also ask

What is the vertical line in Atom editor?

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.

How do I show vertical lines in Visual Studio?

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.

How do you enable vertical lines in an atom?

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.

How do you add indent lines in an atom?

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 .


4 Answers

Have a look at the indent guides extension, this can do what I think you want.

like image 200
Timo Geusch Avatar answered Sep 29 '22 21:09

Timo Geusch


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.

like image 23
Robert Avatar answered Sep 29 '22 20:09

Robert


(Contemporary update)

In Visual Studio 2017 / 2019 (C++, at least), this is the default:

enter image description here

To switch it Off/On: Tools (menu) -> Options -> Text Editor -> General -> Show structure guide lines (checkbox)

like image 21
Amit G. Avatar answered Sep 29 '22 21:09

Amit G.


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.

enter image description here

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.

enter image description here

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.

like image 43
Eric Z Avatar answered Sep 29 '22 22:09

Eric Z