diff --git a/Src/CSharpier.Core/CSharp/SyntaxPrinter/SyntaxNodePrinters/SimpleLambdaExpression.cs b/Src/CSharpier.Core/CSharp/SyntaxPrinter/SyntaxNodePrinters/SimpleLambdaExpression.cs index ef60d96fd..58f20f8d0 100644 --- a/Src/CSharpier.Core/CSharp/SyntaxPrinter/SyntaxNodePrinters/SimpleLambdaExpression.cs +++ b/Src/CSharpier.Core/CSharp/SyntaxPrinter/SyntaxNodePrinters/SimpleLambdaExpression.cs @@ -14,7 +14,7 @@ public static Doc PrintHead(SimpleLambdaExpressionSyntax node, PrintingContext c { return Doc.Concat( Modifiers.PrintSorted(node.Modifiers, context), - Node.Print(node.Parameter, context), + Doc.Group(Node.Print(node.Parameter, context)), " ", Token.Print(node.ArrowToken, context) ); @@ -29,7 +29,7 @@ public static Doc PrintBody(SimpleLambdaExpressionSyntax node, PrintingContext c " ", Node.Print(node.Body, context) ), - _ => Doc.Indent(Doc.Line, Node.Print(node.Body, context)), + _ => Doc.Group(Doc.Indent(Doc.Line, Node.Print(node.Body, context))), }; } } diff --git a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/MemberChains.test b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/MemberChains.test index efe8ca183..323196c70 100644 --- a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/MemberChains.test +++ b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/MemberChains.test @@ -72,8 +72,7 @@ this.SomeMethod( roleNames .ToList() - .ForEach(role => - this.SomeProperty.Setup(o => longThing_______________________________________) + .ForEach(role => this.SomeProperty.Setup(o => longThing_______________________________________) ); roleNames diff --git a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/SimpleLambdaExpressions.test b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/SimpleLambdaExpressions.test index d3f286637..9796413c5 100644 --- a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/SimpleLambdaExpressions.test +++ b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/SimpleLambdaExpressions.test @@ -113,12 +113,10 @@ public class ClassName || t.OtherLongColumn________________________________ ); - Select______________________________________(superLongName_________________________ => - true + Select______________________________________(superLongName_________________________ => true ); - this.Select_________________________________(selector: static longName_____________ => - true + this.Select_________________________________(selector: static longName_____________ => true ); this.Select_________________________________________( @@ -136,6 +134,37 @@ public class ClassName return x; }); + this.Where___________________( + x // Comment + => + { + return x; + } + ); + + this.Where___________________( + // Comment + x => + { + return x; + } + ); + + this.Where___________________( + // Comment + () => + { + return 1; + } + ); + + this.Where___________________( + // Comment + x => true, + // Comment + x => true + ); + this.Where______________________________________( superLongName________________________________ => {