【问题标题】:How can I force ReSharper to always put the first parameter on the same line as the method?如何强制 ReSharper 始终将第一个参数与方法放在同一行?
【发布时间】:2016-12-23 00:03:12
【问题描述】:

在 ReSharper 中,我启用了“Wrap Long Lines”,并且所有“Wrap Parameters”选项都设置为“Chop if long”。

如果我有这样一行代码:

DisplayMessage("This is a really long string that cuts off the screen ...", type, item);

ReSharper 想要像这样格式化该行:

DisplayMessage(
    "This is a really long string that cuts off the screen ...",
    type,
    item);

但我希望它像这样格式化:

DisplayMessage("This is a really long string that cuts off the screen ...",
               type,
               item);

这可能吗?我意识到这是因为第一个参数的字符串很长,所以它想把它放在自己的行上,但我更喜欢切碎的参数与左括号一致。

这就像我需要一个[ ] Don't put the first parameter on its own line 选项。

【问题讨论】:

    标签: c# resharper resharper-10.0


    【解决方案1】:

    您要查找的复选框位于:

    Code editing -> C# -> Formatting Style -> Line Breaks and Wrapping -> Line Wrapping

    并命名

    Prefer wrap after "(" in invocation

    你想要它关闭

    (但我的 Resharper 显示 2016.2.2 build 13-Sept-2016 作为其版本)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-09-04
      • 2010-12-22
      • 2020-08-15
      • 2019-01-17
      • 1970-01-01
      • 2011-11-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多