mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-08 14:30:05 -04:00
parent
caf275382f
commit
fa611f612a
3 changed files with 17 additions and 4 deletions
|
|
@ -59,10 +59,11 @@
|
||||||
(statement_block
|
(statement_block
|
||||||
"{" @indent.branch)
|
"{" @indent.branch)
|
||||||
|
|
||||||
(parenthesized_expression
|
((parenthesized_expression
|
||||||
("("
|
"("
|
||||||
(_)
|
(_)
|
||||||
")" @indent.end))
|
")" @indent.end) @_outer
|
||||||
|
(#not-has-parent? @_outer if_statement))
|
||||||
|
|
||||||
[
|
[
|
||||||
"}"
|
"}"
|
||||||
|
|
@ -75,3 +76,7 @@
|
||||||
(comment)
|
(comment)
|
||||||
(ERROR)
|
(ERROR)
|
||||||
] @indent.auto
|
] @indent.auto
|
||||||
|
|
||||||
|
(if_statement
|
||||||
|
consequence: (_) @indent.dedent
|
||||||
|
(#not-kind-eq? @indent.dedent statement_block)) @indent.begin
|
||||||
|
|
|
||||||
|
|
@ -11,3 +11,9 @@ if (cond1) {
|
||||||
} else {
|
} else {
|
||||||
do_fallback()
|
do_fallback()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (true)
|
||||||
|
console.log('hi')
|
||||||
|
console.log('hi')
|
||||||
|
|
||||||
|
if (true)
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,8 @@ describe("indent JavaScript:", function()
|
||||||
{ 9, 2 },
|
{ 9, 2 },
|
||||||
{ 12, 2 },
|
{ 12, 2 },
|
||||||
{ 13, 0 },
|
{ 13, 0 },
|
||||||
|
{ 16, 0 },
|
||||||
|
{ 19, 2 },
|
||||||
} do
|
} do
|
||||||
run:new_line("ecma/if_else.js", { on_line = info[1], text = "hello()", indent = info[2] }, info[3], info[4])
|
run:new_line("ecma/if_else.js", { on_line = info[1], text = "hello()", indent = info[2] }, info[3], info[4])
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue