Skip to content

Commit b55c294

Browse files
committed
indent correct after oneline def ... do: function
1 parent 2dcc3c2 commit b55c294

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

elixir-smie.el

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,8 @@
315315
(smie-rule-parent elixir-smie-indent-basic))))
316316
(`(:after . ";")
317317
(cond
318+
((smie-rule-parent-p "def")
319+
(smie-rule-parent))
318320
((smie-rule-parent-p "if")
319321
(smie-rule-parent))
320322
((and (smie-rule-parent-p "(")

test/elixir-mode-indentation-test.el

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,28 @@ variable =
828828
end
829829
end")
830830

831+
(elixir-def-indentation-test indent-after-def-do-online
832+
(:tags '(indentation))
833+
"
834+
defmodule Greeter do
835+
def hello, do: IO.puts \"hello\"
836+
def bye, do: IO.puts \"bye\"
837+
838+
def hi(name) do
839+
IO.puts \"Hi #{name}\"
840+
end
841+
end"
842+
843+
"
844+
defmodule Greeter do
845+
def hello, do: IO.puts \"hello\"
846+
def bye, do: IO.puts \"bye\"
847+
848+
def hi(name) do
849+
IO.puts \"Hi #{name}\"
850+
end
851+
end")
852+
831853
;; We don't want automatic whitespace cleanup here because of the significant
832854
;; whitespace after `Record' above. By setting `whitespace-action' to nil,
833855
;; `whitespace-mode' won't automatically clean up trailing whitespace (in my

0 commit comments

Comments
 (0)