Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow :MixFormat command to run on eelixir filetype #43

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sbennett33
Copy link

Overview

With the heex formatter being added to LiveView it would be helpful to allow this plugin to run on those filetypes.

Connects #42

Notes

  • Until the new version of LiveView is released with this plugin built in you'll need to manually add it to your Elixir project: {:heex_formatter, github: "feliperenan/heex_formatter"}
  • If using the vim-elixir plugin, the filetype for *.heex files (should) be set to eelixir.
  • This PR targets eelixir files. I could also see adding support specifically for heex filetype since that is the filetype that gets detected when not using the vim-elixir plugin.

Testing Instructions

  • Update your .formatter.exs to support .heex files
  • Open a *.heex template in a new buffer
  • Ensure the :MixFormat command is available and works as expected

@EasterPeanut
Copy link

EasterPeanut commented Jun 7, 2022

Nothing to do with this PR, but I thought it might be useful for people who stranded here trying to get their .heex files formatted on save.

Ale has a fixer for (e)elixir. So I followed these steps: https://hexdocs.pm/phoenix_live_view/Phoenix.LiveView.HTMLFormatter.html and then in my vim config I added:

Plug 'dense-analysis/ale'
let g:ale_fixers = {
\ 'elixir': ['mix_format'],
\ 'eelixir': ['mix_format'],
\ 'scss': ['stylelint'],
\ 'css': ['stylelint'],
\ 'javascript': ['eslint'],
\ 'ruby': ['rubocop']

\}
let g:ale_fix_on_save = 1

@nathanl
Copy link

nathanl commented Mar 8, 2023

Came here to make this exact PR. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants