Formatting on save does not work with heex files.
See original GitHub issueThe auto formatter does not work on heex
files, even after setting up the configuration in my project correctly and adding the elixir-ls plugin as the default formatter in settings.json
. If I run a mix format
in the terminal, the heex
files are formatted.
# .formatter.exs
[
import_deps: [:ecto, :phoenix],
plugins: [Phoenix.LiveView.HTMLFormatter],
inputs: ["*.{heex,ex,exs}", "priv/*/seeds.exs", "{config,lib,test}/**/*.{heex,ex,exs}"],
subdirectories: ["priv/*/migrations"]
]
# settings.json
"[phoenix-heex]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "JakeBecker.elixir-ls"
},
Is this expected? Is it something to implement on the vscode-elixir-ls level?
Environment
- Elixir & Erlang versions (elixir --version): Erlang/OTP 24, Elixir 1.13.4
- VSCode ElixirLS version: 0.9.0
- Operating System Version: macOS Monterey 12.1 (M1)
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:14
Top Results From Across the Web
a Formatter for Heex templates - Questions / Help - Elixir Forum
I was trying to run it on that heex file. LiveView 0.17.6. Elixir 1.12.1 mix format failed for file: lib/test_crm_web/live/customer_live/index.
Read more >Formatting Phoenix HEEx Templates in VS Code
A modern, straightforward way to auto-format HEEx templates in VS Code.
Read more >Prettier not formatting HTML files in VS Code - Stack Overflow
I had a lot of problems with getting Prettier to format on save. It turned out to be an issue with the default...
Read more >Phoenix LiveView v0.18.3 - HexDocs
Compartmentalize state, markup, and events in LiveView. LiveView supports two extension mechanisms: function components, provided by HEEx templates, and ...
Read more >Using Format commands to change output view - PowerShell
Each object type in PowerShell has default properties that are used when you don't select the properties to display. Each cmdlet uses the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just in case anybody wonders how to compile the current master, try this little snippet:
(Remember to change the version to the current VSCode extension version. Currently
v0.11.0
)https://github.com/elixir-lsp/elixir-ls/pull/690 just got merged… 🥳