views:

103

answers:

2

When I open any code file, whether something i've written or something from another developer, I want it to automatically format it with my preference of bracing, indentation, line spacing, etc..

Ideally, when saving a file to disk, it would only save the formatting for code/lines i've touched. It would still display the rest of the code formatted, however it would not save these to disk (so as to not piss off other developers).

+1  A: 

You could use Resharper for this. It will show warnings for formatting inconsistencies (via colored underscores, much like warnings for spellcheckers), and you could instruct it to reformat a selection or a whole file based on either the default formatting rules or your own.

Formatting rules are customizable to fit your own coding standards.

Jon Limjap
Thanks, that answers half of the question, and might be what I go with. Would really love it if it didn't actually write out the changes to code that I didn't touch. If I use this, other developers who don't use this will get mad at me :P
esac
Well you can opt to format a selection. Cumbersome, I know, but it will work for your purposes.
Jon Limjap
It looks like Reshaper does not work with C/C++ code.
Sorin Sbarnea
+1  A: 

Visual Assist X works for both C/C++ and C#. I use it extensively whenever I have the unfortunate needs to do things in Windows :-).

The refactoring tool is awesome. It fixes Visual Studio smart completion. In fact, after you use Visual Assist X, Visual Studio smart completion looks so dump that you won't believe you paid so much for such crappy "smartness".

Of course, Visual Assist X also adds the much needed snippets. You can finally stop drooling when you see those snippet "special moves" when viewing those Textmate screencasts.

Dat Chu