-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Support mentions for filenames with spaces #5309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Coverage ReportExtension CoverageBase branch: 47% PR branch: 48% ✅ Coverage increased or remained the same Webview CoverageBase branch: 17% PR branch: 17% ✅ Coverage increased or remained the same Overall Assessment✅ Test coverage has been maintained or improved Last updated: 2025-08-04T18:10:01.839005 |
So happy that a PR to fix this issue is being made!! That's by far the biggest painpoint I was encountering with Cline. Was seriously thinking of renaming all my files because of this... Hopefully I won't need it |
Tested with filenames that have spaces & multiple spaces. This is working as expected and tests are passing. One small variable nitpick. |
This change allows users to reference files with spaces in their names, which was previously impossible due to the space-delimited mention syntax. File names with spaces can be @ mentioned by quoting the file name, e.g. @"/path with spaces/file.txt". - Update mention regex in `src/shared/context-mentions.ts` to accept quoted file paths - Add support for quoted file paths that can contain spaces. - Allow multiple trailing punctuation chars; previously only a single limited punctuation characters were allowed. - Maintain support for unquoted paths, URLs, git hashes, and special keywords - Update `src/core/mentions/index.ts` to handle quoted file names in mention parsing - Process quoted file paths by removing quotes when accessing the file system - Preserve existing functionality for all other mention types - Update `webview-ui/src/utils/context-mentions.ts` to auto-quote file names with spaces - `insertMention()` and `insertMentionDirectly()` now wrap file paths containing spaces in quotes - Non-file mentions (URLs, keywords) remain unquoted - Add comprehensive unit tests: - New test file `src/core/mentions/__tests__/index.test.ts` covering all mention types - New test file `webview-ui/src/utils/__tests__/context-mentions.test.ts` for webview mention insertion - Expanded `src/shared/__tests__/context-mentions.test.ts` to cover quoted paths and edge cases
This change allows users to reference files with spaces in their names, which was previously impossible due to the space-delimited mention syntax.
File names with spaces can be @ mentioned by quoting the file name, e.g. @"/path with spaces/file.txt".
Fixes #5304
Update mention regex in
src/shared/context-mentions.ts
to accept quoted file pathsUpdate
src/core/mentions/index.ts
to handle quoted file names in mention parsingUpdate
webview-ui/src/utils/context-mentions.ts
to auto-quote file names with spacesinsertMention()
andinsertMentionDirectly()
now wrap file paths containing spaces in quotesAdd comprehensive unit tests:
src/core/mentions/__tests__/index.test.ts
covering all mention typeswebview-ui/src/utils/__tests__/context-mentions.test.ts
for webview mention insertionsrc/shared/__tests__/context-mentions.test.ts
to cover quoted paths and edge casesScreen.Recording.2025-08-02.at.21.50.15.mov
Important
Support for file mentions with spaces by quoting paths, updating regex, parsing logic, and UI components, with comprehensive tests added.
@"/path with spaces/file.txt"
.context-mentions.ts
to handle quoted file paths and allow multiple trailing punctuation characters.parseMentions()
inindex.ts
to process quoted file paths by removing quotes.insertMention()
andinsertMentionDirectly()
incontext-mentions.ts
to auto-quote file paths with spaces.index.test.ts
for mention parsing covering all mention types.context-mentions.test.ts
for webview mention insertion.context-mentions.test.ts
to cover quoted paths and edge cases.This description was created by
for 3cbf5ba. You can customize this summary. It will automatically update as commits are pushed.