Skip to content

Commit f379906

Browse files
committed
update setup script
1 parent 2936b1d commit f379906

File tree

2 files changed

+29
-5
lines changed

2 files changed

+29
-5
lines changed

lua/tests/install-parsers.lua

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,30 @@
11
#!/usr/bin/env -S nvim -l
2-
vim.opt.runtimepath:append(os.getenv('NVIM_TS_DIR'))
2+
vim.opt.runtimepath:append('../nvim-treesitter')
33
vim.opt.runtimepath:append('.')
44

55
local parsers = { 'go' }
66
for i = 1, #_G.arg do
77
parsers[#parsers + 1] = _G.arg[i] ---@type string
88
end
99

10+
require('nvim-treesitter').setup({
11+
-- Directory to install parsers and queries to
12+
install_dir = vim.fn.stdpath('data') .. '/site',
13+
})
14+
1015
require('nvim-treesitter').install(parsers, { force = true }):wait(1800000) -- wait max. 30 minutes
16+
17+
18+
-- Verify installation
19+
print("Verifying parser installation...")
20+
local install_info = require('nvim-treesitter.info')
21+
local installed = install_info.installed_parsers()
22+
print('Installed parsers: ' .. vim.inspect(installed))
23+
24+
for _, parser in ipairs(parsers) do
25+
if vim.tbl_contains(installed, parser) then
26+
print("✓ Parser " .. parser .. " successfully installed")
27+
else
28+
print("✗ Parser " .. parser .. " failed to install")
29+
end
30+
end

lua/tests/minimal.lua

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,14 @@ vim.api.nvim_create_autocmd('FileType', {
4242
pattern = { 'go' },
4343
callback = function()
4444
pcall(vim.treesitter.start)
45-
local queries = require('nvim-treesitter.config').get_installed('queries')
46-
if not vim.tbl_contains(queries, 'go') then
47-
print('Installed queries: ' .. vim.inspect(queries))
48-
error('No queries for go found')
45+
-- Check if go parser is available using main branch API
46+
local ok, parser = pcall(vim.treesitter.get_parser, 0, 'go')
47+
if not ok then
48+
-- Check what parsers are actually installed
49+
local install_info = require('nvim-treesitter.info')
50+
local installed = install_info.installed_parsers()
51+
print('Installed parsers: ' .. vim.inspect(installed))
52+
error('No parser for go found')
4953
end
5054
end,
5155
})

0 commit comments

Comments
 (0)