]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve elixir-ts--thing-settings.
authorJuri Linkov <juri@linkov.net>
Thu, 1 May 2025 18:03:34 +0000 (21:03 +0300)
committerEshel Yaron <me@eshelyaron.com>
Sat, 10 May 2025 06:54:49 +0000 (08:54 +0200)
* lisp/progmodes/elixir-ts-mode.el (elixir-ts--thing-settings):
Add extra grouping "keywords" to named sexp nodes.
Add "," to anonymous sexp nodes.  Use bos/eos.

* lisp/progmodes/ruby-ts-mode.el (ruby-ts-mode):
Use bos/eos for anonymous sexp nodes for better disambiguation.

* test/lisp/progmodes/heex-ts-mode-tests.el
(heex-ts-mode-test-indentation): Skip the test when 'elixir' is
missing since 'heex-ts-mode' depends on the 'elixir' grammar.

(cherry picked from commit cd557d6f6480cae81c39a451b2a2aaee720ba985)

lisp/progmodes/elixir-ts-mode.el
lisp/progmodes/ruby-ts-mode.el
test/lisp/progmodes/heex-ts-mode-tests.el

index 52744f194a25edbc94c792307f791ff03eb9e485..7edf42c24895bbb1089c142479049e0508c29de1 100644 (file)
 
 (defvar elixir-ts--thing-settings
   `((sexp (not (or (and named
-                        ,(rx bos (or "source" "comment") eos))
+                        ,(rx bos (or "source" "keywords" "comment")
+                             eos))
                    (and anonymous
-                        ,(rx (or "{" "}" "[" "]" "(" ")"
-                                 "do" "end"))))))
+                        ,(rx bos (or "{" "}" "[" "]" "(" ")" ","
+                                     "do" "end")
+                             eos)))))
     (list
      (or (and "\\`arguments\\'" ,#'elixir-ts--with-parens-0-p)
          (and "\\`unary_operator\\'" ,#'elixir-ts--with-parens-1-p)
index e0f2520e837923ad89c212e9e1743e5b81ca85ea..30882f055d37a418e26d3653bb6c75a57f4ed760 100644 (file)
@@ -1179,11 +1179,12 @@ leading double colon is not added."
                                                   "then")
                                           eos))
                                 (and anonymous
-                                     ,(rx (or "do" "begin"
-                                              "if" "unless"
-                                              "def" "end"
-                                              "(" ")" "[" "]"
-                                              "{" "}" "|" "," ";"))))))
+                                     ,(rx bos (or "do" "begin"
+                                                  "if" "unless"
+                                                  "def" "end"
+                                                  "(" ")" "[" "]"
+                                                  "{" "}" "|" "," ";")
+                                          eos)))))
                  (list ,(cons (rx
                                bos
                                (or
index 01c7ed0fcf1a8841ad2b2ed0ccbaea1ed4ca7d86..816d4dd7158937f51942f71423d1385fe0664928 100644 (file)
@@ -24,7 +24,7 @@
 (require 'treesit)
 
 (ert-deftest heex-ts-mode-test-indentation ()
-  (skip-unless (treesit-ready-p 'heex))
+  (skip-unless (and (treesit-ready-p 'heex) (treesit-ready-p 'elixir)))
   (ert-test-erts-file (ert-resource-file "indent.erts")))
 
 (provide 'heex-ts-mode-tests)