Skip to content

Commit b76cf98

Browse files
committed
Merge pull request #150 from elixir-lang/indent-continuation-lines-assignment
Continue of indentation in multiple line assignment.
2 parents 0f20892 + 2fe0282 commit b76cf98

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### Enhancements
66

7+
* [Indentation] Continue of indentation in multiple line assignment.
78
* [Indentation] Always indent with only 2 spaces except when function arguments span multiple lines.
89
* [Indentation] Fix the indentation for mixed matchings.
910
* [Indentation] Pipe |> indentation works correctly.

elixir-smie.el

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117

118118
(defvar elixir-smie--operator-regexp
119119
(rx (or "<<<" ">>>" "^^^" "~~~" "&&&" "|||" "===" "!==" "==" "!=" "<="
120-
">=" "<" ">" "&&" "||" "<>" "++" "--" "//" "/>" "=~" "|>")))
120+
"=" ">=" "<" ">" "&&" "||" "<>" "++" "--" "//" "/>" "=~" "|>")))
121121

122122
(defvar elixir-smie--block-operator-regexp
123123
(rx "->" (0+ nonl)))
@@ -283,7 +283,7 @@
283283

284284
;; Closing paren on the other line
285285
(`(:before . "(")
286-
(smie-rule-parent))
286+
(unless smie--parent 0))
287287

288288
(`(:before . ";")
289289
(cond

test/elixir-mode-indentation-test.el

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,7 @@ end
246246
")
247247

248248
(elixir-def-indentation-test indent-continuation-lines-assignment
249-
(:expected-result :failed
250-
:tags '(indentation))
249+
(:tags '(indentation))
251250
"
252251
some_var =
253252
some_expr
@@ -256,6 +255,22 @@ some_var =
256255
some_expr
257256
")
258257

258+
(elixir-def-indentation-test indent-continuation-lines-assignment/2
259+
(:tags '(indentation))
260+
"
261+
next_fun =
262+
case raw do
263+
true -> &IO.each_binstream(&1, line_or_bytes)
264+
false -> &IO.each_stream(&1, line_or_bytes)
265+
end
266+
" "
267+
next_fun =
268+
case raw do
269+
true -> &IO.each_binstream(&1, line_or_bytes)
270+
false -> &IO.each_stream(&1, line_or_bytes)
271+
end
272+
")
273+
259274
(elixir-def-indentation-test indent-last-commented-line
260275
()
261276
"

0 commit comments

Comments
 (0)