Closed emberTrev closed 8 months ago
This is what I ended up doing
switch (someValue)
{
case 0:
{
// dedented because the only statement is a block
break;
}
case 1:
{
// indented because there are two statements, a block then a break
}
break;
}
It looks a bit weird with the break;
dedented
switch (someValue)
{
case 0:
{
// some comment
}
break;
case 1:
{
// some comment
}
break;
}
And also with the block and break;
at different indents.
switch (someValue)
{
case 0:
{
// some comment
}
break;
case 1:
{
// some comment
}
break;
}
Input:
Output:
Expected behavior:
There shouldn't be an empty line added between the case statement and the opening curly brace.
For the record, I am not a fan of these curly braces, but you need to create a new scope if you want to declare the same variable name in multiple cases of the switch (CS0128). My coworkers always put the break outside the ending curly brace, which causes CSharpier to add a newline before the opening curly brace. There is a workaround by moving the break inside the closing curly brace, which I have been doing when I can. Doesn't change that the extra newline shouldn't be there in this case.