diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-03-18 15:13:03 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-03-18 15:13:03 +0000 |
commit | faff44b10931e6a6d31a9783994f9b8e0125cb9d (patch) | |
tree | cecbf9cb7ee8b6706d2d70aeb04bbf67a6c43ac0 /crates/ide/src/display/navigation_target.rs | |
parent | 3ab9b39dd47d99ffd97f485c27f38b8944e12a3e (diff) | |
parent | c05a1a6e37156b956380d57049a72cfe6f21095d (diff) |
Merge #8088
8088: Store an `AstId` for procedural macros r=jonas-schievink a=jonas-schievink
Point `HasSource` to the `ast::Fn`, and go to it in `TryToNav`.
bors r+
Co-authored-by: Jonas Schievink <[email protected]>
Diffstat (limited to 'crates/ide/src/display/navigation_target.rs')
-rw-r--r-- | crates/ide/src/display/navigation_target.rs | 8 |
1 files changed, 6 insertions, 2 deletions
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 { | |||
339 | impl TryToNav for hir::MacroDef { | 339 | impl TryToNav for hir::MacroDef { |
340 | fn try_to_nav(&self, db: &RootDatabase) -> Option<NavigationTarget> { | 340 | fn try_to_nav(&self, db: &RootDatabase) -> Option<NavigationTarget> { |
341 | let src = self.source(db)?; | 341 | let src = self.source(db)?; |
342 | log::debug!("nav target {:#?}", src.value.syntax()); | 342 | let name_owner: &dyn ast::NameOwner = match &src.value { |
343 | Either::Left(it) => it, | ||
344 | Either::Right(it) => it, | ||
345 | }; | ||
346 | log::debug!("nav target {:#?}", name_owner.syntax()); | ||
343 | let mut res = NavigationTarget::from_named( | 347 | let mut res = NavigationTarget::from_named( |
344 | db, | 348 | db, |
345 | src.as_ref().map(|it| it as &dyn ast::NameOwner), | 349 | src.as_ref().with_value(name_owner), |
346 | SymbolKind::Macro, | 350 | SymbolKind::Macro, |
347 | ); | 351 | ); |
348 | res.docs = self.docs(db); | 352 | res.docs = self.docs(db); |