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

Closing bracket not indented properly #876

Open
arlowhite opened this issue Oct 2, 2024 · 1 comment
Open

Closing bracket not indented properly #876

arlowhite opened this issue Oct 2, 2024 · 1 comment

Comments

@arlowhite
Copy link

We have this code where the closing bracket ] is not indented properly.

Original Code

function find_horizontal(geom::GIWrap.Polygon)::Vector{Tuple{Float64,Float64}}
    coords = collect(GI.coordinates(geom)...)
    first_coord = first(coords)
    second_coord = coords[
        (getindex.(coords, 2) .∈ first_coord[2]) .&&
        (getindex.(coords, 1) .∉ first_coord[1])
    ]

    return [tuple(first_coord...), tuple(first(second_coord)...)]
end

Formatted

function find_horizontal(geom::GIWrap.Polygon)::Vector{Tuple{Float64,Float64}}
    coords = collect(GI.coordinates(geom)...)
    first_coord = first(coords)
    second_coord = coords[
    (getindex.(coords, 2) .∈ first_coord[2]) .&& (getindex.(coords, 1) .∉ first_coord[1])
]

    return [tuple(first_coord...), tuple(first(second_coord)...)]
end

Expected

I prefer the original code, but would expect the indents to look like this after format:

    second_coord = coords[
        (getindex.(coords, 2) .∈ first_coord[2]) .&& (getindex.(coords, 1) .∉ first_coord[1])
    ]

.JuliaFormatter.toml

style="blue"
indent=4
margin=92
always_for_in="nothing"
for_in_replacement=""
whitespace_typedefs=false
import_to_using=true
align_struct_field=true
align_assignment=false
align_conditional=true
align_pair_arrow=false
normalize_line_endings="unix"
align_matrix=true
join_lines_based_on_source=true
indent_submodule=true
surround_whereop_typeparameters=false
yas_style_nesting=true
trailing_comma=false
short_to_long_function_def=false
conditional_to_if=false
@domluna
Copy link
Owner

domluna commented Oct 4, 2024

so the reason for this formatting is due to join_lines_based_on_source=true.

in the original code the closing bracket is on the line below, so this is actually correct but there's a bug regarding the indentation as you pointed out. I'll take a look.

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