-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(highlight): allow extended highlighting patterns (#185) #255
Conversation
e7e50f8
to
c3b860b
Compare
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. |
Hi @LunarLambda , yes, that's also my workaround right now. Thanks for your PR. And it's nice to have this merged. 😄 . 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*\))*:]],
}
}) |
c3b860b
to
2efdea9
Compare
Rebased against latest master. |
2efdea9
to
bf171f7
Compare
Would be nice to see this functionality in main plugin. Been using OP's branch without any apparent problems so far. |
bf171f7
to
85a16d4
Compare
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 |
85a16d4
to
bc08c11
Compare
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. |
bc08c11
to
4947c50
Compare
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 |
## What is this PR for? When using a pattern like `[[(KEYWORDS)\s*(\([^\)]*\)?:)]]` to include the colon character into the capture group, it doesn't take it into consideration for highlighting because currently the range is up to `start + #matched - 1`. This changes the range to `start + #matched`, so it can match correctly until the end of the matched capture group. Inspiration was taken from #255, but since #180 was preferred over it, at least make it possible so that it highlights exactly what the users define. <!-- Describe the big picture of your changes to communicate to the maintainers why we should accept this pull request. --> ## Does this PR fix an existing issue? No <!-- If this PR fixes any issues, please link to the issue here. - Fixes #<issue_number> -->
Highlights the first capture group (as before), if there is a second (typically nested) capture group, use it for keyword matching. Allows highlighting `TODO(foo)` using `.*<((KEYWORDS)%(\(.{-1,}\))?):`.
🤖 I have created a release *beep* *boop* --- ## [1.3.0](v1.2.0...v1.3.0) (2024-07-07) ### Features * added support for fzf-lua ([fe5a7c6](fe5a7c6)) * **fzf:** multiline by default ([8fdea2a](8fdea2a)) * **highlight:** allow extended highlighting patterns ([#185](#185)) ([#255](#255)) ([76c8fee](76c8fee)) * **highlight:** allow highlighting the full pattern ([#180](#180)) ([ad775a7](ad775a7)) ### Bug Fixes * don't use tbl_flatten. Fixes [#272](#272) ([9c104cf](9c104cf)) * **extension:** provide default icon ([#274](#274)) ([7de4e85](7de4e85)), closes [#202](#202) * **highlight:** match to the end of length `#matched` ([#288](#288)) ([a40fa7e](a40fa7e)) * **telecope:** icons highlight. ([#279](#279)) ([4573f4f](4573f4f)) * ternary evaluation in setlist for opts.open ([#252](#252)) ([c7a6a02](c7a6a02)) * **trouble:** compatibility with Trouble v3 ([#286](#286)) ([01b4599](01b4599)) ### Reverts * feat(highlight): allow highlighting the full pattern ([#180](#180)) ([996d1a7](996d1a7)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
desc: It changes the regex pattern for folke/todo-comments. It was needed because a new PR improved the pattern matching for extended highlights. PR: folke/todo-comments.nvim#255 [email protected]
desc: It changes the regex pattern for folke/todo-comments. It was needed because a new PR improved the pattern matching for extended highlights. PR: folke/todo-comments.nvim#255 [email protected]
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.