aboutsummaryrefslogtreecommitdiffstats
path: root/tests/indent/query_spec.lua
diff options
context:
space:
mode:
authorRiley Bruins <ribru17@hotmail.com>2024-02-21 01:47:09 -0800
committerGitHub <noreply@github.com>2024-02-21 18:47:09 +0900
commit455f6586bae558f99b51c0b07d46adc736f3822c (patch)
treea2f5091bd44cc51794c85dd0d86846bd8398d9f4 /tests/indent/query_spec.lua
parenthighlights(slang): add support for `where` (diff)
downloadnvim-treesitter-455f6586bae558f99b51c0b07d46adc736f3822c.tar
nvim-treesitter-455f6586bae558f99b51c0b07d46adc736f3822c.tar.gz
nvim-treesitter-455f6586bae558f99b51c0b07d46adc736f3822c.tar.bz2
nvim-treesitter-455f6586bae558f99b51c0b07d46adc736f3822c.tar.lz
nvim-treesitter-455f6586bae558f99b51c0b07d46adc736f3822c.tar.xz
nvim-treesitter-455f6586bae558f99b51c0b07d46adc736f3822c.tar.zst
nvim-treesitter-455f6586bae558f99b51c0b07d46adc736f3822c.zip
feat(query): indents that reflect the formatter (#6154)
* feat(query): indents that reflect the formatter Indentation queries that reflect the query formatter. Only applicable if `lispoptions=expr:1`
Diffstat (limited to 'tests/indent/query_spec.lua')
-rw-r--r--tests/indent/query_spec.lua25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/indent/query_spec.lua b/tests/indent/query_spec.lua
new file mode 100644
index 000000000..1f9c2315d
--- /dev/null
+++ b/tests/indent/query_spec.lua
@@ -0,0 +1,25 @@
+local Runner = require("tests.indent.common").Runner
+
+local run = Runner:new(it, "tests/indent/query", {
+ tabstop = 2,
+ shiftwidth = 2,
+ softtabstop = 2,
+ expandtab = true,
+ lispoptions = "expr:1",
+})
+
+describe("indent Query:", function()
+ describe("whole file:", function()
+ run:whole_file(".", {})
+ end)
+ describe("new line:", function()
+ run:new_line("test.scm", { on_line = 3, text = "(node)", indent = 2 })
+ run:new_line("test.scm", { on_line = 5, text = "(node)", indent = 2 })
+ run:new_line("test.scm", { on_line = 12, text = "(node)", indent = 2 })
+ run:new_line("test.scm", { on_line = 25, text = "(#my-directive!)", indent = 10 })
+ 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 })
+ end)
+end)