about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-07-27 12:31:26 +0000
committerbors <bors@rust-lang.org>2022-07-27 12:31:26 +0000
commitb4d652aa40911640c137314e97ca99557cd44df5 (patch)
treefd5d4d105077058c811b2d5470dc843fdad4d6f6
parentcb32e269dfcffe7006d172cde494472e7de183ae (diff)
parent349dfc7e95c7b384a3e520db3cc26645918857d2 (diff)
downloadrust-b4d652aa40911640c137314e97ca99557cd44df5.tar.gz
rust-b4d652aa40911640c137314e97ca99557cd44df5.zip
Auto merge of #12830 - hi-rustin:rustin-patch-issue-12717-fix, r=Veykril
Find original ast node before compute ref match

ref https://github.com/rust-lang/rust-analyzer/issues/12717
-rw-r--r--crates/ide-completion/src/render/function.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/crates/ide-completion/src/render/function.rs b/crates/ide-completion/src/render/function.rs
index 241de0a1834..4b5535718c5 100644
--- a/crates/ide-completion/src/render/function.rs
+++ b/crates/ide-completion/src/render/function.rs
@@ -85,7 +85,9 @@ fn render(
                 item.ref_match(ref_match, path_ctx.path.syntax().text_range().start());
             }
             FuncKind::Method(DotAccess { receiver: Some(receiver), .. }, _) => {
-                item.ref_match(ref_match, receiver.syntax().text_range().start());
+                if let Some(original_expr) = completion.sema.original_ast_node(receiver.clone()) {
+                    item.ref_match(ref_match, original_expr.syntax().text_range().start());
+                }
             }
             _ => (),
         }