Open tapayne88 opened 2 years ago
Tried re-setting foldmethod
on BufWritePost
similar to Filetype
detection autocmd
https://github.com/tapayne88/dotfiles/blob/f64443fa41de7498a93f0d23a02eeec1dcba0482/dot_config/nvim/lua/tap/plugins/treesitter.lua#L8-L14
augroup("TreesitterFolding2", {
{
events = {"BufWritePost"},
targets = {"<buffer>"},
command = 'setlocal foldmethod=expr foldexpr=nvim_treesitter#foldexpr()'
}
})
This doesn't work for some reason
This helps debugging
vi -V9debug1.log packages/create-react-app/src/__tests__/MountApp.test.tsx
After reading this it sounds like an upstream issue https://github.com/neovim/neovim/issues/14977
After reading this it sounds like an upstream issue neovim/neovim#14977
Doesn't fix this issue.
command = 'setlocal foldmethod=expr foldexpr=nvim_treesitter#foldexpr()'
nvim-treesitter
have some bugs and is being rewritten. use v:lua.vim.treeesitter.foldexpr()
command = 'setlocal foldmethod=expr foldexpr=nvim_treesitter#foldexpr()'
nvim-treesitter
have some bugs and is being rewritten. usev:lua.vim.treeesitter.foldexpr()
ah, thanks @towry! I'll see if this help! Much appreciated 🙌
Have you tried running vim.cmd.mkview()
and vim.cmd.loadview()
before and after formatting, respectively?
Neovim's folds are setup using treesitter (when available). On save of a file, if the LSP supports it the document will be formatted. This process seems to blow away all the treesitter folds.
Manually running
:e
restores them.