FUSE - Formatter behaves differently when calls end up calling Write (or similar)
Failing test name: FormattingDocument(testFileName: "FormatDocument.cshtml")
<p>
@*
test
*@
@while (true)
{
}
</p>
<div>
@if (true)
{
<div>
<p></p>
</div>
}
</div>
<div>
@(Html.DropDownList("list")
- .ToString()
- )
+ .ToString()
+ )
</div>
Problem
The context for c# in fuse has a method call surrounding the code rather than a variable assignment, causing the csharp compiler to behave differently in indentation rules.
Potential Fix
It's possible to assign DateTime.Now.ToString() as below to a variable that is uniquely named by the compiler, and then use that variable in the call. This would cause the formatting behavior to behave the same as today
Without Fuse
#line 17 "/path/to/Document.mvc"
__o = DateTime
.Now
.ToString();
#line default
With Fuse
Write(
#nullable restore
#line 17 "/path/to/Document.mvc"
DateTime
.Now
.ToString()
#line default
#line hidden
#nullable disable
);
@ryzngard how impactful is this for integration tests? Trying to prioritize given we're low on dev power right now.
This accounts for 4/19 of the integration test failures from the last run.