From 78dd2ba196fee53d32f5f53572a03f748d9bb542 Mon Sep 17 00:00:00 2001 From: kjeremy Date: Wed, 9 Dec 2020 14:36:47 -0500 Subject: [PATCH] Send a CodeLensRefresh when we reload --- crates/rust-analyzer/src/config.rs | 8 ++++++++ crates/rust-analyzer/src/main_loop.rs | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index bd41a971ba..8d37638f4c 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs @@ -198,6 +198,7 @@ pub struct Config { pub lens: LensConfig, pub hover: HoverConfig, pub semantic_tokens_refresh: bool, + pub code_lens_refresh: bool, pub linked_projects: Vec, pub root_path: AbsPathBuf, @@ -340,6 +341,7 @@ impl Config { lens: LensConfig::default(), hover: HoverConfig::default(), semantic_tokens_refresh: false, + code_lens_refresh: false, linked_projects: Vec::new(), root_path, }; @@ -581,6 +583,12 @@ impl Config { { self.semantic_tokens_refresh = refresh_support; } + + if let Some(refresh_support) = + workspace_caps.code_lens.as_ref().and_then(|it| it.refresh_support) + { + self.code_lens_refresh = refresh_support; + } } } diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index d7f8374af7..a5f7647b80 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs @@ -369,6 +369,11 @@ impl GlobalState { self.semantic_tokens_cache.lock().clear(); self.send_request::((), |_, _| ()); } + + // Refresh code lens if the client supports it. + if self.config.code_lens_refresh { + self.send_request::((), |_, _| ()); + } } if let Some(diagnostic_changes) = self.diagnostics.take_changes() {