Skip to content

Commit

Permalink
fix #745 (#762)
Browse files Browse the repository at this point in the history
* fix #745

* v bump
  • Loading branch information
domluna authored Oct 4, 2023
1 parent 32444ee commit ccc6712
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
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

2 comments on commit ccc6712

@domluna
Copy link
Owner Author

@domluna domluna commented on ccc6712 Oct 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/92708

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.0.38 -m "<description of version>" ccc67121296790f3baf7de408280c08256c88808
git push origin v1.0.38

Please sign in to comment.