Inducing Functional Arguments in Visual Studio

VS v010 enter the following C ++ code as:

if (Foo(arg1, arg2)) { } 

Is there a way to change VS formatting rules to defer code below:

  if (Foo(arg1, arg2)) { } 

thanks

Update

Why are these cons? Don't you think the guy code style is important, or is there some other reason?

+7
source share
2 answers

No, there is no “out of the box” way to force Visual Studio to back out the code this way. It will always separate indentation functional parameters with only one tab.

It turns out that this style complies with Microsoft’s general coding rules, and probably why they wrote it that way. I don’t even care about it, but I also prefer your style.

But it turns out that you only need to manually postpone the first wrapped parameter. Subsequently, when you press Enter , Visual Studio will automatically launch the next line under your first carefully constructed parameter.

Also remember that (if you have already written the method definitions), you can select multiple lines at a time and use the Tab key to align them all. You do not have to do one at a time.

In general, there are, unfortunately, extremely limited code formatting options available for C / C ++ code in Visual Studio. C # programmers get more benefits. You might be able to invest in an add-in or extension, such as Visual Assist X , in which you get more features in the IDE.

+9
source

Try using the Artistic Style tool (short for astil ). He can configure almost all the necessary codes. Regarding your indentation format, check its doc for max-instatement-indent . In addition, this tool can be easily integrated into Visual Studio.NET (check this out for quick setup).

+1
source

All Articles