Dmitry Gutov <dmitry@gutov.dev> writes:
On 27/11/2023 19:59, Wilhelm Kirschbaum wrote:
Here is a patch to address numerous issues flagged on Elixir
slack,
Github and in this thread. It will not be perfect, but since
the
changes are pretty large I want to get this in and then we can
pick on
specific issues afterwards if that makes sense?
Thank you. No problem, pushed to master.
Thanks! The code now seems to be properly highlighted. I've just
tested
the update and noticed that putting the `do' keyword on a
separate line
breaks indentation. Here's an example:
defmodule Foo
do # case A
@moduledoc """
Test module.
"""
defp a(x), do: a(x, 0)
defp a(x, y),
do: a(x, 0, 0) # case B
defp a(x, y, z)
do # case C
x + y + z
end
end
I have intentionally introduced incorrect indentation before the
first
`do' keyword (case A), but the matching `end' keyword was
indented
automatically when I called `indent-region' on the whole buffer.
The
case B seems to be indented incorrectly, the default formatter
would
indent such `do:' by just two spaces after the parent `defp'.
The third case C is similar to case A, except the indentation
was
provided by Emacs, meaning, after pressing the RET key before
the `do'
keyword, Emacs had put the keyword at the BOL. If there are no
`do'
after the closing parenthesis, the automatic indentation is
correct.
I'm not sure if these problems were introduced by the changes,
or were
present before, and if I should send a separeate bug report for
them, as
this isn't strictly related to highlighting, just with the
tree-sitter-based indentation.