Closed ranjithshegde closed 1 year ago
I will export the API later, need your test.
Added enable_fold_end_virt_text
option,
require('ufo').setup({
enable_fold_end_virt_text = true,
fold_virt_text_handler = function (virtText, lnum, endLnum, width, truncate, ctx)
local end_virt_text = ctx.end_virt_text
-- ......
end
})
enable_fold_end_virt_text
may be deprecated, feel free to share your opinion under https://github.com/kevinhwang91/nvim-ufo/pull/74
Please use enable_get_fold_virt_text
instead.
Feature description
Since lsp provider folds differently than the treesitter parser, showing the last line of the folded region for treesitter can be helpful.
I have written an example configuration that sets the virtual_text handler to set the last line, and uses some internal functions to use default highlights for the displayed line.
Note: This is a personal/opinionated example, the users's tastes may differ, but this example could be used as a guide to creating your own virt-text-handler
Another note: using this snippet for lsp or indent provider wont break it but would be very redundant and cluttered, so its not recommended
Describe the solution you'd like
Edit/use this snippet in
advanced_configuration example
sectionAdditional context
Some examples![folds1](https://user-images.githubusercontent.com/10258296/177187024-20788844-00d7-4a9f-b6f6-1da496af4892.png)