Code / Code Field Alignment in Visual Studio

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

Thanks in advance, and I hope this issue is not closed. I tried to find the answer, but did not find it.

+6
source share
3 answers

Choose the formatting you want and CTRL + K, and then CTRL + F.

+13
source

Found in C ++ Visual Studio 2010 by subscribing to keywords :

Select the code you want to format, then:

CTRL + K, F or
CTRL + E, F

Formats the current selection according to the indentation and code formatting settings specified in the Formatting panel in the Tools | Options | Text editor | C / C ++.

+2
source

You can always find out what a shortcut is and use it or customize it:

  • go to Tools → Options.
  • expand Environment, select Keyboard
  • type "Format" in the text box that says "Show command containing:"
  • find the line that reads "Edit.FormatDocument"
  • read the value from the "Shortcuts for the selected command:" drop-down menu

If you want to change it, use the new key combination in the "Press shortcut keys" field, then click "Assign".

+2
source

Source: https://habr.com/ru/post/907355/


All Articles