Skip to content

[Sonic] Add a new button to the Syntax Visualizer - #84167

Merged
davidwengier merged 4 commits into
dotnet:features/sonicfrom
davidwengier:SonicSyntaxVisualizer
Jun 20, 2026
Merged

[Sonic] Add a new button to the Syntax Visualizer#84167
davidwengier merged 4 commits into
dotnet:features/sonicfrom
davidwengier:SonicSyntaxVisualizer

Conversation

@davidwengier

@davidwengier davidwengier commented Jun 17, 2026

Copy link
Copy Markdown
Member

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

davidwengier and others added 2 commits June 17, 2026 16:41
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@davidwengier
davidwengier requested a review from a team as a code owner June 17, 2026 07:56
Copilot AI review requested due to automatic review settings June 17, 2026 07:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Copilot AI review requested due to automatic review settings June 17, 2026 08:26
@CyrusNajmabadi

Copy link
Copy Markdown
Contributor

Pic?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 21 out of 21 changed files in this pull request and generated 1 comment.

@davidwengier

Copy link
Copy Markdown
Member Author

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

@CyrusNajmabadi

Copy link
Copy Markdown
Contributor

which is not on any menu or toolbar in VS

understood. i'm still interested :)

@davidwengier

Copy link
Copy Markdown
Member Author

Since you asked...
image

Don't say I didn't warn you!

I need to move the new button to the left though. Maybe I'll see if copilot can improve things a bit while I'm here.

@davidwengier

Copy link
Copy Markdown
Member Author

Okay, thats much nicer
image

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

@ToddGrun ToddGrun left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@davidwengier
davidwengier merged commit be1c541 into dotnet:features/sonic Jun 20, 2026
25 checks passed
@davidwengier
davidwengier deleted the SonicSyntaxVisualizer branch June 20, 2026 00:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants