Skip to content

Commit 562ecb7

Browse files
committed
Auto merge of rust-lang#17070 - Veykril:simplify, r=Veykril
internal: Remove unnecessay `GlobalState::send_hint_refresh_query` field
2 parents 771e0ae + cd5f87a commit 562ecb7

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
lines changed

src/tools/rust-analyzer/crates/rust-analyzer/src/global_state.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ pub(crate) struct GlobalState {
7272

7373
// status
7474
pub(crate) shutdown_requested: bool,
75-
pub(crate) send_hint_refresh_query: bool,
7675
pub(crate) last_reported_status: Option<lsp_ext::ServerStatusParams>,
7776

7877
// proc macros
@@ -207,7 +206,6 @@ impl GlobalState {
207206
mem_docs: MemDocs::default(),
208207
semantic_tokens_cache: Arc::new(Default::default()),
209208
shutdown_requested: false,
210-
send_hint_refresh_query: false,
211209
last_reported_status: None,
212210
source_root_config: SourceRootConfig::default(),
213211
local_roots_parent_map: FxHashMap::default(),

src/tools/rust-analyzer/crates/rust-analyzer/src/main_loop.rs

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -348,11 +348,7 @@ impl GlobalState {
348348
let memdocs_added_or_removed = self.mem_docs.take_changes();
349349

350350
if self.is_quiescent() {
351-
let became_quiescent = !(was_quiescent
352-
|| self.fetch_workspaces_queue.op_requested()
353-
|| self.fetch_build_data_queue.op_requested()
354-
|| self.fetch_proc_macros_queue.op_requested());
355-
351+
let became_quiescent = !was_quiescent;
356352
if became_quiescent {
357353
if self.config.check_on_save() {
358354
// Project has loaded properly, kick off initial flycheck
@@ -363,7 +359,7 @@ impl GlobalState {
363359
}
364360
}
365361

366-
let client_refresh = !was_quiescent || state_changed;
362+
let client_refresh = became_quiescent || state_changed;
367363
if client_refresh {
368364
// Refresh semantic tokens if the client supports it.
369365
if self.config.semantic_tokens_refresh() {
@@ -377,17 +373,17 @@ impl GlobalState {
377373
}
378374

379375
// Refresh inlay hints if the client supports it.
380-
if self.send_hint_refresh_query && self.config.inlay_hints_refresh() {
376+
if self.config.inlay_hints_refresh() {
381377
self.send_request::<lsp_types::request::InlayHintRefreshRequest>((), |_, _| ());
382-
self.send_hint_refresh_query = false;
383378
}
384379
}
385380

386-
let things_changed = !was_quiescent || state_changed || memdocs_added_or_removed;
387-
if things_changed && self.config.publish_diagnostics() {
381+
let project_or_mem_docs_changed =
382+
became_quiescent || state_changed || memdocs_added_or_removed;
383+
if project_or_mem_docs_changed && self.config.publish_diagnostics() {
388384
self.update_diagnostics();
389385
}
390-
if things_changed && self.config.test_explorer() {
386+
if project_or_mem_docs_changed && self.config.test_explorer() {
391387
self.update_tests();
392388
}
393389
}
@@ -641,7 +637,6 @@ impl GlobalState {
641637
}
642638

643639
self.switch_workspaces("fetched build data".to_owned());
644-
self.send_hint_refresh_query = true;
645640

646641
(Some(Progress::End), None)
647642
}
@@ -658,7 +653,6 @@ impl GlobalState {
658653
ProcMacroProgress::End(proc_macro_load_result) => {
659654
self.fetch_proc_macros_queue.op_completed(true);
660655
self.set_proc_macros(proc_macro_load_result);
661-
self.send_hint_refresh_query = true;
662656
(Some(Progress::End), None)
663657
}
664658
};

0 commit comments

Comments
 (0)