Make procMacro_* workspace

This commit is contained in:
Ali Bektas 2024-08-22 20:51:49 +02:00
parent c304ceeb4c
commit e4edbf4601
2 changed files with 11 additions and 7 deletions

View file

@ -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 {

View file

@ -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| {