Add NeoVim test runner

For the queries that can't be tested with `tree-sitter` itself.
This commit is contained in:
Bruno BELANYI 2024-04-11 19:42:25 +01:00
parent cb932811c5
commit c73eadd348
4 changed files with 84 additions and 0 deletions

32
scripts/minimal_init.lua Normal file
View file

@ -0,0 +1,32 @@
local project_root = "." -- FIXME: relies on current working directory
vim.opt.runtimepath:append(vim.env.NVIM_PLENARY)
vim.opt.runtimepath:append(vim.env.NVIM_TREESITTER)
vim.opt.runtimepath:append(vim.env.NVIM_TREESITTER_TEXTOBJECTS)
vim.opt.runtimepath:append(vim.env.NVIM_TREESITTER_PARSER)
vim.cmd.runtime { "plugin/plenary.vim", bang = true }
vim.cmd.runtime { "plugin/nvim-treesitter.lua", bang = true }
vim.cmd.runtime { "plugin/nvim-treesitter-textobjects.lua", bang = true }
vim.filetype.add({
extension = {
bp = "bp",
},
})
vim.o.swapfile = false
vim.bo.swapfile = false
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
parser_config.bp = {
install_info = {
url = project_root,
files = {"src/parser.c"}, -- note that some parsers also require src/scanner.c or src/scanner.cc
},
}
require("nvim-treesitter.configs").setup({
indent = { enable = true },
highlight = { enable = true },
})