@@ -50,6 +50,7 @@ export class NotebookCellDiffDecorator extends DisposableStore {
50
50
) {
51
51
super ( ) ;
52
52
this . add ( this . editor . onDidChangeModel ( ( ) => this . update ( ) ) ) ;
53
+ this . add ( this . editor . onDidChangeModelContent ( ( ) => this . update ( ) ) ) ;
53
54
this . add ( this . editor . onDidChangeConfiguration ( ( e ) => {
54
55
if ( e . hasChanged ( EditorOption . fontInfo ) || e . hasChanged ( EditorOption . lineHeight ) ) {
55
56
this . update ( ) ;
@@ -105,10 +106,6 @@ export class NotebookCellDiffDecorator extends DisposableStore {
105
106
if ( this . isDisposed ) {
106
107
return ;
107
108
}
108
- if ( ! this . editor . hasModel ( ) ) {
109
- this . _clearRendering ( ) ;
110
- return ;
111
- }
112
109
if ( this . editor . getOption ( EditorOption . inDiffEditor ) ) {
113
110
this . _clearRendering ( ) ;
114
111
return ;
@@ -119,9 +116,19 @@ export class NotebookCellDiffDecorator extends DisposableStore {
119
116
return ;
120
117
}
121
118
122
- const version = model . getVersionId ( ) ;
123
119
const originalModel = this . getOrCreateOriginalModel ( ) ;
124
- const diff = originalModel ? await this . computeDiff ( ) : undefined ;
120
+ if ( ! originalModel ) {
121
+ this . _clearRendering ( ) ;
122
+ return ;
123
+ }
124
+ const version = model . getVersionId ( ) ;
125
+ const diff = await this . _editorWorkerService . computeDiff (
126
+ originalModel . uri ,
127
+ model . uri ,
128
+ { computeMoves : true , ignoreTrimWhitespace : false , maxComputationTimeMs : Number . MAX_SAFE_INTEGER } ,
129
+ 'advanced'
130
+ ) ;
131
+
125
132
if ( this . isDisposed ) {
126
133
return ;
127
134
}
@@ -154,23 +161,6 @@ export class NotebookCellDiffDecorator extends DisposableStore {
154
161
}
155
162
return this . _originalModel ;
156
163
}
157
- private async computeDiff ( ) {
158
- const model = this . editor . getModel ( ) ;
159
- if ( ! model ) {
160
- return ;
161
- }
162
- const originalModel = this . getOrCreateOriginalModel ( ) ;
163
- if ( ! originalModel ) {
164
- return ;
165
- }
166
-
167
- return this . _editorWorkerService . computeDiff (
168
- originalModel . uri ,
169
- model . uri ,
170
- { computeMoves : true , ignoreTrimWhitespace : false , maxComputationTimeMs : Number . MAX_SAFE_INTEGER } ,
171
- 'advanced'
172
- ) ;
173
- }
174
164
175
165
private _updateWithDiff ( originalModel : ITextModel | undefined , diff : IDocumentDiff ) : void {
176
166
const chatDiffAddDecoration = ModelDecorationOptions . createDynamic ( {
0 commit comments