Skip to content

Commit 2aed79e

Browse files
authored
Merge pull request #430 from rajbos/copilot/remove-copilot-check
Remove Copilot extension check and startup wait
2 parents 3eca5cf + 90c5270 commit 2aed79e

File tree

1 file changed

+7
-57
lines changed

1 file changed

+7
-57
lines changed

src/extension.ts

Lines changed: 7 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ class CopilotTokenTracker implements vscode.Disposable {
159159
*/
160160
private _disposed = false;
161161
private updateInterval: NodeJS.Timeout | undefined;
162-
private initialDelayTimeout: NodeJS.Timeout | undefined;
163162
private detailsPanel: vscode.WebviewPanel | undefined;
164163
private chartPanel: vscode.WebviewPanel | undefined;
165164
private analysisPanel: vscode.WebviewPanel | undefined;
@@ -415,62 +414,17 @@ class CopilotTokenTracker implements vscode.Disposable {
415414
}
416415

417416
private scheduleInitialUpdate(): void {
418-
const copilotExtension = vscode.extensions.getExtension('GitHub.copilot');
419-
const copilotChatExtension = vscode.extensions.getExtension('GitHub.copilot-chat');
420-
421-
// Check if Copilot extensions exist but are not active (likely still loading)
422-
const extensionsExistButInactive =
423-
(copilotExtension && !copilotExtension.isActive) ||
424-
(copilotChatExtension && !copilotChatExtension.isActive);
425-
426-
if (extensionsExistButInactive) {
427-
// Use shorter delay for testing in Codespaces
428-
const delaySeconds = process.env.CODESPACES === 'true' ? 5 : 2;
429-
this.log(`⏳ Waiting for Copilot Extension to start (${delaySeconds}s delay)`);
430-
431-
this.initialDelayTimeout = setTimeout(async () => {
432-
try {
433-
this.log('🚀 Starting token usage analysis...');
434-
this.recheckCopilotExtensionsAfterDelay();
435-
await this.updateTokenStats();
436-
this.startBackendSyncAfterInitialAnalysis();
437-
await this.showFluencyScoreNewsBanner();
438-
await this.showUnknownMcpToolsBanner();
439-
} catch (error) {
440-
this.error('Error in delayed initial update:', error);
441-
}
442-
}, delaySeconds * 1000);
443-
} else if (!copilotExtension && !copilotChatExtension) {
444-
this.log('⚠️ No Copilot extensions found - starting analysis anyway');
445-
setTimeout(async () => {
446-
await this.updateTokenStats();
447-
this.startBackendSyncAfterInitialAnalysis();
448-
await this.showFluencyScoreNewsBanner();
449-
await this.showUnknownMcpToolsBanner();
450-
}, 100);
451-
} else {
452-
this.log('✅ Copilot extensions are active - starting token analysis');
453-
setTimeout(async () => {
417+
this.log('🚀 Starting token usage analysis...');
418+
setTimeout(async () => {
419+
try {
454420
await this.updateTokenStats();
455421
this.startBackendSyncAfterInitialAnalysis();
456422
await this.showFluencyScoreNewsBanner();
457423
await this.showUnknownMcpToolsBanner();
458-
}, 100);
459-
}
460-
}
461-
462-
private recheckCopilotExtensionsAfterDelay(): void {
463-
const copilotExtension = vscode.extensions.getExtension('GitHub.copilot');
464-
const copilotChatExtension = vscode.extensions.getExtension('GitHub.copilot-chat');
465-
466-
const copilotActive = copilotExtension?.isActive;
467-
const chatActive = copilotChatExtension?.isActive;
468-
469-
if (copilotActive && chatActive) {
470-
this.log('✅ Copilot extensions are now active');
471-
} else {
472-
this.warn('⚠️ Some Copilot extensions still inactive after delay');
473-
}
424+
} catch (error) {
425+
this.error('Error in initial update:', error);
426+
}
427+
}, 100);
474428
}
475429

476430
/**
@@ -6604,10 +6558,6 @@ ${hashtag}`;
66046558
if (this.updateInterval) {
66056559
clearInterval(this.updateInterval);
66066560
}
6607-
if (this.initialDelayTimeout) {
6608-
clearTimeout(this.initialDelayTimeout);
6609-
this.log("Cleared initial delay timeout during disposal");
6610-
}
66116561
if (this.detailsPanel) {
66126562
this.detailsPanel.dispose();
66136563
}

0 commit comments

Comments
 (0)