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

Running format twice produces different output #897

Open
giordano opened this issue Jan 17, 2025 · 1 comment
Open

Running format twice produces different output #897

giordano opened this issue Jan 17, 2025 · 1 comment

Comments

@giordano
Copy link

giordano commented Jan 17, 2025

Reproducer using JuliaFormatter v1.0.62:

julia> using JuliaFormatter

julia> text = "push!(attributes, operandsegmentsizes([1, 1, 1, (lhs_scale==nothing) ? 0 : 1(rhs_scale==nothing) ? 0 : 1]))";

julia> style = BlueStyle();

julia> println(format_text(text; style))
push!(
    attributes,
    operandsegmentsizes([
        1, 1, 1, if (lhs_scale == nothing)
            0
        elseif 1(rhs_scale == nothing)
            0
        else
            1
        end
    ]),
)

julia> println(format_text(format_text(text; style); style))
push!(attributes, operandsegmentsizes([
    1,
    1,
    1,
    if (lhs_scale == nothing)
        0
    elseif 1(rhs_scale == nothing)
        0
    else
        1
    end,
]))
@willow-ahrens
Copy link

I have noticed this as well. I've found that in most cases, running it 3 times produces an output which does not change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants