[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: |
Tue, 24 Dec 2024 09:17:33 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu) |
>>> A better solution IMO is to add some way to distinguish between named and
>>> anonymous nodes. I can think of two ways, either add “and” and
>>> “named/anonymous” predicate, so (and named “unless”) only matches the named
>>> “unless” node; or we add a special syntax such that “(unless)” only matches
>>> named nodes, and “\”unless\”” only matches anonymous nodes.
>>
>> Either predicate or a special syntax is welcome.
>>
>> This would be more handy than writing a lambda with implicit calls
>> of treesit-node-check.
>
> I’ll go with the (and named “unless”) route because after thinking
> about it more, “(unless)” will be hard to work with because the string
> predicate is actually a regexp.
Thanks. 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")'.
- 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/12
- bug#73404: 30.0.50; [forward/kill/etc]-sexp commands do not behave as expected in tree-sitter modes, Juri Linkov, 2024/12/12
- bug#73404: 30.0.50; [forward/kill/etc]-sexp commands do not behave as expected in tree-sitter modes, Eli Zaretskii, 2024/12/12
- bug#73404: 30.0.50; [forward/kill/etc]-sexp commands do not behave as expected in tree-sitter modes, Juri Linkov, 2024/12/13
- bug#73404: 30.0.50; [forward/kill/etc]-sexp commands do not behave as expected in tree-sitter modes, Eli Zaretskii, 2024/12/14
- bug#73404: 30.0.50; [forward/kill/etc]-sexp commands do not behave as expected in tree-sitter modes, Juri Linkov, 2024/12/14
- 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 <=
- 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, 2024/12/25
- 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