Highlight @file references and command options in message text - #1145
Open
snimu wants to merge 13 commits into
Open
Highlight @file references and command options in message text#1145snimu wants to merge 13 commits into
snimu wants to merge 13 commits into
Conversation
… queue previews, and user messages
…d avoid mask corruption from literal placeholder chars
Contributor
Author
UpdateThe PR now also highlights a standalone In a command like This added a net 6 lines of source code and three tests. |
…ighlighting # Conflicts: # packages/coding-agent/src/modes/interactive/interactive-mode.ts
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 aac41f2. Configure here.
…ells keep literal token text
…ands across all surfaces
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.

ENG-5282 · Linear: RES-1275 https://linear.app/primeintellect/issue/RES-1275
What this does
When you write a message in Prime Agent, three kinds of special text now each get their own color, so they are easy to tell apart at a glance:
/compactstay violet (as before).@src/main.tsare now shown in green. They previously had no color at all.--globalin/rlm-max-depth --globalare now shown in blue. They also previously had no color.The colors show up everywhere the message text appears: while you type it, in the list of queued messages waiting to be sent, and in messages that were already sent.
Example:
Why
Commands were already highlighted, but file references and options were plain text. That made it easy to miss a typo in a file path or an option name, and messages with several parts were harder to scan.
How it works
Changes
prompt-highlight.ts(+188 lines).Lines changed: source +249/−44, tests +121/−0, changelogs +3/−0, total +373/−44.
Checks
npm run checkclean.Note
Low Risk
Changes are limited to terminal rendering and styling; no auth, persistence, or command execution behavior is altered beyond visual token rules.
Overview
Adds shared prompt highlighting so
@filereferences,--flags, and (for argument-taking slash commands) bare--separators pick up theme colors everywhere message text appears: the input editor, queued previews, sent user messages, and slash-command messages.A new
prompt-highlightmodule centralizes token detection and styling. The editor uses source-line offsets from an extended TUIstyleDisplayTexthook so wrapped or scrolled lines color only the real token spans, not duplicate plain text. Sent messages mask tokens before Markdown layout and restore colors afterward, including correct copy/selection text viaPromptTokenMask.Reviewed by Cursor Bugbot for commit 285ccf4. Bugbot is set up for automated code reviews on this repo. Configure here.
LOC
Total src: +286/−48 (net +238); tests: +160/−1 (net +159).
Note
Highlight
@filereferences and--flagsin interactive editor, previews, and sent messagesPromptTokenMaskandArgTokenHighlighterin prompt-highlight.ts to mask and color@path,--flag, and bare--tokens across Markdown layout and wrapped editor lines while preserving grapheme widths.Editor.styleDisplayTextandLayoutLinein editor.ts with source-line and source-offset coordinates so subclasses can style wrapped chunks by their logical source position.--is highlighted only for recognized argument-taking slash commands.@and--sequences are excluded from highlighting; tokens split by cursor escape sequences or line wrapping retain their color. Literal private-use mask-range characters in input are left uncorrupted and selection regions return unmasked source text.Macroscope summarized 285ccf4.