Formatter doesn't increase ident in multiline list patterns correctly
- Dominant language
- C#
- Stars
- 20.7k
- Forks
- 4.3k
- PR merge metrics
- PR metrics pending
Description
Found while working on a compiler PR ([link](https://github.com/dotnet/roslyn/pull/73102#discussion_r1579996363))
**Version Used**:
VS 17.10.0 Preview 5.0
**Steps to Reproduce**:
Run formatter on this code:
```cs
MyClass[] arr = [new()];
if (arr is
[
{
Prop: 1,
AnotherProp: 2
}
])
{
}
class MyClass
{
public int Prop { get; set; }
public int AnotherProp { get; set; }
}
```
**Expected Behavior**:
```cs
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:

Contributor guide
Research direction
Start by reproducing the formatter behavior with the C# snippet in the issue, comparing the actual indentation with the expected output. Trace the formatter behavior for multiline list patterns; done means formatting produces the expected indentation and preserves already-correct code.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100