From f64feeb11ac78db9c634339465d973ceb9cb3c97 Mon Sep 17 00:00:00 2001 From: Kartavya Vashishtha Date: Thu, 24 Nov 2022 22:32:15 -0800 Subject: [PATCH] Correct node traversal to look at parent instead Co-authored-by: Lukas Wirth --- crates/ide/src/hover.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs index 9751dc11db6..5e812a1569c 100644 --- a/crates/ide/src/hover.rs +++ b/crates/ide/src/hover.rs @@ -176,8 +176,8 @@ pub(crate) fn hover( return None; } - let record_pat_field_list = - token.parent_ancestors().find_map(ast::RecordPatFieldList::cast)?; + let rest_pat = token.syntax().parent().and_then(ast::RestPat::cast)?; + let record_pat_field_list = rest_pat.syntax().parent().and_then(ast::RecordPatFieldList::cast)?; let record_pat = record_pat_field_list.syntax().parent().and_then(ast::RecordPat::cast)?;