views:

2031

answers:

2

Hi,

I've been using Visual Studio as my main IDE for a while now (I still use Emacs for some personal projects, though).

I like the way Emacs formats C/C++ code and I'd like to convince Visual Studio use similar conventions for C# code. For instance, in Emacs, a C function call looks like:

functionName(argument1,
             argument2,
             argument3);

while in the C# code formatted by Visual Studio a function call looks like:

functionName(argument1,
    argument2,
    argument3);

which seems worse to me.

Is there a way to tweak Visual Studio code formatting rules? Any plugins that can handle that?

Many thanks,

+3  A: 

Tools > Options > Text Editor > C# > Formatting

and

http://www.jetbrains.com/resharper/features/code_formatting.html#Code_Formatting

Ed Guiness
Thanks, but while that allows many customizations, I can't see a way to solve the problem in my example. It's just a minor nuissance, though.
Miron Brezuleanu
You could also drop the first argument to the next line which would make all arguments align.
Ed Guiness
Thanks for the suggestion, that's what I do sometimes, but it 'wastes' a line.However I'm a bit annoyed because I consider the Emacs default formatting better (I bet I would feel the other way around if I had used Visual Studio before Emacs :-) )
Miron Brezuleanu
One man's 'waste' is another man's clear code. Sorry I don't have other ideas except maybe writing a VS macro for this particular bugbear.
Ed Guiness
+2  A: 

Resharper (above) is good. CodeRush is now free from DevExpress. I've enjoyed using their products over the years.

http://www.devexpress.com/Products/Visual_Studio_Add-in/CodeRushX/

Jiyosub
Thanks, I'll try CodeRush.
Miron Brezuleanu