Skip to content

Handle cancelRequest from lsp4ij#410

Merged
helin24 merged 6 commits into
flutter:mainfrom
helin24:cancelRequest
May 19, 2026
Merged

Handle cancelRequest from lsp4ij#410
helin24 merged 6 commits into
flutter:mainfrom
helin24:cancelRequest

Conversation

@helin24
Copy link
Copy Markdown
Member

@helin24 helin24 commented May 16, 2026

Not having cancelRequest forward to the DAS was causing problems as I was working on codeAction because it can cause DAS to crash when there are many requests. However, cancelRequest is independent from codeAction and makes sense to have first.

Note that this is sending a legacy cancelRequest, not LSP-over-legacy.

helin24 added 2 commits May 16, 2026 11:03
… notifications to DAS as legacy server.cancelRequest to prevent request backlog and server OOM
…ful cancellation forwarding does not log unhandled message warning
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request implements support for request cancellation in the DartVirtualStreamConnectionProvider by maintaining a mapping between LSP request IDs and legacy Dart Analysis Server IDs. The reviewer identified a logic bug where handled cancellation requests would still be logged as ignored, a potential null pointer exception when processing message parameters, and a performance concern regarding the O(N) complexity of the current ID lookup strategy.

@helin24
Copy link
Copy Markdown
Member Author

helin24 commented May 19, 2026

@gemini-code-assist comments have been addressed; can you review again?

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request implements support for forwarding LSP cancellation requests to the legacy Dart Analysis Server by updating the pendingLegacyIds storage to a map that tracks the mapping between legacy and LSP request IDs. Feedback was provided regarding a potential string conversion mismatch for numeric IDs and the performance implications of the linear search used to resolve IDs during cancellation.

helin24 and others added 2 commits May 19, 2026 10:12
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@helin24 helin24 requested a review from pq May 19, 2026 17:18
@helin24 helin24 merged commit fcac002 into flutter:main May 19, 2026
8 of 9 checks passed
@helin24 helin24 deleted the cancelRequest branch May 19, 2026 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants