@@ -25,9 +25,9 @@ import { ViewZoneManager } from 'vs/editor/browser/widget/diffEditorWidget2/line
25
25
import { MovedBlocksLinesPart } from 'vs/editor/browser/widget/diffEditorWidget2/movedBlocksLines' ;
26
26
import { OverviewRulerPart } from 'vs/editor/browser/widget/diffEditorWidget2/overviewRulerPart' ;
27
27
import { 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' ;
29
29
import { 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' ;
31
31
import { IDimension } from 'vs/editor/common/core/dimension' ;
32
32
import { LineRange } from 'vs/editor/common/core/lineRange' ;
33
33
import { Position } from 'vs/editor/common/core/position' ;
@@ -42,6 +42,7 @@ import { DelegatingEditor } from './delegatingEditorImpl';
42
42
import { DiffMapping , DiffModel } from './diffModel' ;
43
43
import { Range } from 'vs/editor/common/core/range' ;
44
44
import { LineRangeMapping } from 'vs/editor/common/diff/linesDiffComputer' ;
45
+ import { deepClone } from 'vs/base/common/objects' ;
45
46
46
47
const diffEditorDefaultOptions : ValidDiffEditorBaseOptions = {
47
48
enableSplitViewResizing : true ,
@@ -82,6 +83,7 @@ export class DiffEditorWidget2 extends DelegatingEditor implements IDiffEditor {
82
83
) ;
83
84
private readonly _rootSizeObserver : ObservableElementSizeObserver ;
84
85
private readonly _options : ISettableObservable < ValidDiffEditorBaseOptions > ;
86
+ private _editorOptions : IEditorOptions ;
85
87
private readonly _sash : IObservable < DiffEditorSash | undefined > ;
86
88
private readonly _boundarySashes = observableValue < IBoundarySashes | undefined > ( 'boundarySashes' , undefined ) ;
87
89
private readonly _renderOverviewRuler : IObservable < boolean > ;
@@ -105,6 +107,7 @@ export class DiffEditorWidget2 extends DelegatingEditor implements IDiffEditor {
105
107
) ;
106
108
107
109
this . _options = observableValue < ValidDiffEditorBaseOptions > ( 'options' , validateDiffEditorOptions ( options || { } , diffEditorDefaultOptions ) ) ;
110
+ this . _editorOptions = deepClone ( options ) ;
108
111
109
112
this . _domElement . appendChild ( this . elements . root ) ;
110
113
@@ -431,6 +434,12 @@ export class DiffEditorWidget2 extends DelegatingEditor implements IDiffEditor {
431
434
// Clone minimap options before changing them
432
435
clonedOptions . minimap = { ...( clonedOptions . minimap || { } ) } ;
433
436
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
+ }
434
443
return clonedOptions ;
435
444
}
436
445
@@ -510,6 +519,7 @@ export class DiffEditorWidget2 extends DelegatingEditor implements IDiffEditor {
510
519
override updateOptions ( _newOptions : IDiffEditorOptions ) : void {
511
520
const newOptions = validateDiffEditorOptions ( _newOptions , this . _options . get ( ) ) ;
512
521
this . _options . set ( newOptions , undefined ) ;
522
+ deepMerge ( this . _editorOptions , deepClone ( _newOptions ) ) ;
513
523
514
524
this . _modifiedEditor . updateOptions ( this . _adjustOptionsForRightHandSide ( _newOptions ) ) ;
515
525
this . _originalEditor . updateOptions ( this . _adjustOptionsForLeftHandSide ( _newOptions ) ) ;
0 commit comments