diff options
| author | Ali Bektas <bektasali@protonmail.com> | 2024-08-22 20:51:49 +0200 |
|---|---|---|
| committer | Ali Bektas <bektasali@protonmail.com> | 2024-08-28 19:33:21 +0200 |
| commit | 887dd4e344b71bb8a126b2855847775fbc2ee94f (patch) | |
| tree | 683c31b00a2d4c79e8052919ff2f689e4b10c69c /src | |
| parent | 7360dfe3f1b79acd54d3d8522bfb917d517e5866 (diff) | |
| download | rust-887dd4e344b71bb8a126b2855847775fbc2ee94f.tar.gz rust-887dd4e344b71bb8a126b2855847775fbc2ee94f.zip | |
Make procMacro_* workspace
Diffstat (limited to 'src')
| -rw-r--r-- | src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs | 16 | ||||
| -rw-r--r-- | src/tools/rust-analyzer/crates/rust-analyzer/src/reload.rs | 2 |
2 files changed, 11 insertions, 7 deletions
diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs index 3499cf92595..e459e7b7f3b 100644 --- a/src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs +++ b/src/tools/rust-analyzer/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/src/tools/rust-analyzer/crates/rust-analyzer/src/reload.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/reload.rs index 7087d7fbd57..5d77b7aa67e 100644 --- a/src/tools/rust-analyzer/crates/rust-analyzer/src/reload.rs +++ b/src/tools/rust-analyzer/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| { |
