Subject: Re: bug#67036: 30.0.50; treesit-forward-sexp not working properly in ruby-ts-mode

From: Juri Linkov <[email-masked]>
Date: Thu, 02 May 2024 09:29:41 +0300

close 67036 30.0.50
thanks

>>>>>>>>> +# C-M-f on '[' doesn't jump to after ']'
>>>>>>>>> +hash['key']
>>>>>>>>> +
>>>>>>>
>>>>>>> As discussed previously, there is no specific node which spans from [ to
>>>>>>> ]. Some custom code could probably be written (there *are* leaf nodes for [
>>>>>>> and ]), but the current capabilities of treesit-thing-settings don't offer
>>>>>>> a good way to plug that in.
>>>>>> Like for point inside strings, this might require more general changes
>>>>>> that take into account syntax tables.
>>>>>
>>>>> Possibly, but I expect a solution that doesn't use the syntax table would
>>>>> be tried first.
>>>> Since there is no available information from treesit, handling
>>>> treesit-forward-sexp inside strings/comments could forward to the syntax table
>>>> like `prog-fill-reindent-defun' forwards to `fill-paragraph'.
>>
>> Shouldn't treesit-forward-sexp provide a way for ts-modes to override
>> the default handling?  By default for all ts-modes such a hook could
>> check if point is inside strings/comments then to use syntax navigation.
>
> This is now implemented in bug#68993.  So here is the patch that 
> handles such cases as C-M-f jumping from '[' to ']' in
>
>   hash[:key]
>   hash['key']
>
> and from '{' to '}' in
>
>   "abc #{ghi} def"
>
> diff --git a/lisp/progmodes/ruby-ts-mode.el b/lisp/progmodes/ruby-ts-mode.el

I guess this patch was ok.  So I pushed it to master, and closed.
Anything could be adjusted later if needed.