emacs-bug-tracker
[Top][All Lists]
Advanced

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

bug#61529: closed (30.0.50; tree-sitter: weird off-by-one error but only


From: GNU bug Tracking System
Subject: bug#61529: closed (30.0.50; tree-sitter: weird off-by-one error but only in css-ts-mode(?) with `treesit-node-at')
Date: Fri, 17 Feb 2023 15:12:02 +0000

Your message dated Fri, 17 Feb 2023 17:11:02 +0200
with message-id <89b3f998-e4ba-2270-4dfc-bbe758eaf0a1@yandex.ru>
and subject line Re: bug#61529: 30.0.50; tree-sitter: weird off-by-one error 
but only in css-ts-mode(?) with `treesit-node-at'
has caused the debbugs.gnu.org bug report #61529,
regarding 30.0.50; tree-sitter: weird off-by-one error but only in 
css-ts-mode(?) with `treesit-node-at'
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
61529: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=61529
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: 30.0.50; tree-sitter: weird off-by-one error but only in css-ts-mode(?) with `treesit-node-at' Date: Wed, 15 Feb 2023 08:25:53 +0000
Here's a strange one.

I don't know where to point the finger here exactly, but I think
`treesit-node-at' might have a small bug in it somewhere.


Consider this `css-ts-mode' code:

    a {
      background: linear-gradient(|210deg, rgba(255,82,41,1) 0%, 
rgba(251,165,85,1) 54%, rgba(163,73,73,1) 100%);
    }

Let | be point.

Engage `treesit-inspect-mode' and you'll see it asserts that point is
at '('. OK, so that could easily be a glitch in that implementation,
but let's probe further.

With point at '2', then I'd expect `treesit-node-at' to yield that node. But it 
does not:

(cons (point) (treesit-node-at (point)))

=> (34 . #<treesit-node "(" in 34-35>)

Move back one point

(cons (1- (point)) (treesit-node-at (1- (point)))) 
 
=> (35 . #<treesit-node "(" in 34-35>)

Move *forward* one and it does, but it gives us `unit' but I'd expect
`integer_value` as per the explorer (and indeed the tree.)

(cons (1+ (point)) (treesit-node-at (1+ (point))))

=> (36 . #<treesit-node unit in 38-41>)

Again but with the TS implementation `treesit-node-on`:

(cons (point) (treesit-node-on (point) (point)))

=> (35 . #<treesit-node integer_value in 35-41>)

And now we get the right node.







--- End Message ---
--- Begin Message --- 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: Fri, 17 Feb 2023 17:11:02 +0200 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2
Version: 29.1

On 17/02/2023 08:16, Eli Zaretskii wrote:
Date: Thu, 16 Feb 2023 23:34:58 +0200
Cc: Eli Zaretskii<eliz@gnu.org>,61529@debbugs.gnu.org
From: Dmitry Gutov<dgutov@yandex.ru>

+If no such node is found, but a leaf node ends at POS, it's
+returned.
Passive tense alert!  This is better:

   If no such node exists, but there's a leaf node which ends at POS,
   return that node.

Thank you, pushed. With that, I'm closing the report.


--- End Message ---

reply via email to

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