GNU bug report logs - #61529
30.0.50; tree-sitter: weird off-by-one error but only in css-ts-mode(?) with `treesit-node-at'

Previous Next

Package: emacs;

Reported by: Mickey Petersen <mickey <at> masteringemacs.org>

Date: Wed, 15 Feb 2023 08:32:01 UTC

Severity: normal

Found in version 30.0.50

Fixed in version 29.1

Done: Dmitry Gutov <dgutov <at> yandex.ru>

Bug is archived. No further changes may be made.

Full log


Message #26 received at 61529 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Mickey Petersen <mickey <at> masteringemacs.org>,
 Theodor Thornhill <theo <at> thornhill.no>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 61529 <at> debbugs.gnu.org
Subject: Re: bug#61529: 30.0.50; tree-sitter: weird off-by-one error but only
 in css-ts-mode(?) with `treesit-node-at'
Date: Thu, 16 Feb 2023 23:26:06 +0200
On 15/02/2023 21:01, Mickey Petersen wrote:
> I read and interpreted it to mean that due to how node boundaries work
> that "*end is at*  or after POS" to mean that point is wholly contained
> in the node "(" which, due to how tree-sitter determines node extents,
> it technically isn't.
> 
> But I think it's fair enough if this is intentional -- I've no real
> suggestions for improving its behaviour if this is intended. So if
> it's working as expected, then it's safe to close the issue.

The difference in this case is due to the tree structure:

In '210deg', (integer_value) is not a leaf node. The only leaf node it 
has inside is (unit), and that one starts 3 characters later.

In '255', however, (integer_value) *is* a leaf node. And since 
treesit-node-at looks for leaf nodes, it stops at "(" as documented.

I'd probably calls it a problem with the grammar, but it doesn't seem 
likely to be fixed, backward compatibility and all.




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

Previous Next


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