dotnet/roslyn

Formatter doesn't increase ident in multiline list patterns correctly

Open

#73.251 aperta il 27 apr 2024

Vedi su GitHub
 (1 commento) (0 reazioni) (0 assegnatari)C# (4257 fork)batch import
Area-IDEBughelp wanted

Metriche repository

Star
 (20.414 star)
Metriche merge PR
 (Merge medio 6g 17h) (256 PR mergiate in 30 g)

Descrizione

Found while working on a compiler PR (link)

Version Used: VS 17.10.0 Preview 5.0

Steps to Reproduce: Run formatter on this code:

MyClass[] arr = [new()];

if (arr is
    [
    {
        Prop: 1,
        AnotherProp: 2
    }
    ])
{

}

class MyClass
{
    public int Prop { get; set; }

    public int AnotherProp { get; set; }
}

Expected Behavior:

MyClass[] arr = [new()];

if (arr is
    [
        {
            Prop: 1,
            AnotherProp: 2
        }
    ])
{

}

class MyClass
{
    public int Prop { get; set; }

    public int AnotherProp { get; set; }
}

Actual Behavior: Quite the opposite - when I run formatting on correct code, it dedents it back: formatterBug

Guida contributor