marcin

marcin

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.

Showing Posts 1 to 10

hochata

hochata

Hi,

not a solution, but have you considered Heex Tresitter Mode?

marcin

marcin OP

Thank you for the pointer! I looked there, but I understand it requires emacs 29 and I am not sure Doom Emacs config is v29 ready yet…

marcin

marcin OP

Confirming that in with emacs29 heex-ts-mode does what I expect :slight_smile:
However, emacs29 is still under development and can break some packages

Benjamin-Philip

Benjamin-Philip

Perhaps you should file a bug report at the web-mode repo? That way once they fix it, you won’t have to upgrade to Emacs 29.

marcin

marcin OP

Actually I did this as first thing after failing to configure web-mode myself, but there is still no reply Elixir LiveView <.tag> syntax · Issue #1269 · fxbois/web-mode · GitHub

Benjamin-Philip

Benjamin-Philip

If you want to resolve this within web-mode itself (which is what I would do since this is something web-mode needs to sort out) the only thing we can do is to either fix this ourselves or wait for the maintainer.

I haven’t contributed to web-mode myself, but there is a chance that this is as simple as editing the regex for constitutes as a valid tag. Elisp is not my forte (it’s not many people’s forte), but if you do work on the PR, and you need some help, you can always ping me.

hochata

hochata

True,

but hopefully Emacs 29 pretests will come out soon :slight_smile:

Marcin via Elixir Programming Language Forum noreply@forum.elixirforum.com writes:

alexpls

alexpls

Related post on the Doom discord: https://discourse.doomemacs.org/t/customize-tag-name-regexp-in-web-mode/3648

(no resolution there on having web-mode support HEEx, either)

marcin

marcin OP

Yep, in the end I switched to using Helix which supports tree sitter. I still have EMacs open for Magit and org-mode though… Best bet is to wait till emacs gets native tree sitter support (and doom too)

alexpls

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:

  1. 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
    
  2. Installed tree-sitter:

    brew install tree-sitter
    
  3. Added the elixir-ts-mode package to Doom config:

    ; packages.el
    (package! elixir-ts-mode)
    
  4. Configured .heex files to use elixir-ts-mode instead of web-mode:

    ; config.el
    ; Elixir: Use elixir-ts-mode instead of web-mode for HEEx
    (use-package! elixir-ts-mode
      :mode "\\.heex\\'")
    
  5. Followed instructions on heex-ts-mode README to install grammar, YMMV, but for me it was as easy as M-x heex-ts-install-grammar.

  6. $ doom sync and restarted Emacs.

  7. 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!

Where Next? Top

Trending in Questions Top

stjefim
Hello! Suppose you are building workflow (order / task / payment) processing system with the following requirements: Each workflow con...
New
jonnycharles
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
spammy
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
dli
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app? Looking for hints regarding: Addi...
New
roeland
Kia ora, We have been using elixir-google-api to connect to Google Drive. However, with the updates to Tesla due to CVEs this is now bro...
New
bottlenecked
Hi all, I wanted to ask how the community is dealing with post-release steps. Today we have Ecto migrations, which make sure that the db...
New
rahultumpala
Hello, I have an Elixir backend that implements a custom protocol over TCP. I want to load test the backend and assess the performance o...
New

Other Trending Topics Top

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
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge &amp; Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews