diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-06-01 18:48:06 +0100 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-06-01 18:48:06 +0100 |
commit | ccec71165bf1f8f79bd2d2a5c05bed55ff3a07a2 (patch) | |
tree | 695718725ac4c9fb60a6c5c29a4f83aa489cc6c2 /crates/ra_hir/src/source_binder.rs | |
parent | 1e6b45b05ae378b9e376fcf02ecef15aa7dd1b6b (diff) | |
parent | 371961be0e0b0741599ebf3d9435c03fd45cf777 (diff) |
Merge #1360
1360: Improve goto definition for MBE r=matklad a=edwin0cheng
This PR improve the macro resolution for goto definition and expression macro invocation by using proper path resolution for external macros.
Co-authored-by: Edwin Cheng <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/source_binder.rs')
-rw-r--r-- | crates/ra_hir/src/source_binder.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs index 860e10069..75ed2de6c 100644 --- a/crates/ra_hir/src/source_binder.rs +++ b/crates/ra_hir/src/source_binder.rs | |||
@@ -283,8 +283,13 @@ impl SourceAnalyzer { | |||
283 | self.infer.as_ref()?.field_resolution(expr_id) | 283 | self.infer.as_ref()?.field_resolution(expr_id) |
284 | } | 284 | } |
285 | 285 | ||
286 | pub fn resolve_macro_call(&self, macro_call: &ast::MacroCall) -> Option<MacroByExampleDef> { | 286 | pub fn resolve_macro_call( |
287 | let id = self.resolver.resolve_macro_call(macro_call.path().and_then(Path::from_ast))?; | 287 | &self, |
288 | db: &impl HirDatabase, | ||
289 | macro_call: &ast::MacroCall, | ||
290 | ) -> Option<MacroByExampleDef> { | ||
291 | let id = | ||
292 | self.resolver.resolve_macro_call(db, macro_call.path().and_then(Path::from_ast))?; | ||
288 | Some(MacroByExampleDef { id }) | 293 | Some(MacroByExampleDef { id }) |
289 | } | 294 | } |
290 | 295 | ||