mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
Expand attributes recursively in expand_macro
This commit is contained in:
parent
9e3517f8f3
commit
2f179adc41
2 changed files with 29 additions and 8 deletions
|
@ -278,6 +278,10 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> {
|
|||
self.imp.resolve_macro_call(macro_call)
|
||||
}
|
||||
|
||||
pub fn resolve_attr_macro_call(&self, item: &ast::Item) -> Option<MacroDef> {
|
||||
self.imp.resolve_attr_macro_call(item)
|
||||
}
|
||||
|
||||
pub fn resolve_path(&self, path: &ast::Path) -> Option<PathResolution> {
|
||||
self.imp.resolve_path(path)
|
||||
}
|
||||
|
@ -634,6 +638,12 @@ impl<'db> SemanticsImpl<'db> {
|
|||
sa.resolve_macro_call(self.db, macro_call)
|
||||
}
|
||||
|
||||
fn resolve_attr_macro_call(&self, item: &ast::Item) -> Option<MacroDef> {
|
||||
let item_in_file = self.find_file(item.syntax().clone()).with_value(item.clone());
|
||||
let macro_call_id = self.with_ctx(|ctx| ctx.item_to_macro_call(item_in_file))?;
|
||||
Some(MacroDef { id: self.db.lookup_intern_macro(macro_call_id).def })
|
||||
}
|
||||
|
||||
fn resolve_path(&self, path: &ast::Path) -> Option<PathResolution> {
|
||||
self.analyze(path.syntax()).resolve_path(self.db, path)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue