diff --git a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/CollectionExpressions.test b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/CollectionExpressions.test index a4a417987..790a1585a 100644 --- a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/CollectionExpressions.test +++ b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/CollectionExpressions.test @@ -149,6 +149,18 @@ class ClassName { } class CastExpressions { + public SomeType[] ShortName = + [ + someLongValue___________________________________________________, + someLongValue___________________________________________________, + ]; + + public SomeType[] LongName____________________________________________________________________________ = + [ + someLongValue___________________________________________________, + someLongValue___________________________________________________, + ]; + void MethodName() { var x = (string[])[someValue, someValue]; diff --git a/Src/CSharpier/SyntaxPrinter/RightHandSide.cs b/Src/CSharpier/SyntaxPrinter/RightHandSide.cs index 5fa39669f..0ebe99cb5 100644 --- a/Src/CSharpier/SyntaxPrinter/RightHandSide.cs +++ b/Src/CSharpier/SyntaxPrinter/RightHandSide.cs @@ -12,7 +12,7 @@ FormattingContext context { var layout = DetermineLayout(leftNode, rightNode); - var groupId = Guid.NewGuid().ToString(); + var groupId = layout.ToString() + Guid.NewGuid(); return layout switch { @@ -98,7 +98,8 @@ is ObjectCreationExpressionSyntax return rightNode switch { - LiteralExpressionSyntax + CollectionExpressionSyntax + or LiteralExpressionSyntax { Token.RawKind: (int)SyntaxKind.MultiLineRawStringLiteralToken }