mirror of
https://github.com/chenasraf/nvim-treesitter.git
synced 2026-05-18 01:39:00 +00:00
feat: add indents.scm for nickel (#4790)
This commit is contained in:
13
queries/nickel/indents.scm
Normal file
13
queries/nickel/indents.scm
Normal file
@@ -0,0 +1,13 @@
|
||||
[
|
||||
(term)
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
"]"
|
||||
"}"
|
||||
] @indent.branch
|
||||
|
||||
[
|
||||
"]"
|
||||
"}"
|
||||
] @indent.end
|
||||
@@ -4,6 +4,7 @@ vim.cmd [[runtime! plugin/nvim-treesitter.lua]]
|
||||
|
||||
vim.cmd [[au BufRead,BufNewFile *.conf set filetype=hocon]]
|
||||
vim.cmd [[au BufRead,BufNewFile *.gleam set filetype=gleam]]
|
||||
vim.cmd [[au BufRead,BufNewFile *.ncl set filetype=nickel]]
|
||||
|
||||
vim.o.swapfile = false
|
||||
vim.bo.swapfile = false
|
||||
|
||||
9
tests/indent/nickel/indent-newline.ncl
Normal file
9
tests/indent/nickel/indent-newline.ncl
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
key1 = 1,
|
||||
key2 = [
|
||||
2
|
||||
],
|
||||
key3 = {
|
||||
key4 = 4
|
||||
}
|
||||
}
|
||||
24
tests/indent/nickel_spec.lua
Normal file
24
tests/indent/nickel_spec.lua
Normal file
@@ -0,0 +1,24 @@
|
||||
local Runner = require("tests.indent.common").Runner
|
||||
|
||||
local run = Runner:new(it, "tests/indent/nickel", {
|
||||
shiftwidth = 2,
|
||||
expandtab = true,
|
||||
})
|
||||
|
||||
describe("indent Nickel:", function()
|
||||
describe("whole file:", function()
|
||||
run:whole_file(".", {
|
||||
expected_failures = {},
|
||||
})
|
||||
end)
|
||||
|
||||
describe("new line:", function()
|
||||
run:new_line("indent-newline.ncl", { on_line = 1, text = "stmt", indent = 2 })
|
||||
run:new_line("indent-newline.ncl", { on_line = 2, text = "stmt", indent = 2 })
|
||||
run:new_line("indent-newline.ncl", { on_line = 3, text = "stmt", indent = 4 })
|
||||
run:new_line("indent-newline.ncl", { on_line = 4, text = "]", indent = 2 })
|
||||
run:new_line("indent-newline.ncl", { on_line = 5, text = "stmt", indent = 2 })
|
||||
run:new_line("indent-newline.ncl", { on_line = 6, text = "stmt", indent = 4 })
|
||||
run:new_line("indent-newline.ncl", { on_line = 7, text = "}", indent = 2 })
|
||||
end)
|
||||
end)
|
||||
Reference in New Issue
Block a user