emacs-devel
[Top][All Lists]
Advanced

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

Re: How to add pseudo vector types


From: Stephen Leake
Subject: Re: How to add pseudo vector types
Date: Mon, 26 Jul 2021 23:13:13 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (windows-nt)

Yuan Fu <casouri@gmail.com> writes:

>>> 
>>>> Once again, we are talking about the function used by TS to read
>>>> buffer text.  Not about the parser or its caller.  Low-level code,
>>>> which knows nothing about the context, should never look beyond the
>>>> restriction.
>>> 
>>> It doesn’t harm for tree-sitter to see the rest of the buffer, it
>>> doesn’t modify anything, all it does it reading the text. OTOH,
>>> restricting tree-sitter to the bounds of narrows adds complexity
>>> for no benefit (as far as I can see).
>> 
>> Which complexity does it add?  You just compare with BEGV_BYTE instead
>> of BEG_BYTE etc.
>
> We need to “delete” the hidden text and “re-insert” when we widen the
> buffer. I’ll try to make it a no-op as long as we remember to widen
> before calling tree-sitter to parse anything.

First, the only thing TS deletes is tree nodes, not text; it does not
have a copy of the buffer.

Why do you think we need to delete the tree nodes corresponding to the
hidden text? They provide exactly the context needed to parse the
visible text properly.

This assumes the narrowing is temporary, not for a multi-major-mode.

-- 
-- Stephe



reply via email to

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