diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-12-09 19:37:55 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-12-09 19:37:55 +0000 |
commit | 06a03bab8e0fc76044da24e680582c47584041a9 (patch) | |
tree | 833188eb93968f1be778cb433bc2302ef2ef890d | |
parent | fc1595539ee410c6a713e9b33d2074ae3732b849 (diff) | |
parent | 78dd2ba196fee53d32f5f53572a03f748d9bb542 (diff) |
Merge #6790
6790: Send a CodeLensRefresh when we reload r=kjeremy a=kjeremy
Co-authored-by: kjeremy <[email protected]>
-rw-r--r-- | crates/rust-analyzer/src/config.rs | 8 | ||||
-rw-r--r-- | crates/rust-analyzer/src/main_loop.rs | 5 |
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() { |