feat(search): syntax highlight regex literals - #125664
Open
JoshuaKGoldberg wants to merge 10 commits into
Open
JoshuaKGoldberg wants to merge 10 commits into
JoshuaKGoldberg wants to merge 10 commits into
Conversation
Contributor
📊 Type Coverage Diff✅ no issues found |
Member
Author
|
@cursor review |
Member
Author
|
@cursor review |
JoshuaKGoldberg
marked this pull request as ready for review
September 28, 2026 12:57
JoshuaKGoldberg
added this pull request to stack #125662
September 28, 2026 12:59
Base automatically changed from
joshgoldberg/logs-976-validate-regex-patterns-client-side-with-re2js
to
master
September 28, 2026 13:33
Renders regex filter patterns with Prism's regex grammar, in the filter itself and in an overlay over the value input while editing.
Collapses the plain-pattern branch, shares one render function between the two call sites, swaps the measure/restore juggling for replaceChildren, and drops selectors for constructs RE2 rejects.
Flex shrinks the input below its autosized width, so a long pattern scrolls under the caret while the overlay kept showing the start of it.
tokens.syntax.selector sits at 3.88:1 on the tinted background an invalid filter gets, below the 4.5 AA bar for small text. colors.green600 is 4.82:1 there and 5.70:1 on the default background.
JoshuaKGoldberg
force-pushed
the
joshgoldberg/logs-978-add-syntax-highlighting-to-regex-literals
branch
from
September 28, 2026 13:33
fec3c2c to
b2d73f4
Compare
JoshuaKGoldberg
commented
Sep 29, 2026
| .token.char-set, | ||
| .token.escape, | ||
| .token.special-escape { | ||
| color: ${p => p.theme.colors.green600}; |
Member
Author
There was a problem hiding this comment.
TODO: Talked with Martha, we'll go with a darker green in light mode. And I'll also make sure dark mode still looks good.
k-fish
reviewed
Sep 29, 2026
k-fish
left a comment
Member
There was a problem hiding this comment.
Oooh was going to ask about this but figured it was out of scope, nice 👍
k-fish
approved these changes
Oct 1, 2026
The highlighted value and the input now share one grid cell at least as wide as the value's text, so the input never scrolls its own text out from under the highlighting. The chip row scrolls long regex values instead, and keeps the tail of an input wider than the row in view.
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 782a59d. Configure here.
When the regex input is wider than the chip row, only pin the row to the input's tail while the caret is at the end. Otherwise each keystroke yanked the row toward the tail, leaving the caret stuck at its left edge.
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Regex filter patterns are now tokenized with Prism's
regexgrammar and colored, so structure reads apart from literals. The highlighting appears both in the committed filter and, via an overlay drawn on the value input, while a pattern is being typed.Measuring the filter's middle-ellipsis previously wrote
element.textContentdirectly, which would destroy React-rendered children. It now swaps in a detached text node instead.Closes LOGS-978.