如何让 Resharper 正确换行很长的线?
Resharper 的代码格式通常都很好,但在处理很长的行时似乎完全被破坏了。例如,看看这段代码:
我确实想要某种换行,但它应该看起来如有必要,请提前并减少缩进,以避免出现大量换行符。像这样的东西会很棒:
有什么方法可以让 Resharper 执行此操作吗?
Resharper's code formatting is generally fine, but it seems completely broken when dealing with very long lines. For example look at this piece of code:
I do want some kind of line wrapping, but it should look ahead and indent less if necessary to avoid ridiculous amounts of line breaks. Something like this would be great:
Is there any way to make Resharper do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Jetbrains 的 Alex Berezoutsky 建议关闭“ReSharper | 选项 | 语言 | C# | 格式化样式 | 其他”对话框中的“缩进数组、对象和集合初始值设定项”复选框。在我看来,对于较短的代码行来说,这不是理想的选择,但在很长的代码行上它看起来确实要好得多。
我想这是目前解决这个问题的最佳方法。
Alex Berezoutsky of Jetbrains has suggested to turn off "Indent array, object and collection initializer" checkbox in the "ReSharper | Options | Languages | C# | Formatting Style | Other" dialog. It's not ideal IMO for shorter lines, but it does look much better on very long code lines.
I guess it's the best workaround for this problem at the current time.
诚然,我还没有将您的代码插入我的 IDE 中进行尝试,因此我没有为您提供确切的设置值,但可以尝试调整 R# 选项中的换行选项。
I admittedly haven't plugged your code into my IDE to try it so I don't have exact setting values for you, but have a go at tweaking the line wrapping options in R# options.