Skip to content

Commit

Permalink
Working on collection expression fix
Browse files Browse the repository at this point in the history
closes #1351
  • Loading branch information
belav committed Sep 24, 2024
1 parent d6b4805 commit 1b2a19f
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 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
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,35 @@ namespace CSharpier.SyntaxPrinter.SyntaxNodePrinters;

internal static class CollectionExpression
{
/*
I think this has more to do with the long field name, which causes the break + indent. Changing anything in this class seems to break one of the first two test cases
so this fix may need to happen in the field instead
string[] c =
[
"________________________",
"________________________",
"________________________",
"________________________",
];
public class ClassName
{
SomeType[] ShortName =
[
someLongValue___________________________________________________,
someLongValue___________________________________________________,
];
SomeType[] LongName____________________________________________________________________________ =
[
someLongValue___________________________________________________,
someLongValue___________________________________________________,
];
}
*/

public static Doc Print(CollectionExpressionSyntax node, FormattingContext context)
{
Doc separator = node.Parent
Expand Down

0 comments on commit 1b2a19f

Please sign in to comment.