简体   繁体   English

在删除单个语句周围的花括号时,如何防止Resharper删除我的注释?

[英]How to prevent Resharper from deleting my comments when removing curly braces around single statements?

R# helps me with removing curly braces around single-statement blocks and I like that. R#帮助我消除了单语句块周围的花括号,我很喜欢。 However I usually leave comments there and they're getting deleted every time the the curly braces are removed, despite that it's legal in C# to keep these comments exactly where they are without the curly braces. 但是我通常在这里留下注释,每次删除花括号时它们都会被删除,尽管在C#中合法的是将这些注释精确地保留在没有花括号的位置。

The following sample: 以下示例:

if (true)
{
    // comment.
    Call();
}

Is being reformatted into this: 正在重新格式化为:

if (true)
    Call();

Instead of this: 代替这个:

if (true)
    // comment.
    Call();

And I need my comments to be exactly there before each call, not before the if/else statements. 而且我需要在每次调用之前,而不是在if / else语句之前,将我的注释准确地放在这里。 How do I prevent R# from deleting my comments when removing those braces? 在删除括号时,如何防止R#删除注释?

此问题已在Rider 2019.1中修复 ,并且Rider在Rider 2019.1上不再删除可选花括号中的注释,如果它们在应用格式样式或执行代码清除时被自动删除。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM