You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With a regular switch statement, when the when breaks, it ends up inline with the body of the case statement
switch(expression.Body){case var body whenbody== expression.Parameters[0]:return CompileFromIdentityFunc(expression);case MemberExpression memberExpression
when memberExpression.Expression is ConstantExpression constantExpression:return CompileCapturedConstant(memberExpression, constantExpression);default:returnnull;}
Here are a bunch of ideas I came up with for how to deal with it.
Use align 2 on the when
switch(expression.Body){case var body whenbody== expression.Parameters[0]:return CompileFromIdentityFunc(expression);case MemberExpression memberExpression
when memberExpression.Expression is ConstantExpression constantExpression:return CompileCapturedConstant(memberExpression, constantExpression);default:returnnull;}
Use align 2 on the body of the case
switch(expression.Body){case var body whenbody== expression.Parameters[0]:return CompileFromIdentityFunc(expression);case MemberExpression memberExpression
when memberExpression.Expression is ConstantExpression constantExpression:return CompileCapturedConstant(memberExpression, constantExpression);default:returnnull;}
Line up the when with the case
switch(expression.Body){case var body whenbody== expression.Parameters[0]:return CompileFromIdentityFunc(expression);case MemberExpression memberExpression
when memberExpression.Expression is ConstantExpression constantExpression:return CompileCapturedConstant(memberExpression, constantExpression);default:returnnull;}
Indent and align 2 the when
switch(expression.Body){case var body whenbody== expression.Parameters[0]:return CompileFromIdentityFunc(expression);case MemberExpression memberExpression
when memberExpression.Expression is ConstantExpression constantExpression:return CompileCapturedConstant(memberExpression, constantExpression);default:returnnull;}
I think I lean towards Line up, or Indent + Align2
Looks similar to Ident + Align2, I think I might like it a little better
switch(expression.Body){case var body whenbody== expression.Parameters[0]:return CompileFromIdentityFunc(expression);case MemberExpression memberExpression
when memberExpression.Expression is ConstantExpression constantExpression:return CompileCapturedConstant(memberExpression, constantExpression);default:returnnull;}
…ody (#393)
closes#387
I went with Align 6
Double indent seemed a bit much, and lining up didn't look good in the case below
```c#
case "D______________________________________________________________________"
when D == 50:
default:
{
break;
}
```
This is a side effect of #384 I found while testing the changes on https://github.com/belav/aspnetcore
With a regular switch statement, when the
when
breaks, it ends up inline with the body of the case statementHere are a bunch of ideas I came up with for how to deal with it.
Use align 2 on the
when
Use align 2 on the body of the case
Line up the
when
with thecase
Indent and align 2 the
when
I think I lean towards Line up, or Indent + Align2
@pmccloghrylaing and @shocklateboy92, what do you think?
The text was updated successfully, but these errors were encountered: