In Rider (basically a standalone ReSharper for those who don't know), I can't figure out why automatic code formatting is placing an empty line between my if statements.
Before formatting:
string output = "";
if (i % 3 == 0) { output += "Fizz"; }
if (i % 5 == 0) { output += "Buzz"; }
if (output == "") { Console.WriteLine(i); } else { Console.WriteLine(output); }
After formatting:
string output = "";
if (i % 3 == 0) { output += "Fizz"; }
if (i % 5 == 0) { output += "Buzz"; }
if (output == "") { Console.WriteLine(i); } else { Console.WriteLine(output); }
I cannot figure out for the life of me the setting that is doing this, but it's quite irritating when you have multiple similar one-line if-statements grouped together and Rider/ReSharper displaces them all the time.
File -> Settings -> Editor -> Code Style -> C# -> Blank Lines) Blank Lines in Code: what values do you have for 'After statements with child blocks'? Does it work as expected if you set this value to 0?