[Top][All Lists]

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

Re: How to add pseudo vector types

From: Eli Zaretskii
Subject: Re: How to add pseudo vector types
Date: Sat, 17 Jul 2021 10:18:57 +0300

> From: Yuan Fu <casouri@gmail.com>
> Date: Fri, 16 Jul 2021 23:12:00 -0400
> Cc: emacs-devel@gnu.org
> Another way I thought about is to only “expose” the portion of buffer from 
> BOB to some point to tree-sitter. And when a user asks for a parse tree, he 
> also specifies to which point of the buffer he needs the parse tree for. For 
> example, for fortification, jit-lock only needs the tree up to the end of the 
> visible window. And for structure editing, asking for the portion up to 
> window-end + a few thousand characters might be enough.

Yes, I think we should only ask TS to parse what we need, not more.

> However this heuristic could have problems in practice. (Maybe a giant 
> comment section of thousands of characters follows, and instead of jumping to 
> the end of it, we wrongly jump to middle of that comment section, because 
> tree-sitter only “sees” to that point.) So I don’t know if it’s a good idea.

It's definitely a good idea that should be pursued.  Even if in some
specific situation you'd need to pass to TS a large part of buffer
text, it will help in the other cases.

reply via email to

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