Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better formatting with proc-scoped type aliases #1962

Open
mikex-oss opened this issue Feb 28, 2025 · 0 comments
Open

Better formatting with proc-scoped type aliases #1962

mikex-oss opened this issue Feb 28, 2025 · 0 comments
Labels
dslx:fmt DSLX auto-formatter enhancement New feature or request

Comments

@mikex-oss
Copy link
Collaborator

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

With #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<Bar> out;
    baz: chan<Bar> in;

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

    init { () }

    next(state: ()) {  }
}

is reformatted to

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

    config(bar: chan<Bar> out, baz: chan<Bar> 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.

@mikex-oss mikex-oss added dslx:fmt DSLX auto-formatter enhancement New feature or request labels Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dslx:fmt DSLX auto-formatter enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant