<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="251450" data-post-id="251450">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="cchauche" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  cchauche
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Wanted to update folks on a solution that worked for me to get VSCode to automatically format my HEEX code. I was able to use an extension called <a href="https://marketplace.visualstudio.com/items?itemName=animus-coop.vscode-elixir-mix-formatter" rel="noopener nofollow ugc">Elixir Mix Formatter</a> and then set that as the default formatter for my elixir and heex files.  I am now getting automatic formatting on save as well as the option to save without formatting.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="251450" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/heex-formatter-a-formatter-for-heex-templates/45649/34">Post #33</a>
	                </div>
	            </div>
              <div id="likers-container-251450" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="251450"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #33"></div>
  </section>
</div>
    <div class="postbit" id="253388" data-post-id="253388">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="ryanjafari" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/ryanjafari/120/26823_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  ryanjafari
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Thanks! Your recommendation is what I went with after trying all the options in this thread. <a href="https://marketplace.visualstudio.com/items?itemName=animus-coop.vscode-elixir-mix-formatter" rel="noopener nofollow ugc">Elixir Mix Formatter</a> for VSCode uses <code>mix format</code> for my <code>.heex</code> and <code>.ex, .exs</code>. The key pieces of config seem to be:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">"[elixir]": {
    "editor.defaultFormatter": "animus-coop.vscode-elixir-mix-formatter",
},
"[phoenix-heex]": {
    "editor.defaultFormatter": "animus-coop.vscode-elixir-mix-formatter"
},
</code></pre>
<p>…in VSCode <code>settings.json</code> and…</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">[
  plugins: [Phoenix.LiveView.HTMLFormatter],
  inputs: ["*.{heex,ex,exs}", "priv/*/seeds.exs", "{config,lib,test}/**/*.{heex,ex,exs}"],
  import_deps: [:ecto, :phoenix],
  subdirectories: ["priv/*/migrations"]
]
</code></pre>
<p>in <code>.formatter.exs</code>.</p>
<p>I also setup the <a href="https://github.com/paulanthonywilson/elixir-mix-format-pre-commit-hook/blob/master/pre-commit" rel="noopener nofollow ugc">pre-commit git hook</a> for <code>mix format</code> recommended by <a class="mention" href="/u/jaimeiniesta" rel="nofollow">@jaimeiniesta</a>. You can manage that hook and share it with your teammates in version control by creating a <code>.githooks</code> folder at the project root and <code>git config core.hooksPath .githooks</code>. To ensure everyone formats! <img src="https://forum.elixirforum.com/images/emoji/apple/grinning.png?v=15" title=":grinning:" class="emoji" alt=":grinning:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="253388" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/heex-formatter-a-formatter-for-heex-templates/45649/35">Post #34</a>
	                </div>
	            </div>
              <div id="likers-container-253388" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="253388"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #34"></div>
  </section>
</div>
    <div class="postbit" id="259624" data-post-id="259624">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="zenw0lf" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/zenw0lf/120/3716_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  zenw0lf
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Seems like today the only thing you need is <a href="https://github.com/elixir-lsp/elixir-ls" class="inline-onebox" rel="noopener nofollow ugc">GitHub - elixir-lsp/elixir-ls: A frontend-independent IDE "smartness" server for Elixir. Implements the "Language Server Protocol" standard and provides debugger support via the "Debug Adapter Protocol" · GitHub</a> and edit your <code>.formatter.exs</code> to:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">[
  import_deps: [:ecto, :phoenix],
  plugins: [Phoenix.LiveView.HTMLFormatter],
  inputs: ["*.{heex,ex,exs}", "priv/*/seeds.exs", "{config,lib,test}/**/*.{heex,ex,exs}"],
  subdirectories: ["priv/*/migrations"]
]
</code></pre>
<p>As for VSCode <code>settings.json</code>:</p>
<pre data-code-wrap="json"><code class="lang-json">  "[phoenix-heex]": {
    "editor.defaultFormatter": "JakeBecker.elixir-ls",
    "editor.formatOnSave": true
  },
</code></pre>
<p>If you want to be able to use Emmet in you .heex files, add this to <code>settings.json</code>:</p>
<pre data-code-wrap="json"><code class="lang-json">  "emmet.includeLanguages": {
    "html-eex": "html",
    "phoenix-heex": "html"
  },
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="259624" data-batch-url="/posts/batch_likers">
                        8
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/heex-formatter-a-formatter-for-heex-templates/45649/36">Post #35</a>
	                </div>
	            </div>
              <div id="likers-container-259624" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="259624"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #35"></div>
  </section>
</div>
    <div class="postbit" id="260156" data-post-id="260156">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="ryanjafari" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/ryanjafari/120/26823_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  ryanjafari
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Yep I can confirm that is my setup as well. Thanks Víctor.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="260156" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/heex-formatter-a-formatter-for-heex-templates/45649/37">Post #36</a>
	                </div>
	            </div>
              <div id="likers-container-260156" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="260156"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>