-
Notifications
You must be signed in to change notification settings - Fork 781
feat: add Copy Relative Path context menu option #1854
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
feat: add Copy Relative Path context menu option #1854
Conversation
Adds option to copy file/folder relative paths based on project root. Supports all URI types (file, content, sftp, ftp) with proper fallback.
Summary of ChangesHello @bajrangCoder, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a significant quality-of-life improvement by adding a 'Copy Relative Path' option to the context menu for both files and directories. This feature streamlines workflows by enabling users to effortlessly obtain file paths relative to the project's root, enhancing navigation and referencing within the application. The implementation includes comprehensive logic for path calculation and full internationalization support. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a 'Copy Relative Path' feature to the context menu for files and folders. The implementation adds the necessary UI strings and the core logic in openFolder.js. The changes are mostly good, but I have a few suggestions for improvement.
My review focuses on:
- A potential bug in the relative path calculation logic.
- Improving user feedback messages to be more specific and localized.
- Providing missing translations for the new UI string.
Overall, this is a great addition to the application's functionality.
Greptile OverviewGreptile SummaryThis PR adds a new "Copy Relative Path" feature to the file explorer context menu, allowing users to copy the relative path of files and folders to the clipboard. The implementation includes:
The feature integrates cleanly with the existing context menu system and follows established patterns in the codebase for clipboard operations. Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant ContextMenu as Context Menu
participant execOperation
participant copyRelativePath
participant Url
participant Path
participant Clipboard as Cordova Clipboard
User->>ContextMenu: Right-click file/folder
ContextMenu->>execOperation: "copy-relative-path" action
execOperation->>copyRelativePath: Call copyRelativePath()
copyRelativePath->>copyRelativePath: Validate url and rootUrl
alt Both URLs have pathnames
copyRelativePath->>Url: pathname(rootUrl)
Url-->>copyRelativePath: rootPath
copyRelativePath->>Url: pathname(url)
Url-->>copyRelativePath: targetPath
copyRelativePath->>Path: convertToRelative(rootPath, targetPath)
Path-->>copyRelativePath: relativePath
else Fallback: pathname extraction fails
copyRelativePath->>copyRelativePath: Clean trailing slashes
alt Target starts with root
copyRelativePath->>copyRelativePath: Slice root from target
else Not a child path
copyRelativePath->>Url: basename(url)
Url-->>copyRelativePath: relativePath
end
end
copyRelativePath->>Clipboard: copy(relativePath)
copyRelativePath->>User: toast("Relative path copied")
|
|
thanks 🙏 |
Fixes: #1852