Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ is ArrayCreationExpressionSyntax
parent is ExpressionStatementSyntax expressionStatementSyntax
&& expressionStatementSyntax.SemicolonToken.LeadingTrivia.Any(o => o.IsComment())
)
|| groups.Count == 1
? expanded
: Doc.ConditionalGroup(Doc.Concat(oneLine), expanded);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,24 @@ public static Doc PrintHead(ParenthesizedLambdaExpressionSyntax node, PrintingCo

public static Doc PrintBody(ParenthesizedLambdaExpressionSyntax node, PrintingContext context)
{
return node.Body switch
if (node.Body is BlockSyntax block)
{
BlockSyntax block => Doc.Concat(
return Doc.Concat(
block.Statements.Count > 0 ? Doc.HardLine : " ",
Block.Print(block, context)
),
_ => Doc.Group(Doc.Indent(Doc.Line, Node.Print(node.Body, context))),
};
);
}

var body = Node.Print(node.Body, context);

if (
node.ParameterList.Parameters.Count == 0
&& node.Parent?.Parent is ArgumentListSyntax { Arguments.Count: 1 }
)
{
return Doc.IfBreak(Doc.Indent(Doc.Line, body), Doc.Group(Doc.Indent(Doc.Line, body)));
}

return Doc.Group(Doc.Indent(Doc.Line, body));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,21 @@ public class ClassName
var returnType = object (bool o) => o ? 1 : "two";
var returnTypeWithAsync = async object (bool o) => o ? 1 : "two";
var returnTypeWithAttribute = [Attribute] object (bool o) => o ? 1 : "two";

CallMethod(() => CallAnotherMethod______________________________________________________());
CallMethod(() =>
CallAnotherMethod______________________________________________________1()
);
CallMethod(() =>
CallAnotherMethod______________________________________________________12()
);
CallMethod(() =>
CallAnotherMethod______________________________________________________123()
);

CallMethod(
CallAnotherMethod_________________(),
() => CallAnotherMethod_________________()
);
}
}