mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-03 10:31:37 -08:00
; Fix treesit--children-covering-range
* lisp/treesit.el (treesit--children-covering-range): Handle the case when NODE doesn't have children, and when CHILD is nil.
This commit is contained in:
parent
95d783f27c
commit
2fa6ccab01
1 changed files with 8 additions and 6 deletions
|
|
@ -793,12 +793,14 @@ instead."
|
|||
(defun treesit--children-covering-range (node start end)
|
||||
"Return a list of children of NODE covering a range.
|
||||
The range is between START and END."
|
||||
(let* ((child (treesit-node-first-child-for-pos node start))
|
||||
(result (list child)))
|
||||
(while (and (< (treesit-node-end child) end)
|
||||
(setq child (treesit-node-next-sibling child)))
|
||||
(push child result))
|
||||
(nreverse result)))
|
||||
(if-let* ((child (treesit-node-first-child-for-pos node start))
|
||||
(result (list child)))
|
||||
(progn
|
||||
(while (and child (< (treesit-node-end child) end)
|
||||
(setq child (treesit-node-next-sibling child)))
|
||||
(push child result))
|
||||
(nreverse result))
|
||||
(list node)))
|
||||
|
||||
(defun treesit--children-covering-range-recurse (node start end threshold)
|
||||
"Return a list of children of NODE covering a range.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue