[Sonic] Debugging and breakpoint bits - #84166
Merged
Merged
Conversation
…ervice This method is only called from this one service, and I think its fundamentally broken in SONIC, because there is not guarantee the "next" position comes from the same C# document, so I'm removing it from the general API as a first step, so its easier to iterate.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates Razor cohost debugging-related services to correctly handle mapping between Razor source and the appropriate generated C# document (impl vs decl), and expands test coverage—particularly for Legacy (@functions) scenarios—now that cohosting is decl/impl split aware.
Changes:
- Update remote debugging and datatip range services to map via
RazorCodeDocumentinto the correct generated C# document (decl vs impl) before calling Roslyn breakpoint/datatip helpers. - Simplify
IDocumentMappingServiceby removingTryMapToCSharpPositionOrNext, and inline the specialized “next C# mapping on the same line” logic where it’s needed. - Re-enable and add cohost unit tests for code blocks and Legacy functions blocks across proximity expressions and breakpoint/breakable range scenarios.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Razor/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.UnitTests/Cohost/RemoteDebugInfoServiceTest.cs | Re-enables previously skipped tests and adds Legacy @functions coverage; updates helpers to pass RazorFileKind. |
| src/Razor/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.UnitTests/Cohost/CohostValidateBreakableRangeEndpointTest.cs | Adds Legacy variants and threads optional RazorFileKind through test setup. |
| src/Razor/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.UnitTests/Cohost/CohostDataTipRangeEndpointTest.cs | Adds Legacy and block-kind coverage; threads optional RazorFileKind through test setup. |
| src/Razor/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/DocumentMapping/DocumentMappingService.cs | Removes the “or next” mapping variant and simplifies internal mapping helper signature. |
| src/Razor/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Debugging/RemoteDebugInfoService.cs | Uses decl/impl-aware mapping and inlines “map-or-next-on-line” logic that may span decl/impl docs. |
| src/Razor/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Debugging/RemoteDataTipRangeService.cs | Uses decl/impl-aware mapping to select the correct generated document before datatip computation. |
| src/Razor/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/IDocumentMappingServiceExtensions.cs | Adds a new convenience helper to map spans via either impl or decl C# documents. |
| src/Razor/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/IDocumentMappingService.cs | Removes TryMapToCSharpPositionOrNext from the service contract. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
ToddGrun
reviewed
Jun 19, 2026
Member
Author
|
@dotnet/razor-tooling PTAL, the other of the last two sonic tooling PRs |
chsienki
approved these changes
Jun 24, 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.
This one has a little quirk where it wants the next C# mapping on a line, but since its the only place (left) that needs that behaviour, I decided to inline it since it's a bit complicated.
Microsoft Reviewers: Open in CodeFlow