From e02bc2a58a149265df38174ed177ec73960154e5 Mon Sep 17 00:00:00 2001 From: rvcas Date: Tue, 2 Apr 2024 17:55:04 -0400 Subject: [PATCH] feat(lsp): find_node should traverse tail of list --- crates/aiken-lang/src/expr.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/aiken-lang/src/expr.rs b/crates/aiken-lang/src/expr.rs index 5062319d..1919c5b1 100644 --- a/crates/aiken-lang/src/expr.rs +++ b/crates/aiken-lang/src/expr.rs @@ -371,12 +371,17 @@ impl TypedExpr { TypedExpr::Tuple { elems: elements, .. - } - | TypedExpr::List { elements, .. } => elements + } => elements .iter() .find_map(|e| e.find_node(byte_index)) .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 .iter() .find_map(|arg| arg.find_node(byte_index))