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

@ -9,7 +9,7 @@ use ec4rs::{
Properties as EditorconfigProperties,
};
use globset::{Glob, GlobMatcher, GlobSet, GlobSetBuilder};
use gpui::App;
use gpui::{App, Modifiers};
use itertools::{Either, Itertools};
use schemars::{
schema::{InstanceType, ObjectValidation, Schema, SchemaObject, SingleOrVec},
@ -932,6 +932,13 @@ pub struct InlayHintSettings {
/// Default: 50
#[serde(default = "scroll_debounce_ms")]
pub scroll_debounce_ms: u64,
/// Toggles inlay hints (hides or shows) when the user presses the modifiers specified.
/// If only a subset of the modifiers specified is pressed, hints are not toggled.
/// If no modifiers are specified, this is equivalent to `None`.
///
/// Default: None
#[serde(default)]
pub toggle_on_modifiers_press: Option<Modifiers>,
}
fn edit_debounce_ms() -> u64 {