diff options
| author | Michael Hoffmann <mhoffm@posteo.de> | 2022-04-24 23:16:35 +0200 |
|---|---|---|
| committer | Stephan Seitz <stephan.seitz@fau.de> | 2022-04-25 23:36:36 +0200 |
| commit | 82e43748cf70adab261ba0a23a342774bd5b9088 (patch) | |
| tree | c86943a612b0ab45801f7a3845310157e1778874 | |
| parent | indents(hcl): fix indentation queries (diff) | |
| download | nvim-treesitter-82e43748cf70adab261ba0a23a342774bd5b9088.tar nvim-treesitter-82e43748cf70adab261ba0a23a342774bd5b9088.tar.gz nvim-treesitter-82e43748cf70adab261ba0a23a342774bd5b9088.tar.bz2 nvim-treesitter-82e43748cf70adab261ba0a23a342774bd5b9088.tar.lz nvim-treesitter-82e43748cf70adab261ba0a23a342774bd5b9088.tar.xz nvim-treesitter-82e43748cf70adab261ba0a23a342774bd5b9088.tar.zst nvim-treesitter-82e43748cf70adab261ba0a23a342774bd5b9088.zip | |
indent(hcl): fix function calls
| -rw-r--r-- | queries/hcl/highlights.scm | 4 | ||||
| -rw-r--r-- | queries/hcl/indents.scm | 11 | ||||
| -rw-r--r-- | tests/indent/hcl/function_call.tf | 6 | ||||
| -rw-r--r-- | tests/indent/hcl_spec.lua | 2 |
4 files changed, 12 insertions, 11 deletions
diff --git a/queries/hcl/highlights.scm b/queries/hcl/highlights.scm index 67e85cb61..f6512148c 100644 --- a/queries/hcl/highlights.scm +++ b/queries/hcl/highlights.scm @@ -63,8 +63,8 @@ ] @string [ - (heredoc_identifier) ; <<END - (heredoc_start) ; END + (heredoc_identifier) ; END + (heredoc_start) ; << or <<- ] @punctuation.delimiter [ diff --git a/queries/hcl/indents.scm b/queries/hcl/indents.scm index c316628ba..d68ec3081 100644 --- a/queries/hcl/indents.scm +++ b/queries/hcl/indents.scm @@ -2,21 +2,14 @@ (block) (object) (tuple) + (function_call) ] @indent [ - (block_end) - (object_end) - (tuple_end) -] @branch - - -[ "]" ")" "}" -] @indent_end - +] @branch @indent_end (comment) @auto (ERROR) @auto diff --git a/tests/indent/hcl/function_call.tf b/tests/indent/hcl/function_call.tf new file mode 100644 index 000000000..44c477e48 --- /dev/null +++ b/tests/indent/hcl/function_call.tf @@ -0,0 +1,6 @@ +test { + x = f( + a, + b, + ) +} diff --git a/tests/indent/hcl_spec.lua b/tests/indent/hcl_spec.lua index b97af2786..ee53d89fc 100644 --- a/tests/indent/hcl_spec.lua +++ b/tests/indent/hcl_spec.lua @@ -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("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("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) |
