belav / csharpier

CSharpier is an opinionated code formatter for c#.
https://csharpier.com
MIT License
1.41k stars 99 forks source link

Formatting for indexer parameters should mostly be the same as for method parameters. #1255

Closed Meowtimer closed 5 months ago

Meowtimer commented 6 months ago

Input:

public class Obj
{

    public string this[
        [A] int X,
        [B, VeryLongAttributeWithSoManyArguments(123, 321)] int Y,
        [C, LongAttributeThatIsLong] int Y
    ] => X + Y + Z;

    public string Method(
        [A] int X,
        [B, VeryLongAttributeWithSoManyArguments(123, 321)] int Y,
        [C, LongAttributeThatIsLong] int Y
    ) => X + Y + Z;    

}

Output:

public class Obj
{
    public string this[[A] int X, [B, VeryLongAttributeWithSoManyArguments(123, 321)] int Y, [
        C,
        LongAttributeThatIsLong
    ]
        int Y] => X + Y + Z;

    public string Method(
        [A] int X,
        [B, VeryLongAttributeWithSoManyArguments(123, 321)] int Y,
        [C, LongAttributeThatIsLong] int Y
    ) => X + Y + Z;
}

Expected behavior: Both indexer and Method being formatted similarly with multiple lines for parameters.