Don't emit #line default and #line hidden between consecutive using directives#9991
Merged
davidwengier merged 11 commits intodotnet:mainfrom Mar 6, 2024
Merged
Don't emit #line default and #line hidden between consecutive using directives#9991davidwengier merged 11 commits intodotnet:mainfrom
#line default and #line hidden between consecutive using directives#9991davidwengier merged 11 commits intodotnet:mainfrom
Conversation
These tests were really annoying to update, and I don't think they necessarily add much value, but I've done it now so they may as well stay.
jjonescz
reviewed
Feb 27, 2024
...er/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DesignTimeNodeWriter.cs
Show resolved
Hide resolved
… directive has no source information
jjonescz
approved these changes
Mar 1, 2024
Member
Author
|
@dotnet/razor-compiler for a second review |
333fred
reviewed
Mar 6, 2024
Member
333fred
left a comment
There was a problem hiding this comment.
Done review pass. Mostly LGTM, one minor coment.
...rosoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorIntermediateNodeLoweringPhase.cs
Show resolved
Hide resolved
333fred
approved these changes
Mar 6, 2024
Closed
11 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #9946
Fixes #8671
Roslyn won't offer to generate using directives into hidden regions unless an instance of an
ISpanMappingServiceis provided. In VS Code, and in future in cohosting, this is not the case. The fix I am proposing here is to simply allow the using directive block to not be in a hidden region. Most using directives are already fully mapped anyway (with more coming with #9949) and even for those that aren't mapped, since there is no debuggable code in the using directive block, there seems to me to be no downside to having default mappings. The change ensures that whatever comes after the using directives (attributes, class declaration, something else in future) is correctly hidden.The only tooling changes here are tests. We could change the property that Roslyn checks because it is now redundant, but turns out that is hardcoded in Roslyn anyway. The tests are a little funny, because they only validate user scenarios that already work today, but interestingly wouldn't have worked in our test code before, as our test code does not have a span mapping service.
NOTE: This will conflict with the above mentioned PR, but not in any interesting ways.
Reviewing commit-at-a-time might make sense, if only to make things easier because of the giant commit to update all of the test baselines.