GNU bug report logs -
#62416
30.0.50; Symbols skipped in the navigation in ruby-ts-mode
Previous Next
Full log
View this message in rfc822 format
On 27/03/2023 19:29, Juri Linkov wrote:
>>> 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.
>
> This will break other cases, e.g.
>
> b = %Q{This is a "string"}
> c = %w!foo
> bar
> baz!
> d = %(hello (nested) world)
>
> when point is after "b", 'C-M-f' will move to "c" instead of the end of line.
That is because the string literals aren't recognized as sexps yet. Try
this:
diff --git a/lisp/progmodes/ruby-ts-mode.el b/lisp/progmodes/ruby-ts-mode.el
index d1034d467ab..c46247c747a 100644
--- a/lisp/progmodes/ruby-ts-mode.el
+++ b/lisp/progmodes/ruby-ts-mode.el
@@ -1129,8 +1129,11 @@ ruby-ts-mode
"block"
"do_block"
"begin"
- "binary"
- "assignment")))
+ "integer"
+ "simple_symbol"
+ "string"
+ "string_array"
+ )))
;; AFAIK, Ruby can not nest methods
(setq-local treesit-defun-prefer-top-level nil)
This bug report was last modified 2 years and 105 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.