-
Notifications
You must be signed in to change notification settings - Fork 196
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
Don't emit #line default
and #line hidden
between consecutive using directives
#9991
Merged
Conversation
This file contains 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
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
alexgav
approved these changes
Feb 28, 2024
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.
… directive has no source information
jjonescz
approved these changes
Mar 1, 2024
@dotnet/razor-compiler for a second review |
333fred
reviewed
Mar 6, 2024
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.
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
Open
11 tasks
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
ISpanMappingService
is 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.