1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-30 04:10:54 -08:00

Improve elixir-ts--thing-settings.

* 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.
This commit is contained in:
Juri Linkov 2025-05-01 21:03:34 +03:00
parent 5684a38086
commit cd557d6f64
3 changed files with 12 additions and 9 deletions

View file

@ -590,10 +590,12 @@
(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)

View 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

View 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)