Browse Source

Fix handling of comments within import/using lists

fe/perf
Fredrik Ekre 1 year ago
parent
commit
f0a6d32476
No known key found for this signature in database
GPG Key ID: DE82E6D5E364C0A2
  1. 2
      src/runestone.jl
  2. 2
      test/runtests.jl

2
src/runestone.jl

@ -1039,7 +1039,7 @@ function format_importpath(ctx::Context, node::Node) @@ -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)

2
test/runtests.jl

@ -848,6 +848,8 @@ end @@ -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

Loading…
Cancel
Save