Skip to content

Commit e3a2182

Browse files
committed
feat: show loading spinner only on manual refresh
Show $(sync~spin) only for user-initiated refreshes (commands, tooltip click). Auto-refresh, config change, and startup update silently.
1 parent 8ad0b39 commit e3a2182

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/extension.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ async function activate(context) {
3232
context.subscriptions.push(statusBarItem);
3333

3434
context.subscriptions.push(
35-
vscode.commands.registerCommand('githubCopilotUsage.refresh', () => refresh()),
36-
vscode.commands.registerCommand('githubCopilotUsage.signIn', () => refresh(true)),
35+
vscode.commands.registerCommand('githubCopilotUsage.refresh', () => refresh(false, true)),
36+
vscode.commands.registerCommand('githubCopilotUsage.signIn', () => refresh(true, true)),
3737
vscode.workspace.onDidChangeConfiguration((e) => {
3838
if (e.affectsConfiguration('githubCopilotUsage')) {
3939
resetTimer();
@@ -58,16 +58,17 @@ function deactivate() {
5858

5959
/**
6060
* @param {boolean} [promptSignIn]
61+
* @param {boolean} [isManual] Only show loading indicator for user-initiated refreshes.
6162
*/
62-
async function refresh(promptSignIn = false) {
63+
async function refresh(promptSignIn = false, isManual = false) {
6364
if (deactivated) return;
6465
if (promptSignIn) pendingSignIn = true; // record intent even if in-flight
6566
if (refreshInFlight) return;
6667

6768
const doSignIn = pendingSignIn;
6869
pendingSignIn = false;
6970
refreshInFlight = true;
70-
showLoading();
71+
if (isManual) showLoading();
7172
try {
7273
let session;
7374
try {

0 commit comments

Comments
 (0)