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
11 changes: 11 additions & 0 deletions elixir-smie.el
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,17 @@
(t elixir-smie-indent-basic)))
(`(:before . "if")
(cond
;; Indent when if is inside a `->' block
;;
;; Example:
;;
;; whatever ->
;; if true do <-
;; :foo
;; end
;; ....
((elixir-smie-last-line-end-with-block-operator-p)
(smie-rule-parent elixir-smie-indent-basic))
(t
(smie-rule-parent))))
(`(:before . "->")
Expand Down
31 changes: 31 additions & 0 deletions test/elixir-mode-indentation-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -1333,6 +1333,37 @@ defmodule MyModule do
end
")

(elixir-def-indentation-test complex-case-with-matches/4
(:tags '(indentation))
"
case :foo do
1 ->
try true do
:foo
end
2 ->
false
end

fn x ->
if true do
end
end"
"
case :foo do
1 ->
try true do
:foo
end
2 ->
false
end

fn x ->
if true do
end
end")

(elixir-def-indentation-test close-map-curly-brackt
(:tags '(indentation))
"
Expand Down