fixup! Add NeoVim test runner
This commit is contained in:
parent
8b80b7045a
commit
1cd5fea469
|
@ -1,5 +1,3 @@
|
|||
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)
|
||||
|
@ -9,6 +7,10 @@ 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 }
|
||||
|
||||
local Path = require("plenary.path")
|
||||
|
||||
local project_root = Path:new(".") -- FIXME: relies on current working directory
|
||||
|
||||
vim.filetype.add({
|
||||
extension = {
|
||||
bp = "bp",
|
||||
|
@ -21,8 +23,8 @@ 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
|
||||
url = project_root.filename,
|
||||
files = {"src/parser.c"},
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -30,3 +32,12 @@ require("nvim-treesitter.configs").setup({
|
|||
indent = { enable = true },
|
||||
highlight = { enable = true },
|
||||
})
|
||||
|
||||
-- Add queries, overriding potential `nvim-treesitter`-provided ones
|
||||
local scan_dir = require("plenary.scandir").scan_dir
|
||||
local queries_dir = project_root / "queries"
|
||||
for _, name in ipairs(scan_dir(queries_dir.filename)) do
|
||||
local content = Path:new(name):read()
|
||||
local basename = name:gsub(".*/", "")
|
||||
vim.treesitter.query.set("bp", basename:gsub(".scm$", ""), content)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue