Function: treesit-node-index

treesit-node-index is a byte-compiled function defined in treesit.el.gz.

Signature

(treesit-node-index NODE &optional NAMED)

Documentation

Return the index of NODE in its parent.

If NAMED is non-nil, count named child only.

Other relevant functions are documented in the treesit group.

View in manual

Shortdoc

;; treesit
(treesit-node-index node)
    e.g. => 0

Source Code

;; Defined in /usr/src/emacs/lisp/treesit.el.gz
(defun treesit-node-index (node &optional named)
  "Return the index of NODE in its parent.
If NAMED is non-nil, count named child only."
  (let ((count 0))
    (while (setq node (treesit-node-prev-sibling node named))
      (incf count))
    count))