* bug#75191: [PATCH] Add expression handling to heex-ts-mode
@ 2024-12-30 10:53 Wilhelm Kirschbaum
2025-01-02 7:44 ` Stefan Kangas
0 siblings, 1 reply; 5+ messages in thread
From: Wilhelm Kirschbaum @ 2024-12-30 10:53 UTC (permalink / raw)
To: 75191
[-- Attachment #1.1: Type: text/plain, Size: 208 bytes --]
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.
Kind regards,
Wilhelm
[-- Attachment #1.2: Type: text/html, Size: 400 bytes --]
[-- Attachment #2: 0001-Add-expression-handling-to-heex-ts-mode.patch --]
[-- Type: text/x-patch, Size: 2084 bytes --]
From 7e1fd814d19e820a6b17d62ce4229ae1daaef5cf Mon Sep 17 00:00:00 2001
From: Wilhelm Kirschbaum <wkirschbaum@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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* bug#75191: [PATCH] Add expression handling to heex-ts-mode
2024-12-30 10:53 bug#75191: [PATCH] Add expression handling to heex-ts-mode Wilhelm Kirschbaum
@ 2025-01-02 7:44 ` Stefan Kangas
2025-01-02 8:35 ` Eli Zaretskii
0 siblings, 1 reply; 5+ messages in thread
From: Stefan Kangas @ 2025-01-02 7:44 UTC (permalink / raw)
To: Wilhelm Kirschbaum, 75191; +Cc: Eli Zaretskii, Yuan Fu
Wilhelm Kirschbaum <wkirschbaum@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@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
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#75191: [PATCH] Add expression handling to heex-ts-mode
2025-01-02 7:44 ` Stefan Kangas
@ 2025-01-02 8:35 ` Eli Zaretskii
2025-01-03 5:53 ` Yuan Fu
0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2025-01-02 8:35 UTC (permalink / raw)
To: Stefan Kangas; +Cc: wkirschbaum, 75191, casouri
> From: Stefan Kangas <stefankangas@gmail.com>
> Date: Thu, 2 Jan 2025 01:44:35 -0600
> Cc: Eli Zaretskii <eliz@gnu.org>, Yuan Fu <casouri@gmail.com>
>
> Wilhelm Kirschbaum <wkirschbaum@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?
Looks safe to me, yes.
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#75191: [PATCH] Add expression handling to heex-ts-mode
2025-01-02 8:35 ` Eli Zaretskii
@ 2025-01-03 5:53 ` Yuan Fu
2025-01-03 8:41 ` Stefan Kangas
0 siblings, 1 reply; 5+ messages in thread
From: Yuan Fu @ 2025-01-03 5:53 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: wkirschbaum, 75191, Stefan Kangas
> On Jan 2, 2025, at 12:35 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>
>> From: Stefan Kangas <stefankangas@gmail.com>
>> Date: Thu, 2 Jan 2025 01:44:35 -0600
>> Cc: Eli Zaretskii <eliz@gnu.org>, Yuan Fu <casouri@gmail.com>
>>
>> Wilhelm Kirschbaum <wkirschbaum@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?
>
> Looks safe to me, yes.
Seems fine.
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#75191: [PATCH] Add expression handling to heex-ts-mode
2025-01-03 5:53 ` Yuan Fu
@ 2025-01-03 8:41 ` Stefan Kangas
0 siblings, 0 replies; 5+ messages in thread
From: Stefan Kangas @ 2025-01-03 8:41 UTC (permalink / raw)
To: Yuan Fu, Eli Zaretskii; +Cc: wkirschbaum, 75191-done
Version: 30.1
Yuan Fu <casouri@gmail.com> writes:
>> On Jan 2, 2025, at 12:35 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>>
>>> From: Stefan Kangas <stefankangas@gmail.com>
>>> Date: Thu, 2 Jan 2025 01:44:35 -0600
>>> Cc: Eli Zaretskii <eliz@gnu.org>, Yuan Fu <casouri@gmail.com>
>>>
>>> Wilhelm Kirschbaum <wkirschbaum@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?
>>
>> Looks safe to me, yes.
>
> Seems fine.
Thanks all, pushed to emacs-30 as commit ae2589ea7a5. Closing.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-01-03 8:41 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-30 10:53 bug#75191: [PATCH] Add expression handling to heex-ts-mode Wilhelm Kirschbaum
2025-01-02 7:44 ` Stefan Kangas
2025-01-02 8:35 ` Eli Zaretskii
2025-01-03 5:53 ` Yuan Fu
2025-01-03 8:41 ` Stefan Kangas
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).