Verified that the treesitter reload autocmd is required to rebuild the tree after major tree changes or else the folds won't work. Future work will be needed to verify if this can be replaced, is a known bug, etc.

This commit is contained in:
Finch 2024-01-30 11:42:31 -06:00
parent 2e526c7e44
commit cbbb18df63

View File

@ -282,13 +282,12 @@ vim.api.nvim_create_autocmd({ 'BufWritePost' }, {
command = "source % | PackerCompile"
})
-- Fix for treesitter folds
-- TODO: Determine if this is required
-- vim.api.nvim_create_autocmd({ 'BufEnter', 'BufNew', 'BufWinEnter' }, {
-- pattern = '*',
-- group = vim.api.nvim_create_augroup('telescope_fold_workaround', { clear = true }),
-- command = 'set foldexpr=nvim_treesitter#foldexpr()',
-- })
-- Fix for treesitter folds, as folds are not recalculated upon buffer changes (especially when pasting text)
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufNew', 'BufWinEnter' }, {
pattern = '*',
group = vim.api.nvim_create_augroup('telescope_fold_workaround', { clear = true }),
command = 'set foldexpr=nvim_treesitter#foldexpr()',
})
-- Create a new copy of capabilities and enable the snippetSupport
local capabilities = vim.lsp.protocol.make_client_capabilities()