fix(ui): use custom fold when treesitter foldtext returns a string

This commit is contained in:
Folke Lemaitre committed 2023-10-04 12:47:24 +02:00
1 parent 417de0193d
commit 35053290bf
1 file changed
+1 -1
+1 -1
View File
@@ -24,7 +24,7 @@ end
function M.foldtext()
local ok = pcall(vim.treesitter.get_parser, vim.api.nvim_get_current_buf())
local ret = ok and vim.treesitter.foldtext and vim.treesitter.foldtext()
if not ret then
if not ret or type(ret) == "string" then
ret = { { vim.api.nvim_buf_get_lines(0, vim.v.lnum - 1, vim.v.lnum, false)[1], {} } }
end
table.insert(ret, { " " .. require("lazyvim.config").icons.misc.dots })