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

This commit is contained in:
Kirill Bulatov 2025-02-27 17:53:10 +02:00 committed by GitHub
parent 2e98bc17cb
commit e8ef36edcc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 101 additions and 9 deletions

View file

@ -711,6 +711,7 @@ pub struct Editor {
edit_prediction_indent_conflict: bool,
edit_prediction_requires_modifier_in_indent_conflict: bool,
inlay_hint_cache: InlayHintCache,
inlay_hint_modifiers_toggled: bool,
next_inlay_id: usize,
_subscriptions: Vec<Subscription>,
pixel_position_of_newest_cursor: Option<gpui::Point<Pixels>>,
@ -1419,6 +1420,7 @@ impl Editor {
released_too_fast: false,
},
inline_diagnostics_enabled: mode == EditorMode::Full,
inlay_hint_modifiers_toggled: false,
inlay_hint_cache: InlayHintCache::new(inlay_hint_settings),
gutter_hovered: false,
@ -3691,6 +3693,9 @@ impl Editor {
);
let (invalidate_cache, required_languages) = match reason {
InlayHintRefreshReason::Toggle(enabled) => {
if self.inlay_hint_cache.enabled == enabled {
return;
}
self.inlay_hint_cache.enabled = enabled;
if enabled {
(InvalidationStrategy::RefreshRequested, None)