autofmt removes blank lines between proc/struct/enum members
- Dominant language
- C++
- Stars
- 1.9k
- Forks
- 283
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 135
Description
**Describe the bug**
Maybe more but I noticed that these aggregates aggressively strip blank lines, whereas functions preserve a single blank line which may be intentional for readability to denote logical separation of code.
**To Reproduce**
Run the following code through the autoformatter:
```
proc my_proc {
// foo section
// x data
foo_x: chan out;
// y data
foo_y: chan out;
// bar section
// x data
bar_x: chan out;
// y data
bar_y: chan out;
// baz section
// x data
baz_x: chan out;
// y data
baz_y: chan out;
...
}
```
See the code reformatted to:
```
proc my_proc {
// foo section
// x data
foo_x: chan out;
// y data
foo_y: chan out;
// bar section
// x data
bar_x: chan out;
// y data
bar_y: chan out;
// baz section
// x data
baz_x: chan out;
// y data
baz_y: chan out;
...
}
```
Same behavior can be seen in enum and struct definitions.
**Expected behavior**
The autoformatter should preserve the notion of subsections within these composites. It already does for code within functions, e.g.
```
fn my_function() {
// some code block
let foo = u32:1;
let bar = u32:0;
// return the sum
foo + bar
}
```
does not get reformatted to:
```
fn my_function() {
// some code block
let foo = u32:1;
let bar = u32:0;
// return the sum
foo + bar
}
```
though it would remove extra blank lines beyond 1.
Contributor guide
Assessment
This issue has not been assessed yet.