Skip to content

Commit fc20276

Browse files
committed
Merge pull request #337 from elixir-lang/fix-before-comma-indent
Fix indentation issue after COMMA token
2 parents b25cea6 + 7f0de84 commit fc20276

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

elixir-smie.el

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -285,10 +285,11 @@
285285
((looking-at elixir-smie--operator-regexp)
286286
(goto-char (match-end 0))
287287
"OP")
288-
(t (let ((token (smie-default-forward-token)))
289-
(unless (or (elixir-smie-empty-string-p token)
290-
(elixir-smie--at-dot-call))
291-
token)))))
288+
(t
289+
(let ((token (smie-default-forward-token)))
290+
(unless (or (elixir-smie-empty-string-p token)
291+
(elixir-smie--at-dot-call))
292+
token)))))
292293

293294
(defun elixir-smie--at-dot-call ()
294295
(and (eq ?w (char-syntax (following-char)))
@@ -346,7 +347,7 @@
346347
(cond
347348
((and (smie-rule-parent-p ";")
348349
(smie-rule-hanging-p))
349-
(smie-rule-parent (- elixir-smie-indent-basic)))
350+
(smie-rule-parent))
350351
((smie-rule-parent-p "(")
351352
(smie-rule-parent))
352353
((smie-rule-parent-p "->")

test/elixir-mode-indentation-test.el

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1947,6 +1947,25 @@ defmodule Test do
19471947
end
19481948
")
19491949

1950+
(elixir-def-indentation-test indent-before-comma
1951+
(:tags '(indentation))
1952+
"
1953+
defmodule TestIndentation do
1954+
import Enum
1955+
1956+
@att %{ab: 21,
1957+
de: 22}
1958+
IO.inspect @att
1959+
end"
1960+
"
1961+
defmodule TestIndentation do
1962+
import Enum
1963+
1964+
@att %{ab: 21,
1965+
de: 22}
1966+
IO.inspect @att
1967+
end")
1968+
19501969
;; We don't want automatic whitespace cleanup here because of the significant
19511970
;; whitespace after `Record' above. By setting `whitespace-action' to nil,
19521971
;; `whitespace-mode' won't automatically clean up trailing whitespace (in my

0 commit comments

Comments
 (0)