At this point, thing-at-point with all standard things
is already supported by treesit, for example:
"(thing-at-point 'defun)" by treesit-beginning-of-defun,
"(thing-at-point 'sexp)" by treesit-forward-sexp,
"(thing-at-point 'list)" by treesit-up-list,
"(thing-at-point 'sentence)" by treesit-forward-sentence,
"(thing-at-point 'comment)" by treesit-forward-comment.
https://lists.gnu.org/archive/html/emacs-devel/2025-02/msg00384.html
(cherry picked from commit
b514ec87b618e4ee9a95b248eb55c5e0cc69949c)
;;
;; There are also some defun-specific functions, like
;; treesit-defun-name, treesit-add-log-current-defun.
-;;
-;; TODO: Integration with thing-at-point: once our thing interface is
-;; stable.
(defvar-local treesit-defun-type-regexp nil
"A regexp that matches the node type of defun nodes.
;; Counter equal to 0 means we successfully stepped ARG steps.
(if (eq counter 0) pos nil)))
-;; TODO: In corporate into thing-at-point.
(defun treesit-thing-at-point (thing tactic)
"Return the THING at point, or nil if none is found.