]> git.eshelyaron.com Git - emacs.git/commitdiff
Add treesit thing 'sexp-list' to tsx-ts-mode (bug#73404, bug#73978)
authorJuri Linkov <juri@linkov.net>
Tue, 24 Dec 2024 17:24:11 +0000 (19:24 +0200)
committerEshel Yaron <me@eshelyaron.com>
Fri, 27 Dec 2024 15:30:08 +0000 (16:30 +0100)
* lisp/progmodes/typescript-ts-mode.el (tsx-ts-mode):
Add 'sexp-list' to 'treesit-thing-settings' with "jsx" things.
(typescript-ts-mode--sexp-list-nodes): Remove "jsx" things.

(cherry picked from commit b061c01607aa43b8ffa1b5c4a90c3602497cf823)

lisp/progmodes/typescript-ts-mode.el

index 9a85533181afc2e511d08faaba04b9ca03d5049e..64205e55eeca16c322518c1a052c26ba90eefa9b 100644 (file)
@@ -470,8 +470,6 @@ See `treesit-thing-settings' for more information.")
     "object_pattern"
     "array"
     "array_pattern"
-    "jsx_expression"
-    "_jsx_string"
     "string"
     "regex"
     "arguments"
@@ -597,8 +595,15 @@ at least 3 (which is the default value)."
                 `((tsx
                    (sexp ,(regexp-opt
                            (append typescript-ts-mode--sexp-nodes
-                                   '("jsx"))
-                           'symbols))
+                                   '("jsx"))))
+                   (sexp-list ,(concat "^"
+                                       (regexp-opt
+                                        (append typescript-ts-mode--sexp-list-nodes
+                                                '(
+                                                  "jsx_element"
+                                                  "jsx_self_closing_element"
+                                                  "jsx_expression")))
+                                       "$"))
                    (sentence ,(regexp-opt
                                (append typescript-ts-mode--sentence-nodes
                                        '("jsx_element"