Skip to content

Commit 1d15721

Browse files
committed
Listen for Notebook change events
1 parent 9444abd commit 1d15721

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/wakatime.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,9 @@ export class WakaTime {
417417
vscode.window.onDidChangeActiveTextEditor(this.onChangeTab, this, subscriptions);
418418
vscode.workspace.onDidSaveTextDocument(this.onSave, this, subscriptions);
419419

420+
vscode.workspace.onDidChangeNotebookDocument(this.onChangeNotebook, this, subscriptions);
421+
vscode.workspace.onDidSaveNotebookDocument(this.onSaveNotebook, this, subscriptions);
422+
420423
vscode.tasks.onDidStartTask(this.onDidStartTask, this, subscriptions);
421424
vscode.tasks.onDidEndTask(this.onDidEndTask, this, subscriptions);
422425

@@ -468,6 +471,14 @@ export class WakaTime {
468471
this.onEvent(true);
469472
}
470473

474+
private onChangeNotebook(_e: vscode.NotebookDocumentChangeEvent): void {
475+
this.onEvent(false);
476+
}
477+
478+
private onSaveNotebook(_e: vscode.NotebookDocument | undefined): void {
479+
this.onEvent(true);
480+
}
481+
471482
private onEvent(isWrite: boolean): void {
472483
clearTimeout(this.debounceTimeoutId);
473484
this.debounceTimeoutId = setTimeout(() => {

0 commit comments

Comments
 (0)