dotnet / format

Home for the dotnet-format command
MIT License
1.91k stars 172 forks source link

Line wrapping and indentation of Collection Literals #2174

Open ignatz opened 2 months ago

ignatz commented 2 months ago

Output of running dotnet format with default config:

class Foo { }

class Program
{
    public static void Main()
    {

        List<List<Foo>> list = [[
          new Foo(),
            new Foo(),
            new Foo(),
        ],
            [
          new Foo(),
                new Foo(),
            ],
        ];

        Console.WriteLine($"Hello {list}");
    }
}

Just for some inspiration, the same program in dart:

class Foo {}

void main() {
  List<List<Foo>> list = [
    [
      Foo(),
      Foo(),
      Foo(),
    ],
    [
      Foo(),
      Foo(),
    ],
  ];

  print('Hello ${list}');
}