Closed hrqmonteiro closed 1 month ago
This is not a bug. The default highlight pattern is .*<(KEYWORDS)\s*:
as described in the docs. So // TODO
will not be highlighted, but // TODO: text
will be.
Should close.
This is not a bug. The default highlight pattern is
.*<(KEYWORDS)\s*:
as described in the docs. So// TODO
will not be highlighted, but// TODO: text
will be.Should close.
In case you didn't saw the video, i did that as well
Here it is this pattern in the repro.lua file:
There is no video in your post.
Could you make sure todo-comments.nvim
setup func is actually called? You can check it by running :Lazy profile
.
If that setup func is not called, you can add event = 'BufReadPost'
to your config, or call :lua require('todo-comments').setup()
directly.
It is also possible some tasks in the testing framework are blocking the setup func, since it is deferred if it's called during startup. See https://github.com/folke/todo-comments.nvim/blob/8f45f353dc3649cb9b44cecda96827ea88128584/lua/todo-comments/config.lua#L90-L96
For the record, a repro without testing is totally fine. So I suspect this is some async issue in the testing framework.
Repro without testing:
local root = vim.fn.fnamemodify("./.repro", ":p")
for _, name in ipairs({ "config", "data", "state", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath })
end
vim.opt.runtimepath:prepend(lazypath)
local plugins = {
"folke/tokyonight.nvim",
{ "folke/todo-comments.nvim", opts = {} },
-- TODO: Fix
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
vim.cmd.colorscheme("tokyonight")
Screenshot:
Everything is working for me, but not the highlighting. I tried calling ":lua require('todo-comments').setup()", but didn't get any highlighting. is it possible it's an issue with iterm2 my terminal?
Ah, it has to have colon for me, can it just match with TODO and a space in a comment as well?
-- TODO: wehiweh
-- TODO sdasd
Nvm, read through the readme again and found the config to change pattern
highlight = {
pattern = [[.*<(KEYWORDS)\s*:]], -- pattern or table of patterns, used for highlighting (vim regex)
},
Did you check docs and existing issues?
Neovim version (nvim -v)
NVIM v0.10.1
Operating system/version
openSUSE tumbleweed
Describe the bug
Doesn't work
Steps To Reproduce
Just try to use
With the repro.lua:
Expected Behavior
To highlight it
Repro