Skip to content

Commit 0a8f278

Browse files
committed
fixing another edgecase
1 parent 8d97f37 commit 0a8f278

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Src/CSharpier.Core/CSharp/SyntaxPrinter/SyntaxNodePrinters/ParenthesizedLambdaExpression.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public static Doc PrintBody(ParenthesizedLambdaExpressionSyntax node, PrintingCo
4040
if (
4141
node.ParameterList.Parameters.Count == 0
4242
&& node.Parent?.Parent is ArgumentListSyntax { Arguments.Count: 1 }
43+
&& node.Parent.Parent?.Parent?.Parent is not EqualsValueClauseSyntax
4344
)
4445
{
4546
return Doc.IfBreak(Doc.Indent(Doc.Line, body), Doc.Group(Doc.Indent(Doc.Line, body)));

Src/CSharpier.Tests/FormattingTests/TestFiles/cs/ParenthesizedLambdaExpressions.test

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ public class ClassName
55
null,
66
(Action)(() => { })
77
);
8-
private SomeObject someObject = new SomeObject_____________________________________(
8+
private SomeObject someObject = new SomeObject_____________________________________________(
99
() => new SomeObject()
1010
);
1111
private static readonly Action _callbackCompleted = () => { };
@@ -111,5 +111,9 @@ public class ClassName
111111
CallAnotherMethod_________________(),
112112
() => CallAnotherMethod_________________()
113113
);
114+
115+
var x = CallMethod(
116+
() => CallAnotherMethod_______________________________________________()
117+
);
114118
}
115119
}

0 commit comments

Comments
 (0)