mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 15:23:46 +00:00
Request a refresh of semantic tokens if things are loaded up
This commit is contained in:
parent
5444978f68
commit
2d4be2ef2a
@ -47,6 +47,7 @@ pub struct Config {
|
||||
pub call_info_full: bool,
|
||||
pub lens: LensConfig,
|
||||
pub hover: HoverConfig,
|
||||
pub semantic_tokens_refresh: bool,
|
||||
|
||||
pub with_sysroot: bool,
|
||||
pub linked_projects: Vec<LinkedProject>,
|
||||
@ -193,6 +194,7 @@ impl Config {
|
||||
call_info_full: true,
|
||||
lens: LensConfig::default(),
|
||||
hover: HoverConfig::default(),
|
||||
semantic_tokens_refresh: false,
|
||||
linked_projects: Vec::new(),
|
||||
root_path,
|
||||
}
|
||||
@ -402,6 +404,14 @@ impl Config {
|
||||
self.client_caps.hover_actions = get_bool("hoverActions");
|
||||
self.client_caps.status_notification = get_bool("statusNotification");
|
||||
}
|
||||
|
||||
if let Some(workspace_caps) = caps.workspace.as_ref() {
|
||||
if let Some(refresh_support) =
|
||||
workspace_caps.semantic_tokens.as_ref().and_then(|it| it.refresh_support)
|
||||
{
|
||||
self.semantic_tokens_refresh = refresh_support;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -330,6 +330,12 @@ impl GlobalState {
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
self.update_file_notifications_on_threadpool(subscriptions);
|
||||
|
||||
// Refresh semantic tokens if the client supports it.
|
||||
if self.config.semantic_tokens_refresh {
|
||||
self.semantic_tokens_cache.lock().clear();
|
||||
self.send_request::<lsp_types::request::SemanticTokensRefesh>((), |_, _| ());
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(diagnostic_changes) = self.diagnostics.take_changes() {
|
||||
|
Loading…
Reference in New Issue
Block a user