Skip to content

Commit

Permalink
Fixing extra line + indent with collection expression on fields (#1371)
Browse files Browse the repository at this point in the history
closes #1351

Co-authored-by: Lasath Fernando <devel@lasath.org>
  • Loading branch information
belav and shocklateboy92 authored Nov 7, 2024
1 parent b14d79f commit 91bbafb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
5 changes: 3 additions & 2 deletions Src/CSharpier/SyntaxPrinter/RightHandSide.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -98,7 +98,8 @@ is ObjectCreationExpressionSyntax

return rightNode switch
{
LiteralExpressionSyntax
CollectionExpressionSyntax
or LiteralExpressionSyntax
{
Token.RawKind: (int)SyntaxKind.MultiLineRawStringLiteralToken
}
Expand Down

0 comments on commit 91bbafb

Please sign in to comment.