Render fragments formatted to one indent level
Given the following code:
@code {
void M()
{
RenderFragment rd2 =
@<InputText Value="123">
<div>
<p></p>
</div>
</InputText>;
}
}
No matter what formatting the user uses, we're always formatting the template at one level in. This is consistent across multple formatting operations, so we could be just being opinionated, or taking Html edits without futher processing, so could be by design, but its worth looking into.
The third issue illustracted in this demo: https://youtu.be/nN-V4XYvInM The first 2 are fixed.
Original description:
code for the demo:
@page "/"
@code {
RenderFragment rf1 = @<text></text>;
RenderFragment rf2 = @<InputText Value="123"></InputText>;
List<Col> list = new()
{
new Col()
{
RenderFunc = str =>
@<div class="someclass">
<InputText Value="123"></InputText>
</div>
},
new Col()
{
RenderFunc = str =>
@<ErrorBoundary class="someclass">
<InputText Value="123"></InputText>
</ErrorBoundary>
},
};
public class Col
{
public Func<string, RenderFragment> RenderFunc { get; set; }
}
}
Originally posted by @omuleanu in https://github.com/dotnet/razor-tooling/pull/5824#issuecomment-1193082300
I think two of these are already logged, but am not at the computer at the moment, so will find links on Monday.
Item 1 is https://github.com/dotnet/razor-tooling/issues/6191 and is fixed. Item 2 doesn't repro for me in 17.4 preview 1, and I suspect was caused by https://github.com/dotnet/razor-tooling/issues/6191 too
Item 3 is interesting, and I'll update the description to make this issue solely about that, but I wouldn't be surprised if this ends up being by design, and we're just taking the Html formatting as is in this scenario. I've confirmed its definitely not a duplicate of https://github.com/dotnet/razor-tooling/issues/6150 at least, even though its very similar.
Putting this back to triage to discuss further.
Another report: https://developercommunity.visualstudio.com/t/Blazor:-code-section-formatting-is-inco/1681439