Skip to content

Commit bcb20dc

Browse files
committed
Revert "Use Disposable in a few more places"
This partially reverts commit de9cc71. fyi @mjbvz please don't rearrange furniture
1 parent c3eebae commit bcb20dc

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.ts

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -285,16 +285,18 @@ class NotebookComparator implements IOutlineComparator<OutlineEntry> {
285285
}
286286
}
287287

288-
export class NotebookCellOutline extends Disposable implements IOutline<OutlineEntry> {
288+
export class NotebookCellOutline implements IOutline<OutlineEntry> {
289289

290-
private readonly _onDidChange = this._register(new Emitter<OutlineChangeEvent>());
290+
private readonly _dispoables = new DisposableStore();
291+
292+
private readonly _onDidChange = new Emitter<OutlineChangeEvent>();
291293

292294
readonly onDidChange: Event<OutlineChangeEvent> = this._onDidChange.event;
293295

294296
private _uri: URI | undefined;
295297
private _entries: OutlineEntry[] = [];
296298
private _activeEntry?: OutlineEntry;
297-
private readonly _entriesDisposables = this._register(new DisposableStore());
299+
private readonly _entriesDisposables = new DisposableStore();
298300

299301
readonly config: IOutlineListConfig<OutlineEntry>;
300302
readonly outlineKind = 'notebookCells';
@@ -313,8 +315,8 @@ export class NotebookCellOutline extends Disposable implements IOutline<OutlineE
313315
@IConfigurationService private readonly _configurationService: IConfigurationService,
314316
@INotebookExecutionStateService private readonly _notebookExecutionStateService: INotebookExecutionStateService,
315317
) {
316-
super();
317-
const selectionListener = this._register(new MutableDisposable());
318+
const selectionListener = new MutableDisposable();
319+
this._dispoables.add(selectionListener);
318320
const installSelectionListener = () => {
319321
const notebookEditor = _editor.getControl();
320322
if (!notebookEditor?.hasModel()) {
@@ -335,22 +337,22 @@ export class NotebookCellOutline extends Disposable implements IOutline<OutlineE
335337
}
336338
};
337339

338-
this._register(_editor.onDidChangeModel(() => {
340+
this._dispoables.add(_editor.onDidChangeModel(() => {
339341
this._recomputeState();
340342
installSelectionListener();
341343
}));
342344

343-
this._register(_configurationService.onDidChangeConfiguration(e => {
345+
this._dispoables.add(_configurationService.onDidChangeConfiguration(e => {
344346
if (e.affectsConfiguration('notebook.outline.showCodeCells')) {
345347
this._recomputeState();
346348
}
347349
}));
348350

349-
this._register(themeService.onDidFileIconThemeChange(() => {
351+
this._dispoables.add(themeService.onDidFileIconThemeChange(() => {
350352
this._onDidChange.fire({});
351353
}));
352354

353-
this._register(_notebookExecutionStateService.onDidChangeCellExecution(e => {
355+
this._dispoables.add(_notebookExecutionStateService.onDidChangeCellExecution(e => {
354356
if (!!this._editor.textModel && e.affectsNotebook(this._editor.textModel?.uri)) {
355357
this._recomputeState();
356358
}
@@ -394,6 +396,12 @@ export class NotebookCellOutline extends Disposable implements IOutline<OutlineE
394396
};
395397
}
396398

399+
dispose(): void {
400+
this._onDidChange.dispose();
401+
this._dispoables.dispose();
402+
this._entriesDisposables.dispose();
403+
}
404+
397405
private _recomputeState(): void {
398406
this._entriesDisposables.clear();
399407
this._activeEntry = undefined;

0 commit comments

Comments
 (0)