Closed kristijanhusak closed 2 years ago
@kristijanhusak thanks for mentioning, tbh I'd initially tried to use nvim_buf_attach
and the associated callbacks to manage applying the extmarks rather than the cavalcade of autocommands which is much messier but for some reason none of the events were being triggered when I would undo an action. This only seemed to trigger in the autocommand method. I didn't actually try set_decoration_provider
explicitly since it seemed similar to the buf_attach
method and I guessed it would have the same issues but I'll give it a try when I get a chance. Would be nice to move back to a much tidier update mechanism.
If i remember correctly I also had some issues with nvim_buf_attach
initially, but I'm not sure if it was related to an undo action. This seems to work fine.
Refactored in 8ec3b6d
Hi,
today while debugging some things I checked source code here to see what's happening, and I noticed that you are setting these exmarks via autocmd, and managing them via internal state.
I think using
nvim_set_decoration_provider
+ephermal
option should help you clean things up a bit and have less code to manage. I just pushed a fix for hide leading stars option on tree-sitter branch that is using this provider, and it seems it's working fine. I think same thing is used internally for treesitter highlights.I'm pretty sure using the same chunk of code with addition to the virtual text instead of hl group should do the trick.
This is just a suggestion of course.