@@ -12,6 +12,7 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
12
12
import { SideBySideEditor } from 'vs/workbench/browser/parts/editor/sideBySideEditor' ;
13
13
import { IWorkbenchContribution } from 'vs/workbench/common/contributions' ;
14
14
import { IEditorPane , IEditorPaneScrollPosition , isEditorPaneWithScrolling } from 'vs/workbench/common/editor' ;
15
+ import { ReentrancyBarrier } from 'vs/workbench/contrib/mergeEditor/browser/utils' ;
15
16
import { IEditorService } from 'vs/workbench/services/editor/common/editorService' ;
16
17
import { IStatusbarEntryAccessor , IStatusbarService , StatusbarAlignment } from 'vs/workbench/services/statusbar/browser/statusbar' ;
17
18
@@ -59,6 +60,9 @@ export class SyncScroll extends Disposable implements IWorkbenchContribution {
59
60
this . toggleStatusbarItem ( this . isActive ) ;
60
61
}
61
62
63
+ // makes sure that the onDidEditorPaneScroll is not called multiple times for the same event
64
+ private _reentrancyBarrier = new ReentrancyBarrier ( ) ;
65
+
62
66
private trackVisiblePanes ( ) : void {
63
67
this . paneDisposables . clear ( ) ;
64
68
this . paneInitialScrollTop . clear ( ) ;
@@ -70,7 +74,11 @@ export class SyncScroll extends Disposable implements IWorkbenchContribution {
70
74
}
71
75
72
76
this . paneInitialScrollTop . set ( pane , pane . getScrollPosition ( ) ) ;
73
- this . paneDisposables . add ( pane . onDidChangeScroll ( ( ) => this . onDidEditorPaneScroll ( pane ) ) ) ;
77
+ this . paneDisposables . add ( pane . onDidChangeScroll ( ( ) =>
78
+ this . _reentrancyBarrier . runExclusively ( ( ) => {
79
+ this . onDidEditorPaneScroll ( pane ) ;
80
+ } )
81
+ ) ) ;
74
82
}
75
83
}
76
84
0 commit comments