File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff 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+
3839require (' nvim-treesitter' ).setup ({
3940 -- Directory to install parsers and queries to
4041 install_dir = vim .fn .stdpath (' data' ) .. ' /site' ,
4142})
43+
4244vim .o .swapfile = false
4345vim .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
4450vim .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
You can’t perform that action at this time.
0 commit comments