|
From: | Dmitry Gutov |
Subject: | Re: treesitter local parser: huge slowdown and memory usage in a long file |
Date: | Tue, 13 Feb 2024 02:50:20 +0200 |
User-agent: | Mozilla Thunderbird |
On 12/02/2024 06:16, Yuan Fu wrote:
Thanks, the culprit is the call to treesit-update-ranges in treesit--pre-redisplay, where we don’t pass it any specific range, so it updates the range for the whole buffer. Eli, is there any way to get a rough estimate the range that redisplay is refreshing? Do you think something like this would work?
If we don't update the ranges outside of some interval surrounding the window, what does that mean for correctness?
Perhaps the mode has a syntax-propertize-function which behaves differently (as it should) depending on the language at point. Or different ranges have different syntax tables, something like that.
If the ranges, after some edit (perhaps a programmatic one, performed far from the visible area), are kept not update somewhere around the beginning of the buffer, do we not risk confusing the syntax-ppss parser, for example?
Come to think of it, take treesit-indent: it only updates the ranges for the current line. But the line's indentation usually depends on the previous buffer positions, doesn't it?
[Prev in Thread] | Current Thread | [Next in Thread] |