Improve altName completion behavior in slash commands#4227
Improve altName completion behavior in slash commands#4227scottdensmore merged 8 commits intogoogle-gemini:mainfrom
Conversation
There was a problem hiding this comment.
Summary of Changes
Hello @Lee-WonJun, 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 refines the behavior of slash command completion by ensuring that exact matches for alternative command names (altNames) trigger immediate command execution, aligning their behavior with primary command names. This change significantly improves the user experience by eliminating an unnecessary second Enter keypress for known altNames.
Highlights
- Improved AltName Behavior: The core logic for command completion has been updated to treat fully typed alternative command names (altNames) as perfect matches. This means that when a user types a complete altName like
/usageor/?and presses Enter, the command will now execute immediately instead of displaying autocomplete suggestions, streamlining the user experience. - Enhanced Test Coverage: New integration and unit tests have been added and existing ones modified to thoroughly validate the new altName behavior. Tests now explicitly confirm that full altName inputs result in no suggestions, while partial altName inputs continue to correctly provide relevant autocomplete suggestions.
- Bug Fix: This pull request directly addresses and fixes the issue where users previously had to press Enter twice to execute a command when typing a complete altName, resolving a confusing user experience inconsistency.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| 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 issue 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 is currently in preview and 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 to provide feedback.
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
-
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. ↩
There was a problem hiding this comment.
Code Review
This pull request correctly implements the desired behavior for altName command completion, ensuring that full altName matches execute immediately. The core logic change is sound. My review focuses on improving the test suite's maintainability and correctness. I've identified duplicated test logic that could be refactored using it.each for better maintainability, and a test assertion that needs to be updated to reflect the addition of a new mock command. Addressing these points will make the tests more robust and easier to manage in the future.
2c89281 to
1da8267
Compare
Co-authored-by: Jacob Richman <[email protected]>
…4227) Co-authored-by: Jacob Richman <[email protected]>
…4227) Co-authored-by: Jacob Richman <[email protected]>
…4227) Co-authored-by: Jacob Richman <[email protected]>

TLDR
Fix altName commands (like
/?) to execute immediately instead of showing autocomplete suggestions. When users type a complete altName like/?or/usageand press Enter, the command now executes directly rather than requiring a second Enter keypress.Dive Deeper
Previously, typing
/?(an altName for/help) would show an autocomplete suggestion for/helpinstead of executing the command immediately. This created a confusing UX where users had to press Enter twice:/?→ Enter →/help→ Enter.The fix involves two key changes:
/usag), suggestions should continue to appear — this is intentional./?or/usage), it should behave exactly the same as typing a full command name and execute immediately without suggestions.This change ensures consistency between full
namematches and fullaltNamematches.1. Perfect Match Logic
The completion logic was updated to treat full altName matches the same as full command name matches.
Previously, the perfect match logic only checked
s.name === partial. Now, it also checkss.altName === partial.This simple expansion ensures that full altName inputs (like
/?) are recognized as exact matches and trigger immediate command execution without further interaction.2. Test Coverage for altName Behavior
Test cases were added and updated to cover this new behavior:
/?and/usageexecute immediately and do not show suggestions./usagstill show autocomplete suggestions as intended.Testing Matrix
Linked issues / bugs
Fixes #4201
Video Explanation
31.mp4
The left shows the original behavior, the right shows the fix.
/usa), suggestions appear as expected./usageor/?, the original behavior doesn't execute the command on Enter — it turns into a suggestion instead.This feels unintended because:
Typing
"/?" + Enterchanges it to a suggestion,but typing
"/? " + Enterruns the command directly.That inconsistency seems wrong to me.