Function: treesit-thing-at-point
treesit-thing-at-point is a byte-compiled function defined in
treesit.el.gz.
Signature
(treesit-thing-at-point THING TACTIC)
Documentation
Return the node for THING at point, or nil if no THING is found at point.
THING can be a symbol, a regexp, a predicate function, and more;
for details, see treesit-thing-settings as defined by the
current buffer's major mode.
Return the top-level node for THING if TACTIC is top-level(var)/top-level(fun); return
the smallest node enclosing THING at point if TACTIC is nested.
Probably introduced at or before Emacs version 30.1.
Source Code
;; Defined in /usr/src/emacs/lisp/treesit.el.gz
(defun treesit-thing-at-point (thing tactic)
"Return the node for THING at point, or nil if no THING is found at point.
THING can be a symbol, a regexp, a predicate function, and more;
for details, see `treesit-thing-settings' as defined by the
current buffer's major mode.
Return the top-level node for THING if TACTIC is `top-level'; return
the smallest node enclosing THING at point if TACTIC is `nested'."
(let ((node (treesit-thing-at (point) thing)))
(if (eq tactic 'top-level)
(treesit-node-top-level node thing t)
node)))