Skip to content

Commit edd3359

Browse files
committed
fix minimal
1 parent fb596d4 commit edd3359

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

lua/tests/minimal.lua

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,28 @@ require('go').setup({
3535
log_path = vim.fn.expand('$HOME') .. '/.cache/nvim/gonvim.log',
3636
lsp_cfg = true,
3737
})
38+
3839
require('nvim-treesitter').setup({
3940
-- Directory to install parsers and queries to
4041
install_dir = vim.fn.stdpath('data') .. '/site',
4142
})
43+
4244
vim.o.swapfile = false
4345
vim.bo.swapfile = false
46+
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
4450
vim.api.nvim_create_autocmd('FileType', {
4551
pattern = { 'go' },
4652
callback = function()
47-
-- Don't use pcall here so we can see the actual error
48-
vim.treesitter.start()
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
4960
end,
5061
})
5162

0 commit comments

Comments
 (0)