bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#62086: 29.0.60; ruby-ts-mode regressions


From: Dmitry Gutov
Subject: bug#62086: 29.0.60; ruby-ts-mode regressions
Date: Wed, 12 Apr 2023 02:30:19 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0

On 11/04/2023 19:53, Juri Linkov wrote:
I don't know if opening a new bug report is needed.
Actually I'm doing the same thing for more ts-modes -
trying to find a set of node names that match parens/brackets.
So maybe this patch makes sense too:

These look sensible to me.

I think we should give a chance to the authors to chime in, though.

treesit-sexp-type-regexp.patch

diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el
index d773b4a41f4..e55d26177af 100644
--- a/lisp/progmodes/c-ts-mode.el
+++ b/lisp/progmodes/c-ts-mode.el
@@ -927,7 +927,9 @@ c-ts-base-mode
                              "qualifier"
                              "type"
                              "parameter"
-                            "expression"
+                            ;; "expression"
+                            "argument_list"
+                            "identifier"
                              "literal"
                              "string")))
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index f68ecb6fa6c..3876a5b54f1 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -3827,7 +3827,9 @@ js--treesit-sentence-nodes
  "See `treesit-sentence-type-regexp' for more information.")
(defvar js--treesit-sexp-nodes
-  '("expression"
+  '("expression" ;; SHOULD NOT MATCH "expression_statement", BUT SHOULD MATCH 
"parenthesized_expression"
+    "parenthesized_expression"
+    "formal_parameters"
      "pattern"
      "array"
      "function"
@@ -3845,7 +3847,13 @@ js--treesit-sexp-nodes
      "undefined"
      "arguments"
      "pair"
-    "jsx")
+    "jsx"
+    "statement_block"
+    "object"
+    "object_pattern"
+    "named_imports"
+    "class_body"
+    )
    "Nodes that designate sexps in JavaScript.
  See `treesit-sexp-type-regexp' for more information.")
@@ -3893,7 +3901,7 @@ js-ts-mode
                  (regexp-opt js--treesit-sentence-nodes))
(setq-local treesit-sexp-type-regexp
-                (regexp-opt js--treesit-sexp-nodes))
+                (rx-to-string `(seq bol (or ,@js--treesit-sexp-nodes) eol)))
;; Fontification.
      (setq-local treesit-font-lock-settings js--treesit-font-lock-settings)






reply via email to

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