feat(cli): add shortcuts to open @ mentions in editor or file browser - #25060
feat(cli): add shortcuts to open @ mentions in editor or file browser#25060Oerum wants to merge 22 commits into
Conversation
Implemented suggest.openSelectedMention (Ctrl+X) and suggest.openSelectedMentionLocation (Ctrl+Shift+X) to allow users to quickly open files or directories directly from the @ mention suggestion list. Key changes: - Added openDirectory utility in editorUtils.ts. - Updated useAtCompletion hook to provide path and kind metadata. - Enhanced InputPrompt to handle the new commands and open the correct targets. - Added visual hints for these shortcuts in SuggestionsDisplay. - Updated documentation and unit tests across the CLI package.
Summary of ChangesHello, 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 keyboard-based navigation shortcuts for @ mention targets within the CLI. By allowing users to quickly open files or directories directly from the suggestion list, it streamlines the workflow for interacting with project resources. The changes include backend utility updates, UI feedback improvements, and robust keybinding management to handle command overlaps. 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. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces new keyboard shortcuts to open file and folder mentions directly from the suggestion list. Users can now use Ctrl+X to open a selected file in their preferred editor (or a folder in the file browser) and Ctrl+Shift+X to open the containing directory. The changes include updates to the InputPrompt and SuggestionsDisplay components to support these actions and display relevant hints, enhancements to the useAtCompletion hook to provide necessary path metadata, and the addition of a new openDirectory utility. Documentation and test suites have been updated to reflect these improvements. I have no feedback to provide.
|
Thank you for your interest in contributing to the project! We are closing this PR as the associated issue was closed. |
Summary
This PR adds keyboard shortcuts to the
@mention completion list, allowing users to directly open the selected file/folder in their editor (Ctrl+X) or file browser (Ctrl+Shift+X). It improves navigation speed and provides clear visual hints in the UI for these new actions.Details
openDirectoryfunction ineditorUtils.tsto complementopenFileInEditor.useAtCompletionto return explicitmentionTargetKind('file'or'directory') and absolutementionTargetPathso the UI knows how to process the selected item.InputPromptto handle the newCommand.OPEN_SELECTED_MENTIONandCommand.OPEN_SELECTED_MENTION_LOCATIONevents.SuggestionsDisplayfooter.Ctrl+Xcommand (which opened the prompt editor) and the new contextual action. When the@suggestion window is active, it now strictly targets the mention, providing a hint about the legacy action if attempted inappropriately.Related Issues
Closes #20500
How to Validate
gemini-cli.@to trigger the mention list, or@src/to search inside a folder.Up/Downarrows to highlight a file or directory.Ctrl+Xto see it open in the configured external editor (for files) or default file explorer (for directories).Ctrl+Shift+Xto open the containing folder of the selected file.Ctrl+Xwhen the suggestion list is NOT active still correctly opens the external editor for the current prompt.Pre-Merge Checklist