ayamir / nvimdots

A well configured and structured Neovim.
BSD 3-Clause "New" or "Revised" License
2.82k stars 450 forks source link

fix(todo-comment): add missing keywords #1225

Closed CharlesChiuGit closed 2 months ago

CharlesChiuGit commented 2 months ago

there are some minor issue w/ current todo-comment.nvim's config:

In colors, we define it as following

        colors = {
            error = { "DiagnosticError", "ErrorMsg", "#DC2626" },
            warning = { "DiagnosticWarn", "WarningMsg", "#ff8800" },
            info = { "DiagnosticInfo", "#2563EB" },
            hint = { "DiagnosticHint", "#F5C2E7" },
            default = { "Conditional", "#7C3AED" },
            test = { "Identifier", "#4FC1FF" },
        },

image

However, it's over written to these colors: image

In :Inspect image image

Should we just remove the colors section or enforce colors as such:

    local error_red = "#F44747"
    local warning_orange = "#ff8800"
    local info_yellow = "#FFCC66"
    local hint_blue = "#4FC1FF"
    local perf_purple = "#7C3AED"
    local note_green = "#10B981"

    require("modules.utils").load_plugin("todo-comments", {
        signs = true, -- show icons in the signs column
        sign_priority = 8, -- sign priority
        -- keywords recognized as todo comments
        keywords = {
            FIX = {
                icon = icons.ui.Bug, -- icon used for the sign, and in search results
                color = error_red, -- can be a hex color, or a named color (see below)
                alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, -- a set of other keywords that all map to this FIX keywords
                -- signs = false, -- configure signs for some keywords individually
            },
            TODO = { icon = icons.ui.Check, color = hint_blue, alt = { "TIP" } },
            HACK = { icon = icons.ui.Fire, color = warning_orange },
            WARN = { icon = icons.diagnostics.Warning, color = warning_orange, alt = { "WARNING", "XXX" } },
            PERF = { icon = icons.ui.Perf, color = perf_purple, alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } },
            NOTE = { icon = icons.ui.Note, color = note_green, alt = { "INFO" } },
            TEST = { icon = icons.ui.Lock, color = info_yellow, alt = { "TESTING", "PASSED", "FAILED" } },
        },
Jint-lzxy commented 2 months ago

Hmm, I think this should be in line with the expected behavior, as referenced in folke's documentation (emphasis mine):

list of named colors where we try to extract the guifg from the list of highlight groups or use the hex color if hl not found as a fallback

And the Diagnostic* highlights in our repo do indeed behave like this (they are defined by catppuccin, see my fork), so I think we're good here.

CharlesChiuGit commented 2 months ago

aha, i didn't notice that, then i think it's fine to keep them as backup colors.