Skip to content

Commit 514a5c9

Browse files
committed
Merge pull request #161 from elixir-lang/indent-inside-square-brackets
Indent inside square brackets
2 parents 57e78cc + 3ceaad8 commit 514a5c9

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
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] Indent listing inside square brackets. (#160)
78
* [Indentation] Ident correct after a binary sequence `<<1,2,3,4>>`.
89
* [Indentation] Indent correct after oneline `def ... do:` function
910
* [Indentation] Correct behavior after last line in buffer. (#145)

elixir-smie.el

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,14 @@
281281
;; Closing paren on the other line
282282
(`(:before . "(")
283283
(smie-rule-parent))
284+
(`(:before . "[")
285+
(cond
286+
((smie-rule-hanging-p)
287+
(smie-rule-parent))))
288+
(`(:after . "[")
289+
(cond
290+
((smie-rule-hanging-p)
291+
(smie-rule-parent elixir-smie-indent-basic))))
284292
(`(:before . "->")
285293
(cond
286294
((smie-rule-hanging-p)

test/elixir-mode-indentation-test.el

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -914,6 +914,19 @@ case asd do
914914
main
915915
end")
916916

917+
(elixir-def-indentation-test indent-inside-square-brackets
918+
(:tags '(indentation))
919+
"
920+
children = [
921+
supervisor(Task.Supervisor, [[name: KVServer.TaskSupervisor]]),
922+
worker(Task, [KVServer, :accept, [4040]])
923+
]"
924+
925+
"
926+
children = [
927+
supervisor(Task.Supervisor, [[name: KVServer.TaskSupervisor]]),
928+
worker(Task, [KVServer, :accept, [4040]])
929+
]")
917930

918931
;; We don't want automatic whitespace cleanup here because of the significant
919932
;; whitespace after `Record' above. By setting `whitespace-action' to nil,

0 commit comments

Comments
 (0)