Subject: Re: bug#62333: 30.0.50; Issue with tree-sitter syntax tree during certain changes

From: Gregory Heytings <[email-masked]>
Date: Mon, 27 Mar 2023 08:24:42 +0000

>>>> Again, I'm talking about using a parser library.  We may need to 
>>>> introduce a way of limiting the parser to a certain range of buffer 
>>>> text positions, independently of narrowing.
>>> 
>>> Except it's already limited by narrowing.
>> 
>> Which is a fragile, semi-broken means, as we all know.
>
> What is a broken mess, is user-level narrowing. And how the downstream 
> code can never guess the purpose the narrowing was applied for.
>

Note that this is what labeled narrowings attempts to solve.  It's perhaps 
not the best way to deal with code that has existed for a long time 
(because such code is not prepared to handle that kind of narrowing 
gracefully), but I don't see why it couldn't be used in new code/modes 
such as tree-sitter ones.  It is independent of user-level narrowing, and 
downstream code can act differently depending on the reason for which the 
narrowing was applied.