Is there any code formatting helper similar to Elm Format in Elixir?

I was watching this video on Elm and came across this feature: Elm Format.

Please is there a similar helper for any of the IDEs/ code editors that support Elixir?

Presently i’m using Sublime-Text-3 with two popular add-ons for Elixir, but neither enforces code formatting, or offers re-formatting.

3 Likes

I’ve got Spacemacs with the Alchemist package and it does this. At least for stuff like case do it automatically indents the condition for each block.

2 Likes

I could not get Spacemacs to work on windows. will try that again.

1 Like

Yeah, thats a hard one. I have two possible solutions: disable certificate checks in your ~/.spacemacs-file or change all ELPA-repositories to their HTTP counterparts instead of HTTPS. If one of these doesn’t work, the other one won’t work as well though.

If it does not work, please do provide debug info (start emacs with --debug-init-flag*).

*: Maybe it has been --init-debug, I’m not sure right now and only on a slow mobile data plan

1 Like

Hi all!

I wrote a bunch of Elm and Rust over the last half year, and now that I’m back writing a lot of Elixir I find myself really missing the formatters availible for those languages. To try and resolve this problem I’ve been working on a similar formatter for Elixir.

It doesn’t have a command line interface yet, and there’s more work to do on the output style, but it’s getting there.

Thought you might find it interesting, seems relevant to this thread at least (thus the necro-post) :slight_smile:

9 Likes

Oooo, I’d always considered making a formatter by using the AST as a generic back-end storage for it then formatting it back out again. Glad to see someone beat me to it, I don’t have the time! ^.^

You should make a mix task so we can just call mix exfmt <filepath(s)> or something. :slight_smile:

2 Likes

FWIW, I think Elixir code formatter is one of the projects for this year’s GSoC https://summerofcode.withgoogle.com/projects/#5205518009237504

1 Like

That’s the plan @OvermindDL1, just wanted to get it mostly working first. I think I’m close to a first interactive version :slight_smile:

I’ve just learnt about this project today. Hoping to hear from them later, perhaps we can collaborate.

2 Likes