Whoops, sorry, I missed that part
For formatting, install Elixir Formatter, and add/change the .formatter.exs
file in your project root to this:
[
import_deps: [:ecto, :phoenix],
plugins: [Phoenix.LiveView.HTMLFormatter],
inputs: ["*.{ex,exs}", "priv/*/seeds.exs", "{config,lib,test}/**/*.{ex,exs}"],
subdirectories: ["priv/*/migrations"]
]
The Elixir Formatter plugin will run mix format
on your project, so you will get more formatting than just the heex templates. You may need to configure the VSCode settings to format on save. The Phoenix.LiveView.HTMLFormatter
plugin in .formatter.exs
teaches your formatter how to handle heex. I hope this gets you going
Edit: ElixirLS can format without any additional extensions installed, but you may need to set it as the default formatter and enable the editor.formatOnSave
VSCode setting