question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Formatting on save does not work with heex files.

See original GitHub issue

The 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:closed
  • Created a year ago
  • Reactions:1
  • Comments:14

github_iconTop GitHub Comments

9reactions
benvpcommented, Aug 19, 2022

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)

git clone --depth 1 --branch master https://github.com/elixir-lsp/elixir-ls.git ~/elixir_ls
cd ~/elixir_ls
mix deps.get
mix elixir_ls.release -o ~/.vscode/extensions/jakebecker.elixir-ls-0.11.0/elixir-ls-release/
4reactions
dviccommented, Jun 21, 2022
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found