Skip to content

Commit

Permalink
Fix handling of comments within import/using lists
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikekre committed Aug 3, 2024
1 parent e697677 commit f0a6d32
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/runestone.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1039,7 +1039,7 @@ function format_importpath(ctx::Context, node::Node)
node′ = replace_first_leaf(node, spacebar)
else
# No whitespace, insert
@assert kind(first_leaf(node)) in KSet"Identifier @" ||
@assert kind(first_leaf(node)) in KSet"Identifier @ Comment" ||
JuliaSyntax.is_operator(first_leaf(node))
kids′ = copy(verified_kids(node))
pushfirst!(kids′, spacebar)
Expand Down
2 changes: 2 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,8 @@ end
"$(verb) A: $(a), $(b)"
@test format_string("$(verb) $(sp)A: $(sp)$(a)$(sp),\n$(b)") ==
"$(verb) A: $(a),\n $(b)"
@test format_string("$(verb) $(sp)A: $(sp)$(a)$(sp),$(sp)# c\n$(b)") ==
"$(verb) A: $(a), # c\n $(b)"
end
end
end
Expand Down

0 comments on commit f0a6d32

Please sign in to comment.