1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

* lisp/treesit.el (treesit-show-paren-data--categorize): Improve.

Instead of using only the immediate parent, try to search more levels
using 'treesit-parent-until' (bug#75122).
This commit is contained in:
Juri Linkov 2024-12-30 09:23:05 +02:00
parent ce74534ef8
commit dc653bf063

View file

@ -3393,8 +3393,7 @@ For BOUND, MOVE, BACKWARD, LOOKING-AT, see the descriptions in
(defun treesit-show-paren-data--categorize (pos &optional end-p)
(let* ((pred 'sexp-list)
(parent (treesit-node-parent (treesit-node-at (if end-p (1- pos) pos))))
(parent (when (treesit-node-match-p parent pred t) parent))
(parent (treesit-parent-until (treesit-node-at (if end-p (1- pos) pos)) pred))
(first (when parent (treesit-node-child parent 0)))
(first-start (when first (treesit-node-start first)))
(first-end (when first (treesit-node-end first)))