Unnamed repository; edit this file 'description' to name the repository.
Make procMacro_* workspace
Ali Bektas 2024-08-29
parent c304cee · commit e4edbf4
-rw-r--r--crates/rust-analyzer/src/config.rs16
-rw-r--r--crates/rust-analyzer/src/reload.rs2
2 files changed, 11 insertions, 7 deletions
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs
index 3499cf9259..e459e7b7f3 100644
--- a/crates/rust-analyzer/src/config.rs
+++ b/crates/rust-analyzer/src/config.rs
@@ -119,10 +119,6 @@ config_data! {
/// Sets the LRU capacity of the specified queries.
lru_query_capacities: FxHashMap<Box<str>, u16> = FxHashMap::default(),
- /// These proc-macros will be ignored when trying to expand them.
- ///
- /// This config takes a map of crate names with the exported proc-macro names to ignore as values.
- procMacro_ignored: FxHashMap<Box<str>, Box<[Box<str>]>> = FxHashMap::default(),
/// Enables automatic discovery of projects using [`DiscoverWorkspaceConfig::command`].
@@ -409,6 +405,11 @@ config_data! {
/// If false, `-p <package>` will be passed instead.
check_workspace: bool = true,
+ /// These proc-macros will be ignored when trying to expand them.
+ ///
+ /// This config takes a map of crate names with the exported proc-macro names to ignore as values.
+ procMacro_ignored: FxHashMap<Box<str>, Box<[Box<str>]>> = FxHashMap::default(),
+
/// Command to be executed instead of 'cargo' for runnables.
runnables_command: Option<String> = None,
/// Additional arguments to be passed to cargo for runnables such as
@@ -1764,8 +1765,11 @@ impl Config {
Some(AbsPathBuf::try_from(path).unwrap_or_else(|path| self.root_path.join(path)))
}
- pub fn ignored_proc_macros(&self) -> &FxHashMap<Box<str>, Box<[Box<str>]>> {
- self.procMacro_ignored()
+ pub fn ignored_proc_macros(
+ &self,
+ source_root: Option<SourceRootId>,
+ ) -> &FxHashMap<Box<str>, Box<[Box<str>]>> {
+ self.procMacro_ignored(source_root)
}
pub fn expand_proc_macros(&self) -> bool {
diff --git a/crates/rust-analyzer/src/reload.rs b/crates/rust-analyzer/src/reload.rs
index 7087d7fbd5..5d77b7aa67 100644
--- a/crates/rust-analyzer/src/reload.rs
+++ b/crates/rust-analyzer/src/reload.rs
@@ -382,7 +382,7 @@ impl GlobalState {
pub(crate) fn fetch_proc_macros(&mut self, cause: Cause, paths: Vec<ProcMacroPaths>) {
info!(%cause, "will load proc macros");
- let ignored_proc_macros = self.config.ignored_proc_macros().clone();
+ let ignored_proc_macros = self.config.ignored_proc_macros(None).clone();
let proc_macro_clients = self.proc_macro_clients.clone();
self.task_pool.handle.spawn_with_sender(ThreadIntent::Worker, move |sender| {