fix(query): proper indentation after quantifiers

This commit is contained in:
Riley Bruins 2024-08-02 06:05:25 -07:00 committed by 再生花
parent 8453015093
commit 09bad640e4
3 changed files with 19 additions and 2 deletions

View file

@ -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

View file

@ -38,4 +38,13 @@
"toplevel"
"list"
] @variable
[
(parent
(child))+
(parent
(child))*
(parent
(child))?
] @cap
((

View file

@ -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)