How to automatically indent source code?

后端 未结 7 1522
抹茶落季
抹茶落季 2020-12-07 11:56

How can I automatically indent source code in Visual Studio 2010?

I have used Ctrl + K, Ctrl + F, but it does not work; i

7条回答
  •  死守一世寂寞
    2020-12-07 12:33

    I have tried both ways, and from the Edit|Advanced menu, and they are not doing anything to my source code. Other options like line indent are working. What could be wrong? – Chucky Jul 12 '13 at 11:06

    Sometimes if it doesnt work, try to select a couple lines above and below or the whole block of code (whole function, whole cycle, whole switch, etc.), so that it knows how to indent.

    Like for example if you copy/paste something into a case statement of a switch and it has wrong indentation, you need to select the text + the line with the case statement above to get it to work.

提交回复
热议问题