Or, should I rather ask, when will VS code formatting work properly for Razor markup? The formatting works for most structures, but it seems to choke on \'if\' blocks. The c
I know it's not really the answer you're looking for but I've used WriteLiteral to get around my formatting issues.
For example, when I write:
@foreach (var item in Model) {
if (condition) {
@:
}
@item.Label
}
Visual Studio tries to change it to:
@foreach (var item in Model) {
if (condition) {
@:
}
@item.Label
}
Which causes the page to throw an error.
If you use WriteLiteral you can fool the formatter into ignoring the line but it ain't pretty:
@foreach (var item in Model) {
if (condition) {
WriteLiteral("");
}
@item.Label
}