Skip to content
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 highlighting the full pattern #180

Merged
merged 1 commit into from
Jul 6, 2024

Conversation

doongjohn
Copy link
Contributor

this will allow highlighting TODO(author):

highlight = {
  pattern = [[(KEYWORDS)\s*(\([^\)]*\))?:]],
},

image

fixes #10
fixes #179

@ynhhoJ
Copy link

ynhhoJ commented Aug 16, 2023

@folke , hi!

I just want to know, this PR can be merged?

@wvffle
Copy link

wvffle commented Feb 18, 2024

Hi @folke,

I know you're quite busy man, but could you take time to review this PR? It would be nice to have this merged.

Thanks in advance!

Copy link
Contributor

github-actions bot commented Jul 6, 2024

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

@github-actions github-actions bot added the stale label Jul 6, 2024
@wvffle
Copy link

wvffle commented Jul 6, 2024

bump

this will allow highlighting `TODO(author):`
@folke folke changed the title The entire matched string is now highlighted, not just a keyword. feat(highlight): allow highlighting the full pattern Jul 6, 2024
@folke folke merged commit ad775a7 into folke:main Jul 6, 2024
7 of 8 checks passed
@folke
Copy link
Owner

folke commented Jul 6, 2024

ty!

folke pushed a commit that referenced this pull request Jul 6, 2024
## 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>
-->
@gtabuada gtabuada mentioned this pull request Jul 6, 2024
3 tasks
folke added a commit that referenced this pull request Jul 6, 2024
@folke
Copy link
Owner

folke commented Jul 6, 2024

Reverted. See #290

folke pushed a commit that referenced this pull request Jul 6, 2024
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.
@dpetka2001
Copy link
Contributor

Even better since #255 got merged. That's what I was using before you merged #180 either way.

@folke
Copy link
Owner

folke commented Jul 6, 2024

ok, great :)

folke pushed a commit that referenced this pull request Jul 7, 2024
🤖 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invalid hightlighting in TodoTelescope selection pane [Feature Request]: highlight author in TODO(author):
5 participants