[Sonic] Create a way to do sonic tooling development and keep some kind of sanity - #84008
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a SONICDEV-gated “prototype” workflow intended to surface decl/impl-split awareness gaps via [Obsolete] warnings, adds bool-based overloads to explicitly choose which generated document to operate on, and removes a few unused helper methods to reduce surface area.
Changes:
- Add
SONICDEV-conditional[Obsolete]annotations to steer callers toward decl/impl-aware APIs. - Add bool overloads on snapshots to select impl vs decl generated output/syntax trees.
- Remove unused helper APIs (e.g., document-position helpers and minimal C# range computation).
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Razor/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ProjectSystem/TestDocumentSnapshot.cs | Adds decl/impl-aware GetCSharpSyntaxTreeAsync(bool, ...) for test snapshots and wires the existing overload through it. |
| src/Razor/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/RazorDocumentServiceBase.cs | Removes unused TryGetDocumentPositionInfo helpers. |
| src/Razor/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/ProjectSystem/RemoteDocumentSnapshot.cs | Adds decl/impl-aware generated-document and syntax-tree APIs; adds SONICDEV-gated obsoletion to push callers to the explicit overloads. |
| src/Razor/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/IDocumentSnapshot.cs | Updates the snapshot contract to include an explicit decl/impl-aware syntax-tree overload. |
| src/Razor/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentContext.cs | Adds SONICDEV-gated obsoletion to C# source text retrieval to encourage choosing the right C# document. |
| src/Razor/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/RazorCodeDocumentExtensions.cs | Adds decl/impl-aware hint-name mapping and SONICDEV-gated obsoletion for APIs that implicitly pick impl. |
| src/Razor/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/ProjectExtensions.cs | Adds SONICDEV-gated obsoletion to steer callers away from impl-only helper overloads. |
| src/Razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeDocument.cs | Adds SONICDEV-gated obsoletion to impl/decl-specific accessors in favor of the bool-based APIs. |
| src/Razor/Directory.Build.props | Adds a (currently commented) way to enable SONICDEV for local builds. |
davidwengier
commented
Jun 4, 2026
Co-authored-by: David Wengier <david.wengier@microsoft.com>
davidwengier
commented
Jun 4, 2026
Open
3 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.
This is my best bet at how to make Sonic Tooling dev approachable. It has no impact on CI builds, we'll have to remove it before merging to main (if I understand how PROTOTYPE comments work properly), but by setting a local define, I get a nice todo list from the error list about what needs to be fixed.
I also found a few methods that had no callers when I was making these changes, so I removed them. Less surface area to worry about is good.
As part of de-obsoleting everything at the end of the work, I'm open to removing the methods that take booleans, and switching to the document specific methods, or keeping both sets. Certainly, the boolean option is proving useful in porting other features.
Microsoft Reviewers: Open in CodeFlow