@@ -25,9 +25,9 @@ import { ViewZoneManager } from 'vs/editor/browser/widget/diffEditorWidget2/line
2525import { MovedBlocksLinesPart } from 'vs/editor/browser/widget/diffEditorWidget2/movedBlocksLines' ;
2626import { OverviewRulerPart } from 'vs/editor/browser/widget/diffEditorWidget2/overviewRulerPart' ;
2727import { UnchangedRangesFeature } from 'vs/editor/browser/widget/diffEditorWidget2/unchangedRanges' ;
28- import { ObservableElementSizeObserver , applyObservableDecorations } from 'vs/editor/browser/widget/diffEditorWidget2/utils' ;
28+ import { ObservableElementSizeObserver , applyObservableDecorations , deepMerge } from 'vs/editor/browser/widget/diffEditorWidget2/utils' ;
2929import { WorkerBasedDocumentDiffProvider } from 'vs/editor/browser/widget/workerBasedDocumentDiffProvider' ;
30- import { EditorOptions , IDiffEditorOptions , ValidDiffEditorBaseOptions , clampedFloat , clampedInt , boolean as validateBooleanOption , stringSet as validateStringSetOption } from 'vs/editor/common/config/editorOptions' ;
30+ import { EditorOptions , IDiffEditorOptions , IEditorOptions , ValidDiffEditorBaseOptions , clampedFloat , clampedInt , boolean as validateBooleanOption , stringSet as validateStringSetOption } from 'vs/editor/common/config/editorOptions' ;
3131import { IDimension } from 'vs/editor/common/core/dimension' ;
3232import { LineRange } from 'vs/editor/common/core/lineRange' ;
3333import { Position } from 'vs/editor/common/core/position' ;
@@ -42,6 +42,7 @@ import { DelegatingEditor } from './delegatingEditorImpl';
4242import { DiffMapping , DiffModel } from './diffModel' ;
4343import { Range } from 'vs/editor/common/core/range' ;
4444import { LineRangeMapping } from 'vs/editor/common/diff/linesDiffComputer' ;
45+ import { deepClone } from 'vs/base/common/objects' ;
4546
4647const diffEditorDefaultOptions : ValidDiffEditorBaseOptions = {
4748 enableSplitViewResizing : true ,
@@ -82,6 +83,7 @@ export class DiffEditorWidget2 extends DelegatingEditor implements IDiffEditor {
8283 ) ;
8384 private readonly _rootSizeObserver : ObservableElementSizeObserver ;
8485 private readonly _options : ISettableObservable < ValidDiffEditorBaseOptions > ;
86+ private _editorOptions : IEditorOptions ;
8587 private readonly _sash : IObservable < DiffEditorSash | undefined > ;
8688 private readonly _boundarySashes = observableValue < IBoundarySashes | undefined > ( 'boundarySashes' , undefined ) ;
8789 private readonly _renderOverviewRuler : IObservable < boolean > ;
@@ -105,6 +107,7 @@ export class DiffEditorWidget2 extends DelegatingEditor implements IDiffEditor {
105107 ) ;
106108
107109 this . _options = observableValue < ValidDiffEditorBaseOptions > ( 'options' , validateDiffEditorOptions ( options || { } , diffEditorDefaultOptions ) ) ;
110+ this . _editorOptions = deepClone ( options ) ;
108111
109112 this . _domElement . appendChild ( this . elements . root ) ;
110113
@@ -431,6 +434,12 @@ export class DiffEditorWidget2 extends DelegatingEditor implements IDiffEditor {
431434 // Clone minimap options before changing them
432435 clonedOptions . minimap = { ...( clonedOptions . minimap || { } ) } ;
433436 clonedOptions . minimap . enabled = false ;
437+
438+ if ( this . _options . get ( ) . experimental ?. collapseUnchangedRegions ) {
439+ clonedOptions . stickyScroll = { enabled : false } ;
440+ } else {
441+ clonedOptions . stickyScroll = this . _editorOptions . stickyScroll ;
442+ }
434443 return clonedOptions ;
435444 }
436445
@@ -510,6 +519,7 @@ export class DiffEditorWidget2 extends DelegatingEditor implements IDiffEditor {
510519 override updateOptions ( _newOptions : IDiffEditorOptions ) : void {
511520 const newOptions = validateDiffEditorOptions ( _newOptions , this . _options . get ( ) ) ;
512521 this . _options . set ( newOptions , undefined ) ;
522+ deepMerge ( this . _editorOptions , deepClone ( _newOptions ) ) ;
513523
514524 this . _modifiedEditor . updateOptions ( this . _adjustOptionsForRightHandSide ( _newOptions ) ) ;
515525 this . _originalEditor . updateOptions ( this . _adjustOptionsForLeftHandSide ( _newOptions ) ) ;
0 commit comments