razor icon indicating copy to clipboard operation
razor copied to clipboard

Update whitespace parsing

Open chsienki opened this issue 1 year ago • 1 comments

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 https://github.com/dotnet/razor/issues/10358

chsienki avatar May 17 '24 17:05 chsienki

the newline at the end of a @using statement is no longer part of the using declaration itself

Sounds like maybe this fixes https://github.com/dotnet/razor/issues/10375 then?

davidwengier avatar May 20 '24 08:05 davidwengier

Closing in favor of https://github.com/dotnet/razor/pull/10459

chsienki avatar Jun 10 '24 18:06 chsienki