google / google/xls

Better formatting with proc-scoped type aliases

Open
#1,962 0 comments 0 reactions 0 assignees View on GitHub
dslx:fmt enhancement
Dominant language
C++
Stars
1.9k
Forks
283
Avg merge
2d 10h
Merged PRs (30d)
135

Description

### What's hard to do? (limit 100 words)

With https://github.com/google/xls/issues/1050, you can have proc scoped type aliases.

But the DSLX formatter seems to shove the types and channels into one big blob and does not preserve user inserted line breaks.

```
proc Foo {
type Bar = bits[32];

bar: chan out;
baz: chan in;

config(bar: chan out, baz: chan in) { (bar, baz) }

init { () }

next(state: ()) { }
}
```

is reformatted to

```
proc Foo {
type Bar = bits[32];
bar: chan out;
baz: chan in;

config(bar: chan out, baz: chan in) { (bar, baz) }

init { () }

next(state: ()) { }
}
```

### Current best alternative workaround (limit 100 words)

Adding a comment like `//Channels` at least helps delineate where the channel declarations start.

### Your view of the "best case XLS enhancement" (limit 100 words)

Preserve user line breaks which can be helpful for signifying different conceptual clusters of code.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.