[Code format] Code formatting of if-else statement

My JetBrains Rider keeps removing braces from any simple if-else statement

My expectation

private void SetPLayer([Optional] PlayerName)
{
    if (PlayerName == Player.ID1)
    {
        RecreateCollection();
    }
    else
    {
        RecreateCollection(true);
    }
}

Rider format:

private void SetPLayer([Optional] PlayerName)
{
    if (PlayerName == Player.ID1)
        RecreateCollection();
    else
        RecreateCollection(true);
}

I have unchecked these, but it seems it was not the case

0
1 comment

Hello, 


Thanks for contacting Rider support. Regarding this issue, please go to Settings | Editor | Code Style | C# | Syntax Style, and set “In ‘if’ statement” to “enforce always”, as below: 

If this doesn't resolve the issue, please help us investigate further by sharing your Rider settings:

  1. Go to Settings → Manage Layers (button at the bottom).
  2. For each layer, use the context menu → Export to File.
  3. Additionally, please share your .editorconfig file if it exists.

You can upload these files to our Upload Service and provide us with the Upload ID.

Thanks,

Tom

0

Please sign in to leave a comment.