Skip to content

Commit 06a03ba

Browse files
bors[bot]kjeremy
andauthored
Merge #6790
6790: Send a CodeLensRefresh when we reload r=kjeremy a=kjeremy Co-authored-by: kjeremy <kjeremy@gmail.com>
2 parents fc15955 + 78dd2ba commit 06a03ba

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

crates/rust-analyzer/src/config.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ pub struct Config {
198198
pub lens: LensConfig,
199199
pub hover: HoverConfig,
200200
pub semantic_tokens_refresh: bool,
201+
pub code_lens_refresh: bool,
201202

202203
pub linked_projects: Vec<LinkedProject>,
203204
pub root_path: AbsPathBuf,
@@ -340,6 +341,7 @@ impl Config {
340341
lens: LensConfig::default(),
341342
hover: HoverConfig::default(),
342343
semantic_tokens_refresh: false,
344+
code_lens_refresh: false,
343345
linked_projects: Vec::new(),
344346
root_path,
345347
};
@@ -581,6 +583,12 @@ impl Config {
581583
{
582584
self.semantic_tokens_refresh = refresh_support;
583585
}
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+
}
584592
}
585593
}
586594

crates/rust-analyzer/src/main_loop.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,11 @@ impl GlobalState {
369369
self.semantic_tokens_cache.lock().clear();
370370
self.send_request::<lsp_types::request::SemanticTokensRefesh>((), |_, _| ());
371371
}
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+
}
372377
}
373378

374379
if let Some(diagnostic_changes) = self.diagnostics.take_changes() {

0 commit comments

Comments
 (0)