Add a way to toggle inlay hints with modifiers #2 (#25766)

https://github.com/zed-industries/zed/pull/25752 with fixes on top

* Ensures no flickering happens for all modifiers `: false` case
* Dismisses the toggled state on focus out
* Reworks cache state so that "enabled" and "toggled by modifiers" are
different states with their own lifecycle

Release Notes:

- N/A
This commit is contained in:
Kirill Bulatov 2025-02-28 10:03:25 +02:00 committed by GitHub
parent bb3aef15eb
commit 7440833ff1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 166 additions and 26 deletions

View file

@ -1517,7 +1517,8 @@ To interpret all `.c` files as C++, files called `MyLockFile` as TOML and files
"show_other_hints": true,
"show_background": false,
"edit_debounce_ms": 700,
"scroll_debounce_ms": 50
"scroll_debounce_ms": 50,
"toggle_on_modifiers_press": null
}
```
@ -1539,6 +1540,22 @@ Use the `lsp` section for the server configuration. Examples are provided in the
Hints are not instantly queried in Zed, two kinds of debounces are used, either may be set to 0 to be disabled.
Settings-related hint updates are not debounced.
All possible config values for `toggle_on_modifiers_press` are:
```json
"inlay_hints": {
"toggle_on_modifiers_press": {
"control": true,
"shift": true,
"alt": true,
"platform": true,
"function": true
}
}
```
Unspecified values have a `false` value, hints won't be toggled if all the modifiers are `false` or not all the modifiers are pressed.
## Journal
- Description: Configuration for the journal.