Skip to content

Conversation

@kunwarVivek
Copy link

@kunwarVivek kunwarVivek commented Apr 18, 2025

Context

Implementation

Screenshots

before after

How to Test

Get in Touch


Important

Fix handling of file and folder paths with spaces in mentions and context menu logic.

  • Behavior:
    • Update mentionRegex in context-mentions.ts to handle file and folder paths with spaces.
    • Modify shouldShowContextMenu() in context-mentions.ts to allow paths with spaces.
  • Tests:
    • Add tests in index.test.ts for parsing file and folder paths with spaces.
    • Add tests in context-mentions.test.ts to verify context menu behavior for paths with spaces.
  • Misc:
    • Update comments in context-mentions.ts to reflect regex changes.

This description was created by Ellipsis for 910e9ba. It will automatically update as commits are pushed.

@changeset-bot
Copy link

changeset-bot bot commented Apr 18, 2025

⚠️ No Changeset found

Latest commit: 910e9ba

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. bug Something isn't working labels Apr 18, 2025
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Apr 18, 2025
@hannesrudolph
Copy link
Collaborator

Fixes #2361

@hannesrudolph hannesrudolph moved this from New to PR [Pre Approval Review] in Roo Code Roadmap Apr 18, 2025
@hannesrudolph hannesrudolph linked an issue Apr 18, 2025 that may be closed by this pull request
@hannesrudolph
Copy link
Collaborator

@ellipsis run review

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Reviewed everything up to 910e9ba in 57 seconds

More details
  • Looked at 172 lines of code in 4 files
  • Skipped 0 files when reviewing.
  • Skipped posting 8 drafted comments based on config settings.
1. src/core/mentions/__tests__/index.test.ts:154
  • Draft comment:
    Consider restoring the fs spies (readFile and stat) after each test to avoid side effects. Adding cleanup in an afterEach could improve test isolation.
  • Reason this comment was not posted:
    Confidence changes required: 70% <= threshold 70%
    None
2. src/shared/context-mentions.ts:56
  • Draft comment:
    Ensure the updated regex handles all edge cases, especially trailing punctuation. The detailed comments are helpful, but additional unit tests for corner cases (e.g., multiple spaces and punctuation at the end) may enhance coverage.
  • Reason this comment was not posted:
    Confidence changes required: 50% <= threshold 70%
    None
3. webview-ui/src/utils/context-mentions.ts:271
  • Draft comment:
    In the shouldShowContextMenu function, verifying the first character after '@' with startsWith(' ') correctly allows spaces in file paths, but consider a comment clarifying why only the first space is checked.
  • Reason this comment was not posted:
    Confidence changes required: 30% <= threshold 70%
    None
4. webview-ui/src/utils/context-mentions.ts:244
  • Draft comment:
    When deduplicating items, ensure that undefined values for item.value are handled explicitly to avoid possible key collisions. Consider adding a fallback value for key generation.
  • Reason this comment was not posted:
    Confidence changes required: 60% <= threshold 70%
    None
5. webview-ui/src/utils/context-mentions.ts:247
  • Draft comment:
    The deduplication logic uses the raw value (item.value) as the key. This does not normalize file paths (e.g., 'src/test.ts' vs '/src/test.ts'). Consider normalizing the key (for instance, ensuring a leading slash) so that duplicates differing only by a slash are properly removed.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
6. webview-ui/src/utils/context-mentions.ts:269
  • Draft comment:
    In shouldShowContextMenu, the condition for slash commands checks for any whitespace in the text (using text.includes(' ')). This may be too strict if slash commands are allowed to contain spaces. Please verify this logic matches the intended behavior.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
7. webview-ui/src/utils/context-mentions.ts:93
  • Draft comment:
    The getContextMenuOptions function has a complex block for handling slash commands (modes) using fuzzy search. For better modularity and easier maintenance, consider extracting this logic into a separate helper function.
  • Reason this comment was not posted:
    Confidence changes required: 70% <= threshold 70%
    None
8. src/shared/context-mentions.ts:55
  • Draft comment:
    The updated regex and extensive inline comments greatly improve clarity. For future maintainability, consider breaking the regex into smaller, named components or helper functions.
  • Reason this comment was not posted:
    Confidence changes required: 30% <= threshold 70%
    None

Workflow ID: wflow_WyXpmawh4UjGoCmT


You can teach Ellipsis what to look for with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Mention regex:
- **Purpose**:
- To identify and highlight specific mentions in text that start with '@'.
- **Purpose**:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kunwarVivek can you pleaes remove the unnecessary changes to spaces and comments to focus the PR? Minor tweak. When using AI to write fixes its usually good practice to remove any uneeded changes to lines like this.

@hannesrudolph
Copy link
Collaborator

@dosu Review

@Yikai-Liao
Copy link
Contributor

Yikai-Liao commented Apr 19, 2025

I don't think directly matching the normal space character is a good idea. I think that we need to use escape space in path,just like what we do in terminal.

And this is what I do in my pr #2565

@mrubens
Copy link
Collaborator

mrubens commented Apr 21, 2025

Thank you for the PR! Just tried it out, a few thoughts:

  • I think it needs to escape the spaces when inserting the mention
  • We need to make sure the "backend" is correctly parsing the mention to load the content
  • When you keep typing after the insertion it shows "no results found"
Screen.Recording.2025-04-20.at.10.09.48.PM.mov

@hannesrudolph hannesrudolph linked an issue Apr 29, 2025 that may be closed by this pull request
@mrubens
Copy link
Collaborator

mrubens commented Apr 30, 2025

Thank you for the PR! We just merged #3044 to fix this, so going to close this one.

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

Labels

bug Something isn't working size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

File names containing spaces will be truncated Unable to add file to context if the file name has a space

4 participants