]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/progmodes/typescript-ts-mode.el: Fix regexp-opt of treesit-thing.
authorJuri Linkov <juri@linkov.net>
Tue, 24 Dec 2024 07:40:21 +0000 (09:40 +0200)
committerEshel Yaron <me@eshelyaron.com>
Fri, 27 Dec 2024 15:30:06 +0000 (16:30 +0100)
(typescript-ts-base-mode): Add arg 'symbols' to regexp-opt of 'sexp',
'sexp-list', 'sentence', 'text' (bug#73404, bug#74366, bug#74963).
(tsx-ts-mode): Add arg 'symbols' to regexp-opt of 'sexp', 'sentence'.
This avoids such mismatches as "string_fragment" by "string".

(cherry picked from commit f0afebb99158be3db1d9623758321622a1026c8d)

lisp/progmodes/typescript-ts-mode.el

index e47590214fb708135b4c3d9f7e8068a297a440a7..9a85533181afc2e511d08faaba04b9ca03d5049e 100644 (file)
@@ -512,12 +512,14 @@ This mode is intended to be inherited by concrete major modes."
 
   (setq-local treesit-thing-settings
               `((typescript
-                 (sexp ,(regexp-opt typescript-ts-mode--sexp-nodes))
-                 (sexp-list ,(regexp-opt typescript-ts-mode--sexp-list-nodes))
+                 (sexp ,(regexp-opt typescript-ts-mode--sexp-nodes 'symbols))
+                 (sexp-list ,(regexp-opt typescript-ts-mode--sexp-list-nodes
+                                         'symbols))
                  (sentence ,(regexp-opt
-                             typescript-ts-mode--sentence-nodes))
+                             typescript-ts-mode--sentence-nodes 'symbols))
                  (text ,(regexp-opt '("comment"
-                                      "template_string"))))))
+                                      "template_string")
+                                    'symbols)))))
 
   ;; Imenu (same as in `js-ts-mode').
   (setq-local treesit-simple-imenu-settings
@@ -595,11 +597,13 @@ at least 3 (which is the default value)."
                 `((tsx
                    (sexp ,(regexp-opt
                            (append typescript-ts-mode--sexp-nodes
-                                   '("jsx"))))
+                                   '("jsx"))
+                           'symbols))
                    (sentence ,(regexp-opt
                                (append typescript-ts-mode--sentence-nodes
                                        '("jsx_element"
-                                         "jsx_self_closing_element")))))))
+                                         "jsx_self_closing_element"))
+                               'symbols)))))
 
     ;; Font-lock.
     (setq-local treesit-font-lock-settings