-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Labels
Issue - In ProgressSomeone is actively working on this. Should link to a PR soon.Someone is actively working on this. Should link to a PR soon.bugSomething isn't workingSomething isn't working
Description
App Version
3.11.14
API Provider
OpenRouter
Model Used
Claude 3.7 Sonnet
Actual vs. Expected Behavior
Actual Behavior:
- When a file path contains spaces or special characters, the
@mention highlighting doesn't work correctly - The system fails to properly read or access files with spaces in their paths when referenced using the
@mention syntax - Multiple backslashes are added inconsistently, causing path resolution issues
- In some cases, file paths with existing escaped spaces get double-escaped incorrectly
Expected Behavior:
- File paths with spaces should be properly escaped with backslashes
- The
@mention highlighting should work correctly for all file paths regardless of spaces or special characters - Files with spaces in their paths should be correctly accessed when referenced using the
@mention syntax - Already escaped spaces should not be double-escaped in an incorrect manner
Detailed Steps to Reproduce
- Create a folder and a file with spaces in their names (e.g.,
folder with spaces/file with spaces.txt) - In the editor, type
@to trigger the mention functionality - Select the file with spaces from the file list
- Observe that the file path is incorrectly escaped in the editor
- Try to access the file by clicking on the mention link
- Observe that the file cannot be opened or is opened incorrectly
Code to demonstrate the issue:
// Create a path with spaces
const path = "/path/to/folder with spaces/file with spaces.txt";
// Convert to mention path
const mentionPath = convertToMentionPath(path, "/path/to");
// Expected: "@/folder\ with\ spaces/file\ with\ spaces.txt"
// Actual: Incorrect escaping that varies depending on context
console.log(mentionPath);
// When using insertMention, the spaces are handled inconsistently
const result = insertMention("Check this file: ", cursorPosition, mentionPath.substring(1));Relevant API Request Output
Additional Context
The issue occurs due to multi-level escaping problems in two key utility functions:
convertToMentionPathinpath-mentions.ts- Fails to properly handle paths with spaces and existing escaped spacesinsertMentionincontext-mentions.ts- Doesn't consistently handle the escaped paths
This issue affects both Windows and Unix-style paths. The problem is particularly severe when files already contain escaped spaces, as the escaping logic doesn't account for this case.
The bug impacts users trying to reference files with spaces in their paths, which is a common scenario especially in project names, documentation folders, and descriptive file naming schemes.
Debug info:
- Operating System: Affects all platforms (Windows, macOS, Linux)
- Plugin version: [Your version number]
- Reproducible with: Any file paths containing spaces
dosubot
Metadata
Metadata
Assignees
Labels
Issue - In ProgressSomeone is actively working on this. Should link to a PR soon.Someone is actively working on this. Should link to a PR soon.bugSomething isn't workingSomething isn't working