Resharper格式化链接方法
R#中是否存在设置以设置链接方法的格式以从实例化的类的相同字符开始。
Is there a setting in R# to format chained method to start at the same character of the class instantiated.
我想要什么:
var foo = new FooDataBuilder()
.WithDate(myDate)
.WithBar(myBar)
.Build();
R#给我的好处:
var foo = new FooDataBuilder()
.WithDate(myDate)
.WithBar(myBar)
.Build();
使用Resharper 7.1.2,您可以获得以下内容格式:
With Resharper 7.1.2, you can get the following formatting:
var foo = new FooDataBuilder().WithDate(myDate)
.WithBar(myBar)
.Build();
通过设置以下Resharper选项:
By setting the following Resharper options:
代码编辑
-> C#
-> 格式样式
- > 换行和包装
-> 换行
-> 包装链接方法调用
总是 Chop c
Code Editing
->C#
->Formatting Style
->Line Breaks and Wrapping
->Line Wrapping
->Wrap chained method calls
to Chop always
和
启用代码编辑
-> C#
-> 格式化样式
-> 其他
-> 对齐多行结构
-> 链式调用
enable Code Editing
->C#
->Formatting Style
->Other
->Align Multiline Constructs
->Chained method calls
除非您手动进行操作,否则我认为您不能与 FooDataBuilder()
保持一致。 (这已经得到Jetbrains的@Dmitry Osinovskiy的确认,因此这可能是您最接近想要的东西的地方。)
I don't think you can align with FooDataBuilder()
unless you do it manually. (This has been confirmed by @Dmitry Osinovskiy from Jetbrains so this may be the closest you're going to get to what you want.)