Unnamed repository; edit this file 'description' to name the repository.
fix NameRefClass misclassifying proc-macros
| -rw-r--r-- | crates/ide/src/syntax_highlighting/test_data/highlighting.html | 2 | ||||
| -rw-r--r-- | crates/ide_db/src/defs.rs | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/crates/ide/src/syntax_highlighting/test_data/highlighting.html b/crates/ide/src/syntax_highlighting/test_data/highlighting.html index 185f137b8a..d7f996fba9 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlighting.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlighting.html @@ -56,7 +56,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd <span class="keyword">pub</span> <span class="keyword">trait</span> <span class="trait declaration public">Fn</span><span class="angle"><</span><span class="type_param declaration">Args</span><span class="angle">></span><span class="colon">:</span> <span class="trait public">FnMut</span><span class="angle"><</span><span class="type_param">Args</span><span class="angle">></span> <span class="brace">{</span><span class="brace">}</span> <span class="brace">}</span> -<span class="module crate_root library">proc_macros</span><span class="operator">::</span><span class="function library">mirror</span><span class="macro_bang">!</span> <span class="brace">{</span> +<span class="module crate_root library">proc_macros</span><span class="operator">::</span><span class="macro library">mirror</span><span class="macro_bang">!</span> <span class="brace">{</span> <span class="brace">{</span> <span class="comma">,</span><span class="builtin_type">i32</span> <span class="colon">:</span><span class="field declaration public">x</span> <span class="keyword">pub</span> <span class="comma">,</span><span class="builtin_type">i32</span> <span class="colon">:</span><span class="field declaration public">y</span> <span class="keyword">pub</span> diff --git a/crates/ide_db/src/defs.rs b/crates/ide_db/src/defs.rs index b5a13cea91..ffef33b6c8 100644 --- a/crates/ide_db/src/defs.rs +++ b/crates/ide_db/src/defs.rs @@ -416,10 +416,10 @@ impl NameRefClass { } if let Some(path) = ast::PathSegment::cast(parent.clone()).map(|it| it.parent_path()) { - if path.qualifier().is_none() { + if path.parent_path().is_none() { if let Some(macro_call) = path.syntax().parent().and_then(ast::MacroCall::cast) { - // Only use this to resolve single-segment macro calls like `foo!()`. Multi-segment - // paths are handled below (allowing `log$0::info!` to resolve to the log crate). + // Only use this to resolve to macro calls for last segments as qualifiers resolve + // to modules below. if let Some(macro_def) = sema.resolve_macro_call(¯o_call) { return Some(NameRefClass::Definition(Definition::Macro(macro_def))); } |