GNU bug report logs -
#76788
treesit-thing-settings for elixir-ts-mode
Previous Next
Reported by: Juri Linkov <juri <at> linkov.net>
Date: Thu, 6 Mar 2025 18:18:01 UTC
Severity: wishlist
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 #24 received at 76788 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On Tue, Apr 15, 2025 at 7:37 PM Juri Linkov <juri <at> linkov.net> wrote:
> > 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.
>
In Elixir
def foo(bar), do: bar
is pretty much the same as
(defun foo (bar) bar)
So I think the original implementation is more natural to Emacs users, and
yes there is one slight downside, but at the cost of a multitude of
improvements for navigation. The majority of users I got feedback from
prefer how the new forward-sexp works. The smie-based sexp hardly worked in
any expected way as well. Look at how ruby-mode works with navigation ( I
have not tried ruby-ts-mode ), as it also properly treats def end blocks as
sexps.
>
> 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.
>
I understand that, but this is one case where it is slightly inconvenient,
for any other block in elixir it is impossible to navigate around now.
>
> > 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.
>
How do I enable this? Is this a new setting? Will it make the navigation
work as before?
[Message part 2 (text/html, inline)]
This bug report was last modified 86 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.