From 1a372763d6c36807a465e8f0c562669bd0bd1f34 Mon Sep 17 00:00:00 2001 From: Aditya-PS-05 Date: Sat, 22 Nov 2025 13:51:31 +0530 Subject: [PATCH] fix: Prevent inlay hints from flickering while typing --- crates/rust-analyzer/src/main_loop.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index 7b339fa31bc2..b3fad57e037f 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs @@ -505,11 +505,6 @@ impl GlobalState { self.send_request::((), |_, _| ()); } - // Refresh inlay hints if the client supports it. - if self.config.inlay_hints_refresh() { - self.send_request::((), |_, _| ()); - } - if self.config.diagnostics_refresh() { self.send_request::( (), @@ -518,6 +513,11 @@ impl GlobalState { } } + // Refresh inlay hints only when quiescent to avoid flickering during typing. + if became_quiescent && self.config.inlay_hints_refresh() { + self.send_request::((), |_, _| ()); + } + let project_or_mem_docs_changed = became_quiescent || state_changed || memdocs_added_or_removed; if project_or_mem_docs_changed