# Debounce refresh of inlay hints on buffer edits \(\#8282\) · gitcafe/zed

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

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

Visibility: public

Requested revision: ddca6a3fb7cdf8a9af9a64e121482124c1ce509b

Requested commit: ddca6a3fb7cdf8a9af9a64e121482124c1ce509b

Commit: ddca6a3fb7cdf8a9af9a64e121482124c1ce509b

Tree: db8d107389e548b100a50cecedd3a289d14bb8e7

Author: Thorsten Ball

Committer: GitHub

## Message

````
Debounce refresh of inlay hints on buffer edits (#8282)

I think this makes it less chaotic to edit text when the inlay hints are
on.

It's for cases where you're editing to the right side of an inlay hint.
Example:

```rust
for name in names.iter().map(|item| item.len()) {
    println!("{:?}", name);
}
```

We display a `usize` inlay hint right next to `name`.

But as soon as you remove that `.` in `names.iter` your cursor jumps
around because the inlay hint has been removed.

With this change we now have a 700ms debounce before we update the inlay
hints.

VS Code seems to have an even longer debounce, I think somewhere around
~1s.

Release Notes:

- Added debouncing to make it easier to edit text when inlay hints are
enabled and to save rendering of inlay hints when scrolling. Both
debounce durations can be configured with `{"inlay_hints":
{"edit_debounce_ms": 700}}` (default) and `{"inlay_hints":
{"scroll_debounce_ms": 50}}`. Set a value to `0` to turn off the
debouncing.


### Before


https://github.com/zed-industries/zed/assets/1185253/3afbe548-dcfb-45a3-ab9f-cce14c04a148



### After



https://github.com/zed-industries/zed/assets/1185253/7ea90e42-bca6-4f6c-995e-83324669ab43

---------

Co-authored-by: Kirill <kirill@zed.dev>
````

## Parents

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

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