[Sonic] Test cleanup - #84224
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This change set updates Razor/Sonic tooling test infrastructure and unit tests to account for the generated C# impl/decl split, and re-enables previously skipped rename/code-action test coverage by mapping edits across both generated documents when present.
Changes:
- Re-enabled previously skipped cohost rename/code-action tests and updated them to choose the correct generated document (impl vs decl) based on document mapping.
- Updated span/text-change mapping in tests to consider both generated documents (impl + optional decl) when validating Razor edit remapping.
- Refactored/updated supporting test infrastructure to use the newer
GetRequiredCSharpDocument(declarationDocument: false)API and to track optional declaration output where applicable.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/Razor/src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.UnitTests/Endpoints/Rename/RoslynRenameTest.cs | Re-enables the VS Code cohost rename test. |
| src/Razor/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.UnitTests/Cohost/CohostRoslynRenameTest.cs | Updates rename tests to select impl/decl generated docs correctly and map changes across both. |
| src/Razor/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.UnitTests/Cohost/CohostRoslynCodeActionTest.cs | Updates code action tests to map edits against both generated docs and factors mapping into a helper. |
| src/Razor/src/Razor/test/Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests/RazorDocumentMappingServiceTest.cs | Migrates mapping tests to use GetRequiredCSharpDocument(declarationDocument: false). |
| src/Razor/src/Razor/test/Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests/Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests.projitems | Removes the deleted excerpt test base from compilation inputs. |
| src/Razor/src/Razor/test/Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests/DocumentExcerpt/RazorDocumentExcerptServiceTest.cs | Inlines former base-class setup and adds coverage for declaration-document excerpt/classification scenarios. |
| src/Razor/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Language/IntegrationTests/RazorToolingIntegrationTestBase.cs | Updates integration test compilation pipeline to handle optional decl output and adjusts syntax tree tracking accordingly. |
chsienki
approved these changes
Jun 22, 2026
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.
Completion was the last feature that needed work, but it seems there were some tests still outstanding.
This is essentially the last tooling PR for sonic, other than removing obsolete attributes etc. once we decide on API shape etc. As far as tooling is concerned though, I believe this means the feature branch can be merged.
Microsoft Reviewers: Open in CodeFlow