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
If a method returning markup contains whitespace, it will not be minified / trimmed. That makes the UI ugly, and we need to remember to format it to suppress the whitespace.
But the problem is created by the razor compiler, so the real fix is there. Instead of css hacks, one can do this:
public void Foo() {@*
*@<div><p>Hello</p></div>@*
*@}
That is also a hack, and is really ugly, but it works - no leading/trailing whitespace will be emitted. And that is the correct location for the solution. (Also one does not need to remember to add css hacks later.)
But that leads to another problem: that method looks weird when collapsed and makes the document hard to read. For the above example, without the hack, it correctly collapses to:
public void Foo() {...
But with the hack:
public void Foo() {@*
*@<div>
</div>@*
*@}
I think there are two solutions:
make it so the collapsed method looks good despite the interspersed @* and *@
or better, trim whitespace from the emitted markup
The text was updated successfully, but these errors were encountered:
Collapsing seems to work fine for me in Visual Studio
I'm using VSCode maybe that's why it looks different for me. Also I'm using RazorPages rather than Blazor, so it looks weird for me in @functions { } and @{ } blocks.
That would be a breaking change in the compiler.
That's unfortunate. I wonder whether there's some way to do that without introducing a breaking change (maybe a compile flag or pragma or directive or something).
If a method returning markup contains whitespace, it will not be minified / trimmed. That makes the UI ugly, and we need to remember to format it to suppress the whitespace.
But the problem is created by the razor compiler, so the real fix is there. Instead of css hacks, one can do this:
That is also a hack, and is really ugly, but it works - no leading/trailing whitespace will be emitted. And that is the correct location for the solution. (Also one does not need to remember to add css hacks later.)
But that leads to another problem: that method looks weird when collapsed and makes the document hard to read. For the above example, without the hack, it correctly collapses to:
But with the hack:
I think there are two solutions:
@*
and*@
The text was updated successfully, but these errors were encountered: