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

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

bug#59415: 29.0.50; [feature/tree-sitter] c-ts-mode fails to fontify a p


From: Yuan Fu
Subject: bug#59415: 29.0.50; [feature/tree-sitter] c-ts-mode fails to fontify a portion of a large C file
Date: Mon, 21 Nov 2022 08:53:25 -0800


> On Nov 21, 2022, at 7:15 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> From: Yuan Fu <casouri@gmail.com>
>> Date: Sun, 20 Nov 2022 17:27:16 -0800
>> Cc: Eli Zaretskii <eliz@gnu.org>,
>> 59415@debbugs.gnu.org
>> 
>> I pushed a change that uses treesit-node-on. Now scrolling in most parts of 
>> the buffer is pretty fast. Scrolling around 194770 is still laggy, because 
>> the node we get from treesit-node-on is still too large. I tried some 
>> heuristics but they didn’t work very well, IMO because tree-sitter couldn’t 
>> parse that part of the code very well. The code should observe a structure 
>> like {{}, {}, {}, {}, {}, …} where there are tens thousands of inner 
>> brackets, so ideally we only need to grab the {}’s in the region we want to 
>> fontify. But tree-sitter seems to understand it in some weird structure and 
>> we still end up with very large nodes, which is far larger than the region 
>> we want to fontify and is slow to query.
>> 
>> I’ll try to improve it further in the future, but for now I think it’s good 
>> enough (because in most cases fontification is pretty fast).
> 
> Agreed.
> 
> Thanks, I think we can close the bug now.
> 
> What do you think about enlarging treesit-max-buffer-size as I proposed
> up-thread?

Yeah we should do it, but to what value though? 40MB?

Yuan






reply via email to

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