# Query certain editor ranges for inlays with a delay \(\#2891\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 205e101dd0650f1f4fc1c4b0d284a128ab9d9c78

Requested commit: 205e101dd0650f1f4fc1c4b0d284a128ab9d9c78

Commit: 205e101dd0650f1f4fc1c4b0d284a128ab9d9c78

Tree: dd42a989fcf124f6ed8cd8cffca1544f57001a43

Author: Kirill Bulatov

Committer: GitHub

## Message

```
Query certain editor ranges for inlays with a delay (#2891)

Part of
https://linear.app/zed-industries/issue/Z-2750/investigate-performance-of-collaborating-on-large-files-with-inlay
Fixes
https://linear.app/zed-industries/issue/Z-2824/inlay-hints-affect-code-layout-in-multibuffer

We query hints for visible part of the screen, and two parts above and
below the visible range, of the same range (if applicable, we can be on
the edge of the document).

When rapidly typing, we do not care about the invisible range updates,
yet still query a lot of them + rust-analyzer sends /refresh hint
requests shortly after every modification too, forcing us to re-query.

Instead querying both visible and invisible ranges altogether, wait for
visible range query first and wait add a `400ms` delay afterwards before
querying the invisible ranges.
This allows any /refresh requests or rapid typing to avoid 2 extra
requests, cancelling them before they start.
Visible part of the screen is still queried after every change, without
any debouncing.

Release Notes:

- Delay certain inlay hint requests to reduce general LSP server load
```

## Parents

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

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

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