diff options
| author | Munif Tanjim <hello@muniftanjim.dev> | 2022-02-05 03:08:18 +0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-04 22:08:18 +0100 |
| commit | 11e7ee1d91dcb97f85c3fa98da440595289123fe (patch) | |
| tree | d8ac0196c197a46e09afc448cb5ed9b0d71e1709 | |
| parent | Update lockfile.json (diff) | |
| download | nvim-treesitter-11e7ee1d91dcb97f85c3fa98da440595289123fe.tar nvim-treesitter-11e7ee1d91dcb97f85c3fa98da440595289123fe.tar.gz nvim-treesitter-11e7ee1d91dcb97f85c3fa98da440595289123fe.tar.bz2 nvim-treesitter-11e7ee1d91dcb97f85c3fa98da440595289123fe.tar.lz nvim-treesitter-11e7ee1d91dcb97f85c3fa98da440595289123fe.tar.xz nvim-treesitter-11e7ee1d91dcb97f85c3fa98da440595289123fe.tar.zst nvim-treesitter-11e7ee1d91dcb97f85c3fa98da440595289123fe.zip | |
fix(indent): lua - support `@indent_end` (#2454)
| -rw-r--r-- | queries/lua/indents.scm | 4 | ||||
| -rw-r--r-- | tests/indent/lua_spec.lua | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/queries/lua/indents.scm b/queries/lua/indents.scm index e7366d0d0..0eb0fc1b5 100644 --- a/queries/lua/indents.scm +++ b/queries/lua/indents.scm @@ -13,6 +13,10 @@ (return_statement) ] @indent +[ + "end" +] @indent_end + (return_statement (expression_list (function_call))) @dedent diff --git a/tests/indent/lua_spec.lua b/tests/indent/lua_spec.lua index d198c5cca..2577e4837 100644 --- a/tests/indent/lua_spec.lua +++ b/tests/indent/lua_spec.lua @@ -22,7 +22,9 @@ describe("indent Lua:", function() run:new_line("comment.lua", { on_line = 5, text = "multiline", indent = " " }, "expected failure", XFAIL) run:new_line("func.lua", { on_line = 1, text = "x = x + 1", indent = 2 }) run:new_line("func.lua", { on_line = 2, text = "y = y + 1", indent = 4 }) + run:new_line("func.lua", { on_line = 4, text = "y = y + 1", indent = 2 }) run:new_line("func.lua", { on_line = 5, text = "3,", indent = 4 }) + run:new_line("func.lua", { on_line = 9, text = "x = x + 1", indent = 0 }) run:new_line("string.lua", { on_line = 1, text = "x", indent = 0 }) run:new_line("string.lua", { on_line = 2, text = "x", indent = 0 }) run:new_line("string.lua", { on_line = 3, text = "x", indent = 2 }) @@ -34,5 +36,7 @@ describe("indent Lua:", function() run:new_line("cond.lua", { on_line = 5, text = "x = x + 1", indent = 2 }) run:new_line("cond.lua", { on_line = 7, text = "x = x + 1", indent = 2 }) run:new_line("cond.lua", { on_line = 8, text = "x = x + 1", indent = 4 }) + run:new_line("cond.lua", { on_line = 10, text = "x = x + 1", indent = 2 }) + run:new_line("cond.lua", { on_line = 12, text = "x = x + 1", indent = 0 }) end) end) |
