Tim Long
Tim Long

Reputation: 13778

How can I prevent ReSharper from inserting a blank line between my MSpec fields?

When I write an MSpec context like this:

[Subject(typeof(TheType), "Concern")]
internal class when_this_test_is_run
    {
    Establish context = () =>
        {
        // some code...
        };

    Because of = () => Do.Something();
    It should_do_this;
    It should_do_that;
    }

When I let ReSharper reformat the code, it always inserts a blank line beneath any of the delegates that is an anonymous method, i.e. has a { block } as its body. It doesn't insert blank lines after delegates that are simple expressions. So in the example above, the Establish context delegate gest a blank line, but the Because of and the It delegates do not.

This is driving me crazy as I don't want it to insert the blank lines, but I can't figure out what setting I need to change to stop it happening.

Any ideas?

Upvotes: 1

Views: 1678

Answers (1)

Alexander Kurakin
Alexander Kurakin

Reputation: 13523

Try this:

  1. ReSharper | Options | Code Editing | C# | Formatting Style | Blank Lines | Preserve existing formatting | Keep max blank lines in declaration | Select '0'
  2. ReSharper | Options | Code Editing | C# | Formatting Style | Blank Lines | Blank lines | Around field | Uncheck

Upvotes: 5

Related Questions