]> git.eshelyaron.com Git - emacs.git/commit
Fix heex-ts-mode indentation following previews elixir-mode change
authorYuan Fu <casouri@gmail.com>
Wed, 11 Sep 2024 02:29:31 +0000 (19:29 -0700)
committerEshel Yaron <me@eshelyaron.com>
Sat, 14 Sep 2024 20:21:00 +0000 (22:21 +0200)
commitb0a02ad57eb00671b8da061d1e46edb471276a9f
tree8ace158625098eee4695f78613bab4c84de3d589
parent601fc78c2933f0427c729bcbc830b216c5f7c0f0
Fix heex-ts-mode indentation following previews elixir-mode change

After the previous fix in elixir-ts-mode (0fd259d166c), embedded heex
code are indented like this:

1 defmodule Foo do
2   def foo(assigns) do
3     ~H"""
4 <span>
5   text
6 </span>
7     """
8   end
9 end

The indent rule finds the beginning of the parent heex node, and uses
the indentation of that line as anchor with an offset of 0.  Previously
the parent heex node (fragment) starts at EOL of line 3; after the
previous commit, it now starts at BOL of line 4.  To fix the
indentation, I changed the anchor to the beginning of the elixir
(rather than heex) node at point, which is at EOL at line 3.

* lisp/progmodes/heex-ts-mode.el (heex-ts--indent-rules): Use the elixir
node that contains the heex code as the anchor, instead of the heex root
node.

(cherry picked from commit c5925b6ba5f7821ea72ebd26b76e405cecaabb8e)
lisp/progmodes/heex-ts-mode.el