diff options
author | Yuan Fu <casouri@gmail.com> | 2023-12-10 16:23:44 -0800 |
---|---|---|
committer | Yuan Fu <casouri@gmail.com> | 2023-12-10 16:28:21 -0800 |
commit | 9874561f39e62c1c9fada6c2e013f93d9ea65729 (patch) | |
tree | 65db5b0ca17b500fb2fc65d4b708e58c1dce8ec2 /doc/lispref/parsing.texi | |
parent | eace9e1122601bdc2f7f03228816198ce726f8fc (diff) | |
download | emacs-9874561f39e62c1c9fada6c2e013f93d9ea65729.tar.gz emacs-9874561f39e62c1c9fada6c2e013f93d9ea65729.tar.bz2 emacs-9874561f39e62c1c9fada6c2e013f93d9ea65729.zip |
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.
Diffstat (limited to 'doc/lispref/parsing.texi')
-rw-r--r-- | doc/lispref/parsing.texi | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/doc/lispref/parsing.texi b/doc/lispref/parsing.texi index 353585f79c7..34eb2826a21 100644 --- a/doc/lispref/parsing.texi +++ b/doc/lispref/parsing.texi @@ -1015,8 +1015,8 @@ This function returns the field name of the @var{n}'th child of @var{node}. It returns @code{nil} if there is no @var{n}'th child, or the @var{n}'th child doesn't have a field name. -Note that @var{n} counts both named and anonymous children, and -@var{n} can be negative, e.g., @minus{}1 represents the last child. +Note that @var{n} counts named nodes only, and @var{n} can be +negative, e.g., @minus{}1 represents the last child. @end defun @defun treesit-node-child-count node &optional named |