Skip to content

Commit debb347

Browse files
authored
Trigger change event onces in outline provider (microsoft#210576)
1 parent ad220f4 commit debb347

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineProvider.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,13 @@ export class NotebookCellOutlineProvider {
253253
}
254254
}));
255255

256-
this._recomputeActive();
257-
this._onDidChange.fire({});
256+
const { changeEventTriggered } = this._recomputeActive();
257+
if (!changeEventTriggered) {
258+
this._onDidChange.fire({});
259+
}
258260
}
259261

260-
private _recomputeActive(): void {
262+
private _recomputeActive(): { changeEventTriggered: boolean } {
261263
let newActive: OutlineEntry | undefined;
262264
const notebookEditorWidget = this._editor;
263265

@@ -291,7 +293,10 @@ export class NotebookCellOutlineProvider {
291293
) {
292294
this._activeEntry = newActive;
293295
this._onDidChange.fire({ affectOnlyActiveElement: true });
296+
return { changeEventTriggered: true };
294297
}
298+
299+
return { changeEventTriggered: false };
295300
}
296301

297302
get isEmpty(): boolean {

0 commit comments

Comments
 (0)