Code format places cast on separate line

I have expression that, upon code formatting, is placed on four lines:

    double deltaX =
        (double)
            Math.Min(
                deltaX, some_long_var_foo - some_long_var_bar);



I cant figure out the correct combination of settings to not have this broken up so much. Im looking to get something like this:

    double deltaX = (double)Math.Min(
        deltaX, some_long_var_foo - some_long_var_bar);

Can ReSharper do this?
2 comments
Comment actions Permalink

Hello,

Could you please attach your code style settings (exported through ReSharper

Options > Languages > Common > Code Style Sharing)? Thank you!


Andrey Serebryansky
Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

I have expression that, upon code formatting, is placed on four lines:

double deltaX =
(double)
Math.Min(
deltaX, some_long_var_foo - some_long_var_bar);
I cant figure out the correct combination of settings to not have this
broken up so much. Im looking to get something like this:

double deltaX = (double)Math.Min(
deltaX, some_long_var_foo - some_long_var_bar);
Can ReSharper do this?

---
Original message URL:
http://www.jetbrains.net/devnet/message/5265708#5265708



0
Comment actions Permalink

marcus23 wrote:

Could you please attach your code style settings (exported through ReSharper


Its attached. As you can see I have lowered the character limit to 50 in order to reproduce the problem in the following code:

using System;

namespace foons
{
    public class formattest
    {
        public static double foobar()
        {
            double deltaX = 0.0;
            double some_long_var_foo = 1.0;
            double some_long_var_bar = 2.0;
            deltaX = (double)Math.Min(deltaX,some_long_var_foo-some_long_var_bar);
            return deltaX;
        }
    }
}



That code, when formatted with the attached settings, places the cast on a separate line (what I currently get):

            deltaX =
                (double)
                Math.Min(deltaX,
                    some_long_var_foo -
                    some_long_var_bar);



But I think three lines is well enough (what I want):

            deltaX = (double)Math.Min(deltaX,
                some_long_var_foo -
                some_long_var_bar);



Last snippet is roughly what I'm trying to get. Or rather anything where the cast isn't given a dedicated line.
I'm running my own Code Cleanup profile which does nothing but format the code.

Attachment(s):
resharper_settings.xml
0

Please sign in to leave a comment.