Subject: bug#76693: [PATCH] Use TS to support 'hs-minor-mode' in 'lua-ts-mode'

From: Juri Linkov <[email-masked]>
Date: Mon, 03 Mar 2025 19:33:50 +0200

>> This changes the hs-minor-mode suppport to use tree-sitter list
>> things instead of regexps.
>
> * lisp/progmodes/lua-ts-mode.el (lua-ts-mode): Add list type to
> 'treesit-thing-settings'.

Coincidentally this is what I'm currently doing for all ts-modes
according to the principles agreed in bug#73404.

And it's nice to see that your changes are aligned with them.

There is no need to follow these principles since only you
as the author of the ts-mode decide what is suitable for this ts-mode.

But it would just make it easier for programmers in different languages
to switch between ts-modes that will meet their expectations.

I noticed only a few things that look like omission:

1. "arguments" and "parameters" are parenthesized expressions,
   but are missing in the 'list' setting;

2. "if_statement" without the anchors "\\`...\\'" (bos/eos in rx)
   matches "elseif_statement" too.  But unlike "if_statement",
   "elseif_statement" doesn't end with the "end" keyword
   (whereas "else_statement" doesn't end with "end" too
    but correctly excluded from matching);

3. Also would be nice to support '(forward-comment 1)'
   with something like (comment ,(rx bos "comment" eos))