Blank lines in enumeration definitions when performing "Reformat and clean code"
Hi.
I used JetBrains Rider 2023.1.3
I recently added the following enum definition to a project.
/// <summary>
/// Parameter types
/// </summary>
public enum ParamTypes
{
[Description("fastening")] Fastening,
[Description("adv_normal")] AdvNormal,
[Description("adp_not_used")] AdvPlusNotUsed,
[Description("adp_seating_detection")] AdvPlusSeatingDetection,
[Description("adp_prevailing_control")] AdvPlusPrevailingControl,
[Description("adp_open_hole")] AdvPlusOpenHole,
[Description("adp_engaging_torque")] AdvPlusEngagingTorque,
[Description("model")] Model,
[Description("ms")] Ms,
[Description("screw_count")] ScrewCount,
[Description("input")] Input,
[Description("output")] Output,
[Description("controller")] Controller,
[Description("network")] Network
}
If perform "Reformat and Cleanp Code (Whole solution - Built-in: Full celanup)", it will look like this
/// <summary>
/// Parameter types
/// </summary>
public enum ParamTypes
{
[Description("fastening")] Fastening,
[Description("adv_normal")] AdvNormal,
[Description("adp_not_used")] AdvPlusNotUsed,
[Description("adp_seating_detection")] AdvPlusSeatingDetection,
[Description("adp_prevailing_control")]
AdvPlusPrevailingControl,
[Description("adp_open_hole")] AdvPlusOpenHole,
[Description("adp_engaging_torque")] AdvPlusEngagingTorque,
[Description("model")] Model,
[Description("ms")] Ms,
[Description("screw_count")] ScrewCount,
[Description("input")] Input,
[Description("output")] Output,
[Description("controller")] Controller,
[Description("network")] Network
}
There are multiple enumerations defined in that CS file, but this only happens with this enumeration definition. Also, if copy this definition and define it in another file, the same thing happens.
Why is a blank line added between enumerations and the value of the next enumeration is displayed on the line directly below it?
I like my code to line up nicely, but this is a little weird.
Please sign in to leave a comment.
Hello,
I was able to reproduce this behavior and submitted a new issue RSRP-493280 Code Cleanup introduces unnecessary line breaks in an enum declaration. The issue is in the ReSharper project, since ReSharper and Rider share code base. The issue is handled by a dedicated developer. Please upvote it and click Watch to monitor the progress of the issue.
The workaround is to adjust the following settings in Preferences | Editor | Code Style | C#: