Auto merge of #12800 - hi-rustin:rustin-patch-issue-12717, r=hi-rustin

Find original as node before compute ref match

part of https://github.com/rust-lang/rust-analyzer/issues/12717
This commit is contained in:
bors 2022-07-20 00:17:09 +00:00
commit 0e7135615f

View File

@ -134,8 +134,10 @@ pub(crate) fn render_field(
.lookup_by(name.clone());
item.insert_text(escaped_name);
if let Some(receiver) = &dot_access.receiver {
if let Some(ref_match) = compute_ref_match(ctx.completion, ty) {
item.ref_match(ref_match, receiver.syntax().text_range().start());
if let Some(original) = ctx.completion.sema.original_ast_node(receiver.clone()) {
if let Some(ref_match) = compute_ref_match(ctx.completion, ty) {
item.ref_match(ref_match, original.syntax().text_range().start());
}
}
}
item.build()