feat: Support macro calls in eager macros for IDE features

This commit is contained in:
Lukas Wirth 2024-03-14 12:02:23 +01:00
parent 9767156a29
commit d2f8eae2ec
22 changed files with 420 additions and 226 deletions

View file

@ -2617,6 +2617,15 @@ impl Macro {
}
}
pub fn is_env_or_option_env(&self, db: &dyn HirDatabase) -> bool {
match self.id {
MacroId::Macro2Id(it) => {
matches!(it.lookup(db.upcast()).expander, MacroExpander::BuiltInEager(eager) if eager.is_env_or_option_env())
}
MacroId::MacroRulesId(_) | MacroId::ProcMacroId(_) => false,
}
}
pub fn is_attr(&self, db: &dyn HirDatabase) -> bool {
matches!(self.kind(db), MacroKind::Attr)
}