You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
private List<Card> cards = new();
protected override void OnInitialized()
{
cards.Add(new Card()
{
Id = 1,
Items = new()
{
new (){ Id = 1, Name = "item 1" },
new (){ Id = 2, Name = "item 2" },
new (){ Id = 3, Name = "item 3" }
}
});
}
public class Card
{
public int Id { get; set; }
public List<CardItem> Items { get; set; }
}
public class CardItem
{
public int Id { get; set; }
public string Name { get; set; }
}
in latest version of VS2022 .net 6 blazor server app,
hit Ctrl + K, Ctr + D,
and the first method will look like this:
protected override void OnInitialized()
{
cards.Add(new Card()
{
Id = 1,
Items = new()
{
new (){ Id = 1, Name = "item 1" },
new (){ Id = 2, Name = "item 2" },
new (){ Id = 3, Name = "item 3" }
}
});
}
note how the { } characters lost their relative distance
the same issue will occur when pasting this code (auto formatting I presume)
The text was updated successfully, but these errors were encountered:
@omuleanu Can you confirm what file type you were using when you saw this issue? You said .razor.cs, which would mean this is a Roslyn issue, and we'll want to trasfer it there.
I suspect this is "by design" though, per #8269 as Roslyn doesn't format object or collection initializers, so there is no concept of "relative distance"
having this code in a
.razor.cs
file:in latest version of VS2022 .net 6 blazor server app,
hit
Ctrl + K, Ctr + D
,and the first method will look like this:
note how the
{ }
characters lost their relative distancethe same issue will occur when pasting this code (auto formatting I presume)
The text was updated successfully, but these errors were encountered: