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

1

1

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?

Selfacting answered 20/7, 2014 at 22:9 Comment(1)
Funny, I'm actually looking for the exact opposite as Resharper 9 removes blank lines around single line fields by default.Provided
D
5

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
Dey answered 21/7, 2014 at 9:5 Comment(1)
Nice. The ones I needed there were "before/after statements with child blocks". It's annoying to have useless empty lines inside functions.Menzies

© 2022 - 2024 — McMap. All rights reserved.