bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#66732: tree-sitter fontification doesn't update multi-line syntax re


From: Stefan Monnier
Subject: bug#66732: tree-sitter fontification doesn't update multi-line syntax reliably
Date: Sat, 16 Dec 2023 12:11:07 -0500
User-agent: Gnus/5.13 (Gnus v5.13)

> Hmm... This `put-text-property` can't be right.
> Can you trace `font-lock-fontify-region` and
> `font-lock-default-fontify-region` to check that they correctly return
> the proper (extended) bounds of the region they (re)fontified?

BTW, using the extend-region-function isn't ideal: this is meant for
things which can't be refontified separately, so if a change in the
buffer causes notification to make changes over a large portion of the
buffer we'll end up (re)fontified *right away* that whole large
portion even if only a small part (or even no part at all) is displayed.

IOW, it'd be better to mark the changed chunks with this
`put-text-property`, but to do it before jit&font-lock get triggered.

Basically, we'd like to call it from `after-change-functions`, but this
can be called *many* times within a single command, so we want to delay
it.  So we can probably just set a flag that says "there are unprocessed
changes" and then sprinkle calls to a "lazy update" function which
checks this flag before calling `treesit--font-lock-notifier` (or
something similar).

One of the places where we'd need the sprinkle would be
`pre-redisplay-functions`.  Another one might be `syntax-ppss`?


        Stefan






reply via email to

[Prev in Thread] Current Thread [Next in Thread]