Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix server support for $/cancelRequest #280

Merged
merged 1 commit into from
May 21, 2021
Merged

Conversation

ebkalderon
Copy link
Owner

@ebkalderon ebkalderon commented May 21, 2021

Added

  • Implement conversion between lsp_types::NumberOrString and tower_lsp::jsonrpc::Id.
  • Add new cancels_pending_requests unit test to catch future regressions.

Fixed

  • Fix RequestKind::CancelRequest struct-like variant definition.

Closes #281.

It appears that the `RequestKind::CancelRequest` struct variant is
defined incorrectly, meaning client-to-server `$/cancelRequest`
notifications are silently ignored. This seems to have been broken for a
long time.

I discovered this by intentionally adding a 1500ms async delay to the
`LanguageServer::did_change` method in `examples/stdio.rs`. When this
method is invoked on the server, the unexpected delay causes the client
to emit a `$/cancelRequest` notification to the server. After opening a
new text buffer and starting to type, I successfully confirmed the
`$/cancelRequest` notification was indeed being emitted by the client,
but the server wasn't showing any successful request cancellation logs.
@ebkalderon ebkalderon self-assigned this May 21, 2021
@ebkalderon
Copy link
Owner Author

Due to the criticality of this bug, I think this PR might warrant an immediate patch release after merging.

@ebkalderon ebkalderon merged commit 08fe2f9 into master May 21, 2021
@ebkalderon ebkalderon deleted the fix-server-cancellation branch May 21, 2021 06:42
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.

Fix server support for $/cancelRequest
1 participant