简体   繁体   中英

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. 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.

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. How do I prevent R# from deleting my comments when removing those braces?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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