elixir-editors / emacs-elixir

Emacs major mode for Elixir
446 stars 94 forks source link

Indentation with a guard on a new line #488

Open Nondv opened 2 years ago

Nondv commented 2 years ago

If I just write code naturally and indent everything:

def func(x)
when x.y = 1 do
  abc
end

After elixir-format:

def func(x)
    when x.y = 1 do
  abc
end

and now when I add something after the function, the indentation breaks:

def func(x)
    when x.y = 1 do
  abc
end

    def id(x) do
      x
    end

also, shouldn't the mode's formatting be at least a little bit similar to the format tool?

jsmestad commented 2 years ago

I hit this myself today with the exact same situation 😞

taylor-gl commented 2 years ago

Also happens for me