aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorkjeremy <[email protected]>2020-12-09 19:36:47 +0000
committerkjeremy <[email protected]>2020-12-09 19:36:47 +0000
commit78dd2ba196fee53d32f5f53572a03f748d9bb542 (patch)
tree5818d8e795670b309250417a8e4fb3b8a8c4f09f /crates
parent928d4c6744d4b06bb1d67ea9b967c27342eea38c (diff)
Send a CodeLensRefresh when we reload
Diffstat (limited to 'crates')
-rw-r--r--crates/rust-analyzer/src/config.rs8
-rw-r--r--crates/rust-analyzer/src/main_loop.rs5
2 files changed, 13 insertions, 0 deletions
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs
index bd41a971b..8d37638f4 100644
--- a/crates/rust-analyzer/src/config.rs
+++ b/crates/rust-analyzer/src/config.rs
@@ -198,6 +198,7 @@ pub struct Config {
198 pub lens: LensConfig, 198 pub lens: LensConfig,
199 pub hover: HoverConfig, 199 pub hover: HoverConfig,
200 pub semantic_tokens_refresh: bool, 200 pub semantic_tokens_refresh: bool,
201 pub code_lens_refresh: bool,
201 202
202 pub linked_projects: Vec<LinkedProject>, 203 pub linked_projects: Vec<LinkedProject>,
203 pub root_path: AbsPathBuf, 204 pub root_path: AbsPathBuf,
@@ -340,6 +341,7 @@ impl Config {
340 lens: LensConfig::default(), 341 lens: LensConfig::default(),
341 hover: HoverConfig::default(), 342 hover: HoverConfig::default(),
342 semantic_tokens_refresh: false, 343 semantic_tokens_refresh: false,
344 code_lens_refresh: false,
343 linked_projects: Vec::new(), 345 linked_projects: Vec::new(),
344 root_path, 346 root_path,
345 }; 347 };
@@ -581,6 +583,12 @@ impl Config {
581 { 583 {
582 self.semantic_tokens_refresh = refresh_support; 584 self.semantic_tokens_refresh = refresh_support;
583 } 585 }
586
587 if let Some(refresh_support) =
588 workspace_caps.code_lens.as_ref().and_then(|it| it.refresh_support)
589 {
590 self.code_lens_refresh = refresh_support;
591 }
584 } 592 }
585 } 593 }
586 594
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs
index d7f8374af..a5f7647b8 100644
--- a/crates/rust-analyzer/src/main_loop.rs
+++ b/crates/rust-analyzer/src/main_loop.rs
@@ -369,6 +369,11 @@ impl GlobalState {
369 self.semantic_tokens_cache.lock().clear(); 369 self.semantic_tokens_cache.lock().clear();
370 self.send_request::<lsp_types::request::SemanticTokensRefesh>((), |_, _| ()); 370 self.send_request::<lsp_types::request::SemanticTokensRefesh>((), |_, _| ());
371 } 371 }
372
373 // Refresh code lens if the client supports it.
374 if self.config.code_lens_refresh {
375 self.send_request::<lsp_types::request::CodeLensRefresh>((), |_, _| ());
376 }
372 } 377 }
373 378
374 if let Some(diagnostic_changes) = self.diagnostics.take_changes() { 379 if let Some(diagnostic_changes) = self.diagnostics.take_changes() {