Skip to content

Honour cancellation while processing Razor document symbols - #86207

Merged
davidwengier merged 1 commit into
dotnet:mainfrom
davidwengier:razor-document-symbol-cancellation
Oct 26, 2026
Merged

davidwengier merged 1 commit into
dotnet:mainfrom
davidwengier:razor-document-symbol-cancellation

Conversation

@davidwengier

@davidwengier davidwengier commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

The trace in https://developercommunity.visualstudio.com/t/Significant-intellisense-lag-when-adding/11169845 showed document symbol requests taking up to 17 seconds and eventually being cancelled, so trying to shorten that time by cancelling more aggresively.

Microsoft Reviewers: Open in CodeFlow

@davidwengier
davidwengier requested a review from a team as a code owner October 26, 2026 06:11
Copilot AI balanced review requested due to automatic review settings October 26, 2026 06:11
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

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.

🟡 Changes recommended

Deterministic regression tests are needed to verify that cancellation interrupts Razor-side processing for flat and nested hierarchical symbols.

1 open issue
What changed in this PR

This PR aims to reduce work on canceled Razor document-symbol requests by honoring cancellation during Razor-side symbol processing.

Changes:

  • Pass the request cancellation token through the document-symbol service contract.
  • Check cancellation during recursive symbol conversion, remapping, and merging.
File Description
src/​Razor/​src/​Razor/​src/​Microsoft.CodeAnalysis.Remote.Razor/​DocumentSymbols/​RemoteDocumentSymbolService.cs Forwards cancellation and checks it during symbol conversion.
src/​Razor/​src/​Razor/​src/​Microsoft.CodeAnalysis.Remote.Razor/​DocumentSymbols/​IDocumentSymbolService.cs Adds a cancellation token to the service contract.
src/​Razor/​src/​Razor/​src/​Microsoft.CodeAnalysis.Remote.Razor/​DocumentSymbols/​DocumentSymbolService.cs Checks cancellation while remapping and merging both symbol formats.

Review effort: Balanced

@davidwengier
davidwengier merged commit f3a0cc1 into dotnet:main Oct 26, 2026
25 checks passed
@davidwengier
davidwengier deleted the razor-document-symbol-cancellation branch October 26, 2026 20:35
@dotnet-policy-service dotnet-policy-service Bot added this to the Next milestone Oct 26, 2026
@akhera99 akhera99 modified the milestones: Next, 18.13 Oct 26, 2026
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