-
Notifications
You must be signed in to change notification settings - Fork 198
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
Update whitespace parsing #10380
Update whitespace parsing #10380
Conversation
Sounds like maybe this fixes #10375 then? |
252d807
to
a76bbd7
Compare
@@ -24,6 +24,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AddTagHelp | |||
#pragma warning disable 1998 | |||
public async override global::System.Threading.Tasks.Task ExecuteAsync() | |||
{ | |||
WriteLiteral("\r\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More newlines are emitted now where they previously weren't. I think that's quite serious braking change - it can result in rendering of new spaces in web pages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least it breaks aspnetcore tests (see internal run here), they would need to be updated.
{ | ||
Assert.Equal("Shared/Component1.razor", mappedSemicolon.Path); | ||
Assert.Throws<ArgumentOutOfRangeException>(() => originalText.Lines.GetTextSpan(mappedSemicolon.Span)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the newline at the end of a
@using
statement is no longer part of the using declaration itselfSounds like maybe this fixes #10375 then?
Added this test to check. It doesn't look like this PR fixes the issue. I think it's because the #line
mapping simply maps the whole using directive, it cannot map just a part of it per its spec.
6b81588
to
e82bac2
Compare
Closing in favor of #10459 |
Today we parse the razor syntax tree differently if we're in design time or runtime mode. Specifically, we assign trailing whitespace to markup in design time, and to csharp in runtime. This was originally implemented when the Razor editor used projection buffers, to ensure that users got the IntelliSense they were expecting.
As part of fuse using runtime documents, we need to update the way we assign whitespace for run time too. This PR removes the distinction and prefers the design time handling. This is arguably more correct, as whitespace, while mostly agnostic in HTML, does matter in certain cases (such as
<pre>
), so makes sense that we should represent it in the HTML document.The vast majority of the baseline changes are because the newline at the end of a
@using
statement is no longer part of the using declaration itself, and basically every test has a using declaration.Fixes #10358