elixir-ts-mode
elixir-ts-mode copied to clipboard
`backward-up-list` always goes to the beginning of the first defmodule in the file
Hello,
I'm running emacs 29.3 with elixir-ts-mode 1.6 (freshly pulled from melpa at the time of writing this issue).
Problem
In a file, no matter where the cursor is positioned typing C-M-u
or M-x backward-up-list RET
will bring the cursor to the beginning of the topmost (not the module encapsulating the current position with the lowest level, just the one defined on the smallest line number) module definition.
Expected
The cursor should move up to the beginning of the current do block, or if at this position, to the beggining of the statement before that block. At least that's how it works in other languages. It should also move up lists, tuples and maps.
Example file
defmodule Foo do
def foo do
:foo
end
end
defmodule Bar do
def bar do
unless false do
:bar
end
end
end
Having my cursor on :foo
and invoking the command, I would expect it to jump to def foo |do
but it goes up to the first line, same on :bar,
goes all the way to the top instead of unless fasle |do
as I would expect.
treesit-beginning-of-defun
kind of works but it goes to the beginning of the line instead of the beginning of the indent. Also it only works with def
and defmodule
. Other block statements like if
, case
, cond
... are skipped, I guess this is expected since they're not function definitions.