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

dslx_fmt adds unnecessary blank line #1728

Open
meheff opened this issue Nov 19, 2024 · 0 comments
Open

dslx_fmt adds unnecessary blank line #1728

meheff opened this issue Nov 19, 2024 · 0 comments
Labels
dslx:fmt DSLX auto-formatter dslx DSLX (domain specific language) implementation / front-end

Comments

@meheff
Copy link
Collaborator

meheff commented Nov 19, 2024

The blank line occurs after a line which is exactly 100 characters wide.

Input:

import std;

// Adds empty line
fn f(x: bool, y: bool, offset: u64) -> u32 {
    if x == y {
        const VVVVVVVVVVVVVVVVVV = u32:0;
        const WWWWWWWWWWWWWWWWWWWWWWWWWWWWW = u32:1;
        const WWWWWWWWWWWWWWWWWWWWWWWWWWWWW = s32:1;
        const YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY = s32:3;
        const ZZZZZZZZZZZZZZZZZZZZZZZZZZZ = s32:1;
        const XXXXXXXXXXXXXXXXXXXXXXXXXXXXX = std::clog2(ZZZZZZZZZZZZZZZZZZZZZZZZZZZ as u32) as s32;
        offset[WWWWWWWWWWWWWWWWWWWWWWWWWWWWW + VVVVVVVVVVVVVVVVVV as u32
               :VVVVVVVVVVVVVVVVVV as u32] ++ VVVVVVVVVVVVVVVVVV ++ VVVVVVVVVVVVVVVVVV;
        offset[YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY +
          YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY+:u32]
    } else {
        u32:0
    }
}

Output:

import std;

// Adds empty line
fn f(x: bool, y: bool, offset: u64) -> u32 {
    if x == y {
        const VVVVVVVVVVVVVVVVVV = u32:0;
        const WWWWWWWWWWWWWWWWWWWWWWWWWWWWW = u32:1;
        const WWWWWWWWWWWWWWWWWWWWWWWWWWWWW = s32:1;
        const YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY = s32:3;
        const ZZZZZZZZZZZZZZZZZZZZZZZZZZZ = s32:1;
        const XXXXXXXXXXXXXXXXXXXXXXXXXXXXX = std::clog2(ZZZZZZZZZZZZZZZZZZZZZZZZZZZ as u32) as s32;

        offset[WWWWWWWWWWWWWWWWWWWWWWWWWWWWW + VVVVVVVVVVVVVVVVVV as u32:VVVVVVVVVVVVVVVVVV as u32] ++
        VVVVVVVVVVVVVVVVVV ++ VVVVVVVVVVVVVVVVVV;
        offset[YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY +
               YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
               +:
               u32]
    } else {
        u32:0
    }
}
@meheff meheff added dslx:fmt DSLX auto-formatter dslx DSLX (domain specific language) implementation / front-end labels Nov 19, 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 dslx DSLX (domain specific language) implementation / front-end
Projects
Status: No status
Development

No branches or pull requests

1 participant