From 717fef738bd67b644e70d84182e9b285bf64f810 Mon Sep 17 00:00:00 2001 From: Jędrzej Boczar Date: Wed, 6 Apr 2022 21:14:56 +0200 Subject: fix(indent/lua): wrong for nested tables due to branch on opening pairs --- queries/lua/indents.scm | 3 --- tests/indent/lua/nested-table.lua | 7 +++++++ tests/indent/lua_spec.lua | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 tests/indent/lua/nested-table.lua diff --git a/queries/lua/indents.scm b/queries/lua/indents.scm index fb6bb2820..283808843 100644 --- a/queries/lua/indents.scm +++ b/queries/lua/indents.scm @@ -24,13 +24,10 @@ (function_call))) @dedent [ - "do" "end" "then" "until" - "{" "}" - "(" ")" "elseif" (elseif_statement) diff --git a/tests/indent/lua/nested-table.lua b/tests/indent/lua/nested-table.lua new file mode 100644 index 000000000..cf507d1da --- /dev/null +++ b/tests/indent/lua/nested-table.lua @@ -0,0 +1,7 @@ +local a = { + { + { + 1 + }, + }, +} diff --git a/tests/indent/lua_spec.lua b/tests/indent/lua_spec.lua index 2da965e48..f584e5574 100644 --- a/tests/indent/lua_spec.lua +++ b/tests/indent/lua_spec.lua @@ -38,5 +38,6 @@ describe("indent Lua:", function() run:new_line("cond.lua", { on_line = 12, text = "x = x + 1", indent = 0 }) run:new_line("no-indent-after-paren-pairs.lua", { on_line = 3, text = "x = x + 1", indent = 0 }) run:new_line("no-indent-after-paren-pairs.lua", { on_line = 6, text = "x = x + 1", indent = 0 }) + run:new_line("nested-table.lua", { on_line = 5, text = "{}", indent = 4 }) end) end) -- cgit v1.2.3-70-g09d2