Skip to content

Commit 54bf51c

Browse files
committed
Merge pull request #327 from elixir-lang/indent-maps-inside-list-correct
Correct indentation of maps inside lists
2 parents 981f11d + 389a645 commit 54bf51c

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

elixir-smie.el

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,10 @@
527527
(smie-rule-parent))))
528528
((and (smie-rule-parent-p "OP")
529529
(smie-rule-hanging-p))
530-
(smie-rule-parent))))
530+
(smie-rule-parent))
531+
((smie-rule-parent-p "[")
532+
(smie-rule-parent))
533+
))
531534
(`(:after . "{")
532535
(cond
533536
((smie-rule-hanging-p)

test/elixir-mode-indentation-test.el

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1834,6 +1834,41 @@ cond do
18341834
end
18351835
")
18361836

1837+
(elixir-def-indentation-test indent-maps-inside-list
1838+
(:tags '(indentation))
1839+
"
1840+
[
1841+
%{
1842+
name: \"John Doe\",
1843+
email: \"[email protected]\"
1844+
},
1845+
%{
1846+
name: \"Jane Doe\",
1847+
email: \"[email protected]\",
1848+
},
1849+
%{
1850+
name: \"Josie Doe\",
1851+
email: \"[email protected]\",
1852+
},
1853+
]
1854+
"
1855+
"
1856+
[
1857+
%{
1858+
name: \"John Doe\",
1859+
email: \"[email protected]\"
1860+
},
1861+
%{
1862+
name: \"Jane Doe\",
1863+
email: \"[email protected]\",
1864+
},
1865+
%{
1866+
name: \"Josie Doe\",
1867+
email: \"[email protected]\",
1868+
},
1869+
]
1870+
")
1871+
18371872
;; We don't want automatic whitespace cleanup here because of the significant
18381873
;; whitespace after `Record' above. By setting `whitespace-action' to nil,
18391874
;; `whitespace-mode' won't automatically clean up trailing whitespace (in my

0 commit comments

Comments
 (0)