GNU bug report logs -
#73404
30.0.50; [forward/kill/etc]-sexp commands do not behave as expected in tree-sitter modes
Previous Next
Reported by: Mickey Petersen <mickey <at> masteringemacs.org>
Date: Sat, 21 Sep 2024 05:13:01 UTC
Severity: normal
Merged with 74366
Found in version 30.0.50
Fixed in version 31.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
Full log
Message #127 received at 73404 <at> debbugs.gnu.org (full text, mbox):
>> Probably we could use just such heuristics that 'down-list' should skip
>> the first node of the balanced pair. This should work for most ts-modes.
>>
>> For example, for 'jsx_element' the first child to skip is 'jsx_opening_element'.
>> For 'argument_list' the first child to skip is an anonymous node "(".
>> For 'statement_block' the first child to skip is an anonymous node "{“.
>
> Yes, that should work for the vast majority of grammars. I can’t think
> of an counter example other than for_statment in tree-sitter-c.
Indeed, the 'for_statement' is a hard problem, and I see
no good solution. I already encountered in different languages
the same problem that you described:
> We might also want a way to jump from pair-open to pair-end. Going to
> pair-open’s parent’s end will be almost always correct. (Except for the
> grammars that do weird stuff, like tree-sitter-c’s for statement, the
> condition is not a node by itself, but split into opening parentheses,
> initializer, loop condition, increment, closing paren, all of which direct
> child of the for_statement, not grouped into a condition node.)
Maybe indeed worth to try defining pair-open and pair-end as
some children nodes of the 'for_statement', i.e. only the opening paren
and the closing paren. Something like (completely untested):
(and (member (treesit-node-text node) '("(" ")"))
(equal (treesit-node-type (treesit-node-parent node)) "for_statement"))
This bug report was last modified 131 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.