Skip to content

fix(web): support spaces in composer file mentions#2625

Open
GuilhermeVieiraDev wants to merge 1 commit into
pingdotgg:mainfrom
GuilhermeVieiraDev:fix/composer-file-mentions-with-spaces
Open

fix(web): support spaces in composer file mentions#2625
GuilhermeVieiraDev wants to merge 1 commit into
pingdotgg:mainfrom
GuilhermeVieiraDev:fix/composer-file-mentions-with-spaces

Conversation

@GuilhermeVieiraDev
Copy link
Copy Markdown
Contributor

@GuilhermeVieiraDev GuilhermeVieiraDev commented May 10, 2026

What Changed

Fixed composer file mentions for files and folders whose paths contain whitespace.

The composer now serializes paths with spaces as quoted mention tokens, while leaving simple paths unchanged:

  • @src/index.ts
  • @"My File.md"

Quoted tokens are parsed back into a single mention chip, and the chip still shows the clean filename without quotes.

Fixes #2571.

Why

The previous mention parser treated a mention as @ followed by non-whitespace characters. That worked for paths like @AGENTS.md, but broke for paths containing spaces.

Selecting MY FILE.md inserted @MY FILE.md , and on re-parse only @MY became a mention while FILE.md stayed as plain text. This was visible in the composer and could also send an incomplete file reference to the agent.

Quoting only paths that need it keeps the common representation backwards-compatible and readable, while giving whitespace-containing paths a clear token boundary.

UI Changes

Before:

image image

After:

image

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Note

Medium Risk
Moderate risk because it changes mention token parsing/serialization and cursor mapping logic, which can affect editor selection behavior and the on-wire prompt text for mentions with special characters.

Overview
Adds support for quoted file mention tokens so paths with whitespace (and quotes/backslashes) can be inserted and re-parsed as a single @ mention (e.g. @"My File.md").

Introduces serializeComposerMentionPath and updates mention rendering/insertion (ComposerPromptEditor text content and ChatComposer path completion) plus cursor expand/collapse calculations to use the serialized token length. Updates mention parsing regex to accept quoted tokens with escapes and extends tests to cover quoted mention splitting, unescaping, boundary detection, and cursor mapping.

Reviewed by Cursor Bugbot for commit aac0024. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Fix composer file mentions to support paths with spaces

  • Adds serializeComposerMentionPath in composer-editor-mentions.ts to quote and escape paths containing whitespace or special characters, producing @"..." tokens.
  • Updates the mention regex to recognize both quoted (@"...") and unquoted mention tokens, with proper unescaping of quoted content.
  • Updates ChatComposer.tsx and ComposerMentionNode.getTextContent to serialize paths before insertion/rendering.
  • Fixes cursor expansion and collapse in composer-logic.ts to account for the extra characters introduced by quoting.
  • Behavioral Change: mentions with spaces now serialize as @"path with spaces" instead of @path with spaces, which changes the raw text stored in the composer.

Macroscope summarized aac0024.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 10, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: eb134714-72dc-4610-9c32-b6392d9ee0a3

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels May 10, 2026
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp Bot commented May 10, 2026

Approvability

Verdict: Approved

Self-contained bug fix adding quoted path support for file mentions containing spaces. Changes are limited to parsing/serialization logic with comprehensive test coverage and no broader runtime impact.

You can customize Macroscope's approvability policy. Learn more.

@GuilhermeVieiraDev GuilhermeVieiraDev force-pushed the fix/composer-file-mentions-with-spaces branch from 80da058 to aac0024 Compare May 12, 2026 20:07
@reactreview
Copy link
Copy Markdown

reactreview Bot commented May 12, 2026

Note

No issues found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Using the @ syntax to reference files does not respect whitespace

1 participant