marcin
Editing HEEX with Emacs web-mode - how to recognize <.tag> as a tag?
A (doom) emacs user here.
web-mode ignores <.liveviewtags> which is especially annoying for closing the tags.
Has anyone here figured out how to configure web-mode to recognize live view tags as tags?
Tried to tweak the web-mode-(start-)tag-regexp variable, as well as messing with web-mode-engine-* variable but these did not help.
Marked As Solved
alexpls
I ended up getting a bit further with this by upgrading to Emacs v29 (which natively supports tree-sitter), and using the elixir-ts-mode package.
Doom’s docs do specifically call out that Emacs 29 is unsupported - but I haven’t found any issues after ~1 week of use.
Here’re the rough steps I took:
-
Upgraded to Emacs 29 (I’m using emacs-plus on macOS), so for me this looked like:
# I'm using emacs-plus on macOS brew uninstall emacs-plus && brew install emacs-plus@29 -
Installed tree-sitter:
brew install tree-sitter -
Added the
elixir-ts-modepackage to Doom config:; packages.el (package! elixir-ts-mode) -
Configured
.heexfiles to useelixir-ts-modeinstead ofweb-mode:; config.el ; Elixir: Use elixir-ts-mode instead of web-mode for HEEx (use-package! elixir-ts-mode :mode "\\.heex\\'") -
Followed instructions on
heex-ts-modeREADME to install grammar, YMMV, but for me it was as easy asM-x heex-ts-install-grammar. -
$ doom syncand restarted Emacs. -
Verified it all works by opening a HEEx file and running
M-x treesit-explore-mode. You should see it print a HEEx AST, like this:
You could also use elixir-ts-mode in .ex files to get syntax highlighting in ~H sigils, and then disable Doom’s default elixir config altogether… but I’m leaving that experiment for another day!
Also Liked
hochata
Hi,
not a solution, but have you considered Heex Tresitter Mode?
Popular in Questions
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
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance










