Skip to content

Commit eb5c4f0

Browse files
authored
Anchor equals sign in data/type declarations (#75)
1 parent f4f8dee commit eb5c4f0

File tree

3 files changed

+144
-3
lines changed

3 files changed

+144
-3
lines changed

src/Tidy.purs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ formatDecl conf = case _ of
382382
declareHanging
383383
(formatDataHead conf head)
384384
space
385-
(formatToken conf equals)
385+
(anchor (formatToken conf equals))
386386
(formatHangingDataCtor conf ctors.head)
387387
else
388388
formatDataHead conf head `flexSpaceBreak` indent do
@@ -400,14 +400,14 @@ formatDecl conf = case _ of
400400
declareHanging
401401
(formatDataHead conf head)
402402
space
403-
(formatToken conf equals)
403+
(anchor (formatToken conf equals))
404404
(formatHangingType conf ty)
405405

406406
DeclNewtype head equals name ty ->
407407
declareHanging
408408
(formatDataHead conf head)
409409
space
410-
(formatToken conf equals)
410+
(anchor (formatToken conf equals))
411411
(formatHangingDataCtor conf (DataCtor { name, fields: [ ty ] }))
412412

413413
DeclRole kw1 kw2 name rls ->
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
module DataDeclarations where
2+
3+
data Test a = A | B | C | D | E | F | G | H | I | J | K | L
4+
5+
data Test a
6+
= A
7+
| B
8+
| C
9+
| D
10+
| E
11+
12+
data Test a
13+
= A
14+
| B
15+
| C
16+
| D
17+
| E
18+
19+
data Test a
20+
= A
21+
| B
22+
| C
23+
| D
24+
| E
25+
26+
newtype Test a = Test a
27+
28+
newtype Test a = Test a
29+
30+
newtype Test a =
31+
Test a
32+
33+
newtype Test a =
34+
Test a
35+
36+
type Test a = a
37+
38+
type Test a = a
39+
40+
type Test a =
41+
a
42+
43+
type Test a =
44+
a
45+
46+
-- @format --width=40
47+
module DataDeclarations where
48+
49+
data Test a
50+
= A
51+
| B
52+
| C
53+
| D
54+
| E
55+
| F
56+
| G
57+
| H
58+
| I
59+
| J
60+
| K
61+
| L
62+
63+
data Test a
64+
= A
65+
| B
66+
| C
67+
| D
68+
| E
69+
70+
data Test a
71+
= A
72+
| B
73+
| C
74+
| D
75+
| E
76+
77+
data Test a
78+
= A
79+
| B
80+
| C
81+
| D
82+
| E
83+
84+
newtype Test a = Test a
85+
86+
newtype Test a = Test a
87+
88+
newtype Test a =
89+
Test a
90+
91+
newtype Test a =
92+
Test a
93+
94+
type Test a = a
95+
96+
type Test a = a
97+
98+
type Test a =
99+
a
100+
101+
type Test a =
102+
a

test/snapshots/DataDeclarations.purs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
-- @format --width=40
2+
module DataDeclarations where
3+
4+
data Test a = A | B | C | D | E | F | G | H | I | J | K | L
5+
6+
data Test a
7+
= A | B | C | D | E
8+
9+
data Test a
10+
= A | B
11+
| C | D | E
12+
13+
data Test a =
14+
A | B
15+
| C | D | E
16+
17+
newtype Test a = Test a
18+
19+
newtype Test a
20+
= Test a
21+
22+
newtype Test a =
23+
Test a
24+
25+
newtype Test a
26+
=
27+
Test a
28+
29+
type Test a = a
30+
31+
type Test a
32+
= a
33+
34+
type Test a =
35+
a
36+
37+
type Test a
38+
=
39+
a

0 commit comments

Comments
 (0)