Skip to content

Commit 3a3055b

Browse files
committed
feat: add Premium request analytics link icon to tooltip
- Add BILLING_URL constant for https://github.com/settings/billing/premium_requests_usage - In normal tooltip: show $(graph) link after Used: xxx/yyy (pct%) line (opens Premium request analytics) - In noData tooltip: show $(graph) link alongside $(refresh) button - Remove inline status dot emoji from tooltip; status bar coloring still applies
1 parent c32ff59 commit 3a3055b

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

src/extension.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ async function refresh(promptSignIn = false, isManual = false) {
126126
// Status bar rendering
127127
// ---------------------------------------------------------------------------
128128

129+
const BILLING_URL = 'https://github.com/settings/billing/premium_requests_usage';
130+
129131
/**
130132
* @param {import('./api').UsageData} data
131133
* @param {boolean} [isRateLimited]
@@ -140,7 +142,7 @@ function updateStatusBar(data, isRateLimited = false) {
140142
if (isRateLimited) md.appendMarkdown('\n\n_(Rate limited — showing last known data)_');
141143
md.appendMarkdown('\n\n');
142144
if (lastUpdatedAt) md.appendMarkdown(`Updated at ${formatTimestamp(lastUpdatedAt)} `);
143-
md.appendMarkdown('[$(refresh)](command:githubCopilotUsage.refresh)');
145+
md.appendMarkdown(`[$(refresh)](command:githubCopilotUsage.refresh)  [$(graph)](${BILLING_URL})`);
144146
renderStatus({ text: '—', tooltip: md });
145147
return;
146148
}
@@ -178,12 +180,7 @@ function buildTooltip(data, isRateLimited) {
178180
if (data.unlimited) {
179181
md.appendMarkdown('Quota: Unlimited\n\n');
180182
} else {
181-
const cfg = vscode.workspace.getConfiguration('githubCopilotUsage');
182-
const thresholdEnabled = cfg.get('threshold.enabled', true);
183-
const warnPct = cfg.get('threshold.warning', 75);
184-
const critPct = cfg.get('threshold.critical', 90);
185-
const dot = thresholdEnabled ? (data.usedPct >= critPct ? '🔴' : data.usedPct >= warnPct ? '🟡' : '🟢') : '🟢';
186-
md.appendMarkdown(`Used: ${data.used} / ${data.quota} (${data.usedPct}%) ${dot}\n\n`);
183+
md.appendMarkdown(`Used: ${data.used} / ${data.quota} (${data.usedPct}%)  [$(graph)](${BILLING_URL})\n\n`);
187184
if (data.overageEnabled && data.overageUsed > 0) {
188185
md.appendMarkdown(`Overage: ${data.overageUsed} requests\n\n`);
189186
}

0 commit comments

Comments
 (0)