Skip to content

Commit 134cf5e

Browse files
authored
Merge pull request #162 from Magyarimiki/feature/fix-did-change-active-editor
Prevent handling onDidChangeActiveTextEditor twice
2 parents b4c595c + 2796e32 commit 134cf5e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/sidebar/views/reports.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,14 @@ export class ReportsView implements TreeDataProvider<ReportTreeItem> {
9393

9494
constructor(ctx: ExtensionContext) {
9595
ctx.subscriptions.push(this._onDidChangeTreeData = new EventEmitter());
96-
window.onDidChangeActiveTextEditor(this.refreshBugList, this, ctx.subscriptions);
96+
window.onDidChangeActiveTextEditor(editor => {
97+
// this event is called twice by vscode. Ignore deactivation of the old editor.
98+
if (!editor) {
99+
return;
100+
}
101+
102+
this.refreshBugList();
103+
}, this, ctx.subscriptions);
97104

98105
ExtensionApi.diagnostics.diagnosticsUpdated(() => {
99106
// FIXME: fired twice when a file is opened freshly.

0 commit comments

Comments
 (0)