Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FUSE - Formatter behaves differently when calls end up calling Write (or similar) #10402

Closed
ryzngard opened this issue May 23, 2024 · 2 comments · Fixed by #11364
Closed

FUSE - Formatter behaves differently when calls end up calling Write (or similar) #10402

ryzngard opened this issue May 23, 2024 · 2 comments · Fixed by #11364
Assignees
Labels
area-compiler Umbrella for all compiler issues New Feature: Fuse
Milestone

Comments

@ryzngard
Copy link
Contributor

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 ryzngard added untriaged area-compiler Umbrella for all compiler issues New Feature: Fuse labels May 23, 2024
@jaredpar
Copy link
Member

@ryzngard how impactful is this for integration tests? Trying to prioritize given we're low on dev power right now.

@ryzngard
Copy link
Contributor Author

This accounts for 4/19 of the integration test failures from the last run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-compiler Umbrella for all compiler issues New Feature: Fuse
Projects
None yet
5 participants