[Top][All Lists]

[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: Sat, 24 Jul 2021 02:33:21 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (windows-nt)

Yuan Fu <casouri@gmail.com> writes:

>>> +  // TODO BUF_ZV_BYTE?
>> Do you want to discuss this?  I'd prefer to have it the other way
>> around: use BUF_ZV_BYTE by default.  The callers could widen the
>> buffer if they needed to access outside of the narrowing.
> Yes, I meant to discuss this. The problem with respecting narrowing is
> that, a user can freely narrow and widen arbitrarily, and Emacs needs
> to translate them into insertion & deletion of the buffer text for
> tree-sitter, every time a user narrows or widens the buffer. 

I don't think that's the right thing to do. tree-sitter should always
have a tree that represents the entire buffer; if the user narrows,
edits will only affect the narrowed region, but tree-sitter won't notice
that, and won't care.

In particular, that means buffer positions reported by tree-sitter will
match emacs buffer positions.

> Plus, if tree-sitter respects narrowing, it could happen where a user
> narrows the buffer, the font-locking changes and is not correct
> anymore. Maybe that’s not the user want. 

Exactly. The indent will be wrong, too, if narrowing excludes a
containing block.

-- Stephe

reply via email to

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