Skip to content

Add code actions for documentation diagnostics - #85728

Open
davidwengier wants to merge 4 commits into
mainfrom
davidwengier/razor-doc-code-actions
Open

davidwengier wants to merge 4 commits into
mainfrom
davidwengier/razor-doc-code-actions

Conversation

@davidwengier

@davidwengier davidwengier commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

Adds a quick fix for each documentation diagnostic: escape comment terminators (RZ1047), make legacy expressions explicit (RZ1048), and wrap plain text in <summary> (RZ1049). Each action has its own commit, tests, localisation and documentation.

This is the final layer of the reviewed documentation split, based on #85727. Part of #85414.

Validation passed with analysers enabled and baseline generation disabled: 4,514 compiler tests, 32 Remote completion tests, 482 VS Code tests and 536 Visual Studio tests. The final tree matches the reviewed source except for the previously approved unused import removal.

Native stack registration follows once the coordinator has checked all eight PRs.

Microsoft Reviewers: Open in CodeFlow

@davidwengier
davidwengier requested a review from a team as a code owner September 21, 2026 12:34
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
2 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@davidwengier
davidwengier requested a review from a team September 21, 2026 12:34
@davidwengier
davidwengier added this pull request to stack #85729 September 21, 2026 12:46
Copilot AI balanced review requested due to automatic review settings September 28, 2026 22:21
@davidwengier
davidwengier force-pushed the davidwengier/razor-doc-code-actions branch from 8efe3be to f188261 Compare September 28, 2026 22:21

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.

Copilot review overview

🔵 Needs a closer look

Parser-sensitive CDATA and malformed-document recovery behavior warrants final human review despite comprehensive tests.

Review effort: Balanced
Findings: None

What changed in this PR

Adds Razor quick fixes for documentation diagnostics RZ1047–RZ1049, completing the documentation-directive tooling introduced across the related PR stack.

Changes:

  • Adds three diagnostic-driven code-action providers.
  • Adds shared VS/VS Code tests and localized resources.
  • Documents each quick fix and its edge-case behavior.
File Description
Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests.projitems Includes new shared tests.
CodeActions/​WrapDocumentationInSummaryTests.cs Tests RZ1049 fixes.
CodeActions/​UseExplicitExpressionTests.cs Tests RZ1048 fixes.
CodeActions/​EscapeDocumentationCommentTerminatorTests.cs Tests RZ1047 fixes.
CodeActions/​CohostCodeActionsEndpointTestBase.cs Supports project configuration in tests.
Resources/​xlf/​SR.zh-Hant.xlf Adds localized-resource placeholders.
Resources/​xlf/​SR.zh-Hans.xlf Adds localized-resource placeholders.
Resources/​xlf/​SR.tr.xlf Adds localized-resource placeholders.
Resources/​xlf/​SR.ru.xlf Adds localized-resource placeholders.
Resources/​xlf/​SR.pt-BR.xlf Adds localized-resource placeholders.
Resources/​xlf/​SR.pl.xlf Adds localized-resource placeholders.
Resources/​xlf/​SR.ko.xlf Adds localized-resource placeholders.
Resources/​xlf/​SR.ja.xlf Adds localized-resource placeholders.
Resources/​xlf/​SR.it.xlf Adds localized-resource placeholders.
Resources/​xlf/​SR.fr.xlf Adds localized-resource placeholders.
Resources/​xlf/​SR.es.xlf Adds localized-resource placeholders.
Resources/​xlf/​SR.de.xlf Adds localized-resource placeholders.
Resources/​xlf/​SR.cs.xlf Adds localized-resource placeholders.
Resources/​SR.resx Defines action titles.
WrapDocumentationInSummaryCodeActionProvider.cs Implements RZ1049 wrapping.
UseExplicitExpressionCodeActionProvider.cs Implements RZ1048 expression conversion.
RazorCodeActionFactory.cs Creates the new quick fixes.
EscapeDocumentationCommentTerminatorCodeActionProvider.cs Implements RZ1047 escaping.
LanguageServerConstants.cs Defines action identifiers.
documentation-directive.md Documents quick-fix behavior.

Copilot AI balanced review requested due to automatic review settings September 30, 2026 00:02
@davidwengier
davidwengier force-pushed the davidwengier/razor-doc-code-actions branch from f188261 to 2c937e5 Compare September 30, 2026 00:02

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.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

Review effort: Lite
Findings: 2 Medium severity · 1 Low severity

Open (3)

Copilot stopped reviewing on behalf of davidwengier due to an error September 30, 2026 00:24
@davidwengier
davidwengier removed this pull request from stack #85729 October 4, 2026 21:37
A literal comment terminator cannot be emitted safely inside a documentation comment. Offer an XML-safe edit at the diagnosed occurrence, including CDATA, so users can preserve the displayed text.
The new directive changes how legacy @documentation expressions are parsed. Making the whole expression explicit preserves the old rendered result without changing the following text.
Plain text still needs explicit XML tags; the compiler should not invent them. This action adds a summary while preserving the surrounding whitespace and any existing XML.
XML-first recovery deliberately captures following text as documentation. Verify the escape action updates only the reported comment terminator in components and views.
@davidwengier
davidwengier force-pushed the davidwengier/razor-doc-code-actions branch from 2c937e5 to efd04d6 Compare October 4, 2026 23:31
@davidwengier
davidwengier requested review from a team as code owners October 4, 2026 23:31
@davidwengier
davidwengier changed the base branch from davidwengier/razor-doc-completion to main October 4, 2026 23:33
@dotnet-policy-service dotnet-policy-service Bot added VSCode Needs UX Triage Needs API Review Needs to be reviewed by the API review council labels Oct 4, 2026
@dotnet-policy-service

This comment was marked as outdated.

@davidwengier
davidwengier removed request for a team October 4, 2026 23:37
@davidwengier
davidwengier removed the request for review from a team October 4, 2026 23:37
@davidwengier davidwengier removed Needs UX Triage Needs API Review Needs to be reviewed by the API review council VSCode labels Oct 5, 2026

This branch has not been deployed

No deployments
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.

2 participants