todo-comments.nvim icon indicating copy to clipboard operation
todo-comments.nvim copied to clipboard

feat(highlight): allow extended highlighting patterns (#185)

Open LunarLambda opened this issue 1 year ago • 8 comments

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.

LunarLambda avatar Mar 11 '24 14:03 LunarLambda

Hi there! This PR is very helpful to me and doesn't seem to cause any obvious issues. Are there any concerns before merging?

YuanYuYuan avatar Apr 11 '24 04:04 YuanYuYuan

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.

LunarLambda avatar Apr 11 '24 04:04 LunarLambda

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*\))*:]],
  }
})

YuanYuYuan avatar Apr 11 '24 14:04 YuanYuYuan

Rebased against latest master.

LunarLambda avatar Apr 11 '24 15:04 LunarLambda

Would be nice to see this functionality in main plugin. Been using OP's branch without any apparent problems so far.

dpetka2001 avatar May 22 '24 18:05 dpetka2001

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.

LunarLambda avatar May 22 '24 18:05 LunarLambda

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

sebszyller avatar Jun 05 '24 13:06 sebszyller

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.

LunarLambda avatar Jun 05 '24 14:06 LunarLambda

This PR is stale because it has been open 60 days with no activity.

github-actions[bot] avatar Jul 06 '24 01:07 github-actions[bot]

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.

LunarLambda avatar Jul 06 '24 01:07 LunarLambda

Fixed by #180

folke avatar Jul 06 '24 07:07 folke