Subject: bug#73978: 31.0.50; Text syntax applied on too many things in tsx-ts-mode

From: Juri Linkov <[email-masked]>
Date: Sat, 11 Jan 2025 19:40:12 +0200

> This can be fixed by the following patch that copied the syntax of < and >
> from sgml-make-syntax-table:
>
> @@ -692,7 +694,11 @@ tsx-ts--syntax-propertize-captures
>               (put-text-property
>                (match-beginning 0) (match-end 0)
> -              'syntax-table (string-to-syntax ".")))))))))
> +              'syntax-table (string-to-syntax
> +                             (cond
> +                              ((equal (match-string 0) "<") "(<")
> +                              ((equal (match-string 0) ">") "(>")
> +                              (t ".")))))))))))

I missed the need to apply this < and > syntax on jsx elements,
so also pushed this patch.  Hope this is correct.

diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el
index 3c1b27696bc..937146ddf23 100644
--- a/lisp/progmodes/typescript-ts-mode.el
+++ b/lisp/progmodes/typescript-ts-mode.el
@@ -660,7 +660,9 @@ tsx-ts--s-p-query
   (when (treesit-available-p)
     (treesit-query-compile 'tsx
                            '(((regex pattern: (regex_pattern) @regexp))
-                             ((jsx_text) @jsx)))))
+                             ((jsx_text) @jsx)
+                             ((jsx_opening_element) @jsx)
+                             ((jsx_closing_element) @jsx)))))