GNU bug report logs - #62416
30.0.50; Symbols skipped in the navigation in ruby-ts-mode

Previous Next

Package: emacs;

Reported by: Boško Ivanišević <bosko.ivanisevic <at> gmail.com>

Date: Fri, 24 Mar 2023 12:38:02 UTC

Severity: normal

Found in version 30.0.50

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

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Juri Linkov <juri <at> linkov.net>
Cc: Boško Ivanišević <bosko.ivanisevic <at> gmail.com>, 62416 <at> debbugs.gnu.org
Subject: bug#62416: 30.0.50; Symbols skipped in the navigation in ruby-ts-mode
Date: Sun, 26 Mar 2023 05:14:35 +0300
On 25/03/2023 21:04, Juri Linkov wrote:
>>> Navigating word forward/backward skips the Ruby symbol in the ruby-ts-mode.
>>> Adding "simple_symbol" to the treesit-sexp-type-regexp is fixing it.
>>>     (setq-local treesit-sexp-type-regexp
>>>                 (regexp-opt '("class"
>>>                               "module"
>>>                               "method"
>>>                               "argument_list"
>>>                               "array"
>>>                               "hash"
>>>                               "parenthesized_statements"
>>>                               "if"
>>>                               "case"
>>>                               "when"
>>>                               "block"
>>>                               "do_block"
>>>                               "begin"
>>>                               "binary"
>>>                               "simple_symbol" ;; <-- missing
>>>                               "assignment")))
>>
>> Juri, what do you think?
>>
>> In the context of your previous feedback regarding sexp navigation in
>> ruby-ts-mode.
> 
> This is fine.

Good. Let's push it into master.

> But anyway I think in its current state
> treesit-sexp-type-regexp is underdesigned as noted in
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=62238#59
> so no tweaking could fix its design flaws.  For example,
> 
>    foo = {
>      a: b
>    }
> 
> when point is on the left curly bracket, 'C-M-f C-M-b' doesn't
> move back to the original position, etc.

Hm, yeah, it's a little unexpected that not only it doesn't move back 
exactly, it skips the full assignment expression in both directions.

What is the downside of dropping "binary" and "assignment" from 
treesit-sexp-type-regexp, added there not too long ago? Without 
"assignment" there, your example becomes a round-trip.

BTW, we should wrap the regexp with \`...\'. It currently does substring 
matching, that's why it also matches "identifier" (which should probably 
be added too).




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

Previous Next


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