Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finds no TODO or FIXME (for me) #4

Closed
danielnehrig opened this issue May 13, 2021 · 21 comments
Closed

Finds no TODO or FIXME (for me) #4

danielnehrig opened this issue May 13, 2021 · 21 comments

Comments

@danielnehrig
Copy link

danielnehrig commented May 13, 2021

First of great Job!

i'm very certain this might be a issue with my setup.
so its included in my config like thIs:

packer.lua

    use {
        "folke/todo-comments.nvim",
        config = function()
            require("plugins.todo")
        end,
        cmd = {"TodoQuickFix", "TodoTrouble", "TodoTelescope"}
    }

plugins.todo

require("todo-comments").setup {
    signs = true, -- show icons in the signs column
    -- keywords recognized as todo comments
    keywords = {
        FIX = {
            icon = "", -- icon used for the sign, and in search results
            color = "error", -- can be a hex color, or a named color (see below)
            alt = {"FIXME", "BUG", "FIXIT", "FIX", "ISSUE"} -- a set of other keywords that all map to this FIX keywords
            -- signs = false, -- configure signs for some keywords individually
        },
        TODO = {icon = "", color = "info"},
        HACK = {icon = "", color = "warning"},
        WARN = {icon = "", color = "warning", alt = {"WARNING", "XXX"}},
        PERF = {icon = "", alt = {"OPTIM", "PERFORMANCE", "OPTIMIZE"}},
        NOTE = {icon = "", color = "hint", alt = {"INFO"}}
    },
    -- highlighting of the line containing the todo comment
    -- * before: highlights before the keyword (typically comment characters)
    -- * keyword: highlights of the keyword
    -- * after: highlights after the keyword (todo text)
    highlight = {
        before = "", -- "fg" or "bg" or empty
        keyword = "wide", -- "fg", "bg", "wide" or empty. (wide is the same as bg, but will also highlight surrounding characters)
        after = "fg" -- "fg" or "bg" or empty
    },
    -- list of named colors where we try to extract the guifg from the
    -- list of hilight groups or use the hex color if hl not found as a fallback
    colors = {
        error = {"LspDiagnosticsDefaultError", "ErrorMsg", "#DC2626"},
        warning = {"LspDiagnosticsDefaultWarning", "WarningMsg", "#FBBF24"},
        info = {"LspDiagnosticsDefaultInformation", "#2563EB"},
        hint = {"LspDiagnosticsDefaultHint", "#10B981"},
        default = {"Identifier", "#7C3AED"}
    }
}

Tested for LUA and RUST
i have multiple FIXME and TODO in src
but if i Trigger TodoTrouble, TodoTelescope, TodoQufickFix
it does not show me anything
neither Trouble has any content neither quickfix list is populated same for telescope

see attached video
Video

@folke
Copy link
Owner

folke commented May 13, 2021

Totally forgot there's a dependency on ripgrep. You need to have that installed on your system.

This is probably it?

I will update the docs.

@danielnehrig
Copy link
Author

danielnehrig commented May 13, 2021

i have ripgrep installed

     ~  rg                                                                                           ✔  20:40:24 
error: The following required arguments were not provided:
    <PATTERN>

USAGE:

    rg [OPTIONS] PATTERN [PATH ...]
    rg [OPTIONS] [-e PATTERN ...] [-f PATTERNFILE ...] [PATH ...]
    rg [OPTIONS] --files [PATH ...]
    rg [OPTIONS] --type-list
    command | rg [OPTIONS] PATTERN

For more information try --help

@danielnehrig
Copy link
Author

this is my config
though i dont expect you to debug this for me

@folke
Copy link
Owner

folke commented May 13, 2021

I'll check something.

@folke
Copy link
Owner

folke commented May 13, 2021

I just pushed some changes that should show an error if somthing's wrong with rg. Can you see what you get?

@danielnehrig
Copy link
Author

danielnehrig commented May 13, 2021

did a PackerSync and updated
no change also didn't get an error
video

@folke
Copy link
Owner

folke commented May 13, 2021

What's the output of the below?

:lua print(vim.inspect(require("todo-comments.config")))

@folke
Copy link
Owner

folke commented May 13, 2021

btw, I see you lazy load the plugin, which should be fine, but of course the highlighting won't work then before you triggered the loading with one of the commands

@danielnehrig
Copy link
Author

danielnehrig commented May 13, 2021

btw, I see you lazy load the plugin, which should be fine, but of course the highlighting won't work then before you triggered the loading with one of the commands

also tried without lazyloading same results
:lua print(vim.inspect(require("todo-comments.config")))

{
  _options = {
    colors = {
      default = <1>{ "Identifier", "#7C3AED" },
      error = <2>{ "LspDiagnosticsDefaultError", "ErrorMsg", "#DC2626" },
      hint = <3>{ "LspDiagnosticsDefaultHint", "#10B981" },
      info = <4>{ "LspDiagnosticsDefaultInformation", "#2563EB" },
      warning = <5>{ "LspDiagnosticsDefaultWarning", "WarningMsg", "#FBBF24" }
    },
    highlight = {
      after = "fg",
      before = "",
      keyword = "wide"
    },
    keywords = <6>{
      FIX = {
        alt = { "FIXME", "BUG", "FIXIT", "FIX", "ISSUE" },
        color = "error",
        icon = " "
      },
      HACK = {
        color = "warning",
        icon = " "
      },
      NOTE = {
        alt = { "INFO" },
        color = "hint",
        icon = " "
      },
      PERF = {
        alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" },
        icon = " "
      },
      TODO = {
        color = "info",
        icon = " "
      },
      WARN = {
        alt = { "WARNING", "XXX" },
        color = "warning",
        icon = " "
      }
    },
    signs = true
  },
  _setup = <function 1>,
  colors = <function 2>,
  keywords = {
    BUG = "FIX",
    FIX = "FIX",
    FIXIT = "FIX",
    FIXME = "FIX",
    HACK = "HACK",
    INFO = "NOTE",
    ISSUE = "FIX",
    NOTE = "NOTE",
    OPTIM = "PERF",
    OPTIMIZE = "PERF",
    PERF = "PERF",
    PERFORMANCE = "PERF",
    TODO = "TODO",
    WARN = "WARN",
    WARNING = "WARN",
    XXX = "WARN"
  },
  ns = 1,
  options = {
    colors = {
      default = <table 1>,
      error = <table 2>,
      hint = <table 3>,
      info = <table 4>,
      warning = <table 5>,
      <metatable> = <7>{
        __tostring = <function 3>
      }
    },
    highlight = {
      after = "fg",
      before = "",
      keyword = "wide",
      <metatable> = <table 7>
    },
    keywords = <table 6>,
    signs = true
  },
  rg_regex = "(PERFORMANCE|INFO|NOTE|FIXIT|ISSUE|TODO|BUG|HACK|FIXME|FIX|OPTIMIZE|WARNING|XXX|PERF|WARN|OPTIM):",
  setup = <function 4>,
  signs = <function 5>
}

@folke
Copy link
Owner

folke commented May 13, 2021

Sorry, I needed the more below :)

@ranebrown
Copy link

ranebrown commented May 13, 2021

I'm not getting any results either.

Config
{
  _setup = <function 1>,
  colors = <function 2>,
  keywords = {
    BUG = "FIX",
    FIX = "FIX",
    FIXIT = "FIX",
    FIXME = "FIX",
    HACK = "HACK",
    INFO = "NOTE",
    ISSUE = "FIX",
    NOTE = "NOTE",
    OPTIM = "PERF",
    OPTIMIZE = "PERF",
    PERF = "PERF",
    PERFORMANCE = "PERF",
    TODO = "TODO",
    WARN = "WARN",
    WARNING = "WARN",
    XXX = "WARN"
  },
  ns = 9,
  options = {
    colors = {
      default = { "Identifier", "#7C3AED" },
      error = { "LspDiagnosticsDefaultError", "ErrorMsg", "#DC2626" },
      hint = { "LspDiagnosticsDefaultHint", "#10B981" },
      info = { "LspDiagnosticsDefaultInformation", "#2563EB" },
      warning = { "LspDiagnosticsDefaultWarning", "WarningMsg", "#FBBF24" },
      <metatable> = <1>{
        __tostring = <function 3>
      }
    },
    highlight = {
      after = "fg",
      before = "",
      keyword = "wide",
      <metatable> = <table 1>
    },
    keywords = {
      FIX = {
        alt = { "FIXME", "BUG", "FIXIT", "FIX", "ISSUE" },
        color = "error",
        icon = " ",
        <metatable> = <table 1>
      },
      HACK = {
        color = "warning",
        icon = " ",
        <metatable> = <table 1>
      },
      NOTE = {
        alt = { "INFO" },
        color = "hint",
        icon = " ",
        <metatable> = <table 1>
      },
      PERF = {
        alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" },
        icon = " ",
        <metatable> = <table 1>
      },
      TODO = {
        color = "info",
        icon = " ",
        <metatable> = <table 1>
      },
      WARN = {
        alt = { "WARNING", "XXX" },
        color = "warning",
        icon = " ",
        <metatable> = <table 1>
      },
      <metatable> = <table 1>
    },
    signs = true
  },
  rg_regex = "(NOTE|BUG|FIXIT|ISSUE|TODO|FIXME|HACK|XXX|OPTIM|WARNING|INFO|WARN|PERF|FIX|PERFORMANCE|OPTIMIZE):",
  setup = <function 4>,
  signs = <function 5>
}

@danielnehrig
Copy link
Author

@folke edited the comment and appended the rest sorry

@ahmedelgabri
Copy link

ahmedelgabri commented May 13, 2021

@danielnehrig @ranebrown in my case it only worked with this pattern TODO: some todo but not this one TODO some todo, notice the :. Did you try that?

@folke
Copy link
Owner

folke commented May 13, 2021

@ahmedelgabri Yes! Of course, didn't see it missing in the video. Was digging into uv stuff to see if I did something wrong there.

If you can confirm the above is the issue, then I can see to make it confgurable to also match without the colon.

@ranebrown
Copy link

Worked for me including the colon. Having that be configurable would be nice.

@ahmedelgabri
Copy link

… then I can see to make it confgurable to also match without the colon.

This will be great.

@folke
Copy link
Owner

folke commented May 13, 2021

Glad it worked. I just added a bunch of code from plenary, that made everything more complex than it should be, because I thought I handled something wrong with libuv. Luckily I can remove that again now :)

folke added a commit that referenced this issue May 13, 2021
@danielnehrig
Copy link
Author

Ok with colon everything works now
would it be doable to make it also match without : ?

@folke
Copy link
Owner

folke commented May 13, 2021

I just added this, but you'll likely get a lot of false positives, unless you add some extra comment characters etc to the start of the pattern.

@folke
Copy link
Owner

folke commented May 13, 2021

@danielnehrig ha, just made this possible ;)

@danielnehrig
Copy link
Author

danielnehrig commented May 13, 2021

you the man thanks a bunch
close any time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants