有没有一种方法来标记代码告诉ReSharper的不格式化? [英] Is there a way to mark up code to tell ReSharper not to format it?

查看:169
本文介绍了有没有一种方法来标记代码告诉ReSharper的不格式化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我经常使用ReSharper的清理代码命令,我的编解码方式为我们的编码检查它到源代码控制之前的风格。这非常一般,但一些代码位更好的手动格式(例如,因为在ReSharper的缩进规则,像链LINQ方法或多行三元运营商有一个奇怪的缩进是推动他们的方式向右侧)。

I quite often use the ReSharper "Clean Up Code" command to format my code to our coding style before checking it into source control. This works well in general, but some bits of code are better formatted manually (eg. because of the indenting rules in ReSharper, things like chained linq methods or multi-line ternary operators have a strange indent that pushes them way to the right).

有什么办法来标记文件的部分告诉ReSharper的不格式化区域?我希望某种类似ReSharper的如何禁止其他警告/特征标记。如果没有,是否有改变的设置相结合的办法让ReSharper的格式化正确缩进

Is there any way to mark up parts of a file to tell ReSharper not to format that area? I'm hoping for some kind of markup similar to how ReSharper suppresses other warnings/features. If not, is there some way of changing a combination of settings to get ReSharper to format the indenting correctly?

编辑:

我发现从ReSharper的论坛上说,后产生代码段(如ReSharper的选项页中定义)的代码清理被忽略。尝试过它虽然,它似乎并没有被忽略。

I have found this post from the ReSharper forums that says that generated code sections (as defined in the ReSharper options page) are ignored in code cleanup. Having tried it though, it doesn't seem to get ignored.

推荐答案

ReSharper的>选项>语言> C#>格式样式>其他>

Resharper>Options>Languages>C#>Formatting Style>Other>

取消选中缩进匿名方法体和缩进数组,对象和收集initilizer块和其他任何罢工你的想象。

Uncheck "Indent anonymous method body" and "Indent array, object and collection initilizer blocks" and anything else that strikes your fancy.

这篇关于有没有一种方法来标记代码告诉ReSharper的不格式化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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