Skip to content

Commit

Permalink
fixing extra line bug with complex initializer
Browse files Browse the repository at this point in the history
closes #103
  • Loading branch information
belav committed May 15, 2021
1 parent 514d9b8 commit 3bac5e0
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 3bac5e0

Please sign in to comment.