如何防止ReSharper在我的MSpec字段之间插入空白行? [英] How can I prevent ReSharper from inserting a blank line between my MSpec fields?

查看:72
本文介绍了如何防止ReSharper在我的MSpec字段之间插入空白行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我这样编写MSpec上下文时:

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;
    }

当我让ReSharper重新格式化代码时,它总是在任何委托下方插入一个空行,这是一个匿名方法,即以{}作为其主体.它不会在作为简单表达式的委托之后插入空白行.因此,在上面的示例中,Establish context委托占用空白行,但是Because ofIt委托却没有.

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.

有什么想法吗?

推荐答案

尝试一下:

  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
  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

这篇关于如何防止ReSharper在我的MSpec字段之间插入空白行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆