@@ -42,6 +42,7 @@ export class NotebookCellOutlineProvider {
42
42
}
43
43
44
44
private readonly _outlineEntryFactory : NotebookOutlineEntryFactory ;
45
+ private readonly delayRecomputeActive : ( ) => void ;
45
46
constructor (
46
47
private readonly _editor : INotebookEditor ,
47
48
private readonly _target : OutlineTarget ,
@@ -52,20 +53,27 @@ export class NotebookCellOutlineProvider {
52
53
@IConfigurationService private readonly _configurationService : IConfigurationService ,
53
54
) {
54
55
this . _outlineEntryFactory = new NotebookOutlineEntryFactory ( notebookExecutionStateService ) ;
56
+ const delayerRecomputeActive = this . _disposables . add ( new Delayer ( 10 ) ) ;
57
+ this . delayRecomputeActive = ( ) => delayerRecomputeActive . trigger ( ( ) => {
58
+ const { changeEventTriggered } = this . _recomputeActive ( ) ;
59
+ if ( ! changeEventTriggered ) {
60
+ this . _onDidChange . fire ( { } ) ;
61
+ }
62
+ } ) ;
55
63
56
64
this . _disposables . add ( Event . debounce < void , void > (
57
65
_editor . onDidChangeSelection ,
58
66
( last , _current ) => last ,
59
67
200
60
68
) ( ( ) => {
61
- this . _recomputeActive ( ) ;
69
+ this . delayRecomputeActive ( ) ;
62
70
} , this ) )
63
71
this . _disposables . add ( Event . debounce < INotebookViewCellsUpdateEvent , INotebookViewCellsUpdateEvent > (
64
72
_editor . onDidChangeViewCells ,
65
73
( last , _current ) => last ?? _current ,
66
74
200
67
75
) ( ( ) => {
68
- this . _recomputeActive ( ) ;
76
+ this . delayRecomputeActive ( ) ;
69
77
} , this )
70
78
) ;
71
79
@@ -253,10 +261,7 @@ export class NotebookCellOutlineProvider {
253
261
}
254
262
} ) ) ;
255
263
256
- const { changeEventTriggered } = this . _recomputeActive ( ) ;
257
- if ( ! changeEventTriggered ) {
258
- this . _onDidChange . fire ( { } ) ;
259
- }
264
+ this . delayRecomputeActive ( ) ;
260
265
}
261
266
262
267
private _recomputeActive ( ) : { changeEventTriggered : boolean } {
0 commit comments