emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master f0afebb9915: * lisp/progmodes/typescript-ts-mode.el: Fix regexp-o


From: Juri Linkov
Subject: master f0afebb9915: * lisp/progmodes/typescript-ts-mode.el: Fix regexp-opt of treesit-thing.
Date: Tue, 24 Dec 2024 02:43:21 -0500 (EST)

branch: master
commit f0afebb99158be3db1d9623758321622a1026c8d
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>

    * lisp/progmodes/typescript-ts-mode.el: Fix regexp-opt of treesit-thing.
    
    (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".
---
 lisp/progmodes/typescript-ts-mode.el | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/lisp/progmodes/typescript-ts-mode.el 
b/lisp/progmodes/typescript-ts-mode.el
index 08c8a71c18e..5c3c9a24ff4 100644
--- a/lisp/progmodes/typescript-ts-mode.el
+++ b/lisp/progmodes/typescript-ts-mode.el
@@ -514,12 +514,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
@@ -597,11 +599,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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]