Skip to content

Commit 694d133

Browse files
NatTuckTrevoke
authored andcommitted
Special case for indentation of fat arrows in map literals. (#433)
* Special case for indentation of fat arrows in map literals. * Mark the string key map test as not expecting to fail * Add a failing test for a slightly more complicated case.
1 parent b86aab2 commit 694d133

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

elixir-smie.el

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,8 @@
415415
(smie-rule-parent))
416416
((smie-rule-parent-p ";")
417417
(smie-rule-parent))
418+
((smie-rule-parent-p "{")
419+
(smie-rule-parent elixir-smie-indent-basic))
418420
(t (smie-rule-parent (- elixir-smie-indent-basic)))))
419421
(`(:before . "MATCH-STATEMENT-DELIMITER")
420422
(cond

test/elixir-mode-indentation-test.el

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1510,7 +1510,7 @@ defmodule Foo do
15101510
end")
15111511

15121512
(elixir-def-indentation-test indent-maps-with-stings-as-keys
1513-
(:expected-result :failed :tags '(indentation))
1513+
(:tags '(indentation))
15141514
"%{
15151515
\"data\" => %{
15161516
\"foo\" => %{
@@ -1526,6 +1526,23 @@ end")
15261526
}
15271527
}")
15281528

1529+
(elixir-def-indentation-test indent-maps-with-multiple-string-keys
1530+
(:expected-result :failed :tags '(indentation))
1531+
"Enum.map [], fn x ->
1532+
%{
1533+
\"a\" => 5555,
1534+
\"b\" => 5555,
1535+
\"c\" => x,
1536+
}
1537+
end"
1538+
"Enum.map [], fn x ->
1539+
%{
1540+
\"a\" => 5555,
1541+
\"b\" => 5555,
1542+
\"c\" => x,
1543+
}
1544+
end")
1545+
15291546
(elixir-def-indentation-test indent-maps-and-structs-elements
15301547
(:tags '(indentation))
15311548
"

0 commit comments

Comments
 (0)