@@ -10,6 +10,7 @@ import { Event } from '../../../../../base/common/event.js';
1010import { Iterable } from '../../../../../base/common/iterator.js' ;
1111import { Lazy } from '../../../../../base/common/lazy.js' ;
1212import { Disposable , DisposableStore , IDisposable , IReference , MutableDisposable , combinedDisposable , toDisposable } from '../../../../../base/common/lifecycle.js' ;
13+ import { ScrollEvent } from '../../../../../base/common/scrollable.js' ;
1314import { URI } from '../../../../../base/common/uri.js' ;
1415import { ICodeEditor , IDiffEditorConstructionOptions } from '../../../../../editor/browser/editorBrowser.js' ;
1516import { CodeEditorWidget } from '../../../../../editor/browser/widget/codeEditor/codeEditorWidget.js' ;
@@ -18,30 +19,31 @@ import { DiffEditorWidget } from '../../../../../editor/browser/widget/diffEdito
1819import { EmbeddedDiffEditorWidget } from '../../../../../editor/browser/widget/diffEditor/embeddedDiffEditorWidget.js' ;
1920import { MarkdownRenderer } from '../../../../../editor/browser/widget/markdownRenderer/browser/markdownRenderer.js' ;
2021import { IDiffEditorOptions , IEditorOptions } from '../../../../../editor/common/config/editorOptions.js' ;
22+ import { ITextModel } from '../../../../../editor/common/model.js' ;
2123import { IResolvedTextEditorModel , ITextModelService } from '../../../../../editor/common/services/resolverService.js' ;
2224import { peekViewResultsBackground } from '../../../../../editor/contrib/peekView/browser/peekView.js' ;
2325import { localize } from '../../../../../nls.js' ;
26+ import { IConfigurationService } from '../../../../../platform/configuration/common/configuration.js' ;
2427import { IInstantiationService } from '../../../../../platform/instantiation/common/instantiation.js' ;
2528import { TerminalCapability } from '../../../../../platform/terminal/common/capabilities/capabilities.js' ;
2629import { TerminalCapabilityStore } from '../../../../../platform/terminal/common/capabilities/terminalCapabilityStore.js' ;
2730import { formatMessageForTerminal } from '../../../../../platform/terminal/common/terminalStrings.js' ;
2831import { IWorkspaceContextService } from '../../../../../platform/workspace/common/workspace.js' ;
32+ import { IEditorConfiguration } from '../../../../browser/parts/editor/textEditor.js' ;
2933import { EditorModel } from '../../../../common/editor/editorModel.js' ;
3034import { PANEL_BACKGROUND , SIDE_BAR_BACKGROUND } from '../../../../common/theme.js' ;
3135import { IViewDescriptorService , ViewContainerLocation } from '../../../../common/views.js' ;
36+ import { CALL_STACK_WIDGET_HEADER_HEIGHT } from '../../../debug/browser/callStackWidget.js' ;
3237import { DetachedProcessInfo } from '../../../terminal/browser/detachedTerminal.js' ;
3338import { IDetachedTerminalInstance , ITerminalService } from '../../../terminal/browser/terminal.js' ;
3439import { getXtermScaledDimensions } from '../../../terminal/browser/xterm/xtermTerminal.js' ;
3540import { TERMINAL_BACKGROUND_COLOR } from '../../../terminal/common/terminalColorRegistry.js' ;
36- import { colorizeTestMessageInEditor } from '../testMessageColorizer.js' ;
37- import { InspectSubject , MessageSubject , TaskSubject , TestOutputSubject } from './testResultsSubject.js' ;
3841import { Testing } from '../../common/constants.js' ;
3942import { MutableObservableValue } from '../../common/observableValue.js' ;
4043import { ITaskRawOutput , ITestResult , ITestRunTaskResults , LiveTestResult , TestResultItemChangeReason } from '../../common/testResult.js' ;
4144import { ITestMessage , TestMessageType , getMarkId } from '../../common/testTypes.js' ;
42- import { ScrollEvent } from '../../../../../base/common/scrollable.js' ;
43- import { CALL_STACK_WIDGET_HEADER_HEIGHT } from '../../../debug/browser/callStackWidget.js' ;
44- import { ITextModel } from '../../../../../editor/common/model.js' ;
45+ import { colorizeTestMessageInEditor } from '../testMessageColorizer.js' ;
46+ import { InspectSubject , MessageSubject , TaskSubject , TestOutputSubject } from './testResultsSubject.js' ;
4547
4648
4749class SimpleDiffEditorModel extends EditorModel {
@@ -110,6 +112,35 @@ const diffEditorOptions: IDiffEditorConstructionOptions = {
110112 diffAlgorithm : 'advanced' ,
111113} ;
112114
115+ function applyEditorMirrorOptions < T extends IEditorOptions > ( base : T , cfg : IConfigurationService , update : ( options : Partial < IEditorOptions > ) => void ) {
116+ const immutable = new Set ( Object . keys ( base ) ) ;
117+ function applyCurrent ( ) {
118+ const configuration = cfg . getValue < IEditorConfiguration > ( 'editor' ) ;
119+
120+ let changed = false ;
121+ const patch : Partial < IEditorOptions > = { } ;
122+ for ( const [ key , value ] of Object . entries ( configuration ) ) {
123+ if ( ! immutable . has ( key ) && ( base as any ) [ key ] !== value ) {
124+ ( patch as any ) [ key ] = value ;
125+ changed = true ;
126+ }
127+ }
128+
129+ return changed ? patch : undefined ;
130+ }
131+
132+ Object . assign ( base , applyCurrent ( ) ) ;
133+
134+ return cfg . onDidChangeConfiguration ( e => {
135+ if ( e . affectsConfiguration ( 'editor' ) ) {
136+ const patch = applyCurrent ( ) ;
137+ if ( patch ) {
138+ update ( patch ) ;
139+ Object . assign ( base , patch ) ;
140+ }
141+ }
142+ } ) ;
143+ }
113144
114145export class DiffContentProvider extends Disposable implements IPeekOutputRenderer {
115146 private readonly widget = this . _register ( new MutableDisposable < DiffEditorWidget > ( ) ) ;
@@ -126,6 +157,7 @@ export class DiffContentProvider extends Disposable implements IPeekOutputRender
126157 private readonly container : HTMLElement ,
127158 @IInstantiationService private readonly instantiationService : IInstantiationService ,
128159 @ITextModelService private readonly modelService : ITextModelService ,
160+ @IConfigurationService private readonly configurationService : IConfigurationService ,
129161 ) {
130162 super ( ) ;
131163 }
@@ -148,21 +180,32 @@ export class DiffContentProvider extends Disposable implements IPeekOutputRender
148180
149181 const model = this . model . value = new SimpleDiffEditorModel ( original , modified ) ;
150182 if ( ! this . widget . value ) {
151- this . widget . value = this . editor ? this . instantiationService . createInstance (
183+ const options = { ...diffEditorOptions } ;
184+ const listener = applyEditorMirrorOptions (
185+ options ,
186+ this . configurationService ,
187+ u => editor . updateOptions ( u )
188+ ) ;
189+
190+ const editor = this . widget . value = this . editor ? this . instantiationService . createInstance (
152191 EmbeddedDiffEditorWidget ,
153192 this . container ,
154- diffEditorOptions ,
193+ options ,
155194 { } ,
156195 this . editor ,
157196 ) : this . instantiationService . createInstance (
158197 DiffEditorWidget ,
159198 this . container ,
160- diffEditorOptions ,
199+ options ,
161200 { } ,
162201 ) ;
163202
203+ Event . once ( editor . onDidDispose ) ( ( ) => {
204+ listener . dispose ( ) ;
205+ } ) ;
206+
164207 if ( this . dimension ) {
165- this . widget . value . layout ( this . dimension ) ;
208+ editor . layout ( this . dimension ) ;
166209 }
167210 }
168211
@@ -191,6 +234,7 @@ export class DiffContentProvider extends Disposable implements IPeekOutputRender
191234 editor . getOriginalEditor ( ) . getContentHeight ( ) ,
192235 editor . getModifiedEditor ( ) . getContentHeight ( )
193236 ) ;
237+ editor . updateOptions ( { scrollbar : { ...commonEditorOptions . scrollbar , handleMouseWheel : ! hasMultipleFrames } } ) ;
194238 this . helper = new ScrollHelper ( hasMultipleFrames , height , dimensions . height ) ;
195239 return height ;
196240 }
@@ -293,6 +337,7 @@ export class PlainTextMessagePeek extends Disposable implements IPeekOutputRende
293337 private readonly container : HTMLElement ,
294338 @IInstantiationService private readonly instantiationService : IInstantiationService ,
295339 @ITextModelService private readonly modelService : ITextModelService ,
340+ @IConfigurationService private readonly configurationService : IConfigurationService ,
296341 ) {
297342 super ( ) ;
298343 }
@@ -311,21 +356,32 @@ export class PlainTextMessagePeek extends Disposable implements IPeekOutputRende
311356
312357 const modelRef = this . model . value = await this . modelService . createModelReference ( subject . messageUri ) ;
313358 if ( ! this . widget . value ) {
314- this . widget . value = this . editor ? this . instantiationService . createInstance (
359+ const options = { ...commonEditorOptions } ;
360+ const listener = applyEditorMirrorOptions (
361+ options ,
362+ this . configurationService ,
363+ u => editor . updateOptions ( u )
364+ ) ;
365+
366+ const editor = this . widget . value = this . editor ? this . instantiationService . createInstance (
315367 EmbeddedCodeEditorWidget ,
316368 this . container ,
317- commonEditorOptions ,
369+ options ,
318370 { } ,
319371 this . editor ,
320372 ) : this . instantiationService . createInstance (
321373 CodeEditorWidget ,
322374 this . container ,
323- commonEditorOptions ,
375+ options ,
324376 { isSimpleWidget : true }
325377 ) ;
326378
379+ Event . once ( editor . onDidDispose ) ( ( ) => {
380+ listener . dispose ( ) ;
381+ } ) ;
382+
327383 if ( this . dimension ) {
328- this . widget . value . layout ( this . dimension ) ;
384+ editor . layout ( this . dimension ) ;
329385 }
330386 }
331387
@@ -355,6 +411,8 @@ export class PlainTextMessagePeek extends Disposable implements IPeekOutputRende
355411 editor . layout ( dimensions ) ;
356412 const height = editor . getContentHeight ( ) ;
357413 this . helper = new ScrollHelper ( hasMultipleFrames , height , dimensions . height ) ;
414+ editor . updateOptions ( { scrollbar : { ...commonEditorOptions . scrollbar , handleMouseWheel : ! hasMultipleFrames } } ) ;
415+
358416 return height ;
359417 }
360418}
0 commit comments