todo-comments.nvim
todo-comments.nvim copied to clipboard
feat(highlight): allow extended highlighting patterns (#185)
Highlight the first capture group pattern, if there is a second (typically nested) capture group, use it for keyword matching.
Allows highlighting TODO(foo) using .*<((KEYWORDS)%(\(.{-1,}\))?):.
Closes #185, closes #10
This is similar to #180, however that PR's matching behaviour is not backwards compatible with the default highlight pattern used. This PR retains the behaviour that only the first capturing group is highlighted.
Hi there! This PR is very helpful to me and doesn't seem to cause any obvious issues. Are there any concerns before merging?
No concerns were raised here or in the original issue(s), the plugin maintainer just hasn't responded yet.
My PR branch tracks master, you could switch over to it for the time being.
My PR branch tracks master, you could switch over to it for the time being.
Hi @LunarLambda , yes, that's also my workaround right now. Thanks for your PR. And it's nice to have this merged. :smile: .
BTW, we may need to extend the search pattern as well. So I add the following pattern in my config
require("todo-comments").setup({
highlight = {
-- vimgrep regex, supporting the pattern TODO(name):
pattern = [[.*<((KEYWORDS)%(\(.{-1,}\))?):]],
},
search = {
-- ripgrep regex, supporting the pattern TODO(name):
pattern = [[\b(KEYWORDS)(\(\w*\))*:]],
}
})
Rebased against latest master.
Would be nice to see this functionality in main plugin. Been using OP's branch without any apparent problems so far.
It makes me happy that the PR is so well received. I will continue to rebase it against main since it's such a small change.
This has been waiting since March, and even Feb if you count #180. Any chance of merging so we can stop using OP's branch
I've previously tried to notify folke once or twice in the issue where I originally proposed a workaround, which then became this PR.
I'm happy to keep rebasing my branch but I don't wish to bother folke about it.
This PR is stale because it has been open 60 days with no activity.
Apparently the linked issues will be closed by github actions soon due to being open for so long, as I just received multiple emails about it.
Fixed by #180