Skip to content

Commit 8aa9dd2

Browse files
committed
Improve claude sidebar detection
1 parent af13598 commit 8aa9dd2

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/utils.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,19 @@ export class Utils {
138138
}
139139

140140
public static isAIChatSidebar(uri: vscode.Uri | undefined): boolean {
141+
// first check if the active tab is the Claude Code sidebar
142+
const activeTab = vscode.window.tabGroups?.activeTabGroup?.activeTab;
143+
const viewType = (activeTab?.input as { viewType?: string } | undefined)?.viewType;
144+
if (viewType?.includes('claude') && activeTab?.label.toLowerCase().includes('claude')) {
145+
return true;
146+
}
147+
148+
// second, check if the active uri has an AI sidebar scheme
141149
if (!uri) return false;
142150
if (uri.fsPath.endsWith('.log')) return false;
143-
return uri.scheme === 'vscode-chat-code-block';
151+
if (uri.scheme === 'vscode-chat-code-block') return true;
152+
if (uri.scheme === 'openai-codex') return true;
153+
return false;
144154
}
145155

146156
public static isPossibleAICodeInsert(e: vscode.TextDocumentChangeEvent): boolean {
@@ -202,6 +212,7 @@ export class Utils {
202212
'github.copilot',
203213
'ms-vscode.vscode-ai-toolkit',
204214
'openai.openai-gpt-vscode',
215+
'openai.chatgpt',
205216
'sourcegraph.cody-ai',
206217
'supermaven.supermaven',
207218
'tabnine.tabnine-vscode',

src/wakatime.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,7 @@ export class WakaTime {
431431
vscode.window.onDidChangeTextEditorSelection(this.onChangeSelection, this, subscriptions);
432432
vscode.workspace.onDidChangeTextDocument(this.onChangeTextDocument, this, subscriptions);
433433
vscode.window.onDidChangeActiveTextEditor(this.onChangeTab, this, subscriptions);
434+
vscode.window.tabGroups.onDidChangeTabs(this.onDidChangeTabs, this, subscriptions);
434435
vscode.workspace.onDidSaveTextDocument(this.onSave, this, subscriptions);
435436

436437
vscode.workspace.onDidChangeNotebookDocument(this.onChangeNotebook, this, subscriptions);
@@ -529,6 +530,11 @@ export class WakaTime {
529530
this.onEvent(false);
530531
}
531532

533+
private onDidChangeTabs(): void {
534+
this.updateLineNumbers();
535+
this.onEvent(false);
536+
}
537+
532538
private onSave(_e: vscode.TextDocument | undefined): void {
533539
this.isAICodeGenerating = false;
534540
this.updateLineNumbers();

0 commit comments

Comments
 (0)