Cancel language server requests if request is dropped
Before this change, we would send requests to language servers without canceling them even if we never wait for their response. Example: when doing document highlights, we'd send a request (modulo debouncing) whenever a change was made, ignoring previously sent requests that might still be in-flight. With this change, we now send a Cancel request (from the LSP spec) to the language server in case no one listens to the response anymore (which is what happens when the `Future` returned by `request_internal`) is dropped.
This commit is contained in:
parent
338dcd76b1
commit
1a6cd73334
2 changed files with 15 additions and 1 deletions
|
@ -299,7 +299,7 @@ pub struct Deferred<F: FnOnce()>(Option<F>);
|
|||
|
||||
impl<F: FnOnce()> Deferred<F> {
|
||||
/// Drop without running the deferred function.
|
||||
pub fn cancel(mut self) {
|
||||
pub fn abort(mut self) {
|
||||
self.0.take();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue