diff --git a/Src/CSharpier.Tests/TestFiles/FieldDeclaration/FieldDeclarations.cst b/Src/CSharpier.Tests/TestFiles/FieldDeclaration/FieldDeclarations.cst index fdd565cec..3f67ccd25 100644 --- a/Src/CSharpier.Tests/TestFiles/FieldDeclaration/FieldDeclarations.cst +++ b/Src/CSharpier.Tests/TestFiles/FieldDeclaration/FieldDeclarations.cst @@ -72,13 +72,11 @@ public class ClassName private Func SomeFieldFunc = (someValue) => true; - private Func SomeFieldFunc = (someValue) => SometimesBreaksThisWay( - someValue - ); + private Func SomeFieldFunc = (someValue) => + SometimesBreaksThisWay(someValue); - private Func SomeFieldFunc = ( - someValue - ) => OrWhenLongerBreaksThisWay________(someValue); + private Func SomeFieldFunc = (someValue) => + OrWhenLongerBreaksThisWay________(someValue); private Func SomeFieldFuncWithALongName_________ = (someValue) => SomeOtherLongerMethod(someValue); @@ -91,17 +89,14 @@ public class ClassName private Func< SomeLongObjectIn__________________________________, bool - > SomeFieldFuncWithALongName = (someValue) => SometimesBreaksThisWay( - someValue, - SomeOtherLongValue - ); + > SomeFieldFuncWithALongName = (someValue) => + SometimesBreaksThisWay(someValue, SomeOtherLongValue); private Func< SomeLongObjectIn__________________________________, bool - > SomeFieldFuncWithALongName = ( - someValue_____________________________ - ) => SometimesBreaksThisWay(someValue, SomeOtherLongValue); + > SomeFieldFuncWithALongName = (someValue_____________________________) => + SometimesBreaksThisWay(someValue, SomeOtherLongValue); } struct S diff --git a/Src/CSharpier.Tests/TestFiles/ParenthesizedLambdaExpression/ParenthesizedLambdaExpressions.cst b/Src/CSharpier.Tests/TestFiles/ParenthesizedLambdaExpression/ParenthesizedLambdaExpressions.cst index d0ba0edd3..a9a20175a 100644 --- a/Src/CSharpier.Tests/TestFiles/ParenthesizedLambdaExpression/ParenthesizedLambdaExpressions.cst +++ b/Src/CSharpier.Tests/TestFiles/ParenthesizedLambdaExpression/ParenthesizedLambdaExpressions.cst @@ -13,11 +13,17 @@ public class ClassName this.Where(async () => true); this.Where(static () => true); this.Where(async static () => true); + this.SomeMethod( + (longParameter__________________, longParameter_________________) => + longParameter________________ + ); + this.SomeMethod( ( - a11111111111111111111111111111, - b222222222222222222222222222222 - ) => someLongNameThatWillDoStuff + longerParameter_________________________, + longerParameter_________________________, + longerParameter_________________________ + ) => evenLongerParameter ); var task = Task.Factory.StartNew( @@ -29,9 +35,8 @@ public class ClassName } ); - Action find = () => EntryPointDiscoverer.FindStaticEntryMethod( - typeof(IEnumerable<>).Assembly - ); + Action find = () => + EntryPointDiscoverer.FindStaticEntryMethod(typeof(IEnumerable<>).Assembly); var @delegate = (Action)((s) => { }); @@ -53,5 +58,15 @@ public class ClassName } ) }; + + CallSomeMethod( + () => + CallAnotherMethodWithParameters( + someParameter, + someParameter___________________________________ + ) + > someValue, + anotherParameter + ); } } diff --git a/Src/CSharpier.Tests/TestFiles/VariableDeclaration/VariableDeclarations.cst b/Src/CSharpier.Tests/TestFiles/VariableDeclaration/VariableDeclarations.cst index 3898ab8ad..324bb2253 100644 --- a/Src/CSharpier.Tests/TestFiles/VariableDeclaration/VariableDeclarations.cst +++ b/Src/CSharpier.Tests/TestFiles/VariableDeclaration/VariableDeclarations.cst @@ -25,13 +25,20 @@ class ClassName var captureUnmatchedValuesParameters______________________________ = new List(); + Func s_isVisualBasicCommentTrivia = (syntaxTrivia) => + syntaxTrivia.IsKind(VisualBasic.SyntaxKind.CommentTrivia); + Func s_isVisualBasicCommentTrivia = ( - syntaxTrivia + syntaxTrivia_________________________________ ) => syntaxTrivia.IsKind(VisualBasic.SyntaxKind.CommentTrivia); - Action find = () => EntryPointDiscoverer.FindStaticEntryMethod( - typeof(IEnumerable<>).Assembly - ); + Action find = () => + EntryPointDiscoverer.FindStaticEntryMethod(typeof(IEnumerable<>).Assembly); + + Action find = () => + EntryPointDiscoverer.FindStaticEntryMethod( + typeof(IEnumerable<>).Assembly_________________________________________ + ); var arrayCreationExpression1 = new byte[100]; var arrayCreationExpression2 = new byte[ diff --git a/Src/CSharpier/SyntaxPrinter/ArgumentListLikeSyntax.cs b/Src/CSharpier/SyntaxPrinter/ArgumentListLikeSyntax.cs index 8d071576d..7f0836f0b 100644 --- a/Src/CSharpier/SyntaxPrinter/ArgumentListLikeSyntax.cs +++ b/Src/CSharpier/SyntaxPrinter/ArgumentListLikeSyntax.cs @@ -15,12 +15,14 @@ SyntaxToken closeParenToken Doc.Concat( Token.Print(openParenToken), arguments.Any() - ? Doc.Indent( - Doc.SoftLine, - SeparatedSyntaxList.Print(arguments, Argument.Print, Doc.Line) + ? Doc.Concat( + Doc.Indent( + Doc.SoftLine, + SeparatedSyntaxList.Print(arguments, Argument.Print, Doc.Line) + ), + Doc.SoftLine ) : Doc.Null, - arguments.Any() ? Doc.SoftLine : Doc.Null, Token.Print(closeParenToken) ); } diff --git a/Src/CSharpier/SyntaxPrinter/SyntaxNodePrinters/ParenthesizedLambdaExpression.cs b/Src/CSharpier/SyntaxPrinter/SyntaxNodePrinters/ParenthesizedLambdaExpression.cs index 5c88476b6..c85c86eef 100644 --- a/Src/CSharpier/SyntaxPrinter/SyntaxNodePrinters/ParenthesizedLambdaExpression.cs +++ b/Src/CSharpier/SyntaxPrinter/SyntaxNodePrinters/ParenthesizedLambdaExpression.cs @@ -14,19 +14,23 @@ public static Doc Print(ParenthesizedLambdaExpressionSyntax node) Modifiers.Print(node.Modifiers), ParameterList.Print(node.ParameterList), " ", - Token.PrintWithSuffix( - node.ArrowToken, - node.Block - is not null - and { Statements: { Count: > 0 } } ? Doc.HardLine : " " - ) + Token.Print(node.ArrowToken) }; if (node.ExpressionBody != null) { - docs.Add(Node.Print(node.ExpressionBody)); + docs.Add(Doc.Group(Doc.Indent(Doc.Line, Node.Print(node.ExpressionBody)))); } else if (node.Block != null) { + if (node.Block.Statements.Count > 0) + { + docs.Add(Doc.HardLine); + } + else + { + docs.Add(" "); + } + docs.Add(Block.Print(node.Block)); }