@@ -206,6 +206,8 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
206206
207207 private _ignoreTrimWhitespace : boolean ;
208208 private _originalIsEditable : boolean ;
209+ private _originalCodeLens : boolean ;
210+ private _modifiedCodeLens : boolean ;
209211
210212 private _renderSideBySide : boolean ;
211213 private _maxComputationTime : number ;
@@ -281,6 +283,16 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
281283 this . _originalIsEditable = Boolean ( options . originalEditable ) ;
282284 }
283285
286+ this . _originalCodeLens = false ;
287+ if ( typeof options . originalCodeLens !== 'undefined' ) {
288+ this . _originalCodeLens = Boolean ( options . originalCodeLens ) ;
289+ }
290+
291+ this . _modifiedCodeLens = false ;
292+ if ( typeof options . modifiedCodeLens !== 'undefined' ) {
293+ this . _modifiedCodeLens = Boolean ( options . modifiedCodeLens ) ;
294+ }
295+
284296 this . _updateDecorationsRunner = this . _register ( new RunOnceScheduler ( ( ) => this . _updateDecorations ( ) , 0 ) ) ;
285297
286298 this . _containerDomElement = document . createElement ( 'div' ) ;
@@ -469,7 +481,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
469481 }
470482
471483 private _createLeftHandSideEditor ( options : IDiffEditorOptions , instantiationService : IInstantiationService ) : CodeEditorWidget {
472- const editor = this . _createInnerEditor ( instantiationService , this . _originalDomNode , this . _adjustOptionsForLeftHandSide ( options , this . _originalIsEditable ) ) ;
484+ const editor = this . _createInnerEditor ( instantiationService , this . _originalDomNode , this . _adjustOptionsForLeftHandSide ( options , this . _originalIsEditable , this . _originalCodeLens ) ) ;
473485
474486 this . _register ( editor . onDidScrollChange ( ( e ) => {
475487 if ( this . _isHandlingScrollEvent ) {
@@ -502,7 +514,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
502514 }
503515
504516 private _createRightHandSideEditor ( options : IDiffEditorOptions , instantiationService : IInstantiationService ) : CodeEditorWidget {
505- const editor = this . _createInnerEditor ( instantiationService , this . _modifiedDomNode , this . _adjustOptionsForRightHandSide ( options ) ) ;
517+ const editor = this . _createInnerEditor ( instantiationService , this . _modifiedDomNode , this . _adjustOptionsForRightHandSide ( options , this . _modifiedCodeLens ) ) ;
506518
507519 this . _register ( editor . onDidScrollChange ( ( e ) => {
508520 if ( this . _isHandlingScrollEvent ) {
@@ -662,9 +674,15 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
662674 if ( typeof newOptions . originalEditable !== 'undefined' ) {
663675 this . _originalIsEditable = Boolean ( newOptions . originalEditable ) ;
664676 }
677+ if ( typeof newOptions . originalCodeLens !== 'undefined' ) {
678+ this . _originalCodeLens = Boolean ( newOptions . originalCodeLens ) ;
679+ }
680+ if ( typeof newOptions . modifiedCodeLens !== 'undefined' ) {
681+ this . _modifiedCodeLens = Boolean ( newOptions . modifiedCodeLens ) ;
682+ }
665683
666- this . modifiedEditor . updateOptions ( this . _adjustOptionsForRightHandSide ( newOptions ) ) ;
667- this . originalEditor . updateOptions ( this . _adjustOptionsForLeftHandSide ( newOptions , this . _originalIsEditable ) ) ;
684+ this . modifiedEditor . updateOptions ( this . _adjustOptionsForRightHandSide ( newOptions , this . _modifiedCodeLens ) ) ;
685+ this . originalEditor . updateOptions ( this . _adjustOptionsForLeftHandSide ( newOptions , this . _originalIsEditable , this . _originalCodeLens ) ) ;
668686
669687 // enableSplitViewResizing
670688 if ( typeof newOptions . enableSplitViewResizing !== 'undefined' ) {
@@ -1059,15 +1077,21 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
10591077 return clonedOptions ;
10601078 }
10611079
1062- private _adjustOptionsForLeftHandSide ( options : IDiffEditorOptions , isEditable : boolean ) : IEditorOptions {
1080+ private _adjustOptionsForLeftHandSide ( options : IDiffEditorOptions , isEditable : boolean , isCodeLensEnabled : boolean ) : IEditorOptions {
10631081 let result = this . _adjustOptionsForSubEditor ( options ) ;
1082+ if ( isCodeLensEnabled ) {
1083+ result . codeLens = true ;
1084+ }
10641085 result . readOnly = ! isEditable ;
10651086 result . extraEditorClassName = 'original-in-monaco-diff-editor' ;
10661087 return result ;
10671088 }
10681089
1069- private _adjustOptionsForRightHandSide ( options : IDiffEditorOptions ) : IEditorOptions {
1090+ private _adjustOptionsForRightHandSide ( options : IDiffEditorOptions , isCodeLensEnabled : boolean ) : IEditorOptions {
10701091 let result = this . _adjustOptionsForSubEditor ( options ) ;
1092+ if ( isCodeLensEnabled ) {
1093+ result . codeLens = true ;
1094+ }
10711095 result . revealHorizontalRightPadding = EditorOptions . revealHorizontalRightPadding . defaultValue + DiffEditorWidget . ENTIRE_DIFF_OVERVIEW_WIDTH ;
10721096 result . scrollbar ! . verticalHasArrows = false ;
10731097 result . extraEditorClassName = 'modified-in-monaco-diff-editor' ;
0 commit comments