Skip to content

Commit 419aef0

Browse files
committed
Merge pull request #151 from elixir-lang/indent-block-inside-fn-match
Indent block inside a fn match
2 parents e90638c + 9f94aa4 commit 419aef0

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## v2.2.0-dev (unreleased)
44

5+
### Enhancements
6+
7+
* [Indentation] Indent block inside a fn match.
8+
59
## v2.1.0 - 2014/12/23
610

711
### Enhancements

elixir-smie.el

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,8 @@
291291
(if (and smie--parent (elixir-smie--same-line-as-parent
292292
(nth 1 smie--parent)
293293
(point)))
294-
(smie-rule-parent elixir-smie-indent-basic)))
294+
(smie-rule-parent elixir-smie-indent-basic)
295+
elixir-smie-indent-basic))
295296
;; Otherwise, if just indent by two.
296297
((smie-rule-hanging-p)
297298
(cond

test/elixir-mode-indentation-test.el

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,30 @@ rescue
412412
end
413413
")
414414

415+
(elixir-def-indentation-test indent-block-inside-fn-match ()
416+
"
417+
defp into(stream, device, raw) do
418+
fn
419+
:ok, {:cont, x} ->
420+
case raw do
421+
true -> IO.binwrite(device, x)
422+
false -> IO.write(device, x)
423+
end
424+
:ok, _ -> stream
425+
end
426+
end"
427+
"
428+
defp into(stream, device, raw) do
429+
fn
430+
:ok, {:cont, x} ->
431+
case raw do
432+
true -> IO.binwrite(device, x)
433+
false -> IO.write(device, x)
434+
end
435+
:ok, _ -> stream
436+
end
437+
end")
438+
415439
(elixir-def-indentation-test indent-fn-in-assignment ()
416440
"
417441
f = fn x, y ->

0 commit comments

Comments
 (0)