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

autoformatter distorts comments on tuple #1678

Open
mikex-oss opened this issue Oct 30, 2024 · 0 comments
Open

autoformatter distorts comments on tuple #1678

mikex-oss opened this issue Oct 30, 2024 · 0 comments
Labels
dslx:fmt DSLX auto-formatter

Comments

@mikex-oss
Copy link
Collaborator

Describe the bug
These might all be different root causes, but I encountered each of these when trying to comment on a tuple element, but the autoformatter keeps changing my intent.

Below, comment 1 is moved to the previous element, comment 2 is removed, and comment 3 is triplicated in the branch arms.

To Reproduce

fn foo(bar: u32) {
    let some_data_to_make_single_update_per_line = u32:0xabcdef;
    (
        bit_slice_update(some_data_to_make_single_update_per_line, 0, u1:1), 
        // This is an important comment
        bit_slice_update(
            some_data_to_make_single_update_per_line, 1,
            // This is another important comment
            if bar > u32:0xdeadbeef { u1:1 } else { u1:0 }),  // this is yet another comment
        bit_slice_update(some_data_to_make_single_update_per_line, 2, u1:1)
    )
}

Changes to:

fn foo(bar: u32) {
    let some_data_to_make_single_update_per_line = u32:0xabcdef;
    (
        bit_slice_update(some_data_to_make_single_update_per_line, 0, u1:1), // This is an important
        // comment
        bit_slice_update(
            some_data_to_make_single_update_per_line, 1,
            if bar > u32:0xdeadbeef {
                u1:1  // this is yet another comment
            } else {
                u1:0  // this is yet another comment
            }), // this is yet another comment
        bit_slice_update(some_data_to_make_single_update_per_line, 2, u1:1)
    )
}

Expected behavior
Preserve my comments as is, which best reflects the developer intent for readability.

@mikex-oss mikex-oss added the dslx:fmt DSLX auto-formatter label Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dslx:fmt DSLX auto-formatter
Projects
None yet
Development

No branches or pull requests

1 participant