folke / todo-comments.nvim

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

Comments found and highlighted but not appearing in listings #144

Closed HoloTheDrunk closed 1 year ago

HoloTheDrunk commented 1 year ago

todo-comments finds the comments properly but they do not show in any of the lists (not Loc, QuickFix, Telescope nor Trouble).

Error message Error message Code sample used where FIXMEs are detected and highlighted (bottom window is Trouble) Code sample used where FIXMEs are detected and highlighted

Neovim version: 0.8

eduardomcv commented 1 year ago

I'm having the same issue: todo-comments highlights keywords but they don't show up in any list.

Additionally, when I call require('todo-comments').jump_next() or require('todo-comments').jump_prev(), if a keyword is available, I'm getting this stack trace: Screenshot 2022-10-30 at 20 44 06 If there's no keywords, it works as intended and I get No more todo comments to jump to.

I'm using nvim 0.8. Here's my config if it helps:

require("todo-comments").setup {
  keywords = {
    DELETEME = {
      icon = "",
      color = "#ff0000",
    },
    FIXME = {
      icon = "",
      color = "#fff400",
    },
    HACK = {
      icon = "",
      color = "#00f9ff",
    },
    TODO = {
      icon = "",
      color = "#ed00ff",
    },
    WIP = {
      icon = "",
      color = "#ff7C00",
    }
  },
  merge_keywords = false,
}
midoBB commented 1 year ago

The weird thing about this in my case was that TodoTelescope was working correctly, but TodoTrouble / TodoQuickfix both didn't.

folke commented 1 year ago

@midoBB that's interesting. Are you using the default config? Can you give me an example with a comment that shows with Telescope, but not with the other commands?

midoBB commented 1 year ago

This is my config at the moment. To be noted that if I don't include this pattern the Telescope search doesn't find the Todo comments.

local status_ok, trouble = pcall(require, "trouble")
if not status_ok then
  return
end
trouble.setup {
    mode = "workspace_diagnostics",
    fold_open = "",
    fold_closed = "",
    auto_jump = { "lsp_definitions" },
    auto_fold = true,
    use_diagnostic_signs = true,
}
local status_ok, todo = pcall(require, "todo-comments")
if not status_ok then
  return
end
todo.setup {
  signs = true,
  search = {
    pattern = [[\b(KEYWORDS)\b]]
  }
}
folke commented 1 year ago

The default higlight pattern requires a :, so I guess that's your issue?

midoBB commented 1 year ago

I'm so sorry for troubling you. Yes, adding a column seemed to fix both.

folke commented 1 year ago

@HoloTheDrunk did you change any of the patterns? highlight and search pattersn have a different syntax, so make sure you make them behave the same

IlyasYOY commented 1 year ago

I have the same issue.

Are there any updates on this?

UPD. https://github.com/BurntSushi/ripgrep/issues/623 solved the problem. I just had to add configuration like this.

dawnchan030920 commented 1 year ago

I'm also confronted with the problem and adding --hidden doesn't work for me. Also, when I run jump_next() it says that there're no more todos. i'm using lazy & nvchad and here is my code in custom/plugins.lua related to todo-comments

{
  "folke/todo-comments.nvim",
  dependencies = {{"nvim-lua/plenary.nvim"}},
  init = function()
    require("core.utils").lazy_load "todo-comments.nvim"
  end,
  config = function (_, opts)
    require("todo-comments").setup(opts)
  end,
},

todo-comments list无法显示(可以高亮) todo-comments list无法显示2(可以高亮)

arturxdev commented 1 year ago

i have the same issue

paulhdk commented 1 year ago

Same issue for me too. TODO comments are highlighted, but the quickfix list, which I'm opening with a Telescope mapping, not with TodoTelescope, remains empty. RunningTodoQuickfix then populates it with values and I can access it with my dedicated Telescope mapping.

@folke, do you maybe have some pointers for us? Or is this by design?

calvinchoy commented 11 months ago

I notice that I have this issue with specific files. Everything works fine in for example my vue/js/ts files but NOT in lua. Highlights showing up correctly but not listing in for example TodoTelescope.

EGmux commented 9 months ago

@calvinchoy I fixed the issue by appending "--no-ignore-vcs" to the key search.args in opts/require('todo-comments').setup()

search = {
    command = "rg",
    args = {
        "--color=never",
        "--no-heading",
        "--with-filename",
        "--line-number",
        "--column",
        "--no-ignore-vcs",
    },
}

I had similar problems with telescope-live-grep not working in some projects and that was also fixed

calvinchoy commented 9 months ago

@calvinchoy I fixed the issue by appending "--no-ignore-vcs" to the key search in opts/require('todo-comments').setup()


search = {

    command = "rg",

    args = {

        "--color=never",

        "--no-heading",

        "--with-filename",

        "--line-number",

        "--column",

        "--no-ignore-vcs",

    },

}

I had similar problems with telescope-live-grep not working in some projects and that fixed as well

Excellent, thanks!