feat: display token usage in footers and show unclamped context usage with warning when limit exceeded (#317977)#319165
Open
Neizan93 wants to merge 3 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates chat UI token/context usage display and improves notification toast removal with fade-out behavior.
Changes:
- Show token usage (and optional cost) in the chat response footer with hover details.
- Allow context usage percentages to display above 100% and refine warning messaging near/exceeding limits.
- Add fade-out animation for notification toasts and defer removal until transition completes.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageWidget.ts | Adds dev fallback model metadata; shows percentages >100% in label/ARIA |
| src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageDetails.ts | Shows >100% usage in details label; updates warning text by threshold |
| src/vs/workbench/contrib/chat/browser/widget/media/chat.css | Adds styling/visibility rules for new footer token-usage element |
| src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.ts | Renders token usage + cost in footer with hover tooltip; injects language model service |
| src/vs/workbench/browser/parts/notifications/notificationsToasts.ts | Implements toast fade-out and defers removal; adds pending-removal tracking |
| src/vs/workbench/browser/parts/notifications/media/notificationsToasts.css | Adds CSS fade-out transition and reduced-motion override |
6f0ac74 to
65008cf
Compare
65008cf to
aad1dcd
Compare
aad1dcd to
b4cddc5
Compare
… with warning when limit exceeded microsoft#317977
b4cddc5 to
a0f20ef
Compare
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.
Proposed Changes
This PR addresses issue #317977 by adding detailed token usage metrics to response footers and enhancing context usage visibility when limit thresholds are crossed.
1. Response Token Usage Badge
ILanguageModelsServiceinto the chat list renderer to check for metadata (costs and pricing categories).2. Unclamped Context Usage & Limit Warning
Math.min(100, ...)clamping on the bottom-right context usage circular widget and the details popup panel so actual percentage values above100%can be visualized when limits are exceeded.>= 100%.