[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master e03cfec0a45: Improve call indentation for elixir-ts-mode
From: |
Eli Zaretskii |
Subject: |
master e03cfec0a45: Improve call indentation for elixir-ts-mode |
Date: |
Sat, 29 Apr 2023 05:16:55 -0400 (EDT) |
branch: master
commit e03cfec0a455dd8c496d33c422c8edb9ac5a4005
Author: Wilhelm H Kirschbaum <wkirschbaum@gmail.com>
Commit: Eli Zaretskii <eliz@gnu.org>
Improve call indentation for elixir-ts-mode
* lisp/progmodes/elixir-ts-mode.el
(elixir-ts--indent-rules): Change match order.
(Bug#63110)
* test/lisp/progmodes/elixir-ts-mode-resources/indent.erts:
Add test case.
---
lisp/progmodes/elixir-ts-mode.el | 2 +-
test/lisp/progmodes/elixir-ts-mode-resources/indent.erts | 14 +++++++++++++-
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/lisp/progmodes/elixir-ts-mode.el b/lisp/progmodes/elixir-ts-mode.el
index 47f53043af3..7175fe4bff8 100644
--- a/lisp/progmodes/elixir-ts-mode.el
+++ b/lisp/progmodes/elixir-ts-mode.el
@@ -257,7 +257,6 @@
((node-is "^stab_clause$") parent-bol ,offset)
((query ,elixir-ts--capture-operator-parent) grand-parent 0)
((node-is "^when$") parent 0)
- ((node-is "^keywords$") parent-bol ,offset)
((parent-is "^body$")
(lambda (node parent _)
(save-excursion
@@ -272,6 +271,7 @@
,'elixir-ts--argument-indent-anchor
,'elixir-ts--argument-indent-offset)
;; Handle incomplete maps when parent is ERROR.
+ ((node-is "^keywords$") parent-bol ,offset)
((n-p-gp "^binary_operator$" "ERROR" nil) parent-bol 0)
;; When there is an ERROR, just indent to prev-line.
((parent-is "ERROR") prev-line ,offset)
diff --git a/test/lisp/progmodes/elixir-ts-mode-resources/indent.erts
b/test/lisp/progmodes/elixir-ts-mode-resources/indent.erts
index 4eb6e768b96..1f855d3c977 100644
--- a/test/lisp/progmodes/elixir-ts-mode-resources/indent.erts
+++ b/test/lisp/progmodes/elixir-ts-mode-resources/indent.erts
@@ -193,7 +193,19 @@ tuple = {
}
=-=-=
-Name: Spec and method
+Name: Call with keywords
+
+=-=
+def foo() do
+ bar(:one,
+ :two,
+ one: 1,
+ two: 2
+ )
+end
+=-=-=
+
+Name: Call with @spec
=-=
@spec foobar(
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master e03cfec0a45: Improve call indentation for elixir-ts-mode,
Eli Zaretskii <=