feat(cli): add Tab key file path completion in normal prompt mode#25787
feat(cli): add Tab key file path completion in normal prompt mode#25787gvenugo3 wants to merge 1 commit intogoogle-gemini:mainfrom
Conversation
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 enhances the command-line interface by introducing intuitive file path completion when the Tab key is pressed in the standard prompt. This change significantly improves the user experience by providing immediate access to file and directory suggestions without requiring a specific prefix or mode, making the CLI more efficient and user-friendly for navigating the file system. 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 enables file path completion via the Tab key in the normal prompt mode by introducing a suppressCommandSuggestions flag to the useShellCompletion hook. When this flag is active, the hook skips executable scanning. The changes also include UI updates to trigger these suggestions and new test cases. Feedback was provided regarding the logic flow in useShellCompletion.ts, noting that when command suggestions are suppressed, the hook should bypass all shell-specific logic to avoid irrelevant argument suggestions in natural language prompts.
Pressing Tab in the normal prompt now triggers file path completion, consistent with standard shell UX. Command/executable suggestions are suppressed in this mode; only file and directory completions are shown. Adds suppressCommandSuggestions option to useShellCompletion and wires forceShowShellSuggestions into the completionMode useMemo so the shell completion pipeline activates without requiring shell mode. Closes google-gemini#18990
07da631 to
6154bd1
Compare
There was a problem hiding this comment.
Code Review
This pull request enables file path completion in the normal prompt mode by allowing the Tab key to trigger shell suggestions while suppressing command/executable scanning. Key changes include updating InputPrompt to force shell suggestions on Tab, modifying useCommandCompletion to pass a suppression flag, and updating useShellCompletion to skip command logic when that flag is active. Additionally, the test suite for shell completion was refactored and expanded to verify these new behaviors. I have no feedback to provide as no review comments were submitted.
Summary
Pressing Tab in the normal (Gemini) prompt now triggers file path completion, consistent with standard shell UX. Previously, file completion was only available via the
@prefix (fuzzy search) or in shell mode (!). Now users can type a partial path and press Tab to get completions without switching modes.Command/executable suggestions are suppressed in normal mode — only files and directories are shown.
Details
Three targeted changes wire up the existing shell completion pipeline to the normal prompt:
useShellCompletion.ts: AddedsuppressCommandSuggestionsoption. Whentrue, the hook skips PATH executable scanning and falls through toresolvePathCompletions, so only file/directory suggestions are returned in the command-token position.useCommandCompletion.tsx:forceShowShellSuggestionsis now included in thecompletionModeuseMemo. Whentrueand no@or/completion is active,completionModereturnsCompletionMode.SHELL, enabling the shell completion pipeline without requiring shell mode.suppressCommandSuggestions: !shellModeActiveis passed touseShellCompletionso command scanning only occurs in actual shell mode.InputPrompt.tsx: Tab key handler extended — whencompletionMode === IDLEand no other completion is active, Tab callssetForceShowShellSuggestions(true). Subsequent Tab presses are handled by the existing suggestion navigation and acceptance logic.The
@prefix and/slash command completions are unaffected and retain priority over Tab-triggered path completion. Escape dismisses the dropdown as usual.Related Issues
Closes #18990
How to Validate
npm run devorgemini!prefix), type a partial file or directory path (e.g.src/orpack)@pathand/commandcompletions are unaffected!), Tab still completes both commands and file pathsPre-Merge Checklist