Closed milisims closed 9 months ago
nvim-ufo should work under 0.7.2 version for neovim which is a stable version for ubuntu 22 lts, so don't use a function program API;
Don't change the code for "better to read", the captureVirtText
function is inside decoration_provider
, and shouldn't use the core API.
I suggest you just change the code about concealed
extmarks. Of course, you can also capture the concealed
in synconcealed()
if you are interested in the old highlight group system in vim.
nvim-ufo should work under 0.7.2 version for neovim which is a stable version for ubuntu 22 lts, so
captureVirtText
function is inside decoration_provider
, and shouldn't use the core API.I suggest you just change the code about
concealed
extmarks. Of course, you can also capture theconcealed
insynconcealed()
if you are interested in the old highlight group system in vim.
I'll add synconcealed()
support after a quick review:
I originally attempted to simply add an insertConcealed
, but because conceal and inlays both change the length of the text trying to track the col
and endCol
with an offset was a nightmare. I had to change/remove fillSlots
and insertInlay
. Doing them at the same time made it possible for me to implement.
How does it look now? (before I look into adding synconcealed()
)
Before checking the conceal, the 'conceallevel'
option should be more than zero.
Added synconcealed
support & made the rest of the changes, happy to address anything else but this works very well in my testing
Should add concealLevel parameter to M.captureVirtText(bufnr, text, lnum, syntax, namespaces)
:
1: 0 will pass the conceal logic;
2: 1 and 2 show the cchar
which is the first char of conceal extmark;
3: 3 hide the concealed range;
I think this is good for merge unless there's anything else you can think of!
Thanks, I will append some commits in this PR. There are some details that are hard to say, you can check out the commit.
And I found an issue like below image:
After adding virtual text or conceal, the width of foldtext
output is not fixed sometime.
The char text of foldtext
output should map to the virtual text captured by ufo, otherwise, there is a flicker issue.
The reason is adding extmarks in a decorator render in the next tick, but foldtext renders in the current tick.
I will rework the module to fix this issue later.
Have appended some commits, feel free to review them. No issue will merge into main
.
Other than typo looks great to me
Thanks!
For testing, a simple example would be to add the following to
vim.fn.stdpath('config') .. '/after/queries/lua/highlights.scm'