brainlid

brainlid

What do you use to format your .html.leex and .html.eex files? I’m using VS Code and haven’t found a beautifier I’m happy with yet.

I’d also prefer not to install a Ruby gem for it to work.

Showing Posts 1 to 10

brainlid

brainlid OP

The general consensus I’ve gotten from others is that currently nothing works well and everyone is hand formatting them.

adamzapasnik

adamzapasnik

I hope it’s solid enough :sweat_smile:
I think the only major problem right now is this:

https://github.com/adamzapasnik/prettier-plugin-eex/issues/6

But it should be solved by the end of this weekend. (I have a semi working solution atm)

mindreframer

mindreframer

Nice! Thanks for providing ideas for this topic, currently there is not much alternatives.
The installation instructions are a bit involved at the moment and the amount of TODO comments is a bit scary :sweat_smile:

$ ag TODO
prettier-plugin-eex/lib/html_parser/encoder.js
47:          // TODO: added space
134:    // TODO: better error wording?

prettier-plugin-eex/lib/html_parser/decoder.js
151:          // TODO: show an example

prettier-plugin-eex/lib/html_parser/decoder/table_and_head_decoder.js
6:      // TODO: change name
34:      // TODO: change name

prettier-plugin-eex/lib/html_parser/decoder/html_body_decoder.js
56:  // TODO: validate if it's needed!

prettier-plugin-eex/lib/index.js
30:      // TODO: ADD mjml?

prettier-plugin-eex/lib/eex/formatter.js
5:// TODO: add formatting option to format multiline by urself
6:// TODO: better naming please

prettier-plugin-eex/lib/eex/tokenizer.js
55:      (html.endsWith('/>') || // TODO: FIX THIS

I need to play with it on a bigger project and see how well it copes with real world markup. Anyways, I hope you get yourself more beta-users and they will help to improve your library! :slight_smile:

ouven

ouven

Hi, I wrote and use YAB for eex/leex - Visual Studio Marketplace

Maybe you want to give it a try and send feedback. For me it works good enough.

Oh, I have missed your point, not to install a ruby gem :upside_down_face:

mindreframer

mindreframer

Nice, it worked quite OK for the couple files that I have thrown at it. It does not handle embedded markup in Liveviews, like:

  def render(assigns) do
    ~L"""
    <div class="container">
      <h3>Counter for <%= @current %> </h3>
    </div>
    """
  end

I can image that this would be tricky to support, though.

Thanks for posting it, it was completely under my radar!

cenotaph

cenotaph

thank you! I was working with intellij and just switched to vscode as this was making me mad. I don’t even have OCD :nerd_face:

praveenperera

praveenperera

Thanks for this, its pretty good but it doesn’t indent inputs_for

ex:

<%= inputs_for f, :config, fn fc -> %>
<%= label fc, :devise_secret_key, "Devise Secret Key" %>
<%= text_input fc, :devise_secret_key, phx_debounce: 600 %>
<%= error_tag fc, :devise_secret_key %>
<% end %>
praveenperera

praveenperera

So far this (prettier-plugin-eex) is the one that works the best.

I’m using it with vscode using Run on Save - Visual Studio Marketplace

  "emeraldwalk.runonsave": {
    "commands": [
      {
        "match": "\\.l?eex$",
        "cmd": "prettier --write ${file}"
      },
    ]
  },

Thank you for this

wtd423

wtd423

I followed the readme til the end and format on save started to work with just the regular Prettier extension. Unfortunately it changed every line of <% code... %> into <eext1> so don’t forget to commit your work before trying the eex plugin. :scream:

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
kpanic
Hi everyone, I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding. I sta...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
asweet-confluent
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
apz
I’m new to elixir and just tried to install the elixirLS extension for VScode(ium) and it is throwing some errors that I would like help ...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
georgeguimaraes
Just published claude-code-elixir, a plugin marketplace for Claude Code with Elixir support. These are the plugins I’ve been using for my...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews