Closed MeanderingProgrammer closed 1 month ago
There are a couple limitations that make this tricky but I think I can work through them. Lately I've focussed on optimizing the code as it runs now and have gotten some pretty awesome performance improvements on larger files. Mostly to do with how we pull conceal information and handling tables a little better by avoiding redundant processing:
I believe this last change (https://github.com/MeanderingProgrammer/markdown.nvim/commit/c7a20552b83c2abad92ac5e52feb7fe3b929f0a7) to only parse visible content ranges fulfills the heart of this issue, though going about it in a different way.
Nearly any file size now works with little noticeable impact waiting for this plugin to do its thing. At this point doing a minimal diff kind of parsing, while still better, is probably not necessary.
Using events to re-render the entire file is not very efficient. Instead we can use callbacks provided by
nvim_buf_attach
to figure out which text changed and create / remove only the necessary marks.