ReSharper的 - 迫使各地一行花括号 [英] ReSharper - force curly braces around single line
问题描述
我可以配置ReSharper的修复C#代码时,大括号不用于环绕单行代码块,像这样的:
如果(blnSomeCondition)
DoSomething的(); //抱怨
如果(blnSomeOtherCondition)
{
DoSomethingElse(); //不要抱怨
}
感谢
< DIV CLASS =h2_lin>解决方案
Gorohoroh的解决方案是接近,但不是选择使用大括号多行,我不得不选择添加括号,迫使它添加括号中的单行情况。我不得不设置下的强制大括号所有六个下拉菜单抓住所有的场景:
我真的希望是能够建立ReSharper的做一个黄色的警告或红色当规则被侵犯的错误,但我还没有找到一种方式来做到这一点。因为你是对的,Gorohoroh,清理代码做了很多的东西,我想一定要看和修复在一次违规一个选项。
感谢您的帮助!
Can I configure ReSharper to fix C# code when curly braces are not used to surround a single-line code block, like this:
if (blnSomeCondition)
DoSomething(); // complain
if (blnSomeOtherCondition)
{
DoSomethingElse(); // don't complain
}
Thanks
Gorohoroh's solution is close, but instead of selecting "Use braces for multiline" I had to select "Add braces" to force it to add the braces in the single-line scenario. And I had to set that in all six dropdowns under "Force Braces" to catch all the scenarios:
What I was really hoping for was to be able to set up ReSharper to do a yellow warning or red error when the rule was violated, but I haven't found a way to do that. Because you're right, Gorohoroh, Cleanup Code does a lot of stuff and I'd like to have the option to look at and fix the rule violations one at a time.
Thanks for your help!
这篇关于ReSharper的 - 迫使各地一行花括号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!