Skip to content

Commit 048d7c1

Browse files
giacomocavalierilpil
authored andcommitted
CHANGELOG
1 parent fba6355 commit 048d7c1

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

CHANGELOG.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,81 @@
22

33
## Unreleased
44

5+
### Formatter
6+
7+
- The formatter now allows more control over how bit arrays are split. By adding
8+
a trailing comma at the end of a bit array that can fit on a single line, the
9+
bit array will be split on multiple lines:
10+
11+
```gleam
12+
pub fn dgram() -> BitArray {
13+
<<ip_version:4, header_length:4, service_type:8,>>
14+
}
15+
```
16+
17+
Will be formatted as:
18+
19+
```gleam
20+
pub fn dgram() -> BitArray {
21+
<<
22+
ip_version:4,
23+
header_length:4,
24+
service_type:8,
25+
>>
26+
}
27+
```
28+
29+
By removing the trailing comma, the formatter will try and fit the bit array
30+
on a single line again:
31+
32+
```gleam
33+
pub fn dgram() -> BitArray {
34+
<<
35+
ip_version:4,
36+
header_length:4,
37+
service_type:8
38+
>>
39+
}
40+
```
41+
42+
Will be formatted back to a single line:
43+
44+
```gleam
45+
pub fn dgram() -> BitArray {
46+
<<ip_version:4, header_length:4, service_type:8>>
47+
}
48+
```
49+
50+
([Giacomo Cavalieri](https://github.com/giacomocavalieri))
51+
52+
- The formatter now allows more control over how bit arrays are formatted.
53+
If a bit array is split with multiple segments on the same line, removing the
54+
trailing comma will make sure the formatter keeps each segment on its own
55+
line:
56+
57+
```gleam
58+
pub fn dgram() -> BitArray {
59+
<<
60+
"This bit array was formatted", "keeping segments on the same line",
61+
"notice how the formatting changes by removing the trailing comma ->",
62+
>>
63+
}
64+
```
65+
66+
Is formatted as:
67+
68+
```gleam
69+
pub fn dgram() -> BitArray {
70+
<<
71+
"This bit array was formatted",
72+
"keeping segments on the same line",
73+
"notice how the formatting changes by removing the trailing comma ->"
74+
>>
75+
}
76+
```
77+
78+
([Giacomo Cavalieri](https://github.com/giacomocavalieri))
79+
580
### Bug fixes
681

782
- Fixed a bug where the formatter would move a comment before `assert` to be

0 commit comments

Comments
 (0)