From 2163ceb7ef0fc3c5268c9ca5f48bb50ae311947f Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Tue, 14 Jul 2020 17:23:33 +0200 Subject: Fix classify_name_ref on multi-path macro calls --- crates/ra_ide_db/src/defs.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'crates/ra_ide_db/src') diff --git a/crates/ra_ide_db/src/defs.rs b/crates/ra_ide_db/src/defs.rs index 3ef5e74b6..bcaabca92 100644 --- a/crates/ra_ide_db/src/defs.rs +++ b/crates/ra_ide_db/src/defs.rs @@ -255,8 +255,14 @@ pub fn classify_name_ref( } if let Some(macro_call) = parent.ancestors().find_map(ast::MacroCall::cast) { - if let Some(macro_def) = sema.resolve_macro_call(¯o_call) { - return Some(NameRefClass::Definition(Definition::Macro(macro_def))); + if let Some(path) = macro_call.path() { + if path.qualifier().is_none() { + // Only use this to resolve single-segment macro calls like `foo!()`. Multi-segment + // paths are handled below (allowing `log<|>::info!` to resolve to the log crate). + if let Some(macro_def) = sema.resolve_macro_call(¯o_call) { + return Some(NameRefClass::Definition(Definition::Macro(macro_def))); + } + } } } -- cgit v1.2.3