mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-17 02:40:09 -04:00
fix(indent): lua - support @indent_end (#2454)
This commit is contained in:
parent
9f69999e2a
commit
11e7ee1d91
2 changed files with 8 additions and 0 deletions
|
|
@ -13,6 +13,10 @@
|
||||||
(return_statement)
|
(return_statement)
|
||||||
] @indent
|
] @indent
|
||||||
|
|
||||||
|
[
|
||||||
|
"end"
|
||||||
|
] @indent_end
|
||||||
|
|
||||||
(return_statement
|
(return_statement
|
||||||
(expression_list
|
(expression_list
|
||||||
(function_call))) @dedent
|
(function_call))) @dedent
|
||||||
|
|
|
||||||
|
|
@ -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("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 = 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 = 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 = 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 = 1, text = "x", indent = 0 })
|
||||||
run:new_line("string.lua", { on_line = 2, 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 })
|
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 = 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 = 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 = 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)
|
||||||
end)
|
end)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue