# Rework inlay hover model \(\#2969\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 8d3c251cc2568981c078decb4adde3a3183be52c

Requested commit: 8d3c251cc2568981c078decb4adde3a3183be52c

Commit: 8d3c251cc2568981c078decb4adde3a3183be52c

Tree: 3dd75481b1dce9f28c34dab07859061ec1eda3a7

Author: Kirill Bulatov

Committer: GitHub

## Message

````
Rework inlay hover model (#2969)

Fixes
```
thread 'main' panicked at 'byte index 2 is not a char boundary; it is inside '…' (bytes 0..3) of `…)`'
```
panics like
https://zed-industries.slack.com/archives/C04S6T1T7TQ/p1694535396473329

by reworking the inlay hover model:
* avoid storing "hardcoded" coordinates of hovered inlay labels (such as
`InlayOffset`), instead, remember `inlay_id` and apply required
highlights there when hint with the same id is handled
* add randomized tests on inlay highlights
* sped up inlay hint cache lookup by inlay_id

As a downside, background highlights are no long appearing on inlay
hints, but Zed does not receive any tooltips for inlays anyway (r-a does
not send them for some reason, other LSP seem to have no such feature?),
so it does not matter now.
Nontheless, if the logic for displaying hint pop-ups is present and
works for harcoded tooltips in r-a, only background highlight is missing
now.

Release Notes:

- Fixed inlay hint highlights causing panic for certain cases with
"large" characters
````

## Parents

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

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

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