Skip to content

Commit

Permalink
fix #745
Browse files Browse the repository at this point in the history
  • Loading branch information
domluna committed Oct 2, 2023
1 parent 32444ee commit 51a016e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
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

0 comments on commit 51a016e

Please sign in to comment.