If else and cleanup code

Answered

I'd like to configure cleanup code to prefer the following layout:

if (a = b)
{
    // do something
}
else if (a < TOOBIG)
{
    // do something else
}
else
{
    // third thing
}

Basically I'd like to enforce braces for single statements, but treat if/else as a special-case. Right now I'm getting this:

if (a = b)
{
    // do something
}
else
{
    if (a < TOOBIG)
    {
        // do something else
    }
    else
    {
        // third thing
    }
}

Is there a setting that achieves my goal? There is an option under Options->Code Editing->C#->Formatting Style->Other->Special "else if" treatment, but I have that checked without effect.

Thanks,

Mike.

2 comments
Official comment

Hello Mike,

You are welcome to comment and vote for https://youtrack.jetbrains.com/issue/RSRP-460653 ticket. 

Thanks! 

Thanks Alexander - good to know it's not something I missed.

0

Please sign in to leave a comment.