rider

How can I add white space after comma when declaring enum member?


When I declare enum in Rider I have to add white space manually

public enum ETest
{
    a=1,
    b,
    c,
    d,
    e,
}

I want to change as, when I hit the comma add white spaces as following

public enum ETest
{
    a = 1,
    b,
    c,
    d,
    e,
}

Solution

  • I submitted this feature request: RSRP-501236 Auto-format on typing quote

    The most convenient option currently is to enable the "Reformat on Save" (File | Settings | Tools | Actions on Save).

    Ensure this setting: File | Settings | Editor | Code Style | C# | Spaces | Assignment operators is enabled.

    So, now, upon saving a file (Ctrl+S), the spaces you didn't enter would be added by a formater.

    Another option to trigger reformat is to delete/enter the closing brace in the end of enum declaration.

    Have a nice day!