Subject: Re: bug#73404: 30.0.50; [forward/kill/etc]-sexp commands do not behave as expected in tree-sitter modes

From: Juri Linkov <[email-masked]>
Date: Wed, 25 Dec 2024 09:44:09 +0200

>> For html-ts-mode a list node is "element", and the node to skip
>> is "tag".  So for example:
>> 
>> -!-text <html></html>
>> 
>> 'C-M-f' will use node "element" to move to the beginning of "element":
>> 
>> text -!-<html></html>
>> 
>> then to get inside also need to skip the <html> tag:
>> 
>> text <html>-!-</html>
>
> Right, the thing navigation only supports going up/outside, but not going
> down/inside. We can add a new thing for beginning and end of balanced
> pairs. Then down-list will be going from the start of a balanced-pair-open
> to the end of it. Up-list will be going from the start of
> a balanced-pair-close to the end of it.

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 "{".