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
In the tall style, we generally split at the operator of an "assignment" (=, :, or =>) if the right hand side splits (and it's block-like). So these are all fine:
// No split:
thing = left + right;
// Block-like split:
thing = [
element,
];
// Split at operator:
thing =
veryLongOperand +
anotherLongOperand;
Currently, that implies that when a conditional expression splits, the entire expression is moved down past the operator, like:
thing =
condition
? thenBranch
: elseBranch;
I think it would look nicer if we allowed the condition part to stay on the same line as the assignment in that case:
thing = condition
? thenBranch
: elseBranch;
Note that this would only apply if the condition part of the conditional expressions fits on one line. If the condition itself splits, then we should also split the surrounding assignment. So this wouldn't be allowed:
I think the current tall style might be an improvement. The case in df97775 looks better with the first operand on the next line because it makes the indentation against that operand more obvious.
Currently, that implies that when a conditional expression splits, the entire expression is moved down past the operator, like:
Is your example correct? I though the condition operand would have less indentation than the branches while you show them aligned.
I think the current tall style might be an improvement. The case in df97775 looks better with the first operand on the next line because it makes the indentation against that operand more obvious.
You might be right. I tend to prefer the condition being on the same line as the assignment when it fits, but it's mostly just an aesthetic preference. (For what it's worth, I think the old short style more or less keeps the condition expression on the first line in these cases, though I'm not 100% sure since the rules are quite different.)
Is your example correct? I though the condition operand would have less indentation than the branches while you show them aligned.
I think it looks OK like that, but that's a good question. I could see us going either way. I think we'd have to see what actually works with the surrounding code and is implementable.
In the tall style, we generally split at the operator of an "assignment" (
=
,:
, or=>
) if the right hand side splits (and it's block-like). So these are all fine:Currently, that implies that when a conditional expression splits, the entire expression is moved down past the operator, like:
I think it would look nicer if we allowed the condition part to stay on the same line as the assignment in that case:
Note that this would only apply if the condition part of the conditional expressions fits on one line. If the condition itself splits, then we should also split the surrounding assignment. So this wouldn't be allowed:
And you would instead get:
The text was updated successfully, but these errors were encountered: