Skip to content

VSCode - new List within @code block not being formatted correctly #11647

@jusmccar

Description

@jusmccar

Is this a Bug or Feature request?:

Bug

Steps to reproduce:

Make a new List within @code block and attempt to format it in VSCode.

Description of the problem:

The indentation is incorrect.

Expected behavior:

@code {
	private List<Event> events = new List<Event>
	{
		new Event { Name = "Blazor Conference", Date = new DateTime(2025, 4, 15), Location = "New York" },
		new Event { Name = "DotNet Summit", Date = new DateTime(2025, 5, 20), Location = "San Francisco" },
		new Event { Name = "Tech Expo", Date = new DateTime(2025, 6, 10), Location = "Chicago" }
	};
}

Actual behavior:

@code {
	private List<Event> events = new List<Event>
{
new Event { Name = "Blazor Conference", Date = new DateTime(2025, 4, 15), Location = "New York" },
new Event { Name = "DotNet Summit", Date = new DateTime(2025, 5, 20), Location = "San Francisco" },
new Event { Name = "Tech Expo", Date = new DateTime(2025, 6, 10), Location = "Chicago" }
};
}

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions