From e5f24a6d7c6e91e590e72b9ffd107a398c2bdebd Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Sat, 25 Mar 2023 18:20:42 +0100 Subject: [PATCH] Set proc_macros input when creating the RootDatabase --- crates/ide-db/src/apply_change.rs | 1 + crates/ide-db/src/lib.rs | 1 + crates/rust-analyzer/src/reload.rs | 6 ++++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/ide-db/src/apply_change.rs b/crates/ide-db/src/apply_change.rs index ea1d9cc491..3b8458980c 100644 --- a/crates/ide-db/src/apply_change.rs +++ b/crates/ide-db/src/apply_change.rs @@ -64,6 +64,7 @@ impl RootDatabase { // SourceDatabase base_db::ParseQuery base_db::CrateGraphQuery + base_db::ProcMacrosQuery // SourceDatabaseExt base_db::FileTextQuery diff --git a/crates/ide-db/src/lib.rs b/crates/ide-db/src/lib.rs index b1df11bf91..f9b8a502d9 100644 --- a/crates/ide-db/src/lib.rs +++ b/crates/ide-db/src/lib.rs @@ -137,6 +137,7 @@ impl RootDatabase { pub fn new(lru_capacity: Option) -> RootDatabase { let mut db = RootDatabase { storage: ManuallyDrop::new(salsa::Storage::default()) }; db.set_crate_graph_with_durability(Default::default(), Durability::HIGH); + db.set_proc_macros_with_durability(Default::default(), Durability::HIGH); db.set_local_roots_with_durability(Default::default(), Durability::HIGH); db.set_library_roots_with_durability(Default::default(), Durability::HIGH); db.set_enable_proc_attr_macros(false); diff --git a/crates/rust-analyzer/src/reload.rs b/crates/rust-analyzer/src/reload.rs index f8f2cb0932..9c6edb46f4 100644 --- a/crates/rust-analyzer/src/reload.rs +++ b/crates/rust-analyzer/src/reload.rs @@ -445,12 +445,14 @@ impl GlobalState { let mut change = Change::new(); change.set_crate_graph(crate_graph); self.analysis_host.apply_change(change); + self.process_changes(); - if same_workspaces { + if same_workspaces && !self.fetch_workspaces_queue.op_requested() { self.load_proc_macros(proc_macro_paths); } - self.process_changes(); + self.reload_flycheck(); + tracing::info!("did switch workspaces"); }