* lisp/treesit.el (treesit--after-change): New function.
(treesit-major-mode-setup): Set 'outline-minor-mode-hook' to add 'treesit--after-change' with 'treesit-update-ranges' to 'after-change-functions' (bug#77256).
This commit is contained in:
parent
5e0daa1ef7
commit
bec2de2046
1 changed files with 14 additions and 1 deletions
|
@ -4068,6 +4068,10 @@ For BOUND, MOVE, BACKWARD, LOOKING-AT, see the descriptions in
|
|||
|
||||
level))
|
||||
|
||||
(defun treesit--after-change (beg end _len)
|
||||
"Force updating the ranges after each text change."
|
||||
(treesit-update-ranges beg end))
|
||||
|
||||
;;; Hideshow mode
|
||||
|
||||
(defun treesit-hs-block-end ()
|
||||
|
@ -4362,7 +4366,16 @@ before calling this function."
|
|||
(setq treesit-outline-predicate
|
||||
#'treesit-outline-predicate--from-imenu))
|
||||
(setq-local outline-search-function #'treesit-outline-search
|
||||
outline-level #'treesit-outline-level))
|
||||
outline-level #'treesit-outline-level)
|
||||
(add-hook 'outline-minor-mode-hook
|
||||
(lambda ()
|
||||
(if (bound-and-true-p outline-minor-mode)
|
||||
(add-hook 'after-change-functions
|
||||
#'treesit--after-change
|
||||
0 t)
|
||||
(remove-hook 'after-change-functions
|
||||
#'treesit--after-change t)))
|
||||
nil t))
|
||||
|
||||
;; Remove existing local parsers.
|
||||
(dolist (ov (overlays-in (point-min) (point-max)))
|
||||
|
|
Loading…
Add table
Reference in a new issue