6790: Send a CodeLensRefresh when we reload r=kjeremy a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
This commit is contained in:
bors[bot] 2020-12-09 19:37:55 +00:00 committed by GitHub
commit 06a03bab8e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View file

@ -198,6 +198,7 @@ pub struct Config {
pub lens: LensConfig, pub lens: LensConfig,
pub hover: HoverConfig, pub hover: HoverConfig,
pub semantic_tokens_refresh: bool, pub semantic_tokens_refresh: bool,
pub code_lens_refresh: bool,
pub linked_projects: Vec<LinkedProject>, pub linked_projects: Vec<LinkedProject>,
pub root_path: AbsPathBuf, pub root_path: AbsPathBuf,
@ -340,6 +341,7 @@ impl Config {
lens: LensConfig::default(), lens: LensConfig::default(),
hover: HoverConfig::default(), hover: HoverConfig::default(),
semantic_tokens_refresh: false, semantic_tokens_refresh: false,
code_lens_refresh: false,
linked_projects: Vec::new(), linked_projects: Vec::new(),
root_path, root_path,
}; };
@ -581,6 +583,12 @@ impl Config {
{ {
self.semantic_tokens_refresh = refresh_support; 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;
}
} }
} }

View file

@ -369,6 +369,11 @@ impl GlobalState {
self.semantic_tokens_cache.lock().clear(); self.semantic_tokens_cache.lock().clear();
self.send_request::<lsp_types::request::SemanticTokensRefesh>((), |_, _| ()); self.send_request::<lsp_types::request::SemanticTokensRefesh>((), |_, _| ());
} }
// Refresh code lens if the client supports it.
if self.config.code_lens_refresh {
self.send_request::<lsp_types::request::CodeLensRefresh>((), |_, _| ());
}
} }
if let Some(diagnostic_changes) = self.diagnostics.take_changes() { if let Some(diagnostic_changes) = self.diagnostics.take_changes() {