[Sonic] Add a new button to the Syntax Visualizer - #84167
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR extends the Razor Syntax Visualizer “generated document” tooling to support viewing the C# declaration generated document in addition to the existing C# (implementation) view, wiring the new command through the VSCT/UI, cohost LSP endpoint, and remote devtools service, with corresponding localization and tests.
Changes:
- Split generated C# retrieval into implementation vs. declaration via
GeneratedDocumentKind+ updated remote devtools service contract/implementation. - Add a new Syntax Visualizer toolbar command/button to Show Generated C# Declaration.
- Expand cohost endpoint tests to cover both document kinds and the “no declaration doc” case.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/Razor/src/Razor/test/Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests/Endpoints/CohostGeneratedDocumentContentsEndpointTest.cs | Updates/extends tests for implementation vs declaration generated C# contents (and null when absent). |
| src/Razor/src/Razor/src/Microsoft.VisualStudio.RazorExtension/SyntaxVisualizer/SyntaxVisualizerToolWindow.cs | Registers a new VS command to invoke “Show Generated C# Declaration”. |
| src/Razor/src/Razor/src/Microsoft.VisualStudio.RazorExtension/SyntaxVisualizer/SyntaxVisualizerControl.xaml.cs | Adds handler to request/open the declaration generated document and updates existing C# to “implementation”. |
| src/Razor/src/Razor/src/Microsoft.VisualStudio.RazorExtension/RazorContextMenu.vsct | Adds a new toolbar button/command id for “Show Generated C# Declaration”. |
| src/Razor/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Protocol/DevTools/GeneratedDocumentKind.cs | Splits CSharp into CSharpImplementation and CSharpDeclaration. |
| src/Razor/src/Razor/src/Microsoft.CodeAnalysis.Razor.CohostingShared/GeneratedDocumentContents/CohostGeneratedDocumentContentsEndpoint.cs | Routes LSP requests to fetch implementation vs declaration C# text (nullable for declaration). |
| src/Razor/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/IRemoteDevToolsService.cs | Extends remote devtools API to select declaration vs implementation; returns nullable for C# text. |
| src/Razor/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/DevTools/RemoteDevToolsService.cs | Implements declaration/implementation selection using Razor GetCSharpDocument(...). |
| src/Razor/src/Razor/src/Microsoft.VisualStudio.RazorExtension/xlf/RazorContextMenu.vsct.cs.xlf | Adds localized string entry for the new command (cs). |
| src/Razor/src/Razor/src/Microsoft.VisualStudio.RazorExtension/xlf/RazorContextMenu.vsct.de.xlf | Adds localized string entry for the new command (de). |
| src/Razor/src/Razor/src/Microsoft.VisualStudio.RazorExtension/xlf/RazorContextMenu.vsct.es.xlf | Adds localized string entry for the new command (es). |
| src/Razor/src/Razor/src/Microsoft.VisualStudio.RazorExtension/xlf/RazorContextMenu.vsct.fr.xlf | Adds localized string entry for the new command (fr). |
| src/Razor/src/Razor/src/Microsoft.VisualStudio.RazorExtension/xlf/RazorContextMenu.vsct.it.xlf | Adds localized string entry for the new command (it). |
| src/Razor/src/Razor/src/Microsoft.VisualStudio.RazorExtension/xlf/RazorContextMenu.vsct.ja.xlf | Adds localized string entry for the new command (ja). |
| src/Razor/src/Razor/src/Microsoft.VisualStudio.RazorExtension/xlf/RazorContextMenu.vsct.ko.xlf | Adds localized string entry for the new command (ko). |
| src/Razor/src/Razor/src/Microsoft.VisualStudio.RazorExtension/xlf/RazorContextMenu.vsct.pl.xlf | Adds localized string entry for the new command (pl). |
| src/Razor/src/Razor/src/Microsoft.VisualStudio.RazorExtension/xlf/RazorContextMenu.vsct.pt-BR.xlf | Adds localized string entry for the new command (pt-BR). |
| src/Razor/src/Razor/src/Microsoft.VisualStudio.RazorExtension/xlf/RazorContextMenu.vsct.ru.xlf | Adds localized string entry for the new command (ru). |
| src/Razor/src/Razor/src/Microsoft.VisualStudio.RazorExtension/xlf/RazorContextMenu.vsct.tr.xlf | Adds localized string entry for the new command (tr). |
| src/Razor/src/Razor/src/Microsoft.VisualStudio.RazorExtension/xlf/RazorContextMenu.vsct.zh-Hans.xlf | Adds localized string entry for the new command (zh-Hans). |
| src/Razor/src/Razor/src/Microsoft.VisualStudio.RazorExtension/xlf/RazorContextMenu.vsct.zh-Hant.xlf | Adds localized string entry for the new command (zh-Hant). |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
Pic? |
I'm on my phone, so just imagine a really ugly toolbar with too many buttons on it. I probably should gave clarified in the title, this is for the razor syntax visualizer, which is not on any menu or toolbar in VS |
understood. i'm still interested :) |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>


Wouldn't it be cool to get rid of this one day, when the Dependencies node actually works properly :D
Microsoft Reviewers: Open in CodeFlow