GNU bug report logs - #73978
31.0.50; Text syntax applied on too many things in tsx-ts-mode

Previous Next

Package: emacs;

Reported by: Yuan Fu <casouri <at> gmail.com>

Date: Thu, 24 Oct 2024 04:08:02 UTC

Severity: normal

Found in version 31.0.50

Done: Yuan Fu <casouri <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> linkov.net>
To: Yuan Fu <casouri <at> gmail.com>
Cc: Dmitry Gutov <dmitry <at> gutov.dev>, Theodor Thornhill <theo <at> thornhill.no>, 73978 <at> debbugs.gnu.org
Subject: bug#73978: 31.0.50; Text syntax applied on too many things in tsx-ts-mode
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)))))




This bug report was last modified 133 days ago.

Previous Next


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