diff options
author | Lenard Pratt <[email protected]> | 2019-04-24 21:16:50 +0100 |
---|---|---|
committer | Lenard Pratt <[email protected]> | 2019-05-04 17:39:51 +0100 |
commit | 8198e13c26fe985af5893af7bdac04041880b461 (patch) | |
tree | d38470089855571fed08974c6cf3d57b80f3084f /crates/ra_ide_api/src/display | |
parent | 12629d5e4f2d949eedb707dedad4d75eff09e683 (diff) |
Added local macro goto
Diffstat (limited to 'crates/ra_ide_api/src/display')
-rw-r--r-- | crates/ra_ide_api/src/display/navigation_target.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/crates/ra_ide_api/src/display/navigation_target.rs b/crates/ra_ide_api/src/display/navigation_target.rs index 84645287d..765cf883b 100644 --- a/crates/ra_ide_api/src/display/navigation_target.rs +++ b/crates/ra_ide_api/src/display/navigation_target.rs | |||
@@ -213,6 +213,15 @@ impl NavigationTarget { | |||
213 | } | 213 | } |
214 | } | 214 | } |
215 | 215 | ||
216 | pub(crate) fn from_macro_def( | ||
217 | db: &RootDatabase, | ||
218 | macro_call: hir::MacroByExampleDef, | ||
219 | ) -> NavigationTarget { | ||
220 | let (file_id, node) = macro_call.source(db); | ||
221 | log::debug!("nav target {}", node.syntax().debug_dump()); | ||
222 | NavigationTarget::from_named(file_id.original_file(db), &*node) | ||
223 | } | ||
224 | |||
216 | #[cfg(test)] | 225 | #[cfg(test)] |
217 | pub(crate) fn assert_match(&self, expected: &str) { | 226 | pub(crate) fn assert_match(&self, expected: &str) { |
218 | let actual = self.debug_render(); | 227 | let actual = self.debug_render(); |
@@ -289,6 +298,7 @@ impl NavigationTarget { | |||
289 | .visit(doc_comments::<ast::StaticDef>) | 298 | .visit(doc_comments::<ast::StaticDef>) |
290 | .visit(doc_comments::<ast::NamedFieldDef>) | 299 | .visit(doc_comments::<ast::NamedFieldDef>) |
291 | .visit(doc_comments::<ast::EnumVariant>) | 300 | .visit(doc_comments::<ast::EnumVariant>) |
301 | .visit(doc_comments::<ast::MacroCall>) | ||
292 | .accept(&node)? | 302 | .accept(&node)? |
293 | } | 303 | } |
294 | 304 | ||