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

余生颓废 提交于 2019-12-24 17:09:25

问题


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?


回答1:


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


来源:https://stackoverflow.com/questions/24855393/how-can-i-prevent-resharper-from-inserting-a-blank-line-between-my-mspec-fields

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!