]> git.eshelyaron.com Git - emacs.git/commit
Fix treesit-node-field-name and friends (bug#66674)
authorYuan Fu <casouri@gmail.com>
Mon, 11 Dec 2023 00:23:44 +0000 (16:23 -0800)
committerYuan Fu <casouri@gmail.com>
Mon, 11 Dec 2023 00:28:21 +0000 (16:28 -0800)
commit9874561f39e62c1c9fada6c2e013f93d9ea65729
tree65db5b0ca17b500fb2fc65d4b708e58c1dce8ec2
parenteace9e1122601bdc2f7f03228816198ce726f8fc
Fix treesit-node-field-name and friends (bug#66674)

So turns out ts_node_field_name_for_child takes a named node index,
but we were passing it normal index that counts both named and
anonymous nodes.  That's what makes the field name all wrong in
treesit explorer.

* doc/lispref/parsing.texi:
(Accessing Node Information): Update docstring.
* lisp/treesit.el (treesit-node-index): Add some unrelated comment.
(treesit-node-field-name): Get named node index rather than all node
index.
* src/treesit.c (Ftreesit_node_field_name_for_child): Update
docstring, use ts_node_named_child_count.
doc/lispref/parsing.texi
lisp/treesit.el
src/treesit.c