Skip to content

Commit 1305c53

Browse files
fix: comment break indentation of simple lambdas
1 parent b3b3acb commit 1305c53

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public static Doc PrintHead(SimpleLambdaExpressionSyntax node, PrintingContext c
1414
{
1515
return Doc.Concat(
1616
Modifiers.PrintSorted(node.Modifiers, context),
17-
Node.Print(node.Parameter, context),
17+
Doc.Group(Node.Print(node.Parameter, context)),
1818
" ",
1919
Token.Print(node.ArrowToken, context)
2020
);

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,30 @@ public class ClassName
136136
return x;
137137
});
138138

139+
this.Where___________________(
140+
x // Comment
141+
=>
142+
{
143+
return x;
144+
}
145+
);
146+
147+
this.Where___________________(
148+
// Comment
149+
x =>
150+
{
151+
return x;
152+
}
153+
);
154+
155+
this.Where___________________(
156+
// Comment
157+
() =>
158+
{
159+
return 1;
160+
}
161+
);
162+
139163
this.Where______________________________________(
140164
superLongName________________________________ =>
141165
{

0 commit comments

Comments
 (0)