Browse Source

Fix single line macro definition

pull/19/head
Fredrik Ekre 1 year ago
parent
commit
9d30a41b84
No known key found for this signature in database
GPG Key ID: DE82E6D5E364C0A2
  1. 2
      src/runestone.jl
  2. 1
      test/runtests.jl

2
src/runestone.jl

@ -1347,7 +1347,7 @@ function indent_function_or_macro(ctx::Context, node::Node) @@ -1347,7 +1347,7 @@ function indent_function_or_macro(ctx::Context, node::Node)
any_kid_changed = true
end
# Fifth node is the closing end keyword
end_idx = block_idx + 1
end_idx = findnext(x -> kind(x) === K"end", kids, block_idx + 1)::Int
end_node = kids[end_idx]
@assert is_leaf(end_node) && kind(end_node) === K"end"
if !has_tag(end_node, TAG_DEDENT)

1
test/runtests.jl

@ -454,6 +454,7 @@ end @@ -454,6 +454,7 @@ end
# macro-end
@test format_string("macro f()\n$(sp)x\n$(sp)end") ==
"macro f()\n x\nend"
@test format_string("macro f() x end") == "macro f() x end"
# let-end
@test format_string("let a = 1\n$(sp)x\n$(sp)end") == "let a = 1\n x\nend"
@test format_string("let\n$(sp)x\n$(sp)end") == "let\n x\nend"

Loading…
Cancel
Save