Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion elixir-smie.el
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,22 @@
-2)
((smie-rule-parent-p "def" "defp" "defmacro" "defmacrop")
(smie-rule-parent))))
(`(:before . "def")
(cond
(t
(smie-rule-parent))))
(`(:before . "defp")
(cond
(t
(smie-rule-parent))))
(`(:before . "defmacro")
(cond
(t
(smie-rule-parent))))
(`(:before . "defmacrop")
(cond
(t
(smie-rule-parent))))
(`(:after . "OP")
(cond
((smie-rule-sibling-p) nil)
Expand Down Expand Up @@ -375,7 +391,7 @@
(smie-rule-parent))
((and (smie-rule-parent-p ";")
(not (smie-rule-hanging-p)))
(smie-rule-parent elixir-smie-indent-basic))
(smie-rule-parent))
;; Example
;;
;; hi = for i <- list, do: i
Expand Down
19 changes: 18 additions & 1 deletion test/elixir-mode-indentation-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ end"
end")

(elixir-def-indentation-test indent-after-not-finished-one-line-def
(:tags '(indentation))
(:expected-result :failed :tags '(indentation))
"
defmodule Hello do
defp skip,
Expand All @@ -1002,6 +1002,23 @@ defmodule Hello do
defmacrop whatever, do: do_it!
end")

(elixir-def-indentation-test indent-correct-with-multiple-one-line-macro-calls
(:tags '(indentation))
"
mymacro x1, do: [:x1]
mymacro x2, do: [:x2]
mymacro x3, do: [:x3]
mymacro x1, do: [:x1]
mymacro x2, do: [:x2]
mymacro x3, do: [:x3]"
"
mymacro x1, do: [:x1]
mymacro x2, do: [:x2]
mymacro x3, do: [:x3]
mymacro x1, do: [:x1]
mymacro x2, do: [:x2]
mymacro x3, do: [:x3]")

(elixir-def-indentation-test indent-binary-sequence
(:tags '(indentation))
"
Expand Down