Custom Brace formatting with Resharper

二次信任 提交于 2019-11-27 06:08:24

You can customize ReSharper to do just that, you'll need to do the following (All in ReSharper -> Options -> C# -> Formatting Style):

  1. In Braces Layout, set Array and object initializer to At Next line (BSD Style).
  2. In Other, make sure that Continuous line indent multiplier is set to 1.
  3. In Other, make sure that Indent array, object and collection initializer block is unchecked.

You should get the style you want.

As of R#7.1 some Option attributes were changed:

  1. In Braces Layout, set Array and object initializer to At Next line (BSD Style).
  2. In Other, make sure that Continuous line indent multiplier is set to 1.

like in older versions and

  1. In Other, at Align Multiline Constructs make sure that Array, object and collection initializer is unchecked.
Alex Beynenson

This article seems to have an answer similar to what you're looking for:

ReSharper: Fixing array and object initializer indentation

(continuation of previous answers by @igal and @mbx)

As of R# 2017.1 (and possibly earlier versions), do the following:

  1. In Formatting Style -> Braces Layout, set Array and object initializer to At Next line (BSD Style)
  2. In Formatting Style -> Other -> Indentation, make sure that Continuous line indent multiplier is set to 1
  3. In Formatting Style -> Other -> Align Multiline Constructs, make sure that Array, object and collection initializer is unchecked. You may also want to uncheck Anonymous method body if that conforms to the same style.

as far as i know you cant, Resharper comes with predefined styles, but maybe if you create your own live template and set it the way you want it will works.

hope this helps.

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