feat(treesitter): add foldtext with treesitter highlighting (#25391)

This commit is contained in:
Till Bungert
2023-10-01 21:10:51 +02:00
committed by GitHub
parent c0f4d60016
commit 9ce1623837
5 changed files with 288 additions and 0 deletions

View File

@ -508,4 +508,16 @@ function M.foldexpr(lnum)
return require('vim.treesitter._fold').foldexpr(lnum)
end
--- Returns the highlighted content of the first line of the fold or falls back to |foldtext()|
--- if no treesitter parser is found. Can be set directly to 'foldtext':
---
--- ```lua
--- vim.wo.foldtext = 'v:lua.vim.treesitter.foldtext()'
--- ```
---
---@return { [1]: string, [2]: string[] }[] | string
function M.foldtext()
return require('vim.treesitter._fold').foldtext()
end
return M