mirror of
https://github.com/neovim/neovim
synced 2025-07-16 01:01:49 +00:00
feat(treesitter): add foldtext with treesitter highlighting (#25391)
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user