Skip to content

Always indent with only 2 spaces except when function arguments span multiple lines. #149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 23, 2014
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Enhancements

* [Indentation] Always indent with only 2 spaces except when function arguments span multiple lines.
* [Indentation] Fix the indentation for mixed matchings.
* [Indentation] Pipe |> indentation works correctly.
* [Syntax Highlighting] Fontify continuation lines assignment.
Expand Down
6 changes: 6 additions & 0 deletions elixir-smie.el
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,12 @@
(t
(smie-rule-parent elixir-smie-indent-basic))))))

(`(:before . "fn")
(smie-rule-parent))

(`(:before . "end")
(smie-rule-parent))

;; Closing paren on the other line
(`(:before . "(")
(smie-rule-parent))
Expand Down
17 changes: 9 additions & 8 deletions test/elixir-mode-indentation-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -572,24 +572,25 @@ x = do_something(
:bar
)")

(elixir-def-indentation-test indent-inside-parens/2 ()
"
(elixir-def-indentation-test indent-inside-parens/2
(:tags '(indentation))
"
x = do_something(:foo,
:bar)"
"
:bar)"
"
x = do_something(:foo,
:bar)")

(elixir-def-indentation-test indent-inside-parens/3
(:expected-result :failed)
"
(:tags '(indentation))
"
x = do_something(:foo, fn (arg) ->
do_another(arg)
end)"
"
x = do_something(:foo, fn (arg) ->
do_another(arg)
end)")
do_another(arg)
end)")

(elixir-def-indentation-test indent-lone-keyword ()
"
Expand Down