@codingame/monaco-vscode-notebook-service-override 25.1.2 → 26.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +2 -2
- package/package.json +3 -3
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +112 -94
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +95 -96
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticEditorContrib.js +28 -19
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticsActions.js +15 -9
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/diagnosticCellStatusBarContrib.js +22 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.js +25 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +37 -44
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +211 -115
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.js +16 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookCellPausing.js +5 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +57 -49
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.js +24 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +78 -76
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/execute/executionEditorProgress.js +14 -15
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +43 -28
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +65 -34
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +19 -16
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/kernelDetection/notebookKernelDetection.js +6 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +15 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +28 -16
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookMulticursor.js +211 -170
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookSelectionHighlight.js +11 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +158 -156
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookInlineVariables.js +109 -105
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableContextKeys.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +28 -22
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +26 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +23 -16
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +72 -40
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +233 -186
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +22 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +239 -151
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +85 -86
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +25 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.js +13 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/apiActions.js +8 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/editActions.js +218 -196
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +258 -255
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +106 -98
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/notebookIndentationActions.js +63 -49
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.js +55 -64
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/variablesActions.js +21 -25
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +149 -129
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.d.ts +57 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.js +286 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditorInput.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditorInput.js +82 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +452 -363
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibilityHelp.js +44 -61
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibleView.js +9 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +203 -207
- package/vscode/src/vs/workbench/contrib/notebook/browser/outputEditor/notebookOutputEditor.js +148 -104
- package/vscode/src/vs/workbench/contrib/notebook/browser/outputEditor/notebookOutputEditorInput.js +19 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/replEditorAccessibleView.js +9 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookCellStatusBarServiceImpl.js +9 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +34 -22
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +29 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +70 -52
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +31 -19
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +78 -41
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +37 -27
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +9 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.js +8 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +214 -119
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +38 -36
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineDataSource.js +24 -25
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineDataSourceFactory.js +2 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.js +26 -15
- package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.js +35 -15
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +468 -258
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.d.ts +33 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +113 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +74 -58
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.js +7 -10
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookCellMatching.js +72 -16
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookWebWorker.js +70 -51
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/repl.contribution.js +195 -149
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditorAccessibilityHelp.js +60 -81
- package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.js +7 -12
- package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +104 -66
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +115 -77
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.js +42 -26
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopyManager.js +19 -12
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.d.ts +0 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +0 -198
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.d.ts +0 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.js +0 -333
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext.js +0 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.d.ts +0 -13
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +0 -261
|
@@ -12,14 +12,25 @@ import { filter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/objec
|
|
|
12
12
|
import { matchCellBasedOnSimilarties } from './notebookCellMatching.js';
|
|
13
13
|
import '@codingame/monaco-vscode-api/vscode/vs/base/common/uuid';
|
|
14
14
|
import { DiffChange } from '@codingame/monaco-vscode-api/vscode/vs/base/common/diff/diffChange';
|
|
15
|
-
import { computeDiff } from '@codingame/monaco-vscode-
|
|
15
|
+
import { computeDiff } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookDiff';
|
|
16
16
|
|
|
17
17
|
const PREFIX_FOR_UNMATCHED_ORIGINAL_CELLS = `unmatchedOriginalCell`;
|
|
18
18
|
class MirrorCell {
|
|
19
19
|
get eol() {
|
|
20
|
-
return this._eol ===
|
|
21
|
-
}
|
|
22
|
-
constructor(
|
|
20
|
+
return this._eol === "\r\n" ? DefaultEndOfLine.CRLF : DefaultEndOfLine.LF;
|
|
21
|
+
}
|
|
22
|
+
constructor(
|
|
23
|
+
handle,
|
|
24
|
+
uri,
|
|
25
|
+
source,
|
|
26
|
+
_eol,
|
|
27
|
+
versionId,
|
|
28
|
+
language,
|
|
29
|
+
cellKind,
|
|
30
|
+
outputs,
|
|
31
|
+
metadata,
|
|
32
|
+
internalMetadata
|
|
33
|
+
) {
|
|
23
34
|
this.handle = handle;
|
|
24
35
|
this._eol = _eol;
|
|
25
36
|
this.language = language;
|
|
@@ -47,7 +58,7 @@ class MirrorCell {
|
|
|
47
58
|
hashValue = doHash(this.language, hashValue);
|
|
48
59
|
hashValue = doHash(this.getValue(), hashValue);
|
|
49
60
|
hashValue = doHash(this.metadata, hashValue);
|
|
50
|
-
hashValue = doHash(this.internalMetadata?.internalId ||
|
|
61
|
+
hashValue = doHash(this.internalMetadata?.internalId || "", hashValue);
|
|
51
62
|
for (const op of this.outputs) {
|
|
52
63
|
hashValue = doHash(op.metadata, hashValue);
|
|
53
64
|
for (const output of op.outputs) {
|
|
@@ -72,31 +83,25 @@ class MirrorNotebookDocument {
|
|
|
72
83
|
event.rawEvents.forEach(e => {
|
|
73
84
|
if (e.kind === NotebookCellsChangeType.ModelChange) {
|
|
74
85
|
this._spliceNotebookCells(e.changes);
|
|
75
|
-
}
|
|
76
|
-
else if (e.kind === NotebookCellsChangeType.Move) {
|
|
86
|
+
} else if (e.kind === NotebookCellsChangeType.Move) {
|
|
77
87
|
const cells = this.cells.splice(e.index, 1);
|
|
78
88
|
this.cells.splice(e.newIdx, 0, ...cells);
|
|
79
|
-
}
|
|
80
|
-
else if (e.kind === NotebookCellsChangeType.Output) {
|
|
89
|
+
} else if (e.kind === NotebookCellsChangeType.Output) {
|
|
81
90
|
const cell = this.cells[e.index];
|
|
82
91
|
cell.outputs = e.outputs;
|
|
83
|
-
}
|
|
84
|
-
else if (e.kind === NotebookCellsChangeType.ChangeCellLanguage) {
|
|
92
|
+
} else if (e.kind === NotebookCellsChangeType.ChangeCellLanguage) {
|
|
85
93
|
this._assertIndex(e.index);
|
|
86
94
|
const cell = this.cells[e.index];
|
|
87
95
|
cell.language = e.language;
|
|
88
|
-
}
|
|
89
|
-
else if (e.kind === NotebookCellsChangeType.ChangeCellMetadata) {
|
|
96
|
+
} else if (e.kind === NotebookCellsChangeType.ChangeCellMetadata) {
|
|
90
97
|
this._assertIndex(e.index);
|
|
91
98
|
const cell = this.cells[e.index];
|
|
92
99
|
cell.metadata = e.metadata;
|
|
93
|
-
}
|
|
94
|
-
else if (e.kind === NotebookCellsChangeType.ChangeCellInternalMetadata) {
|
|
100
|
+
} else if (e.kind === NotebookCellsChangeType.ChangeCellInternalMetadata) {
|
|
95
101
|
this._assertIndex(e.index);
|
|
96
102
|
const cell = this.cells[e.index];
|
|
97
103
|
cell.internalMetadata = e.internalMetadata;
|
|
98
|
-
}
|
|
99
|
-
else if (e.kind === NotebookCellsChangeType.ChangeDocumentMetadata) {
|
|
104
|
+
} else if (e.kind === NotebookCellsChangeType.ChangeDocumentMetadata) {
|
|
100
105
|
this.metadata = e.metadata;
|
|
101
106
|
}
|
|
102
107
|
});
|
|
@@ -122,11 +127,10 @@ class CellSequence {
|
|
|
122
127
|
return ( new CellSequence(hashValue));
|
|
123
128
|
}
|
|
124
129
|
static createWithCellId(cells, includeCellContents) {
|
|
125
|
-
const hashValue = ( cells.map(
|
|
130
|
+
const hashValue = ( cells.map(c => {
|
|
126
131
|
if (includeCellContents) {
|
|
127
132
|
return `${doHash(c.internalMetadata?.internalId, numberHash(104579, 0))}#${c.getComparisonValue()}`;
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
133
|
+
} else {
|
|
130
134
|
return `${doHash(c.internalMetadata?.internalId, numberHash(104579, 0))}}`;
|
|
131
135
|
}
|
|
132
136
|
}));
|
|
@@ -144,8 +148,7 @@ class NotebookWorker {
|
|
|
144
148
|
this._requestHandlerBrand = undefined;
|
|
145
149
|
this._models = Object.create(null);
|
|
146
150
|
}
|
|
147
|
-
dispose() {
|
|
148
|
-
}
|
|
151
|
+
dispose() {}
|
|
149
152
|
$acceptNewModel(uri, metadata, transientDocumentMetadata, cells) {
|
|
150
153
|
this._models[uri] = ( new MirrorNotebookDocument(( URI.parse(uri)), ( cells.map(dto => ( new MirrorCell(dto.handle, ( URI.parse(dto.url)), dto.source, dto.eol, dto.versionId, dto.language, dto.cellKind, dto.outputs, dto.metadata, dto.internalMetadata)))), metadata, transientDocumentMetadata));
|
|
151
154
|
}
|
|
@@ -178,8 +181,12 @@ class NotebookWorker {
|
|
|
178
181
|
cellsDiff: originalDiff
|
|
179
182
|
};
|
|
180
183
|
}
|
|
181
|
-
const cellMapping = computeDiff(originalModel, modifiedModel, {
|
|
182
|
-
|
|
184
|
+
const cellMapping = computeDiff(originalModel, modifiedModel, {
|
|
185
|
+
cellsDiff: {
|
|
186
|
+
changes: originalDiff.changes,
|
|
187
|
+
quitEarly: false
|
|
188
|
+
}}).cellDiffInfo;
|
|
189
|
+
if (cellMapping.every(c => c.type === "modified" || c.type === "unchanged")) {
|
|
183
190
|
return {
|
|
184
191
|
metadataChanged,
|
|
185
192
|
cellsDiff: originalDiff
|
|
@@ -203,17 +210,21 @@ class NotebookWorker {
|
|
|
203
210
|
CellSequence.createWithCellId(original.cells),
|
|
204
211
|
CellSequence.createWithCellId(modified.cells)
|
|
205
212
|
)).ComputeDiff(false);
|
|
206
|
-
const cellDiffInfo = computeDiff(originalModel, modifiedModel, {
|
|
213
|
+
const cellDiffInfo = computeDiff(originalModel, modifiedModel, {
|
|
214
|
+
cellsDiff: {
|
|
215
|
+
changes: cellsInsertedOrDeletedDiff.changes,
|
|
216
|
+
quitEarly: false
|
|
217
|
+
}}).cellDiffInfo;
|
|
207
218
|
let processedIndex = 0;
|
|
208
219
|
const changes = [];
|
|
209
220
|
cellsInsertedOrDeletedDiff.changes.forEach(change => {
|
|
210
221
|
if (!change.originalLength && change.modifiedLength) {
|
|
211
|
-
const changeIndex = cellDiffInfo.findIndex(c => c.type ===
|
|
222
|
+
const changeIndex = cellDiffInfo.findIndex(c => c.type === "insert" && c.modifiedCellIndex === change.modifiedStart);
|
|
212
223
|
cellDiffInfo.slice(processedIndex, changeIndex).forEach(c => {
|
|
213
|
-
if (c.type ===
|
|
224
|
+
if (c.type === "unchanged" || c.type === "modified") {
|
|
214
225
|
const originalCell = original.cells[c.originalCellIndex];
|
|
215
226
|
const modifiedCell = modified.cells[c.modifiedCellIndex];
|
|
216
|
-
const changed = c.type ===
|
|
227
|
+
const changed = c.type === "modified" || originalCell.getComparisonValue() !== modifiedCell.getComparisonValue();
|
|
217
228
|
if (changed) {
|
|
218
229
|
changes.push(( new DiffChange(c.originalCellIndex, 1, c.modifiedCellIndex, 1)));
|
|
219
230
|
}
|
|
@@ -221,14 +232,13 @@ class NotebookWorker {
|
|
|
221
232
|
});
|
|
222
233
|
changes.push(change);
|
|
223
234
|
processedIndex = changeIndex + 1;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
const changeIndex = cellDiffInfo.findIndex(c => c.type === 'delete' && c.originalCellIndex === change.originalStart);
|
|
235
|
+
} else if (change.originalLength && !change.modifiedLength) {
|
|
236
|
+
const changeIndex = cellDiffInfo.findIndex(c => c.type === "delete" && c.originalCellIndex === change.originalStart);
|
|
227
237
|
cellDiffInfo.slice(processedIndex, changeIndex).forEach(c => {
|
|
228
|
-
if (c.type ===
|
|
238
|
+
if (c.type === "unchanged" || c.type === "modified") {
|
|
229
239
|
const originalCell = original.cells[c.originalCellIndex];
|
|
230
240
|
const modifiedCell = modified.cells[c.modifiedCellIndex];
|
|
231
|
-
const changed = c.type ===
|
|
241
|
+
const changed = c.type === "modified" || originalCell.getComparisonValue() !== modifiedCell.getComparisonValue();
|
|
232
242
|
if (changed) {
|
|
233
243
|
changes.push(( new DiffChange(c.originalCellIndex, 1, c.modifiedCellIndex, 1)));
|
|
234
244
|
}
|
|
@@ -236,14 +246,15 @@ class NotebookWorker {
|
|
|
236
246
|
});
|
|
237
247
|
changes.push(change);
|
|
238
248
|
processedIndex = changeIndex + 1;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
|
|
249
|
+
} else {
|
|
250
|
+
const changeIndex = cellDiffInfo.findIndex(
|
|
251
|
+
c => (c.type === "delete" && c.originalCellIndex === change.originalStart) || (c.type === "insert" && c.modifiedCellIndex === change.modifiedStart)
|
|
252
|
+
);
|
|
242
253
|
cellDiffInfo.slice(processedIndex, changeIndex).forEach(c => {
|
|
243
|
-
if (c.type ===
|
|
254
|
+
if (c.type === "unchanged" || c.type === "modified") {
|
|
244
255
|
const originalCell = original.cells[c.originalCellIndex];
|
|
245
256
|
const modifiedCell = modified.cells[c.modifiedCellIndex];
|
|
246
|
-
const changed = c.type ===
|
|
257
|
+
const changed = c.type === "modified" || originalCell.getComparisonValue() !== modifiedCell.getComparisonValue();
|
|
247
258
|
if (changed) {
|
|
248
259
|
changes.push(( new DiffChange(c.originalCellIndex, 1, c.modifiedCellIndex, 1)));
|
|
249
260
|
}
|
|
@@ -254,10 +265,10 @@ class NotebookWorker {
|
|
|
254
265
|
}
|
|
255
266
|
});
|
|
256
267
|
cellDiffInfo.slice(processedIndex).forEach(c => {
|
|
257
|
-
if (c.type ===
|
|
268
|
+
if (c.type === "unchanged" || c.type === "modified") {
|
|
258
269
|
const originalCell = original.cells[c.originalCellIndex];
|
|
259
270
|
const modifiedCell = modified.cells[c.modifiedCellIndex];
|
|
260
|
-
const changed = c.type ===
|
|
271
|
+
const changed = c.type === "modified" || originalCell.getComparisonValue() !== modifiedCell.getComparisonValue();
|
|
261
272
|
if (changed) {
|
|
262
273
|
changes.push(( new DiffChange(c.originalCellIndex, 1, c.modifiedCellIndex, 1)));
|
|
263
274
|
}
|
|
@@ -275,20 +286,28 @@ class NotebookWorker {
|
|
|
275
286
|
return this.canComputeDiffWithCellInternalIds(original, modified) || this.canComputeDiffWithCellMetadataIds(original, modified);
|
|
276
287
|
}
|
|
277
288
|
canComputeDiffWithCellInternalIds(original, modified) {
|
|
278
|
-
const originalCellIndexIds = ( original.cells.map(
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
289
|
+
const originalCellIndexIds = ( original.cells.map((cell, index) => ({
|
|
290
|
+
index,
|
|
291
|
+
id: (cell.internalMetadata?.internalId || "")
|
|
292
|
+
})));
|
|
293
|
+
const modifiedCellIndexIds = ( modified.cells.map((cell, index) => ({
|
|
294
|
+
index,
|
|
295
|
+
id: (cell.internalMetadata?.internalId || "")
|
|
296
|
+
})));
|
|
284
297
|
if (( originalCellIndexIds.some(c => !c.id)) || ( modifiedCellIndexIds.some(c => !c.id))) {
|
|
285
298
|
return false;
|
|
286
299
|
}
|
|
287
300
|
return ( originalCellIndexIds.some(c => modifiedCellIndexIds.find(m => m.id === c.id)));
|
|
288
301
|
}
|
|
289
302
|
canComputeDiffWithCellMetadataIds(original, modified) {
|
|
290
|
-
const originalCellIndexIds = ( original.cells.map((cell, index) => ({
|
|
291
|
-
|
|
303
|
+
const originalCellIndexIds = ( original.cells.map((cell, index) => ({
|
|
304
|
+
index,
|
|
305
|
+
id: (cell.metadata?.id || "")
|
|
306
|
+
})));
|
|
307
|
+
const modifiedCellIndexIds = ( modified.cells.map((cell, index) => ({
|
|
308
|
+
index,
|
|
309
|
+
id: (cell.metadata?.id || "")
|
|
310
|
+
})));
|
|
292
311
|
if (( originalCellIndexIds.some(c => !c.id)) || ( modifiedCellIndexIds.some(c => !c.id))) {
|
|
293
312
|
return false;
|
|
294
313
|
}
|
|
@@ -298,7 +317,7 @@ class NotebookWorker {
|
|
|
298
317
|
return true;
|
|
299
318
|
}
|
|
300
319
|
isOriginalCellMatchedWithModifiedCell(originalCell) {
|
|
301
|
-
return (originalCell.internalMetadata?.internalId ||
|
|
320
|
+
return (originalCell.internalMetadata?.internalId || "").startsWith(PREFIX_FOR_UNMATCHED_ORIGINAL_CELLS);
|
|
302
321
|
}
|
|
303
322
|
updateCellIdsBasedOnMappings(mappings, originalCells, modifiedCells) {
|
|
304
323
|
return true;
|
|
@@ -311,10 +330,10 @@ class NotebookWorker {
|
|
|
311
330
|
if (cell.cellKind === CellKind.Markup) {
|
|
312
331
|
continue;
|
|
313
332
|
}
|
|
314
|
-
if (cell.language !==
|
|
333
|
+
if (cell.language !== "python") {
|
|
315
334
|
continue;
|
|
316
335
|
}
|
|
317
|
-
const searchParams = ( new SearchParams(
|
|
336
|
+
const searchParams = ( new SearchParams("import\\s*pandas|from\\s*pandas", true, false, null));
|
|
318
337
|
const searchData = searchParams.parseSearchRequest();
|
|
319
338
|
if (!searchData) {
|
|
320
339
|
continue;
|