5
5
6
6
import { $ } from 'vs/base/browser/dom' ;
7
7
import { ArrayQueue } from 'vs/base/common/arrays' ;
8
+ import { RunOnceScheduler } from 'vs/base/common/async' ;
8
9
import { Codicon } from 'vs/base/common/codicons' ;
9
10
import { Disposable , DisposableStore } from 'vs/base/common/lifecycle' ;
10
- import { IObservable , derived , observableFromEvent , observableSignalFromEvent , observableValue } from 'vs/base/common/observable' ;
11
+ import { IObservable , derived , observableFromEvent , observableValue } from 'vs/base/common/observable' ;
11
12
import { autorun , autorunWithStore2 } from 'vs/base/common/observableImpl/autorun' ;
12
13
import { ThemeIcon } from 'vs/base/common/themables' ;
13
14
import { assertIsDefined } from 'vs/base/common/types' ;
@@ -61,15 +62,16 @@ export class ViewZoneManager extends Disposable {
61
62
super ( ) ;
62
63
63
64
let isChangingViewZones = false ;
65
+ const state = observableValue ( 'state' , 0 ) ;
64
66
65
- const originalViewZonesChanged = observableSignalFromEvent (
66
- 'origViewZonesChanged' ,
67
- e => this . _editors . original . onDidChangeViewZones ( ( args ) => { if ( ! isChangingViewZones && ! this . _canIgnoreViewZoneUpdateEvent ( ) ) { e ( args ) ; } } )
68
- ) ;
69
- const modifiedViewZonesChanged = observableSignalFromEvent (
70
- 'modViewZonesChanged' ,
71
- e => this . _editors . modified . onDidChangeViewZones ( ( args ) => { if ( ! isChangingViewZones && ! this . _canIgnoreViewZoneUpdateEvent ( ) ) { e ( args ) ; } } )
72
- ) ;
67
+ const updateImmediately = this . _register ( new RunOnceScheduler ( ( ) => {
68
+ state . set ( state . get ( ) + 1 , undefined ) ;
69
+ } , 0 ) ) ;
70
+
71
+ this . _register ( this . _editors . original . onDidChangeViewZones ( ( args ) => { if ( ! isChangingViewZones && ! this . _canIgnoreViewZoneUpdateEvent ( ) ) { updateImmediately . schedule ( ) ; } } ) ) ;
72
+ this . _register ( this . _editors . modified . onDidChangeViewZones ( ( args ) => { if ( ! isChangingViewZones && ! this . _canIgnoreViewZoneUpdateEvent ( ) ) { updateImmediately . schedule ( ) ; } } ) ) ;
73
+ this . _register ( this . _editors . original . onDidChangeConfiguration ( ( args ) => { if ( args . hasChanged ( EditorOption . wrappingInfo ) ) { updateImmediately . schedule ( ) ; } } ) ) ;
74
+ this . _register ( this . _editors . modified . onDidChangeConfiguration ( ( args ) => { if ( args . hasChanged ( EditorOption . wrappingInfo ) ) { updateImmediately . schedule ( ) ; } } ) ) ;
73
75
74
76
const originalModelTokenizationCompleted = this . _diffModel . map ( m =>
75
77
m ? observableFromEvent ( m . model . original . onDidChangeTokens , ( ) => m . model . original . tokenization . backgroundTokenizationState === BackgroundTokenizationState . Completed ) : undefined
@@ -82,16 +84,14 @@ export class ViewZoneManager extends Disposable {
82
84
const diffModel = this . _diffModel . read ( reader ) ;
83
85
const diff = diffModel ?. diff . read ( reader ) ;
84
86
if ( ! diffModel || ! diff ) { return null ; }
85
- originalViewZonesChanged . read ( reader ) ;
86
- modifiedViewZonesChanged . read ( reader ) ;
87
+ state . read ( reader ) ;
87
88
return computeRangeAlignment ( this . _editors . original , this . _editors . modified , diff . mappings , alignmentViewZoneIdsOrig , alignmentViewZoneIdsMod ) ;
88
89
} ) ;
89
90
90
91
const alignmentsSyncedMovedText = derived < ILineRangeAlignment [ ] | null > ( 'alignments' , ( reader ) => {
91
92
const syncedMovedText = this . _diffModel . read ( reader ) ?. syncedMovedTexts . read ( reader ) ;
92
93
if ( ! syncedMovedText ) { return null ; }
93
- originalViewZonesChanged . read ( reader ) ;
94
- modifiedViewZonesChanged . read ( reader ) ;
94
+ state . read ( reader ) ;
95
95
const mappings = syncedMovedText . changes . map ( c => new DiffMapping ( c ) ) ;
96
96
// TODO dont include alignments outside syncedMovedText
97
97
return computeRangeAlignment ( this . _editors . original , this . _editors . modified , mappings , alignmentViewZoneIdsOrig , alignmentViewZoneIdsMod ) ;
0 commit comments