Find original as node before compute ref match

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
This commit is contained in:
hi-rustin 2022-07-18 21:39:13 +08:00
parent 8e379cec62
commit 15016bc09f

View file

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