malloryerik
How to use 'phoenix-heex' templates in VSCode
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode.
The solution seems to be, in a hyphenated word, phoenix-heex.
phoenix-heex is the VSCode “language id” for .html.heex templates. If I understand correctly, Marlus Saraiva @msaraiva set it up, and it seems to solve… everything?
The new Phoenix Framework VSCode extension uses it.
So, just add phoenix-heex (and not, for example, HEEx) as a language for html and the vs-code-eex-formatter, Tailwind IntelliSense extension, HTML expansion/completion and other extensions all work today. ![]()
In your VSCode’s settings.json :
emmet HTML/CSS expansion & snippets
"emmet.includeLanguages": {
...
"phoenix-heex": "html"
},
"[phoenix-heex]": {
"editor.defaultFormatter": "RoyalMist.vscode-eex-format"
},
Tailwind class autocomplete (<- The maintainer told me how to find a language ID.)
"tailwindCSS.includeLanguages": {
"phoenix-heex": "html"
},
… and likewise for the other extensions I use that allow language id input in setting.json; planting a “phoenix-heex” following the general pattern of other listed languages has seemed to work. ![]()
I know quite little about this stuff, actually, so any help, advice and/or correction is welcome!
Most Liked
Sebb
Thanks for the guide.
I do not quite understand how to find the language ID and how to connect plugins to them.
It’s working for those you posted but I’d like to use some more plugins.
Here is a list of the plugins and the state of affairs:
| Extension | HEEX | ~H-sigil | Comment |
|---|---|---|---|
| Alpine.js IntelliSense | - | - | |
| Auto Close Tag | - | - | |
| Auto Rename Tag | + | + | works for components |
| Elixir Templates Formatter | o | - | not for components |
| Phoenix Framework | + | + | |
| Tailwind CSS IntelliSense | + | - |
How can we put a + in each cell?
| Extension | Ver | Author | ID |
|---|---|---|---|
| Alpine.js IntelliSense | v1.2.0 | Adrian Wilczyński | adrianwilczynski.alpine-js-intellisense |
| Auto Close Tag | v0.5.13 | Jun Han | formulahendry.auto-close-tag |
| Auto Rename Tag | v0.1.9 | Jun Han | formulahendry.auto-rename-tag |
| Elixir Templates Formatter | v0.5.0 | RoyalMist | royalmist.vscode-eex-format |
| ElixirLS: Elixir support and debugger | v0.9.0 | ElixirLS | jakebecker.elixir-ls |
| Phoenix Framework | v0.1.1 | phoenixframework | phoenixframework.phoenix |
| Tailwind CSS IntelliSense | v0.7.4 | Tailwind Labs | bradlc.vscode-tailwindcss |
Ritvyk
@malloryerik ncase you want the same ability with pure .HTML.heex files , take a look at this extension just came into marketplace.
It also takes alpine js x-* and phx and new <.component> syntax into consideration ![]()
Popular in Guides/Tuts
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #hex










