folke / todo-comments.nvim

✅ Highlight, list and search todo comments in your projects
Apache License 2.0
2.99k stars 87 forks source link

bug: source code in hidden folders is not listed with :TodoLocList #251

Closed isaldarriaga closed 3 weeks ago

isaldarriaga commented 5 months ago

Did you check docs and existing issues?

Neovim version (nvim -v)

NVIM v0.10.0-dev

Operating system/version

Ubuntu 23.10

Describe the bug

files in hidden folder are highlighted properly, but their TODO entries does not appear in the lists generated by the plugin

Steps To Reproduce

  1. mkdir .hidden
  2. touch .hidden/init.lua
  3. nvim
  4. open neo-tree explorer with <space> e (tip: astronvim includes it)
  5. the .hidden folder does not appear listed in neo-tree
  6. type H
  7. the .hidden folder is listed
  8. navigate to init.lua then hit
  9. insert mode
  10. -- TODO: my todo
  11. The TODO is highlighted properly
  12. type :TodoLocList
  13. The file is not listed in the Loc list window
  14. A warning alert indicates: no todos found

Expected Behavior

  1. The file is listed in the Loc list window
  2. There's no warning alert

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

-- TODO: My Todo
-- This file should be in a hidden folder and current working directory is the **parent** of the hidden folder
dougrocha commented 5 months ago

You can add --hidden to your opts

 search = {
    command = "rg",
    args = {
      "--color=never",
      "--no-heading",
      "--with-filename",
      "--line-number",
      "--column",
      "--hidden", -- added line
    },
    -- regex that will be used to match keywords.
    -- don't replace the (KEYWORDS) placeholder
    pattern = [[\b(KEYWORDS):]], -- ripgrep regex
    -- pattern = [[\b(KEYWORDS)\b]], -- match without the extra colon. You'll likely get false positives
  },

But I think it would also make sense to add the current buffer's todos in the list even if the buffer is hidden. Is that something that makes sense here?

github-actions[bot] commented 4 weeks ago

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.

github-actions[bot] commented 3 weeks ago

This issue was closed because it has been stalled for 7 days with no activity.