Correct node traversal to look at parent instead

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
Kartavya Vashishtha 2022-11-24 22:32:15 -08:00 committed by GitHub
parent 29951f9766
commit f64feeb11a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)?;