From e868955bff3b97bad88bd09b4401e87cab94011c Mon Sep 17 00:00:00 2001 From: Yuan Fu Date: Tue, 25 Oct 2022 22:48:30 -0700 Subject: [PATCH] * src/treesit.c (treesit_search_dfs): Fix traverse algorithm. --- src/treesit.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/treesit.c b/src/treesit.c index 0f949b75542..cd1af3f52d6 100644 --- a/src/treesit.c +++ b/src/treesit.c @@ -2455,7 +2455,8 @@ treesit_search_dfs (TSNode *root, Lisp_Object pred, Lisp_Object parser, for (int offset = 0; offset < count; offset++) { uint32_t idx = forward ? offset : count - offset - 1; - TSNode child = ts_node_child (node, idx); + TSNode child = + named ? ts_node_named_child (node, idx) : ts_node_child (node, idx); if (!ts_node_is_null (child) && treesit_search_dfs (&child, pred, parser, named, -- 2.39.2