views:

55

answers:

2

I'm new to visual studio, so perhaps this is something easy... but I've had no luck finding how to solve this formatting issue.

I would like for VS to auto format this

int x = 
5;

like this

int x = 5;

When I type this in and select 'Format Document' nothing changes.

It will also not remove unnecessary newlines such as

MyClass someClass = 

    new MyClass();

Any help for this would be great!

+2  A: 

Visual studio can't fix that. You can do it with the Replace All dialog + regex if you are careful.

jgauffin
Somewhat infuriating that VS can't do that, but at least good to know it wasn't my googling skills. Thanks.
derivation
+1  A: 

jgauffin is right. However you can format other items to speed up the process.

Tip for key combinations for general reformatting

Tip for using a macro to modify all files in your solution

Redburn