# Cancel language server requests if request is dropped \(\#4159\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/e55e895e1935f624f5ea1c1a07e1c30366e5487d)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: e55e895e1935f624f5ea1c1a07e1c30366e5487d

Requested commit: e55e895e1935f624f5ea1c1a07e1c30366e5487d

Commit: e55e895e1935f624f5ea1c1a07e1c30366e5487d

Tree: 61fcdf3330508a1a5e47953f7d414ab88a88ccbe

Author: Thorsten Ball

Committer: GitHub

## Message

```
Cancel language server requests if request is dropped (#4159)

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.

Release Notes:

- Improved performance when interacting with language servers.
```

## Parents

- [f4e3c4a107e741fbf7dfbdf17a8c75f40fe0c748](https://git.cafe/gitcafe/zed/commit/f4e3c4a107e741fbf7dfbdf17a8c75f40fe0c748?format=markdown)

- [1a6cd7333429d0b102eaaa30ff96841ed46569b7](https://git.cafe/gitcafe/zed/commit/1a6cd7333429d0b102eaaa30ff96841ed46569b7?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/e55e895e1935f624f5ea1c1a07e1c30366e5487d?format=markdown)
