GNU bug report logs - #75191
[PATCH] Add expression handling to heex-ts-mode

Previous Next

Package: emacs;

Reported by: Wilhelm Kirschbaum <wkirschbaum <at> gmail.com>

Date: Mon, 30 Dec 2024 10:55:02 UTC

Severity: wishlist

Tags: patch

Fixed in version 30.1

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Wilhelm Kirschbaum <wkirschbaum <at> gmail.com>, 75191 <at> debbugs.gnu.org
Cc: Eli Zaretskii <eliz <at> gnu.org>, Yuan Fu <casouri <at> gmail.com>
Subject: bug#75191: [PATCH] Add expression handling to heex-ts-mode
Date: Thu, 2 Jan 2025 01:44:35 -0600
Wilhelm Kirschbaum <wkirschbaum <at> gmail.com> writes:

> This patch is to handle the recent update to the heex grammar:
> https://github.com/phoenixframework/tree-sitter-heex/releases/tag/v0.7.0
>
> This change appears to be backwards compatible.

Looks safe enough for emacs-30?  Eli, Yuan, WDYT?

> From 7e1fd814d19e820a6b17d62ce4229ae1daaef5cf Mon Sep 17 00:00:00 2001
> From: Wilhelm Kirschbaum <wkirschbaum <at> gmail.com>
> Date: Mon, 30 Dec 2024 12:45:08 +0200
> Subject: [PATCH] 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.
> * test/lisp/progmodes/heex-ts-mode-resources/indent.erts: Add expression
> indent test.
> ---
>  lisp/progmodes/heex-ts-mode.el                   |  3 ++-
>  .../progmodes/heex-ts-mode-resources/indent.erts | 16 ++++++++++++++++
>  2 files changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/lisp/progmodes/heex-ts-mode.el b/lisp/progmodes/heex-ts-mode.el
> index b527d96b579..797bfd6c8ff 100644
> --- a/lisp/progmodes/heex-ts-mode.el
> +++ b/lisp/progmodes/heex-ts-mode.el
> @@ -54,7 +54,7 @@ heex-ts-indent-offset
>  (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 @@ heex-ts--indent-rules
>         ((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)
> diff --git a/test/lisp/progmodes/heex-ts-mode-resources/indent.erts b/test/lisp/progmodes/heex-ts-mode-resources/indent.erts
> index 500ddb2b536..7fef6571933 100644
> --- a/test/lisp/progmodes/heex-ts-mode-resources/indent.erts
> +++ b/test/lisp/progmodes/heex-ts-mode-resources/indent.erts
> @@ -45,3 +45,19 @@ Name: Slots
>    </:bar>
>  </Foo>
>  =-=-=
> +
> +Name: Expression
> +
> +=-=
> +<div>
> +{
> +@bar
> +}
> +</div>
> +=-=
> +<div>
> +  {
> +    @bar
> +  }
> +</div>
> +=-=-=
> --
> 2.45.2




This bug report was last modified 217 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.