Don't copy generated file banners to new documents - #85682
Open
davidwengier wants to merge 1 commit into
Open
davidwengier wants to merge 1 commit into
davidwengier wants to merge 1 commit into
Conversation
New document formatting used the hint document's banner even when that document was generated. Ignore generated hints and remove Razor's post-processing workaround.
|
Azure Pipelines: Successfully started running 2 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No unresolved blocking issues were identified.
Pull request overview
Updates new-document formatting to ignore generated hint documents, removing the Razor-specific banner workaround.
Changes:
- Ignore generated hint documents when copying banners.
- Remove obsolete Razor banner cleanup.
- Add regression test support and coverage.
File summaries
| File | Description |
|---|---|
src/Razor/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/CodeActions/CSharp/CSharpCodeActionResolver.cs |
Removes the Razor banner workaround. |
src/Features/Core/Portable/AddFileBanner/AbstractAddFileBannerNewDocumentFormattingProvider.cs |
Ignores generated hint documents. |
src/EditorFeatures/TestUtilities/Formatting/AbstractNewDocumentFormattingServiceTests.cs |
Supports hint-document tests. |
src/EditorFeatures/CSharpTest/Formatting/CSharpNewDocumentFormattingServiceTests.cs |
Adds banner regression coverage. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 0
- Review effort level: Lite
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.
In #84670 we had to introduce a bit of a hack to Razor, to parse out and remove the generated file header from a new document we were creating, because various things in Roslyn act differently for generated files, and because the new file wasn't actually generated.
This PR is the real fix for that workaround, and removal of same. Since the new file formatting services are designed to run on new files being created, it makes no sense for them to get hints from a generated document.
Microsoft Reviewers: Open in CodeFlow