Skip to content

fix(ui): keep mention highlights after slash command expansion - #11777

Merged
marius-kilocode merged 5 commits into
mainfrom
kindly-need
Jun 29, 2026
Merged

fix(ui): keep mention highlights after slash command expansion#11777
marius-kilocode merged 5 commits into
mainfrom
kindly-need

Conversation

@marius-kilocode

@marius-kilocode marius-kilocode commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Rendered user messages color inline @mentions by using source offsets from attachments. When a slash command expands or rewrites the displayed text before an attachment mention, those offsets can become stale and highlight unrelated words instead of the actual mention.

This change moves message highlight segmentation into a focused helper that first verifies the stored range still matches the original source value. If the range is stale, it relocates the highlight by the source value in the rendered text, while preserving the existing regex fallback for plain path mentions. This keeps @git-changes and other attachment mentions visually aligned with the text the user sees after command expansion.

Prompt:
dyn-44297241deb3b06eb38322d2a6db50e9

Before:
file-90f26631069d22727f022a0a8b0de4a3

After:
file-b363c467f1bc54b265a6a4b5204b2d61

Comment thread packages/kilo-ui/src/components/message-highlight.ts Outdated
@kilo-code-bot

kilo-code-bot Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (5 files)
  • .changeset/fix-slash-mention-highlight.md
  • packages/kilo-ui/src/components/message-highlight.test.ts
  • packages/kilo-ui/src/components/message-highlight.ts
  • packages/kilo-ui/src/components/message-part.tsx
  • packages/kilo-vscode/tests/unit/kilo-ui-contract.test.ts
Previous Review Summaries (2 snapshots, latest commit 3219a06)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 3219a06)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • packages/kilo-ui/src/components/message-highlight.test.ts
  • packages/kilo-ui/src/components/message-highlight.ts

Previous review (commit ff427e5)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0

Fix these issues in Kilo Cloud

Issue Details (click to expand)

WARNING

File Line Issue
packages/kilo-ui/src/components/message-highlight.ts 46 Relocating stale refs with indexOf(source.value) always picks the first duplicate mention, so repeated identical mentions collapse onto the first highlight.
Files Reviewed (4 files)
  • .changeset/fix-slash-mention-highlight.md - 0 issues
  • packages/kilo-ui/src/components/message-highlight.test.ts - 0 issues
  • packages/kilo-ui/src/components/message-highlight.ts - 1 issue
  • packages/kilo-ui/src/components/message-part.tsx - 0 issues

Reviewed by gpt-5.4-20260305 · Input: 48.8K · Output: 6.1K · Cached: 194.6K

Review guidance: REVIEW.md from base branch main

@marius-kilocode
marius-kilocode merged commit ff0d7c0 into main Jun 29, 2026
26 checks passed
@marius-kilocode
marius-kilocode deleted the kindly-need branch June 29, 2026 14:25
t7tran pushed a commit to t7tran/kilocode that referenced this pull request Aug 14, 2026
fix(ui): keep mention highlights after slash command expansion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants