Skip to content

bug: Slow on large files #358

@niekdomi

Description

@niekdomi

Did you check docs and existing issues?

  • I have read all the todo-comments.nvim docs
  • I have updated the plugin to the latest version before submitting this issue
  • 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.4

Operating system/version

6.13.5-arch1-1

Describe the bug

I opened a plain text file with approximately 1.3 million lines of code. When moving from the first line (gg) to the last line (G), I experienced a delay of about 5 seconds. Disabling the plugin eliminated the delay, confirming that the plugin is the cause. The file has no folds or special features.

While debugging, I explored the following:

require("lazy").setup({
	spec = {
		-- { import = "plugins" },
		"folke/todo-comments.nvim",
		dependencies = { "nvim-lua/plenary.nvim" },
	},
	checker = {
		enabled = true,
		notify = false,
	},
	change_detection = {
		notify = false,
	},
})

This configuration works fine—no 5-second delay when moving from gg to G. However, if I uncomment { import = "plugins" } (where only todo-comments.nvim is included in the plugins directory), the 5-second lag reappears. Interestingly, after the file is "loaded," subsequent movements from the first to the last line are instant. The delay only occurs on the initial navigation.

Here’s the todo.lua file inside the plugins directory:

return {
	"folke/todo-comments.nvim",
	dependencies = { "nvim-lua/plenary.nvim" },
	opts = {
		highlight = {
			-- multiline = false,
		},
	},
}

And here’s part of my init.lua:

require("lazy").setup({
	spec = {
		{ import = "plugins" },
	},
	checker = {
		enabled = true,
		notify = false,
	},
	change_detection = {
		notify = false,
	},
})

Steps To Reproduce

described above

Repro

Here is the minimal init.lua I used

-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
  local lazyrepo = "https://github.com/folke/lazy.nvim.git"
  local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
  if vim.v.shell_error ~= 0 then
    vim.api.nvim_echo({
      { "Failed to clone lazy.nvim:\n", "ErrorMsg" },
      { out, "WarningMsg" },
      { "\nPress any key to exit..." },
    }, true, {})
    vim.fn.getchar()
    os.exit(1)
  end
end
vim.opt.rtp:prepend(lazypath)

require("lazy").setup({
  spec = {
    -- { import = "plugins" },
    "folke/todo-comments.nvim",
    dependencies = { "nvim-lua/plenary.nvim" },
  },
  checker = {
    enabled = true,
    notify = false,
  },
  change_detection = {
    notify = false,
  },
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstaleThis issue or PR has been inactive for a while

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions