From c05a1a6e37156b956380d57049a72cfe6f21095d Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Thu, 18 Mar 2021 16:11:18 +0100 Subject: Store an `AstId` for procedural macros --- crates/ide/src/display/navigation_target.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'crates/ide/src/display') diff --git a/crates/ide/src/display/navigation_target.rs b/crates/ide/src/display/navigation_target.rs index c086de163..364be260c 100644 --- a/crates/ide/src/display/navigation_target.rs +++ b/crates/ide/src/display/navigation_target.rs @@ -339,10 +339,14 @@ impl TryToNav for hir::Field { impl TryToNav for hir::MacroDef { fn try_to_nav(&self, db: &RootDatabase) -> Option { let src = self.source(db)?; - log::debug!("nav target {:#?}", src.value.syntax()); + let name_owner: &dyn ast::NameOwner = match &src.value { + Either::Left(it) => it, + Either::Right(it) => it, + }; + log::debug!("nav target {:#?}", name_owner.syntax()); let mut res = NavigationTarget::from_named( db, - src.as_ref().map(|it| it as &dyn ast::NameOwner), + src.as_ref().with_value(name_owner), SymbolKind::Macro, ); res.docs = self.docs(db); -- cgit v1.2.3