Skip to content

Commit

Permalink
Merge pull request #194 from belav/initializer-extra-line
Browse files Browse the repository at this point in the history
fixing extra line bug with complex initializer
  • Loading branch information
belav committed May 15, 2021
2 parents 514d9b8 + d241b6d commit b1560d0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ class ClassName
{
// should break braces correctly
{ 1, "one" },
{ 2, "two" }
{ 2, "two" },
{
3,
"ifThisIsReallyLongItShouldntInsertAnExtraLineAboveItttttttttttttttt"
}
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@ public static class InitializerExpression
public static Doc Print(InitializerExpressionSyntax node)
{
var result = Doc.Concat(
node.Kind() == SyntaxKind.ArrayInitializerExpression
? string.Empty
: node.Kind() == SyntaxKind.ComplexElementInitializerExpression
? Doc.SoftLine
: Doc.Line,
node.Kind()
is (SyntaxKind.ArrayInitializerExpression
or SyntaxKind.ComplexElementInitializerExpression) ? Doc.Null : Doc.Line,
Token.Print(node.OpenBraceToken),
Doc.Indent(
Doc.Line,
Expand Down

0 comments on commit b1560d0

Please sign in to comment.