belav / csharpier

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

Inconsistent formatting of linq chains #1150

Open Rudomitori opened 10 months ago

Rudomitori commented 10 months ago

Input:

new Something(
    formBindings: dto
        .Forms.Select(form => new FormBinding
        {
            Id = form.Id,
            Type = formBindings.First(x => x.Id == form.Id).Type,
            FormTypeForInitialAnswers = form.FormTypeForInitialAnswers,
        })
        .ToList()
)
{
    FormBindings = dto
        .Forms.Select(form => new FormBinding
        {
            Id = form.Id,
            Type = formBindings.First(x => x.Id == form.Id).Type,
            FormTypeForInitialAnswers = form.FormTypeForInitialAnswers,
        })
        .ToList()
};

Output:

new Something(
    formBindings: dto.Forms.Select(form => new FormBinding
    {
        Id = form.Id,
        Type = formBindings.First(x => x.Id == form.Id).Type,
        FormTypeForInitialAnswers = form.FormTypeForInitialAnswers,
    })
        .ToList()
)
{
    FormBindings = dto
        .Forms.Select(form => new FormBinding
        {
            Id = form.Id,
            Type = formBindings.First(x => x.Id == form.Id).Type,
            FormTypeForInitialAnswers = form.FormTypeForInitialAnswers,
        })
        .ToList()
};

Expected behavior:

new Something(
    formBindings: dto
        .Forms.Select(form => new FormBinding
        {
            Id = form.Id,
            Type = formBindings.First(x => x.Id == form.Id).Type,
            FormTypeForInitialAnswers = form.FormTypeForInitialAnswers,
        })
        .ToList()
)
{
    FormBindings = dto
        .Forms.Select(form => new FormBinding
        {
            Id = form.Id,
            Type = formBindings.First(x => x.Id == form.Id).Type,
            FormTypeForInitialAnswers = form.FormTypeForInitialAnswers,
        })
        .ToList()
};