Skip to content
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

Remove special indentation rules for operators, except booleans. #74

Merged
merged 2 commits into from
Aug 16, 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
10 changes: 1 addition & 9 deletions elixir-smie.el
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,7 @@
,regexp)
(pushnew `(,',regex-name . ,(upcase (symbol-name ',name))) elixir-syntax-class-names))))

(elixir-smie-define-regexp-opt op
"<<<" ">>>" "^^^" "~~~" "&&&" "|||" ; op3
"===" "!==" ; comp3
"==" "!=" "<=" ">=" ; comp2
"<" ">" ; comp1
"&&" "||" "<>" "++" "--" "**" "//" "::" "<-" ".." "/>" "=~" ; op2 (minus ->)
"xor" "|>" ; http://elixir-lang.org/docs/stable/Kernel.html
)
(elixir-smie-define-regexp-opt op "&&" "||" "!")
(elixir-smie-define-regexp dot "\\.")
(elixir-smie-define-regexp comma ",")
(elixir-smie-define-regexp -> "->")
Expand Down Expand Up @@ -290,7 +283,6 @@ Return non-nil if any line breaks were skipped."
(smie-rule-parent elixir-smie-indent-basic)
elixir-smie-indent-basic)))
(`(,_ . ,(or `"COMMA")) (smie-rule-separator kind))
(`(:after . "=") elixir-smie-indent-basic)
(`(:after . "end") 0)
(`(:after . ,(or `"do"))
elixir-smie-indent-basic)
Expand Down
34 changes: 34 additions & 0 deletions test/elixir-mode-indentation-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -399,3 +399,37 @@ end")
"
[1.2,
3.4]")

(elixir-def-indentation-test indent-after-operator ()
"
defmodule Banana do
def start do
a = \"\" <> \"?\"

case bar do
z -> 1
end

case foo do
?x -> x
end

end
end
"
"
defmodule Banana do
def start do
a = \"\" <> \"?\"

case bar do
z -> 1
end

case foo do
?x -> x
end

end
end
")