feat(lsp): find_node should traverse tail of list

This commit is contained in:
rvcas 2024-04-02 17:55:04 -04:00
parent 98bd61a0cd
commit e02bc2a58a
No known key found for this signature in database
GPG Key ID: C09B64E263F7D68C
1 changed files with 7 additions and 2 deletions

View File

@ -371,12 +371,17 @@ impl TypedExpr {
TypedExpr::Tuple { TypedExpr::Tuple {
elems: elements, .. elems: elements, ..
} } => elements
| TypedExpr::List { elements, .. } => elements
.iter() .iter()
.find_map(|e| e.find_node(byte_index)) .find_map(|e| e.find_node(byte_index))
.or(Some(Located::Expression(self))), .or(Some(Located::Expression(self))),
TypedExpr::List { elements, tail, .. } => elements
.iter()
.find_map(|e| e.find_node(byte_index))
.or_else(|| tail.as_ref().and_then(|t| t.find_node(byte_index)))
.or(Some(Located::Expression(self))),
TypedExpr::Call { fun, args, .. } => args TypedExpr::Call { fun, args, .. } => args
.iter() .iter()
.find_map(|arg| arg.find_node(byte_index)) .find_map(|arg| arg.find_node(byte_index))