Skip to content

Commit c056282

Browse files
committed
Merge pull request #315 from elixir-lang/correct-indent-inside-block-for-comp
Correct indentation with for-comprehensions within blocks
2 parents cdde61c + d1588f0 commit c056282

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

elixir-smie.el

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,10 @@
391391
(`(:before . "fn")
392392
(smie-rule-parent))
393393
(`(:before . "for")
394-
(smie-rule-parent))
394+
(cond
395+
((elixir-smie-last-line-end-with-block-operator-p)
396+
(smie-rule-parent elixir-smie-indent-basic))
397+
(t (smie-rule-parent))))
395398
(`(:before . "do:")
396399
(cond
397400
((smie-rule-parent-p "def" "if" "defp" "defmacro" "defmacrop")

test/elixir-mode-indentation-test.el

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1466,9 +1466,7 @@ end"
14661466
end")
14671467

14681468
(elixir-def-indentation-test case-with-for-comprehension
1469-
; the for-comprehension should get indented one level
1470-
; https://github.com/elixir-lang/emacs-elixir/issues/304
1471-
(:expected-result :failed :tags '(indentation))
1469+
(:tags '(indentation))
14721470
"case expression do
14731471
true ->
14741472
for _ <- [] do

0 commit comments

Comments
 (0)