Oh! What a pleasure it is to watch the ugly HTML snippets written inside the ~H sigil to be formatted on save in VS Code. Thanks a lot @josevalim .
One question though. html.heex files are not getting formatted automatically. I am running mix format still. Is it file association the issue? Should I be adding heex files also to be elixir files now?
I am using VS Code and for elixir support I am using elixir-lsp/vscode-elixir-ls: (github.com) and under the hood vscode-elixir-ls (github.com) is used.
So, the regular elixir code was getting formatted on save, if we set editor.formatOnSave=true in the VS Code settings. Even after the release of elixir 1.13, the sigils and the heex files are not getting formatted. I have asked in the vscode-elixir-ls repository How does this format the file? · Discussion #224 · elixir-lsp/vscode-elixir-ls (github.com) a question regarding this. @axelson has been very receptive and responded back. An issue Feature Request: Support mix format plugins · Issue #660 · elixir-lsp/elixir-ls (github.com) to this effect has been created as well. The main issue of contention has been elixir-ls does not use mix format but uses its own function.
However, with the release of elixir 1.13.3 suddenly, the formatting in the ~H sigil started working in all *.ex files.
I think the reason heex files are not getting formatted because they are not associated with elixir-ls extension. If they are, most likely, they also will be getting automatically formatted.
I do think not just vs-code, all the editors elixir-lsp/elixir-ls: (github.com) listed here should get the benefit of automatic formatting.
Thank you Jose and team! We are running 1.13.3 on prod now and all good on our end. We love Elixir, crazy I been using it since 2016 over a stranger on reddit just giving away a ticket to Orlando’s elixirconf. He radically changed my life and he probably doesn’t even know it.
Is there an .heex formatter now? I got excited reading this thread, but it doesn’t appear to work out of the box, and I can’t find any documentation or sign of a formatter plugin in the Phoenix repo.