22import { PlainTextDiff } from '@jupyterlab/git' ;
33import { DiffModel } from '@jupyterlab/git/lib/components/diff/model' ;
44import { Widget } from '@lumino/widgets' ;
5- import { LineWidget } from 'codemirror' ;
5+ import { LineWidget , MergeView } from 'codemirror' ;
66import { IComment , IDiffOptions , IThread } from '../../tokens' ;
77import { generateNode } from '../../utils' ;
88import { Discussion } from '../discussion/Discussion' ;
@@ -101,22 +101,17 @@ export class PlainTextPRDiff extends PlainTextDiff {
101101 editor . setGutterMarker ( lineIdx , 'jp-PullRequestCommentDecoration' , div ) ;
102102 }
103103 }
104-
105104 /**
106105 * Create the Plain Text Diff view
107106 */
108- protected async createDiffView ( ) : Promise < void > {
109- await super . createDiffView ( ) ;
107+ protected async createDiffView (
108+ challengerContent : string ,
109+ referenceContent : string
110+ ) : Promise < void > {
111+ await super . createDiffView ( challengerContent , referenceContent ) ;
110112
111113 if ( this . _mergeView ) {
112114 {
113- this . _mergeView . leftOriginal ( ) . setOption ( 'gutters' , [
114- 'CodeMirror-linenumbers' ,
115- // FIXME without this - the comment decoration does not show up
116- // But it add a single comment decoration on the first line of each editors
117- 'jp-PullRequestCommentDecoration' ,
118- 'CodeMirror-patchgutter'
119- ] ) ;
120115 const { from, to } = this . _mergeView . leftOriginal ( ) . getViewport ( ) ;
121116 this . updateView (
122117 this . _mergeView . leftOriginal ( ) ,
@@ -135,13 +130,6 @@ export class PlainTextPRDiff extends PlainTextDiff {
135130 }
136131
137132 {
138- this . _mergeView . editor ( ) . setOption ( 'gutters' , [
139- 'CodeMirror-linenumbers' ,
140- // FIXME without this - the comment decoration does not show up
141- // But it add a single comment decoration on the first line of each editors
142- 'jp-PullRequestCommentDecoration' ,
143- 'CodeMirror-patchgutter'
144- ] ) ;
145133 const { from, to } = this . _mergeView . editor ( ) . getViewport ( ) ;
146134 this . updateView ( this . _mergeView . editor ( ) , from , to , 'line' ) ;
147135 this . _mergeView
@@ -194,6 +182,24 @@ export class PlainTextPRDiff extends PlainTextDiff {
194182 }
195183 }
196184
185+ /**
186+ * Returns default CodeMirror editor options
187+ *
188+ * @returns CodeMirror editor options
189+ */
190+ protected getDefaultOptions ( ) : Partial < MergeView . MergeViewEditorConfiguration > {
191+ return {
192+ ...super . getDefaultOptions ( ) ,
193+ gutters : [
194+ 'CodeMirror-linenumbers' ,
195+ // without this - the comment decoration does not show up
196+ // But it add a single comment decoration on the first line of each editors
197+ 'jp-PullRequestCommentDecoration' ,
198+ 'CodeMirror-patchgutter'
199+ ]
200+ } ;
201+ }
202+
197203 /**
198204 * Create the widget associated with a discussion
199205 *
0 commit comments