folke / todo-comments.nvim

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

bug: not immediately highlighting #233

Closed DrunkenToast closed 4 days ago

DrunkenToast commented 9 months ago

Did you check docs and existing issues?

Neovim version (nvim -v)

v0.10.0-dev-1324+gc3d21ad1b-Homebrew

Operating system/version

MacOS 14.0

Describe the bug

When opening a new buffer with Trouble it will not always immediately highlight it. I have to type something or call :e!. Most of the time nothing is highlighted until I edit something.

Possibly related #61

Steps To Reproduce

  1. Startup vim
  2. Open todo trouble
  3. Open a result
  4. Not highlighted
  5. Type something in the comment
  6. Highlighted

Expected Behavior

It is immediately highlighted whenever I open a buffer.

Repro

{
        "folke/todo-comments.nvim",
        dependencies = { "nvim-lua/plenary.nvim" },
        cmd = { "TodoTrouble", "TodoTelescope" },
        -- NOTE: https://github.com/LazyVim/LazyVim/discussions/1583
        event = "VimEnter",
        opts = {
            highlight = {
                pattern = [[.*<(KEYWORDS)\s*[:@]\s*]] -- vim regex
            },
            search = {
                -- Matches with "TODO: something" and "TODO @PL something"
                pattern = [[\b(KEYWORDS)\s*[:@]\b]], -- ripgrep regex
            }
        },
        keys = {
            {
                "<leader>xt",
                '<CMD>TodoTrouble<CR>',
                desc = "Open todos in Trouble",
                noremap = true,
                silent = true
            },
        },
    }
wqferr commented 5 months ago

Sorry for intruding, but shouldn't that < in the vim regex be escaped?

I've tested with a similar setup and had the same result, so that wasn't that anyway.

DrunkenToast commented 5 months ago

Sorry for intruding, but shouldn't that < in the vim regex be escaped?

I've tested with a similar setup and had the same result, so that wasn't that anyway.

Possibly, not sure. I've been using this pattern for a while now and it seems to work as I intend it to.

github-actions[bot] commented 1 week 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 4 days ago

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