Add expression handling to heex-ts-mode

On the latest update of the grammar expressions were added and won't be
seen as directives anymore.

* lisp/progmodes/heex-ts-mode.el
(heex-ts--sexp-regexp): Match on expression as well.
(heex-ts--indent-rules): Indent on expression end.  (Bug#75191)
* test/lisp/progmodes/heex-ts-mode-resources/indent.erts: Add expression
indent test.
This commit is contained in:
Wilhelm Kirschbaum 2024-12-30 12:45:08 +02:00 committed by Stefan Kangas
parent 0cacf80639
commit ae2589ea7a
2 changed files with 18 additions and 1 deletions

View file

@ -54,7 +54,7 @@
(defconst heex-ts--sexp-regexp
(rx bol
(or "directive" "tag" "component" "slot"
"attribute" "attribute_value" "quoted_attribute_value")
"attribute" "attribute_value" "quoted_attribute_value" "expression")
eol))
;; There seems to be no parent directive block for tree-sitter-heex,
@ -81,6 +81,7 @@
((node-is "end_slot") parent-bol 0)
((node-is "/>") parent-bol 0)
((node-is ">") parent-bol 0)
((node-is "}") parent-bol 0)
((parent-is "comment") prev-adaptive-prefix 0)
((parent-is "component") parent-bol ,offset)
((parent-is "tag") parent-bol ,offset)

View file

@ -45,3 +45,19 @@ Name: Slots
</:bar>
</Foo>
=-=-=
Name: Expression
=-=
<div>
{
@bar
}
</div>
=-=
<div>
{
@bar
}
</div>
=-=-=