Function: treesit-filter-child
treesit-filter-child is a byte-compiled function defined in
treesit.el.gz.
Signature
(treesit-filter-child NODE PRED &optional NAMED)
Documentation
Return children of NODE that satisfies predicate PRED.
PRED is a function that takes one argument, the child node. If optional argument NAMED is non-nil, only search for named node.
Other relevant functions are documented in the treesit group.
Shortdoc
;; treesit
(treesit-filter-child node (lambda (n) (equal (treesit-node-type) "identifier")))
e.g. => (#<treesit-node (identifier) in 195-196>)
Source Code
;; Defined in /usr/src/emacs/lisp/treesit.el.gz
(defun treesit-filter-child (node pred &optional named)
"Return children of NODE that satisfies predicate PRED.
PRED is a function that takes one argument, the child node.
If optional argument NAMED is non-nil, only search for named
node."
(let ((child (treesit-node-child node 0 named))
result)
(while child
(when (funcall pred child)
(push child result))
(setq child (treesit-node-next-sibling child named)))
(reverse result)))