Skip to content

Trim lsp dispatch allocations - #84651

Merged
dibarbet merged 2 commits into
dotnet:mainfrom
dibarbet:trim-lsp-dispatch-allocations
Jul 28, 2026
Merged

dibarbet merged 2 commits into
dotnet:mainfrom
dibarbet:trim-lsp-dispatch-allocations

Conversation

@dibarbet

@dibarbet dibarbet commented Jul 27, 2026

Copy link
Copy Markdown
Member
Microsoft Reviewers: Open in CodeFlow

Copilot AI review requested due to automatic review settings July 27, 2026 23:16
@dibarbet
dibarbet requested review from a team as code owners July 27, 2026 23:16
@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.

dibarbet added 2 commits July 27, 2026 16:18
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 6916157a-dea6-4065-98b5-dc87c9c217b3
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 6916157a-dea6-4065-98b5-dc87c9c217b3
@dibarbet
dibarbet force-pushed the trim-lsp-dispatch-allocations branch from 4606b8a to b680441 Compare July 27, 2026 23:19

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 reduces per-request allocations in the Language Server Protocol framework dispatch path by removing an async state machine and avoiding a capturing cancellation callback, and it also updates a NuGet dependency version used by the Language Server layer.

Changes:

  • Remove async/await from SystemTextJsonLanguageServer request entrypoint to avoid state machine allocation.
  • Replace a capturing CancellationToken.Register callback in QueueItem<TRequestContext> with a static callback + state to avoid closure allocation.
  • Bump NuGet.ProjectModel version in eng/Packages.props.
Show a summary per file
File Description
src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/SystemTextJsonLanguageServer.cs Removes async wrapper around InvokeAsync to reduce dispatch overhead.
src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/QueueItem.cs Avoids closure allocation in cancellation registration by using a static callback and state.
eng/Packages.props Updates NuGet.ProjectModel package version for Language Server dependencies.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 0

Copilot AI review requested due to automatic review settings July 27, 2026 23:19

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's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 1

@dibarbet
dibarbet merged commit cf0761f into dotnet:main Jul 28, 2026
25 checks passed
@dibarbet
dibarbet deleted the trim-lsp-dispatch-allocations branch July 28, 2026 01:33
@jjonescz jjonescz added this to the 18.11 milestone Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants