bug: performance issues on large files with folds
mtrajano opened this issue · 2 comments
Did you check docs and existing issues?
- I have read all the todo-comments.nvim docs
- I have searched the existing issues of todo-comments.nvim
- I have searched the existing issues of plugins related to this issue
Neovim version (nvim -v)
NVIM v0.10.0
Operating system/version
MacOS 13.6.3
Describe the bug
When scrolling on a large file with folds there is a very noticeable lag during scrolling. There's a WinScroll
autocommand that fires in order to update the window highlights. This works fine if there are no folds since it only processes a few dozen lines but in a large file with folds w0
and w$
can be very far apart and currently it's looping through every single line to add the highlight even though they are not in view. I tried setting the highlight.throttle
option to a lower value and it did not help much. (This config value is also not documented). I'm attaching a video of the issue happening.
Screen.Recording.2024-07-02.at.2.46.00.PM.mov
Steps To Reproduce
- Open a large file (in my case it was a tree-sitter src/parser.c file)
- Fold all code blocks
- Scroll through the file
Expected Behavior
Ideally todo-comments wouldn't process all these folded lines that are not in view.
Repro
-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)
-- install plugins
local plugins = {
"folke/tokyonight.nvim",
"folke/todo-comments.nvim",
-- add any other plugins here
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
vim.cmd.colorscheme("tokyonight")
-- add anything else here
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.
This issue was closed because it has been stalled for 7 days with no activity.