[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#74963: Ambiguous treesit named and anonymous nodes in ruby-ts-mode
From: |
Juri Linkov |
Subject: |
bug#74963: Ambiguous treesit named and anonymous nodes in ruby-ts-mode |
Date: |
Wed, 25 Dec 2024 09:52:33 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu) |
>> While addition of '(and named "unless")' would be appreciated,
>> I see that currently it's possible to do this by proving a predicate
>> like there is 'ruby-ts--sexp-p' in
>>
>> (setq-local treesit-thing-settings
>> `((ruby
>> (sexp ,(cons (rx
>> bol
>> (or
>> "class"
>> ...
>> )
>> eol)
>> #'ruby-ts--sexp-p))
>>
>> Then 'ruby-ts--sexp-p' could check for the named node "unless" as well.
>>
>> But it seems such solution is less efficient than adding '(and named
>> "unless")'.
>
> Given that we're already calling a predicate every time (in
> ruby-ts-mode), we might as well add one more check. See the patch at the
> end.
Thanks, I tried the patch. It was broken, so needed to edit manually.
Also the new key 'w' doesn't work in diff buffers, need to fix it as well.
> Speaking of tricky examples though, here's a definition:
>
> module Bar
> class Foo
> def baz
> end
> end
> end
>
> If you move point inside the keyword "module" or "class", C-M-f wouldn't
> move forward either as of the latest master. No such problem with "def".
>
> Adding the check for "named" fixes the first two cases, but then C-M-f
> inside "def" jumps to after "baaz". Could be worked around with a
> special case, but I wonder what this difference comes from (haven't
> properly debugged yet).
I see no problems with your patch. Everything works nicely.
- bug#73404: 30.0.50; [forward/kill/etc]-sexp commands do not behave as expected in tree-sitter modes, (continued)
- bug#73404: 30.0.50; [forward/kill/etc]-sexp commands do not behave as expected in tree-sitter modes, Juri Linkov, 2024/12/18
- bug#73404: 30.0.50; [forward/kill/etc]-sexp commands do not behave as expected in tree-sitter modes, Yuan Fu, 2024/12/18
- bug#74963: Ambiguous treesit named and anonymous nodes in ruby-ts-mode, Juri Linkov, 2024/12/19
- bug#74963: Ambiguous treesit named and anonymous nodes in ruby-ts-mode, Yuan Fu, 2024/12/23
- bug#74963: Ambiguous treesit named and anonymous nodes in ruby-ts-mode, Juri Linkov, 2024/12/24
- bug#74963: Ambiguous treesit named and anonymous nodes in ruby-ts-mode, Juri Linkov, 2024/12/24
- bug#74963: Ambiguous treesit named and anonymous nodes in ruby-ts-mode, Dmitry Gutov, 2024/12/24
- bug#74963: Ambiguous treesit named and anonymous nodes in ruby-ts-mode,
Juri Linkov <=
- bug#74963: Ambiguous treesit named and anonymous nodes in ruby-ts-mode, Dmitry Gutov, 2024/12/25
- bug#74963: Ambiguous treesit named and anonymous nodes in ruby-ts-mode, Juri Linkov, 2024/12/27
- bug#74963: Ambiguous treesit named and anonymous nodes in ruby-ts-mode, Juri Linkov, 2024/12/24
- bug#74963: Ambiguous treesit named and anonymous nodes in ruby-ts-mode, Yuan Fu, 2024/12/24
- bug#74963: Ambiguous treesit named and anonymous nodes in ruby-ts-mode, Juri Linkov, 2024/12/25
- bug#74963: Ambiguous treesit named and anonymous nodes in ruby-ts-mode, Yuan Fu, 2024/12/25
- bug#74963: Ambiguous treesit named and anonymous nodes in ruby-ts-mode, Juri Linkov, 2024/12/25
- bug#73404: 30.0.50; [forward/kill/etc]-sexp commands do not behave as expected in tree-sitter modes, Juri Linkov, 2024/12/19
- bug#73404: 30.0.50; [forward/kill/etc]-sexp commands do not behave as expected in tree-sitter modes, Juri Linkov, 2024/12/19
- bug#73404: 30.0.50; [forward/kill/etc]-sexp commands do not behave as expected in tree-sitter modes, Juri Linkov, 2024/12/24