elixir-editors / emacs-elixir

Emacs major mode for Elixir
446 stars 94 forks source link

incorrect indentation if do is on its own line #469

Open andreyorst opened 3 years ago

andreyorst commented 3 years ago

The following code:

defmodule Example do
  def foo0
  do
    "0"
  end

  def foo1
  do
    "1"
  end

  def foo2
  do
    "2"
  end
end

Is indented like this:

image

I know that do on its own line is not very common, but indentation should not grow with each definition

jsmestad commented 3 years ago

Oh that is interesting 🤔

jsmestad commented 3 years ago

I just hit this today writing some code so it definitely is a bug to fix. In my case I had a long line that caused this:

  def create_authorization_request(client_id, now \\ DateTime.utc_now()) 
    when is_binary(client_id) do
andreyorst commented 1 year ago

The elixir-ts-mode package handles this case properly. I see there are plans for tree sitter support in #494 so I guess this can be closed once it's there.