From: Wilhelm H Kirschbaum Date: Thu, 27 Apr 2023 10:13:25 +0000 (+0200) Subject: Improve call indentation for elixir-ts-mode X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e03cfec0a455dd8c496d33c422c8edb9ac5a4005;p=emacs.git 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. --- 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(