Code format: don't force mehtods to single line

Answered

Look at the attached gif. If I have a method with only one line of code in it Rider automatically forces it to one line. Super annoying!

Cannot find any way to change this in code style settings, have I missed anything?

In my team I'm currently the only one using Rider, and right now I'm getting a ton of line diffs if I was to do a "code format" since I cannot add the rules to work according to our style guide. This is the biggest issue.

1
3 comments

Hi,

Thank you for contacting us.

You can set this property in Preferences | Editor | Code Style | C# -> Line Breaks and Wrapping -> Place simple method on a single line. Just untick this checkbox.

Kind regards,

Sofia

0
Avatar
Permanently deleted user

Thanks a lot Sofia, that did the trick!

(I had the "Keep existing arrangement of declaration blocks" checked, but it did not help if that ohter checkbox was marked as well.)

0
Avatar
Permanently deleted user

This was already unchecked yet Rider is still doing this and it is causing a lot of frustration. Is there a separate rule that is affecting the problematic code below?

RestClient.Post(serverUrl + "/authenticate", body))
.Then(response => { Debug.Log("Successfully authenticated") })
.Catch(error => { Debug.Log("Failed to authenticate") });
0

Please sign in to leave a comment.