Visual Studio 2010 Won't Auto-Indent Lines

匿名 (未验证) 提交于 2019-12-03 01:34:02

问题:

Visual Studio 2010, used to auto indent my lines, and now suddenly it won't do that, for example, when I created a method, it looked like that:

public static void Foo (int FooInt) {     // Some methods stuff... }

but now, it looks like that:

public static void Foo (int FooInt) { // Some method stuff... }

I can't find any answer for that, what can I do?

I am using Visual Studio 2010, Windows 7 64 Bit

Update: Turns out my problem on resides on C#, when I am trying it on a C++ project, indentation work perfectly... Any suggestions?

Update:

Problem was solved, unexpectedly by re-installing Windows.

回答1:

I was having the same problem and after changing Indenting from Block to Smart it started working!



回答2:

Check your indentation settings in Visual Studio - Tools|Options.. => Text Editor > C# > Formatting > Indentation:



回答3:

If the project wont build the auto indent wont work.

The short command for indent in VS 2010 is ctrl + K + D



回答4:

I don't know what the problem is precisely, but I'll take a shot in the dark. Under Tools->Options->C#->Tabs, what is the value?



回答5:

Another potential solution to this problem if all of the settings in VS2010 seem to be correct is to check for characters from other character encodings. For example, if one accidentally places left and right quotes inside the source code, it could prevent visual studio from automatically formatting your code. Sometimes you get an error to help you identify such a situation, sometimes it is more latent and a pain to find.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!