feat: [TBB] Refactor quota usage menu and UI updates#172
Open
ethanyhou wants to merge 4 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the Copilot “Usage” menu (status bar + menu bar) to support updated quota semantics and plan types (including Individual Max), adds shared menu helpers, and modernizes the quota protocol types to Java records.
Changes:
- Introduces
MenuUtilsto centralize plan labeling, usage icon selection, overage/upgrade row logic, and allowance-reset formatting. - Updates status-bar and menu-bar handlers +
QuotaTextCalculatorto render the new usage UI (monthly limit/included credits, overage upsell, allowance reset row). - Refactors quota protocol DTOs (
Quota,CheckQuotaResult) to records, addsresetDateUtc, and addsCheckQuotaResult.empty()as the default placeholder.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/utils/MenuUtils.java | New shared helpers for usage menu rendering (plan labels, icons, allowance reset, predicates). |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/i18n/messages.properties | Adds/updates localized strings for the refactored usage UI. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/i18n/Messages.java | Declares new NLS fields for the updated usage UI strings. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/handlers/ShowStatusBarMenuHandler.java | Refactors status-bar menu construction and refresh to use MenuUtils + new quota display rules. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/handlers/ShowMenuBarMenuHandler.java | Refactors menu-bar contribution items to match the new usage UI and refresh behavior. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/handlers/QuotaTextCalculator.java | Updates quota row text formatting (included credits vs monthly limit, percent formatting, tooltips). |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/services/ModelService.java | Updates plan accessor usage after CheckQuotaResult refactor. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/ChatContentViewer.java | Updates plan accessor usage and reuses CFI plan predicate. |
| com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/quota/QuotaSnapshotParams.java | Adds record type for quota snapshots used in quota change/warning notifications. |
| com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/quota/Quota.java | Refactors quota DTO to a record with clamped percentRemaining and equality excluding timestamp. |
| com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/quota/CopilotPlan.java | Adds individual_max plan value. |
| com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/quota/CheckQuotaResult.java | Refactors to a record, adds resetDateUtc + token-based billing flag, and empty() placeholder. |
| com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/AuthStatusManager.java | Uses CheckQuotaResult.empty() as the default quota status. |
| com.microsoft.copilot.eclipse.core.test/src/com/microsoft/copilot/eclipse/core/AuthStatusManagerTests.java | Updates tests to use CheckQuotaResult.empty() instead of new CheckQuotaResult(). |
Co-authored-by: Copilot <copilot@github.com>
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR updated Copilot usage status bar menu and menu bar menu.
qingyiliu/token-based-billingCFI users should see AI Credits and CBCE users should see Monthly Limit if the plan is not unlimited.
Also added code to fallback to the original UI before TBB relase