-- 1. Map each status to a distinct color, Nerd Font icon, and styling local status_configs = { ["backlog"] = { fg = "#7f8c8d", icon = " ", bold = false }, -- Clipboard List ["selected for development"] = { fg = "#3498db", icon = "󰓾 ", bold = false }, -- Target / Bullseye ["in progress"] = { fg = "#f1c40f", icon = "󱐋 ", bold = true }, -- Lightning Bolt ["in review"] = { fg = "#9b59b6", icon = "󰈈 ", bold = true }, -- Eye / Review ["on hold"] = { fg = "#e67e22", icon = "󰏤 ", bold = false }, -- Pause Circle ["done"] = { fg = "#2ecc71", icon = "󰄬 ", bold = true }, -- Checkmark ["closed"] = { fg = "#555555", icon = "󰅙 ", strikethrough = true }, -- Blocked / Minus Circle } -- 2. Dynamically build the Neovim Highlight Groups for status, config in pairs(status_configs) do local hl_name = "TaskStatus_" .. status:gsub(" ", "_") vim.api.nvim_set_hl(0, hl_name, { fg = config.fg, bold = config.bold, strikethrough = config.strikethrough }) config.hl_group = hl_name end -- Subtle gray style for the task title vim.api.nvim_set_hl(0, "TaskTitle", { fg = "#abb2bf", italic = true }) -- 3. Create a unique namespace local task_hint_ns = vim.api.nvim_create_namespace("custom_task_inlay_hints") -- 4. Hijack the native LSP Inlay Hint Renderer local native_inlay_handler = vim.lsp.handlers["textDocument/inlayHint"] vim.lsp.handlers["textDocument/inlayHint"] = function(err, result, ctx, config) if err or not result then return native_inlay_handler(err, result, ctx, config) end local standard_hints = {} local bufnr = ctx.bufnr or 0 if vim.api.nvim_buf_is_loaded(bufnr) then vim.api.nvim_buf_clear_namespace(bufnr, task_hint_ns, 0, -1) end for _, hint in ipairs(result) do local raw_label = "" if type(hint.label) == "string" then raw_label = hint.label elseif type(hint.label) == "table" then for _, part in ipairs(hint.label) do raw_label = raw_label .. part.value end end -- Match format: [] local status, title = raw_label:match("^%[(.-)%]%s*(.*)$") local norm_status = status and status:lower() or "" if status_configs[norm_status] then local cfg = status_configs[norm_status] -- Multi-colored array using the clean Nerd Font icons local virtual_text_chunks = { { " ── ", "Comment" }, { cfg.icon, cfg.hl_group }, -- Nerd Font Symbol { "[" .. status:upper() .. "] ", cfg.hl_group }, -- Colored Status text { title, "TaskTitle" } -- Muted task name } vim.api.nvim_buf_set_extmark(bufnr, task_hint_ns, hint.position.line, hint.position.character, { virt_text = virtual_text_chunks, virt_text_pos = "inline", -- Swap to "eol" if it disrupts typing alignment }) else table.insert(standard_hints, hint) end end return native_inlay_handler(err, standard_hints, ctx, config) end