Phoenix template syntax checking

What do folks use for basic tag checking in eex template files? Something like htmlhint would do but for eex so its aware of and ignores the Elixir code.

I build up most of my templates via functions rather than straight HTML, so that handles that. Otherwise I rely on my IDE/Editor to syntax highlight broken things. ^.^;

Yeah. I’m using VS Code and I setup eex files to be associated as HTML. This is done in user settings as below in case anyone is interested.

"files.associations": {
    "*.eex": "html",

This autocloses tags so if I type
<div> I get <div></div>
which I find helpful and it pretties the HTML on save – which aligns tags — which I also find helpful. I don’t see it syntax highlighting things like missing closing tags…but what it does is helpful.

1 Like

It doesn’t do that automatically? In Atom and emacs it ‘just worked’ without me adding eex files to any listings…

I’ve recently started trying VS Code, and I don’t think it does by default. Thanks for the config, @fmcgeough.

How this is possible?

EEX templates are just functions, you can call back and forth all you wish, you can even embed EEX templates ‘in’ functions via a sigil as well. :slight_smile:


I saw someone suggest this extension on a Github Issue (I think?). From what I understand it treats Phoenix eex files as erb files (RoR).