Skip to content

Commit a282ec7

Browse files
committed
fix(folding): make treesitter folding backwards compatible with Neovim v0.10
1 parent 730bda9 commit a282ec7

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

lua/astroui/folding.lua

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ local fold_methods = {
1818
if lsp_bufs[bufnr or vim.api.nvim_get_current_buf()] then return vim.lsp.foldexpr(lnum) end
1919
end,
2020
treesitter = function(lnum, bufnr)
21-
if vim.bo.filetype and vim.treesitter.get_parser(bufnr, nil, { error = false }) then
22-
return vim.treesitter.foldexpr(lnum)
23-
end
21+
if vim.bo.filetype and pcall(vim.treesitter.get_parser, bufnr) then return vim.treesitter.foldexpr(lnum) end
2422
end,
2523
indent = function(lnum, bufnr)
2624
if not lnum then lnum = vim.v.lnum end

0 commit comments

Comments
 (0)