Subject: bug#76788: treesit-thing-settings for elixir-ts-mode

From: Juri Linkov <[email-masked]>
Date: Tue, 15 Apr 2025 20:30:34 +0300

>     Previously C-M-f jumped from "def" to "end":
>
> Yes, this is desired. The expression starts with "def" and the do -> end is
> just an argument to the "def" macro.  
>
>       def fun(a) do
>       end
>
>     The change is to jump only from "do" to "end" like in other ts-modes.
>
> Why is this better?

Because otherwise there is no easy way to navigate to the function name
and its arguments.  There were many complaints that unlike smie-based sexp
now tree-sitter jumps too far directly to the end of functions.
So sadly an idealistic promise of tree-sitter doesn't fit perfectly
into the real world.

For many years I used elixir-mode before switching to elixir-ts-mode.
And it caused a minor disruption by the inability to move to the
function name and arguments as before in elixir-mode.

> The one huge advantage that elixir-ts-mode brought to
> the table was to navigate between functions, the existing elixir-mode could
> not get this right. 

The new command 'treesit-cycle-sexp-type' keeps this advantage
while allowing the users to toggle the traditional behavior
where C-M-f moves over the arguments.

> Before the changes it is possible to navigate or kill the next x functions,
> now it is unpredictable. The Elixir grammar is a bit more complicated than
> most other languages unfortunately. 

This is still possible with 'treesit-cycle-sexp-type'.