mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 11:06:54 -04:00
fix(query): proper indentation after quantifiers
This commit is contained in:
parent
8453015093
commit
09bad640e4
3 changed files with 19 additions and 2 deletions
|
|
@ -12,7 +12,12 @@
|
|||
|
||||
"]" @indent.branch @indent.end
|
||||
|
||||
")" @indent.end
|
||||
[
|
||||
")"
|
||||
"?"
|
||||
"*"
|
||||
"+"
|
||||
] @indent.end
|
||||
|
||||
; Captures always mark the end of a node
|
||||
; Because of that, mark it as indent.end
|
||||
|
|
|
|||
|
|
@ -38,4 +38,13 @@
|
|||
"toplevel"
|
||||
"list"
|
||||
] @variable
|
||||
|
||||
[
|
||||
(parent
|
||||
(child))+
|
||||
(parent
|
||||
(child))*
|
||||
(parent
|
||||
(child))?
|
||||
] @cap
|
||||
((
|
||||
|
|
|
|||
|
|
@ -20,6 +20,9 @@ describe("indent Query:", function()
|
|||
run:new_line("test.scm", { on_line = 34, text = '"more"', indent = 2 })
|
||||
run:new_line("test.scm", { on_line = 35, text = "(node)", indent = 0 })
|
||||
run:new_line("test.scm", { on_line = 40, text = "(node)", indent = 0 })
|
||||
run:new_line("test.scm", { on_line = 41, text = "node_name", indent = 2 })
|
||||
run:new_line("test.scm", { on_line = 44, text = "(node)", indent = 2 })
|
||||
run:new_line("test.scm", { on_line = 46, text = "(node)", indent = 2 })
|
||||
run:new_line("test.scm", { on_line = 48, text = "(node)", indent = 2 })
|
||||
run:new_line("test.scm", { on_line = 50, text = "node_name", indent = 2 })
|
||||
end)
|
||||
end)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue