From 09bad640e4507885fa0e7035348c7854c531b3d6 Mon Sep 17 00:00:00 2001 From: Riley Bruins Date: Fri, 2 Aug 2024 06:05:25 -0700 Subject: fix(query): proper indentation after quantifiers --- queries/query/indents.scm | 7 ++++++- tests/indent/query/test.scm | 9 +++++++++ tests/indent/query_spec.lua | 5 ++++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/queries/query/indents.scm b/queries/query/indents.scm index d1cdb3eef..5cea97e1e 100644 --- a/queries/query/indents.scm +++ b/queries/query/indents.scm @@ -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 diff --git a/tests/indent/query/test.scm b/tests/indent/query/test.scm index 62b94417c..56d755690 100644 --- a/tests/indent/query/test.scm +++ b/tests/indent/query/test.scm @@ -38,4 +38,13 @@ "toplevel" "list" ] @variable + +[ + (parent + (child))+ + (parent + (child))* + (parent + (child))? +] @cap (( diff --git a/tests/indent/query_spec.lua b/tests/indent/query_spec.lua index 1f9c2315d..ca2ccdef5 100644 --- a/tests/indent/query_spec.lua +++ b/tests/indent/query_spec.lua @@ -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) -- cgit v1.2.3-70-g09d2