Skip to content

Commit cb3f1a8

Browse files
committed
Merge pull request #232 from elixir-lang/closing-map
correct indentation for closing Map curly bracket fixes #223
2 parents f30fa7b + bb17fe7 commit cb3f1a8

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

elixir-smie.el

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,10 @@
377377
(smie-rule-parent elixir-smie-indent-basic)
378378
(if (elixir-smie-last-line-start-with-block-operator-p)
379379
(smie-rule-parent -2)
380-
(smie-rule-parent))))))
380+
(smie-rule-parent))))
381+
((and (smie-rule-parent-p "OP")
382+
(smie-rule-hanging-p))
383+
(smie-rule-parent))))
381384
(`(:after . "{")
382385
(cond
383386
((smie-rule-hanging-p)

test/elixir-mode-indentation-test.el

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,7 +1184,8 @@ defmodule Foo do
11841184
end
11851185
")
11861186

1187-
(elixir-def-indentation-test complex-case-with-matches (:tags '(indentation))
1187+
(elixir-def-indentation-test complex-case-with-matches
1188+
(:tags '(indentation))
11881189
"
11891190
case parse do
11901191
{ [ help: true ], _, _ }
@@ -1207,7 +1208,8 @@ case parse do
12071208
end")
12081209

12091210

1210-
(elixir-def-indentation-test complex-case-with-matches/2 (:tags '(indentation))
1211+
(elixir-def-indentation-test complex-case-with-matches/2
1212+
(:tags '(indentation))
12111213
"
12121214
case parse do
12131215
{ [ help: true ], _, _ }
@@ -1229,6 +1231,24 @@ case parse do
12291231
_ -> :help
12301232
end")
12311233

1234+
(elixir-def-indentation-test close-map-curly-brackt
1235+
(:tags '(indentation))
1236+
"
1237+
config = %{
1238+
async_cases: [],
1239+
exclude: opts[:exclude],
1240+
include: opts[:include],
1241+
timeout: opts[:timeout],
1242+
trace: opts[:trace]
1243+
}"
1244+
"
1245+
config = %{
1246+
async_cases: [],
1247+
exclude: opts[:exclude],
1248+
include: opts[:include],
1249+
timeout: opts[:timeout],
1250+
trace: opts[:trace]
1251+
}")
12321252

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

0 commit comments

Comments
 (0)