rmirabelle
rmirabelle

Reputation: 6446

Resharper stop newline before return

in C#, whenever I type a single line statement that includes return, formatting with ReSharper causes it to place the return indented on a new line.

I get this:

if(x == 0)
    return;

But I want this

if(x == 0) return;

I can find no option for changing the setting and it's driving me nuts.

Thanks in advance.

Upvotes: 1

Views: 1489

Answers (2)

rmirabelle
rmirabelle

Reputation: 6446

Found another possible solution to this insidious problem:

Options > Text Editor > C# > Formatting > Wrapping

Check Leave statements and member declarations on the same line. This is, of course, misleading and inaccurate, as in my example, there is no member declaration, but it's worth a try if anyone else gets caught.

Upvotes: 2

Steve
Steve

Reputation: 9551

In Resharper options, under Code Editing -> C# -> Formatting Style -> Line Breaks and Wrapping, set Break line in single embedded statement to either Do not change, or, Force put on single line.

enter image description here

Upvotes: 6

Related Questions