user215361
user215361

Reputation:

Is there an option in ReSharper to not remove the blank line I put between the namespace and class definition?

Every time I let ReSharper format my code, it removes the blank line I put between the namespace and class declaration.

From this:

namespace Test {

  public class Test {

To this:

namespace Test {
  public class Test {

It does the same thing with the blank lines at the closing braces of both. All my "blank line" settings are set to 1, except for single line fields.

Is there an option I'm missing?

Upvotes: 12

Views: 6208

Answers (3)

Skorunka František
Skorunka František

Reputation: 5450

Visual Studio menu: ReSharper > Options...

Type in the search box "Line feed at end of file":

Resharper 2018.1.2

Upvotes: 14

wisner
wisner

Reputation: 523

This is actually now an option (as of June 2016). Go to ReSharper | Options -> Code Editing | C# | Formatting style | Other and check Line feed at end of file.

Upvotes: 20

Dmitry Osinovskiy
Dmitry Osinovskiy

Reputation: 10118

Fsck, just 10 minutes ahead of me. Well, I'll answer anyway. Bad news is that it's a long-time feature request http://youtrack.jetbrains.com/issue/RSRP-74903

Good news is that it would fixed in the tomorrow's 7.1 EAP build. There would be new options in ReSharper | Options -> Code Editing | C# | Formatting style | Blank Lines:

  1. Remove blank lines after "{" and before "}" in declarations (turn it off to prevent ReSharper from removing blank line) and
  2. Around namespace and Around type (set it to non-zero value to force ReSharper to add blank lines).

Upvotes: 2

Related Questions