Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Aligning code/Code margin in Visual Studio

So when I used to program in java I did it in Eclipse. Whenever my code had all the same margin I just had to select everything and press Ctrl+i. Now I use Visual Studio Professional for programming in C++ The question is simple enough: How to properly set a margin to the lines of code so that it all looks well and I can easily tell what code belongs inside what brackets.

Thank you beforehand, and I hope this question is not closed. I tried searching for an answer, but found none.

like image 863
Ren Avatar asked Jan 31 '12 21:01

Ren


People also ask

What is code alignment in Visual Studio?

Code Alignment for Visual Studio Code Port of the C# Code base to TypeScript Code alignment is the practice of formatting your code vertically to improve readability. Based on principles borrowed from mathematics and other disciplines, code alignment gives extra meaning to your code by lining up similar data in columns.

How do I align my code to a specific line?

The plan is to release early and release often, and to eventually reach parity. Select the lines which you want to align (Or use Auto scope selection) Press F1 and type 'Code Alignment' to bring up options.

How do I enable the indicator margin in Visual Studio?

Build the solution. Run the project by pressing F5. A second instance of Visual Studio starts. Make sure that the indicator margin is showing. (On the Tools menu, click Options. On the Text Editor page, make sure that Indicator margin is selected.)

How to make your code look more professional in Visual Studio?

Aligning code in the code-behind as well as in front-end makes the code more professional look. The Visual Studio Code Editor gives you the ability to format your code with options such as hiding text, displaying URLs, and so forth.


1 Answers

Select what needs formatting and CTRL+K followed by CTRL+F.

like image 61
John Avatar answered Oct 15 '22 17:10

John