Reputation: 1214
I have the Productivity Power Tools extension installed on my machine, as well as VS 2010, but I seem to have developed a mysterious issue.
The IDE no longer auto-formats code when I enter a ;
or }
which is quite annoying, I made particular use of the auto-format on }
option.
I found this question, but that doesn't solve my problem either (the settings suggested there were already the same in my IDE).
I can't really offer more information at the minute, it was working yesterday, I came into work this morning and it's just stopped working, I haven't changed any settings at all. Any help would be massively appreciated.
Upvotes: 4
Views: 16801
Reputation: 41
This happened to me. Closing files and closing VS didn't help, and it's not the case of a missing bracket in the code. Somehow the Formatting setting got changed by some black magic in VS.
Here's where the setting is in VS 2010:
Tools ⇒ Options ⇒ Text Editor ⇒ C# ⇒ Formatting ⇒ Wrapping ⇒ Leave block on Single Line.
Uncheck the checkbox, and the lines will wrap when you enter the closing bracket.
Upvotes: 4
Reputation: 1781
Typically I've seen this when my code wouldn't build, or I'd missed a closing brace } somewhere (or something similar), usually above the code that I'm looking at. Check that the code builds first just to remove it as a possibility, then try a forced auto format from the menu (Edit > Advanced > Format Document (Ctrl + K, Ctrl + D)). Does it still not work?
This may not solve the issue, but should help refine the problem.
Upvotes: 12
Reputation: 11
Old issue I know, but classic MS solution that hasn't been mentioned: close the file and/or VS and start again (sometimes just the file is enough, sometimes VS).
This happens a lot if you have the file open for a long time / lots of edits. VS just gets fed up / bored / confused / overwhelmed.
Upvotes: 1