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

fix #745 #762

Merged
merged 2 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "JuliaFormatter"
uuid = "98e50ef6-434e-11e9-1051-2b60c6c9e899"
authors = ["Dominique Luna <[email protected]>"]
version = "1.0.37"
version = "1.0.38"

[deps]
CSTParser = "00ebfdb7-1f24-5e51-bd34-a7502290713f"
Expand Down
9 changes: 7 additions & 2 deletions src/styles/default/pretty.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2223,8 +2223,13 @@ function p_ncat(ds::DefaultStyle, cst::CSTParser.EXPR, s::State)
for (i, a) in enumerate(cst)
n = pretty(style, a, s)
diff_line = t.endline != t.startline
i == st && continue
if is_opener(a) && nest
if i == st && length(args) == 0
for c in 1:n_semicolons
add_node!(t, Semicolon(), s)
end
elseif i == st
continue
elseif is_opener(a) && nest
add_node!(t, n, s, join_lines = true)
add_node!(t, Placeholder(0), s)
elseif !is_closer(a) && i > st
Expand Down
6 changes: 6 additions & 0 deletions test/issues.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1691,6 +1691,12 @@
@test format_text(s, SciMLStyle()) == s
end

@testset "745" begin
s = "[;;;]"
@test fmt(s, 4, 92) == s
@test fmt(s, 4, 1) == s
end

@testset "748" begin
# this started out as an error with SciMLStyle but I narrowed it down to an edge case
# with the `join_lines_based_on_source` option with vcat types
Expand Down