indent(hcl): fix function calls

This commit is contained in:
Michael Hoffmann 2022-04-24 23:16:35 +02:00 committed by Stephan Seitz
parent b1e8b61a94
commit 82e43748cf
4 changed files with 12 additions and 11 deletions

View file

@ -63,8 +63,8 @@
] @string ] @string
[ [
(heredoc_identifier) ; <<END (heredoc_identifier) ; END
(heredoc_start) ; END (heredoc_start) ; << or <<-
] @punctuation.delimiter ] @punctuation.delimiter
[ [

View file

@ -2,21 +2,14 @@
(block) (block)
(object) (object)
(tuple) (tuple)
(function_call)
] @indent ] @indent
[
(block_end)
(object_end)
(tuple_end)
] @branch
[ [
"]" "]"
")" ")"
"}" "}"
] @indent_end ] @branch @indent_end
(comment) @auto (comment) @auto
(ERROR) @auto (ERROR) @auto

View file

@ -0,0 +1,6 @@
test {
x = f(
a,
b,
)
}

View file

@ -29,5 +29,7 @@ describe("indent HCL:", function()
run:new_line("multiple-attributes.tf", { on_line = 4, text = "a = 1", indent = 0 }) run:new_line("multiple-attributes.tf", { on_line = 4, text = "a = 1", indent = 0 })
run:new_line("nested_blocks.tf", { on_line = 3, text = "a = 1", indent = 4 }) run:new_line("nested_blocks.tf", { on_line = 3, text = "a = 1", indent = 4 })
run:new_line("nested_blocks.tf", { on_line = 4, text = "a = 1", indent = 2 }) run:new_line("nested_blocks.tf", { on_line = 4, text = "a = 1", indent = 2 })
run:new_line("function_call.tf", { on_line = 4, text = "c,", indent = 4 })
run:new_line("function_call.tf", { on_line = 5, text = "a = 1", indent = 2 })
end) end)
end) end)