GNU bug report logs - #62333
30.0.50; Issue with tree-sitter syntax tree during certain changes

Previous Next

Package: emacs;

Reported by: Wilhelm Kirschbaum <wkirschbaum <at> gmail.com>

Date: Tue, 21 Mar 2023 14:15:01 UTC

Severity: normal

Found in version 30.0.50

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: wkirschbaum <at> gmail.com, casouri <at> gmail.com, 62333 <at> debbugs.gnu.org
Subject: bug#62333: 30.0.50; Issue with tree-sitter syntax tree during certain changes
Date: Sat, 25 Mar 2023 15:34:26 +0300
> Date: Sat, 25 Mar 2023 03:51:48 +0200
> Cc: Wilhelm Kirschbaum <wkirschbaum <at> gmail.com>, 62333 <at> debbugs.gnu.org
> From: Dmitry Gutov <dgutov <at> yandex.ru>
> 
> On 24/03/2023 09:34, Yuan Fu wrote:
>  > Well, this is a bit embarrassing, there is even a comment warning 
> this mistake, but anyway, I pushed a fix, once it gets merged into 
> master, the problem should go away.
> 
> Excellent, thanks.
> 
> > As things stands right now, every time blink-match-open blinks the matching parenthesis, tree-sitter would reparse the buffer twice, that’s not exactly ideal. Blink-match-open’s use of narrowing is legit, and we can’t just automatically widen in tree-sitter functions.
> 
> Not ideal indeed.
> 
> Aside from the performance impact, we could also see cases where the 
> "narrowed" parse tree contains errors (due to incomplete code) which 
> make the tree itself less useful. Especially when the narrowing's end is 
> closer to the current position than in blink-matching-open's usage.
> 
> Not sure how to solve that, but suppose we had a way to convey to 
> treesit.c that it shouldn't change the visibility bounds for the parser 
> in this particular instance? Though that would raise the issue of code 
> trying to use node positions beyond the current accessible range.

Exactly.  Which is why I don't think this is the right way.

Is there any real reason blink-matching-open narrows the buffer?  If
we could remove that narrowing, the problem with the parser's taking
notice of it would be gone.




This bug report was last modified 2 years and 77 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.