Unnamed repository; edit this file 'description' to name the repository.
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
bors 2022-07-27
parent cb32e26 · parent 349dfc7 · commit b4d652a
-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 241de0a183..4b5535718c 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());
+ }
}
_ => (),
}