shellRaining / hlchunk.nvim

This is the lua implementation of nvim-hlchunk, you can use this neovim plugin to highlight your indent line and the current chunk (context) your cursor stayed
MIT License
472 stars 29 forks source link

Laggy in diff-mode with a thousand lines folded #85

Closed tknightz closed 2 months ago

tknightz commented 7 months ago

Describe the bug In diff-mode, Vim/Neovim uses different fold method, it can lead to thousands of unchanged lines will be folded. Rendering chunks in folded lines costs a lot of CPU resources and laggy while scrolling.

To Reproduce Steps to reproduce the behavior:

  1. You have a file > 3000 lines of code.
  2. Make some changes near the end of file.
  3. Open diffview
  4. See the CPU percentage goes up and laggy while scrolling.

Expected behavior Shouldn't render chunk in folded lines, or is there any way to disable it in diff-mode.

Screenshots image

Additional context Here is my hlchunk config:

{
    "shellRaining/hlchunk.nvim",
    config = function()
      require("hlchunk").setup({
        chunk = {
          notify = false,
          style = {
            { fg = "#c75ae8" },
            { fg = "#f65866" }, -- this fg is used to highlight wrong chunk
          },
        },
        blank = {
          enable = true,
          chars = { " " },
        },
        line_num = { enable = false },
      })
    end,
    event = "BufReadPre"
}
shellRaining commented 6 months ago

sorry for late reply, I found that whenever edit a big file (10w+ lines), it could be very laggy, and It not caused by my plugin, so... maybe I can't provide a solution if there are more info

or, maybe there is another way to prevent this, when the chunk is too big (like more than 500 lines), not render it, is this OK?

tknightz commented 6 months ago

Yes! Is there any way to turn it off when editing a big file?

PostCyberPunk commented 6 months ago

Yes! Is there any way to turn it off when editing a big file?

you can try #86 if you want to test,there is a new option choke_at_linecount,hint:you have to set for every mod