From 2e76acc143a5f8d66db0b7a65b4c5427ff854963 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Tue, 24 Dec 2024 09:40:21 +0200 Subject: [PATCH] * 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". (cherry picked from commit f0afebb99158be3db1d9623758321622a1026c8d) --- 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 e47590214fb..9a85533181a 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -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 -- 2.39.5