]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve treesit settings for js/typescript/ruby-ts-mode (bug#73404)
authorJuri Linkov <juri@linkov.net>
Thu, 6 Mar 2025 18:22:50 +0000 (20:22 +0200)
committerEshel Yaron <me@eshelyaron.com>
Sun, 9 Mar 2025 10:19:54 +0000 (11:19 +0100)
* lisp/progmodes/js.el (js--treesit-list-nodes):
* lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode--list-nodes):
Replace leaf "string" with "template_string" and "template_substitution"
that can contain more nodes.

* lisp/progmodes/ruby-ts-mode.el (ruby-ts-mode):
Add the 'sentence' thing to treesit-thing-settings.

(cherry picked from commit 63cc542b9402ad0a794f4e05790366bd580b8bd1)

lisp/progmodes/js.el
lisp/progmodes/ruby-ts-mode.el
lisp/progmodes/typescript-ts-mode.el

index abe7e15b9c7929749fb2da071c5c9ca1170fefe6..d34fd8d627c615b45d706c2506af3e7b79bcf7f1 100644 (file)
@@ -3916,7 +3916,8 @@ See `treesit-thing-settings' for more information.")
     "jsx_element"
     "jsx_expression"
     "jsx_self_closing_element"
-    "string"
+    "template_string"
+    "template_substitution"
     "regex"
     "arguments"
     "class_body"
index 551271275d7d46cbdc61e110013188444f564d56..6fb71a75a58c6a4b9c9edc4087d39791fa0369ef 100644 (file)
@@ -1253,6 +1253,11 @@ leading double colon is not added."
                                 "hash")
                                eos)
                               #'ruby-ts--list-p))
+                 (sentence ,(rx bos (or "return"
+                                        "body_statement"
+                                        "call"
+                                        "assignment")
+                                eos))
                  (text ,(lambda (node)
                           (or (member (treesit-node-type node)
                                       '("comment" "string_content" "heredoc_content"))
index ece8eebd028c53bc07fbae6f8432632751cb017b..94a854a1c8f741ec90267ddc881a3c6330fcbce8 100644 (file)
@@ -495,12 +495,14 @@ See `treesit-thing-settings' for more information.")
     "object_pattern"
     "array"
     "array_pattern"
-    "string"
+    "template_string"
+    "template_substitution"
     "regex"
     "arguments"
     "class_body"
     "formal_parameters"
     "computed_property_name"
+    ;; TypeScript
     "decorator_parenthesized_expression"
     "enum_body"
     "parenthesized_type"