Skip to content

feat(cli): add Tab key file path completion in normal prompt mode#25787

Open
gvenugo3 wants to merge 1 commit intogoogle-gemini:mainfrom
gvenugo3:feat/tab-file-completion-normal-mode
Open

feat(cli): add Tab key file path completion in normal prompt mode#25787
gvenugo3 wants to merge 1 commit intogoogle-gemini:mainfrom
gvenugo3:feat/tab-file-completion-normal-mode

Conversation

@gvenugo3
Copy link
Copy Markdown

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: Added suppressCommandSuggestions option. When true, the hook skips PATH executable scanning and falls through to resolvePathCompletions, so only file/directory suggestions are returned in the command-token position.

  • useCommandCompletion.tsx: forceShowShellSuggestions is now included in the completionMode useMemo. When true and no @ or / completion is active, completionMode returns CompletionMode.SHELL, enabling the shell completion pipeline without requiring shell mode. suppressCommandSuggestions: !shellModeActive is passed to useShellCompletion so command scanning only occurs in actual shell mode.

  • InputPrompt.tsx: Tab key handler extended — when completionMode === IDLE and no other completion is active, Tab calls setForceShowShellSuggestions(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

  1. Start the CLI: npm run dev or gemini
  2. At the normal prompt (no ! prefix), type a partial file or directory path (e.g. src/ or pack)
  3. Press Tab — a file path completion dropdown should appear
  4. Press Tab again to cycle through suggestions, or Enter to accept
  5. Press Escape to dismiss without completing
  6. Verify that @path and /command completions are unaffected
  7. Verify that in shell mode (!), Tab still completes both commands and file paths

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

@gvenugo3 gvenugo3 requested a review from a team as a code owner April 22, 2026 07:01
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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

  • Tab Key File Path Completion: Implemented file path completion when pressing the Tab key in the normal (Gemini) prompt mode, aligning with standard shell user experience.
  • Suppressed Command Suggestions: Command/executable suggestions are now suppressed in normal mode when using Tab for completion, showing only files and directories.
  • Integration with Existing Shell Completion: The feature leverages the existing shell completion pipeline by introducing a suppressCommandSuggestions option and modifying completion mode logic.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a 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 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.

Comment thread packages/cli/src/ui/hooks/useShellCompletion.ts Outdated
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
@gvenugo3 gvenugo3 force-pushed the feat/tab-file-completion-normal-mode branch from 07da631 to 6154bd1 Compare April 22, 2026 07:12
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a 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 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.

@gemini-cli gemini-cli Bot added area/core Issues related to User Interface, OS Support, Core Functionality help wanted We will accept PRs from all issues marked as "help wanted". Thanks for your support! labels Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Issues related to User Interface, OS Support, Core Functionality help wanted We will accept PRs from all issues marked as "help wanted". Thanks for your support!

Projects

None yet

1 participant