diff options
| author | Juri Linkov | 2025-05-01 21:03:34 +0300 |
|---|---|---|
| committer | Juri Linkov | 2025-05-01 21:03:34 +0300 |
| commit | cd557d6f6480cae81c39a451b2a2aaee720ba985 (patch) | |
| tree | 9e0ad2c0b22473479f6b7a8f9842bd5f47e49de3 | |
| parent | 5684a3808677fb701833c83325cd3bc8de475561 (diff) | |
| download | emacs-cd557d6f6480cae81c39a451b2a2aaee720ba985.tar.gz emacs-cd557d6f6480cae81c39a451b2a2aaee720ba985.zip | |
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.
| -rw-r--r-- | lisp/progmodes/elixir-ts-mode.el | 8 | ||||
| -rw-r--r-- | lisp/progmodes/ruby-ts-mode.el | 11 | ||||
| -rw-r--r-- | test/lisp/progmodes/heex-ts-mode-tests.el | 2 |
3 files changed, 12 insertions, 9 deletions
diff --git a/lisp/progmodes/elixir-ts-mode.el b/lisp/progmodes/elixir-ts-mode.el index 52744f194a2..7edf42c2489 100644 --- a/lisp/progmodes/elixir-ts-mode.el +++ b/lisp/progmodes/elixir-ts-mode.el | |||
| @@ -590,10 +590,12 @@ | |||
| 590 | 590 | ||
| 591 | (defvar elixir-ts--thing-settings | 591 | (defvar elixir-ts--thing-settings |
| 592 | `((sexp (not (or (and named | 592 | `((sexp (not (or (and named |
| 593 | ,(rx bos (or "source" "comment") eos)) | 593 | ,(rx bos (or "source" "keywords" "comment") |
| 594 | eos)) | ||
| 594 | (and anonymous | 595 | (and anonymous |
| 595 | ,(rx (or "{" "}" "[" "]" "(" ")" | 596 | ,(rx bos (or "{" "}" "[" "]" "(" ")" "," |
| 596 | "do" "end")))))) | 597 | "do" "end") |
| 598 | eos))))) | ||
| 597 | (list | 599 | (list |
| 598 | (or (and "\\`arguments\\'" ,#'elixir-ts--with-parens-0-p) | 600 | (or (and "\\`arguments\\'" ,#'elixir-ts--with-parens-0-p) |
| 599 | (and "\\`unary_operator\\'" ,#'elixir-ts--with-parens-1-p) | 601 | (and "\\`unary_operator\\'" ,#'elixir-ts--with-parens-1-p) |
diff --git a/lisp/progmodes/ruby-ts-mode.el b/lisp/progmodes/ruby-ts-mode.el index 53fefe068b2..0ab9f30d70d 100644 --- a/lisp/progmodes/ruby-ts-mode.el +++ b/lisp/progmodes/ruby-ts-mode.el | |||
| @@ -1179,11 +1179,12 @@ leading double colon is not added." | |||
| 1179 | "then") | 1179 | "then") |
| 1180 | eos)) | 1180 | eos)) |
| 1181 | (and anonymous | 1181 | (and anonymous |
| 1182 | ,(rx (or "do" "begin" | 1182 | ,(rx bos (or "do" "begin" |
| 1183 | "if" "unless" | 1183 | "if" "unless" |
| 1184 | "def" "end" | 1184 | "def" "end" |
| 1185 | "(" ")" "[" "]" | 1185 | "(" ")" "[" "]" |
| 1186 | "{" "}" "|" "," ";")))))) | 1186 | "{" "}" "|" "," ";") |
| 1187 | eos))))) | ||
| 1187 | (list ,(cons (rx | 1188 | (list ,(cons (rx |
| 1188 | bos | 1189 | bos |
| 1189 | (or | 1190 | (or |
diff --git a/test/lisp/progmodes/heex-ts-mode-tests.el b/test/lisp/progmodes/heex-ts-mode-tests.el index 01c7ed0fcf1..816d4dd7158 100644 --- a/test/lisp/progmodes/heex-ts-mode-tests.el +++ b/test/lisp/progmodes/heex-ts-mode-tests.el | |||
| @@ -24,7 +24,7 @@ | |||
| 24 | (require 'treesit) | 24 | (require 'treesit) |
| 25 | 25 | ||
| 26 | (ert-deftest heex-ts-mode-test-indentation () | 26 | (ert-deftest heex-ts-mode-test-indentation () |
| 27 | (skip-unless (treesit-ready-p 'heex)) | 27 | (skip-unless (and (treesit-ready-p 'heex) (treesit-ready-p 'elixir))) |
| 28 | (ert-test-erts-file (ert-resource-file "indent.erts"))) | 28 | (ert-test-erts-file (ert-resource-file "indent.erts"))) |
| 29 | 29 | ||
| 30 | (provide 'heex-ts-mode-tests) | 30 | (provide 'heex-ts-mode-tests) |