mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
fix(indent): c/cpp - support newline after closing brace
This commit is contained in:
parent
8f9d4ada35
commit
782e299cd6
3 changed files with 6 additions and 0 deletions
|
|
@ -25,6 +25,8 @@
|
|||
(binary_expression)
|
||||
] @indent)
|
||||
|
||||
(compound_statement "}" @indent_end)
|
||||
|
||||
[
|
||||
"#define"
|
||||
"#ifdef"
|
||||
|
|
|
|||
|
|
@ -24,7 +24,9 @@ describe("indent C:", function()
|
|||
runner:new_line("array.c", { on_line = 2, text = "0,", indent = 4 })
|
||||
runner:new_line("compound_lit.c", { on_line = 7, text = ".z = 5,", indent = 8 })
|
||||
runner:new_line("cond.c", { on_line = 3, text = "x++;", indent = 8 })
|
||||
runner:new_line("cond.c", { on_line = 6, text = "x++;", indent = 8 })
|
||||
runner:new_line("cond.c", { on_line = 8, text = "x++;", indent = 8 })
|
||||
runner:new_line("cond.c", { on_line = 9, text = "x++;", indent = 4 })
|
||||
runner:new_line("expr.c", { on_line = 10, text = "2 *", indent = 8 })
|
||||
runner:new_line("func.c", { on_line = 17, text = "int z,", indent = 4 })
|
||||
runner:new_line("label.c", { on_line = 3, text = "normal:", indent = 0 }, "expected failure", XFAIL)
|
||||
|
|
|
|||
|
|
@ -31,7 +31,9 @@ describe("indent C++:", function()
|
|||
-- TODO: find a clean way to import these from c_spec.lua
|
||||
run:new_line("c/array.c", { on_line = 2, text = "0,", indent = 4 })
|
||||
run:new_line("c/cond.c", { on_line = 3, text = "x++;", indent = 8 })
|
||||
run:new_line("c/cond.c", { on_line = 6, text = "x++;", indent = 8 })
|
||||
run:new_line("c/cond.c", { on_line = 8, text = "x++;", indent = 8 })
|
||||
run:new_line("c/cond.c", { on_line = 9, text = "x++;", indent = 4 })
|
||||
run:new_line("c/expr.c", { on_line = 10, text = "2 *", indent = 8 })
|
||||
run:new_line("c/func.c", { on_line = 17, text = "int z,", indent = 4 })
|
||||
run:new_line("c/label.c", { on_line = 3, text = "normal:", indent = 0 }, "expected failure", XFAIL)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue