Skip to content

Commit 48481ad

Browse files
committed
add debug logs
1 parent edd3359 commit 48481ad

File tree

2 files changed

+18
-28
lines changed

2 files changed

+18
-28
lines changed

lua/tests/install-parsers.lua

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,22 @@ if vim.fn.isdirectory(queries_dir) == 1 then
4343
print('Go query files: ' .. vim.inspect(go_queries))
4444
end
4545

46+
-- Set parser path explicitly
47+
vim.treesitter.language.register('go', 'go')
48+
4649
-- Try to load the parser
4750
for _, parser in ipairs(parsers) do
48-
local ok, err = pcall(vim.treesitter.language.add, parser)
51+
local ok, lang = pcall(vim.treesitter.language.add, parser)
4952
if ok then
50-
print("✓ Parser " .. parser .. " language loaded")
51-
else
52-
print("✗ Parser " .. parser .. " language failed: " .. tostring(err))
53-
end
54-
55-
-- Check if we can create a parser instance
56-
local test_ok, test_err = pcall(vim.treesitter.get_string_parser, '', parser)
57-
if test_ok then
58-
print("✓ Can create " .. parser .. " parser instance")
53+
print("✓ Parser " .. parser .. " language added")
54+
-- Try to actually load it
55+
local load_ok, err = pcall(vim.treesitter.language.inspect, parser)
56+
if load_ok then
57+
print("✓ Parser " .. parser .. " successfully loaded")
58+
else
59+
print("✗ Parser " .. parser .. " failed to load: " .. tostring(err))
60+
end
5961
else
60-
print("Cannot create " .. parser .. " parser: " .. tostring(test_err))
62+
print("Parser " .. parser .. " language failed: " .. tostring(lang))
6163
end
6264
end

lua/tests/minimal.lua

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ vim.opt.rtp:append('../nvim-lspconfig/')
55
vim.opt.rtp:append('../guihua.lua/')
66

77
-- Add the treesitter parser install directory to runtimepath BEFORE loading plugins
8-
vim.opt.rtp:append(vim.fn.stdpath('data') .. '/site')
8+
local parser_install_dir = vim.fn.stdpath('data') .. '/site'
9+
vim.opt.rtp:prepend(parser_install_dir)
910

1011
vim.cmd([[
1112
runtime! plugin/plenary.vim
@@ -38,27 +39,14 @@ require('go').setup({
3839

3940
require('nvim-treesitter').setup({
4041
-- Directory to install parsers and queries to
41-
install_dir = vim.fn.stdpath('data') .. '/site',
42+
install_dir = parser_install_dir,
4243
})
4344

4445
vim.o.swapfile = false
4546
vim.bo.swapfile = false
4647

47-
-- Don't create a FileType autocmd that calls vim.treesitter.start()
48-
-- Treesitter will start automatically when needed
49-
-- Just verify the parser is available when needed
50-
vim.api.nvim_create_autocmd('FileType', {
51-
pattern = { 'go' },
52-
callback = function()
53-
-- Only verify, don't start
54-
local has_parser = pcall(vim.treesitter.language.add, 'go')
55-
if not has_parser then
56-
print('Warning: Go parser not available')
57-
else
58-
print('Go parser is available')
59-
end
60-
end,
61-
})
48+
-- Disable automatic treesitter start for now
49+
vim.g.ts_highlight_disable = true
6250

6351
vim.cmd([[set completeopt+=menuone,noselect,popup]])
6452
vim.lsp.enable('gopls')

0 commit comments

Comments
 (0)