Tree-sitter: only update range and reparse for changed ranges
In the very beginning, there's bug#66732, to solve that bug, we added
treesit--pre-redisplay and treesit--syntax-propertize-notifier.
However, to fix bug#66732, we were updating ranges for the whole
buffer which makes Emacs extremely slow when there are a lot of local
parsers in a large buffer. Then to solve that we introduced a
workaround where we only update ranges in a fixed range around point.
This change fixes the original problem (bug#66732) without using that
workaround.
* lisp/treesit.el (treesit--font-lock-notifier):
(treesit--syntax-propertize-notifier): Remove functions
(treesit--pre-redisplay): Use the new function
treesit-parser-changed-ranges to get the changed ranges of the primary
parser, and only update ranges for those ranges. Plus do the work of
the removed function.
(treesit-major-mode-setup): Remove setup for the removed functions.
(cherry picked from commit
f62c1b4cd00e5b2f1cdc94796cf55d006c3113eb)