tonini / alchemist.el

Elixir Tooling Integration Into Emacs
http://www.alchemist-elixir.org
906 stars 103 forks source link

Add a way to format on save if you are using elixir >= 1.6 #337

Open rockneurotiko opened 6 years ago

rockneurotiko commented 6 years ago

Elixir 1.6 is released! And it have the awesome formatter: https://github.com/elixir-lang/elixir/blob/v1.6.0/CHANGELOG.md

I think that it would be a great idea to be able to configure alchemist to format on save.

Cheers!

dylnclrk commented 6 years ago

Is there more complexity here than just adding an after-save-hook that runs mix format in the project root? (e.g., similar to how alchemist-hooks-test-on-save is implemented).

Based on what I see in mix-format.el, I'm guessing that there's some work to make sure all of the open buffers are updated to include changes from mix format.

BTW, @rockneurotiko you should consider checking out https://github.com/anildigital/mix-format.el, I haven't tried it out yet…

rockneurotiko commented 6 years ago

Yeah, it's an easy feature (Actually I made my own solution 3 months ago, not as good as mix-format but it works fine).

I just thinks that it would be great to have this official formatting added to this de-facto package for elixir, it would probably help newcomers to appreciate the formatter and write clean elixir (it happens on Go and Elm)