@@ -11,7 +11,7 @@ import { IThemeService, ThemeIcon } from 'vs/platform/theme/common/themeService'
11
11
import { CellRevealType , IActiveNotebookEditor , ICellViewModel , INotebookEditorOptions , INotebookViewCellsUpdateEvent } from 'vs/workbench/contrib/notebook/browser/notebookBrowser' ;
12
12
import { NotebookEditor } from 'vs/workbench/contrib/notebook/browser/notebookEditor' ;
13
13
import { CellKind } from 'vs/workbench/contrib/notebook/common/notebookCommon' ;
14
- import { IOutline , IOutlineComparator , IOutlineCreator , IOutlineListConfig , IOutlineService , IQuickPickDataSource , IQuickPickOutlineElement , OutlineChangeEvent , OutlineConfigKeys , OutlineTarget } from 'vs/workbench/services/outline/browser/outline' ;
14
+ import { IOutline , IOutlineComparator , IOutlineCreator , IOutlineListConfig , IOutlineService , IQuickPickDataSource , IQuickPickOutlineElement , OutlineChangeEvent , OutlineConfigCollapseItemsValues , OutlineConfigKeys , OutlineTarget } from 'vs/workbench/services/outline/browser/outline' ;
15
15
import { IWorkbenchContributionsRegistry , Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions' ;
16
16
import { Registry } from 'vs/platform/registry/common/platform' ;
17
17
import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle' ;
@@ -285,16 +285,18 @@ class NotebookComparator implements IOutlineComparator<OutlineEntry> {
285
285
}
286
286
}
287
287
288
- export class NotebookCellOutline extends Disposable implements IOutline < OutlineEntry > {
288
+ export class NotebookCellOutline implements IOutline < OutlineEntry > {
289
289
290
- private readonly _onDidChange = this . _register ( new Emitter < OutlineChangeEvent > ( ) ) ;
290
+ private readonly _dispoables = new DisposableStore ( ) ;
291
+
292
+ private readonly _onDidChange = new Emitter < OutlineChangeEvent > ( ) ;
291
293
292
294
readonly onDidChange : Event < OutlineChangeEvent > = this . _onDidChange . event ;
293
295
294
296
private _uri : URI | undefined ;
295
297
private _entries : OutlineEntry [ ] = [ ] ;
296
298
private _activeEntry ?: OutlineEntry ;
297
- private readonly _entriesDisposables = this . _register ( new DisposableStore ( ) ) ;
299
+ private readonly _entriesDisposables = new DisposableStore ( ) ;
298
300
299
301
readonly config : IOutlineListConfig < OutlineEntry > ;
300
302
readonly outlineKind = 'notebookCells' ;
@@ -313,8 +315,8 @@ export class NotebookCellOutline extends Disposable implements IOutline<OutlineE
313
315
@IConfigurationService private readonly _configurationService : IConfigurationService ,
314
316
@INotebookExecutionStateService private readonly _notebookExecutionStateService : INotebookExecutionStateService ,
315
317
) {
316
- super ( ) ;
317
- const selectionListener = this . _register ( new MutableDisposable ( ) ) ;
318
+ const selectionListener = new MutableDisposable ( ) ;
319
+ this . _dispoables . add ( selectionListener ) ;
318
320
const installSelectionListener = ( ) => {
319
321
const notebookEditor = _editor . getControl ( ) ;
320
322
if ( ! notebookEditor ?. hasModel ( ) ) {
@@ -335,22 +337,22 @@ export class NotebookCellOutline extends Disposable implements IOutline<OutlineE
335
337
}
336
338
} ;
337
339
338
- this . _register ( _editor . onDidChangeModel ( ( ) => {
340
+ this . _dispoables . add ( _editor . onDidChangeModel ( ( ) => {
339
341
this . _recomputeState ( ) ;
340
342
installSelectionListener ( ) ;
341
343
} ) ) ;
342
344
343
- this . _register ( _configurationService . onDidChangeConfiguration ( e => {
345
+ this . _dispoables . add ( _configurationService . onDidChangeConfiguration ( e => {
344
346
if ( e . affectsConfiguration ( 'notebook.outline.showCodeCells' ) ) {
345
347
this . _recomputeState ( ) ;
346
348
}
347
349
} ) ) ;
348
350
349
- this . _register ( themeService . onDidFileIconThemeChange ( ( ) => {
351
+ this . _dispoables . add ( themeService . onDidFileIconThemeChange ( ( ) => {
350
352
this . _onDidChange . fire ( { } ) ;
351
353
} ) ) ;
352
354
353
- this . _register ( _notebookExecutionStateService . onDidChangeCellExecution ( e => {
355
+ this . _dispoables . add ( _notebookExecutionStateService . onDidChangeCellExecution ( e => {
354
356
if ( ! ! this . _editor . textModel && e . affectsNotebook ( this . _editor . textModel ?. uri ) ) {
355
357
this . _recomputeState ( ) ;
356
358
}
@@ -360,7 +362,7 @@ export class NotebookCellOutline extends Disposable implements IOutline<OutlineE
360
362
installSelectionListener ( ) ;
361
363
362
364
const options : IWorkbenchDataTreeOptions < OutlineEntry , FuzzyScore > = {
363
- collapseByDefault : _target === OutlineTarget . Breadcrumbs ,
365
+ collapseByDefault : _target === OutlineTarget . Breadcrumbs || ( _target === OutlineTarget . OutlinePane && _configurationService . getValue ( OutlineConfigKeys . collapseItems ) === OutlineConfigCollapseItemsValues . Collapsed ) ,
364
366
expandOnlyOnTwistieClick : true ,
365
367
multipleSelectionSupport : false ,
366
368
accessibilityProvider : new NotebookOutlineAccessibility ( ) ,
@@ -394,6 +396,12 @@ export class NotebookCellOutline extends Disposable implements IOutline<OutlineE
394
396
} ;
395
397
}
396
398
399
+ dispose ( ) : void {
400
+ this . _onDidChange . dispose ( ) ;
401
+ this . _dispoables . dispose ( ) ;
402
+ this . _entriesDisposables . dispose ( ) ;
403
+ }
404
+
397
405
private _recomputeState ( ) : void {
398
406
this . _entriesDisposables . clear ( ) ;
399
407
this . _activeEntry = undefined ;
0 commit comments