Function: treesit-update-ranges
treesit-update-ranges is a byte-compiled function defined in
treesit.el.gz.
Signature
(treesit-update-ranges &optional BEG END)
Documentation
Update the ranges for each language in the current buffer.
If BEG and END are non-nil, only update parser ranges in that region.
Source Code
;; Defined in /usr/src/emacs/lisp/treesit.el.gz
(defun treesit-update-ranges (&optional beg end)
"Update the ranges for each language in the current buffer.
If BEG and END are non-nil, only update parser ranges in that
region."
(let ((modified-tick (buffer-chars-modified-tick))
(beg (or beg (point-min)))
(end (or end (point-max)))
(host-parsers (list treesit-primary-parser))
(embed-level 0))
;; Handle function range settings here once. They don't participate
;; in the recursive update below.
(dolist (setting treesit-range-settings)
(when (functionp (car setting))
(funcall (car setting) beg end)))
(while (and host-parsers (< embed-level 4))
(cl-incf embed-level)
(let ((next-round-of-host-parsers nil))
(dolist (host-parser host-parsers)
(setq next-round-of-host-parsers
(append next-round-of-host-parsers
(treesit--update-range-1
beg end host-parser
treesit-range-settings embed-level))))
(setq host-parsers next-round-of-host-parsers)))
(treesit--cleanup-local-range-overlays modified-tick beg end)))