fix(ui): decouple context percentage from model info visibility#20790
fix(ui): decouple context percentage from model info visibility#20790anthonychen000 wants to merge 2 commits 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 addresses a bug where the context percentage and quota statistics in the CLI footer would incorrectly disappear when the model information was hidden. The changes refactor the footer's rendering logic to ensure these elements are displayed independently based on their own visibility settings, improving the user experience and configurability of the UI. Highlights
Changelog
Activity
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.
Code Review
This pull request effectively decouples the visibility of footer stats like context usage and quota from the model info display toggle. The logic changes in Footer.tsx correctly ensure that these stats can be shown independently, and the new unit tests in Footer.test.tsx provide good coverage for the fix.
I've identified one issue with the layout logic for justifyContent that is not fully robust and can lead to alignment problems in certain configurations, and have provided a suggestion to refactor this for better reliability.
| const justifyContent = | ||
| hideCWD && hideModelInfo && hideContextPercentage | ||
| ? 'center' | ||
| : 'space-between'; | ||
| const displayVimMode = vimEnabled ? vimMode : undefined; | ||
|
|
||
| const showDebugProfiler = debugMode || isDevelopment; |
There was a problem hiding this comment.
The logic for justifyContent is an improvement, but it's still not fully robust. It doesn't account for all elements that can be visible on the left and right sides of the footer, which can lead to incorrect centering. For example, if hideCWD, hideModelInfo, and hideContextPercentage are all true, but quotaStats is visible on the right, justifyContent will incorrectly be set to 'center'.
To make this more reliable, I suggest refactoring to define all visibility flags first, then use them to determine the layout. This makes the logic clearer and bug-free.
const displayVimMode = vimEnabled ? vimMode : undefined;
const showDebugProfiler = debugMode || isDevelopment;
const showLeftSection = showDebugProfiler || !!displayVimMode || !hideCWD;
const showRightSection =
!hideModelInfo ||
!hideContextPercentage ||
!!quotaStats ||
showMemoryUsage ||
corgiMode ||
showErrorSummary;
const justifyContent =
!showLeftSection && !showRightSection ? 'center' : 'space-between';
There was a problem hiding this comment.
I updated the logic to use the suggested showLeftSection and showRightSection flags. This ensures the layout correctly handles secondary elements like showMemoryUsage and quotaStats even when the primary model info is hidden.
I verified this locally with the following configuration:
"ui": {
"showMemoryUsage": true,
"footer": {
"hideCWD": true,
"hideModelInfo": true,
"hideContextPercentage": true
}
}Even when hiding all primary footer elements, the Memory Usage now correctly stays right-aligned while the Sandbox Status remains centered.
|
I am working on a PR that makes the entire footer customizeable via I think this de-coupling may not be needed as those settings will become legacy/deprecated one I merge my PR. |
Thanks for taking a look Jack. I'll close this out. I did add some unit tests for the context/quota visibility—feel free to cherry-pick those if they’re helpful for your implementation. Looking forward to the customizable footer! |
|
Closing this |
Fixes #14864
Summary
Decouples the
ContextUsageDisplay,QuotaDisplay, andMemoryUsageDisplayfrom the model info visibility toggle in the UI footer.Details
Currently, in
packages/cli/src/ui/components/Footer.tsx, several stats displays are nested inside the {!hideModelInfo} conditional block. This causes the context percentage and quota stats to disappear when the model info is disabled, even if hideContextPercentage is explicitly set to false.Changes:
How to Validate
~/.gemini/settings.jsonto include:{ "ui": { "footer": { "hideModelInfo": true, "hideContextPercentage": false } } }Pre-Merge Checklist
screenshot with updated ~/.gemini/settings.json: