kevinhwang91 / nvim-ufo

Not UFO in the sky, but an ultra fold in Neovim.
BSD 3-Clause "New" or "Revised" License
2.16k stars 37 forks source link

Treesitter provider doesn't respect foldnestmax option #213

Open net opened 2 months ago

net commented 2 months ago

Feature description

With

vim.opt.foldnestmax = 1

the UFO Treesitter provider

provider_selector = function(bufnr, filetype, buftype)
  return { 'treesitter' }
end,

does not respect foldnestmax, while disabling UFO providers and using

provider_selector = function(bufnr, filetype, buftype)
  return ''
end,

...

vim.opt.foldmethod = 'expr'
vim.opt.foldexpr = 'nvim_treesitter#foldexpr()'

does.

See: https://neovim.io/doc/user/options.html#'foldnestmax'

Describe the solution you'd like

The UFO Treesitter provider should respect foldnestmax.

Additional context

No response