@codingame/monaco-vscode-notebook-service-override 15.0.2 → 16.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 +5 -11
- package/package.json +27 -26
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.css +6 -0
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +10 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +22 -22
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticEditorContrib.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticEditorContrib.js +7 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticsActions.js +5 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/diagnosticCellStatusBarContrib.js +7 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +7 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +12 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +10 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/media/notebookFind.css +17 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +4 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +5 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookMulticursor.js +6 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +14 -14
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookInlineVariables.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +10 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +13 -13
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +28 -28
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.js +54 -31
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/editActions.js +25 -25
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +26 -26
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +25 -25
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +18 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/notebookIndentationActions.js +7 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.js +12 -12
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/variablesActions.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +22 -22
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +72 -74
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibilityHelp.js +11 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibleView.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +33 -33
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +54 -12
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +4 -3
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +42 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +10 -2
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookCellMatching.d.ts +15 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookCellMatching.js +173 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/services/{notebookSimpleWorker.d.ts → notebookWebWorker.d.ts} +24 -6
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookWebWorker.js +366 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookWebWorkerMain.js +5 -0
- package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +12 -12
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +1 -1
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.d.ts +2 -2
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.js +1 -1
- package/worker.js +1 -1
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/contribution.js +0 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookCellDecorators.d.ts +0 -24
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookCellDecorators.js +0 -332
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookChatActionsOverlay.d.ts +0 -23
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookChatActionsOverlay.js +0 -299
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookChatEditController.d.ts +0 -9
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookChatEditController.js +0 -179
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookOriginalCellModelFactory.d.ts +0 -21
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookOriginalCellModelFactory.js +0 -42
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookOriginalModelRefFactory.d.ts +0 -25
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookOriginalModelRefFactory.js +0 -77
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookSynchronizer.d.ts +0 -64
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookSynchronizer.js +0 -443
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookSynchronizerService.d.ts +0 -20
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookSynchronizerService.js +0 -86
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/media/notebookFind.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookSimpleWorker.js +0 -279
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookSimpleWorkerMain.d.ts +0 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookSimpleWorkerMain.js +0 -5
- /package/vscode/src/vs/workbench/contrib/notebook/{browser/contrib/chatEdit/contribution.d.ts → common/services/notebookWebWorkerMain.d.ts} +0 -0
|
@@ -1,279 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { LcsDiff } from '@codingame/monaco-vscode-api/vscode/vs/base/common/diff/diff';
|
|
3
|
-
import { numberHash, doHash } from '@codingame/monaco-vscode-api/vscode/vs/base/common/hash';
|
|
4
|
-
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
5
|
-
import { PieceTreeTextBufferBuilder } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeTextBufferBuilder';
|
|
6
|
-
import { NotebookCellsChangeType, CellKind } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
7
|
-
import { Range } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/core/range';
|
|
8
|
-
import { SearchParams } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/model/textModelSearch';
|
|
9
|
-
import { MirrorModel } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/textModelSync/textModelSync.impl';
|
|
10
|
-
import { DefaultEndOfLine } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/model';
|
|
11
|
-
import { filter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/objects';
|
|
12
|
-
|
|
13
|
-
class MirrorCell {
|
|
14
|
-
get eol() {
|
|
15
|
-
return this._eol === '\r\n' ? DefaultEndOfLine.CRLF : DefaultEndOfLine.LF;
|
|
16
|
-
}
|
|
17
|
-
constructor(handle, uri, source, _eol, versionId, language, cellKind, outputs, metadata, internalMetadata) {
|
|
18
|
-
this.handle = handle;
|
|
19
|
-
this._eol = _eol;
|
|
20
|
-
this.language = language;
|
|
21
|
-
this.cellKind = cellKind;
|
|
22
|
-
this.outputs = outputs;
|
|
23
|
-
this.metadata = metadata;
|
|
24
|
-
this.internalMetadata = internalMetadata;
|
|
25
|
-
this.textModel = ( new MirrorModel(uri, source, _eol, versionId));
|
|
26
|
-
}
|
|
27
|
-
onEvents(e) {
|
|
28
|
-
this.textModel.onEvents(e);
|
|
29
|
-
this._hash = undefined;
|
|
30
|
-
}
|
|
31
|
-
getValue() {
|
|
32
|
-
return this.textModel.getValue();
|
|
33
|
-
}
|
|
34
|
-
async getComparisonValue() {
|
|
35
|
-
return this._hash ??= this._getHash();
|
|
36
|
-
}
|
|
37
|
-
async _getHash() {
|
|
38
|
-
let hashValue = numberHash(104579, 0);
|
|
39
|
-
hashValue = doHash(this.language, hashValue);
|
|
40
|
-
hashValue = doHash(this.getValue(), hashValue);
|
|
41
|
-
hashValue = doHash(this.metadata, hashValue);
|
|
42
|
-
hashValue = doHash({ ...this.internalMetadata, 'cellId': '' }, hashValue);
|
|
43
|
-
for (const op of this.outputs) {
|
|
44
|
-
hashValue = doHash(op.metadata, hashValue);
|
|
45
|
-
for (const output of op.outputs) {
|
|
46
|
-
hashValue = doHash(output.mime, hashValue);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
const digests = await Promise.all(this.outputs.flatMap(op => ( op.outputs.map(o => crypto.subtle.digest('sha-1', o.data.buffer)))));
|
|
50
|
-
for (const digest of digests) {
|
|
51
|
-
hashValue = numberHash(( new Int32Array(digest))[0], hashValue);
|
|
52
|
-
}
|
|
53
|
-
return hashValue;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
class MirrorNotebookDocument {
|
|
57
|
-
constructor(uri, cells, metadata, transientDocumentMetadata) {
|
|
58
|
-
this.uri = uri;
|
|
59
|
-
this.cells = cells;
|
|
60
|
-
this.metadata = metadata;
|
|
61
|
-
this.transientDocumentMetadata = transientDocumentMetadata;
|
|
62
|
-
}
|
|
63
|
-
acceptModelChanged(event) {
|
|
64
|
-
event.rawEvents.forEach(e => {
|
|
65
|
-
if (e.kind === NotebookCellsChangeType.ModelChange) {
|
|
66
|
-
this._spliceNotebookCells(e.changes);
|
|
67
|
-
}
|
|
68
|
-
else if (e.kind === NotebookCellsChangeType.Move) {
|
|
69
|
-
const cells = this.cells.splice(e.index, 1);
|
|
70
|
-
this.cells.splice(e.newIdx, 0, ...cells);
|
|
71
|
-
}
|
|
72
|
-
else if (e.kind === NotebookCellsChangeType.Output) {
|
|
73
|
-
const cell = this.cells[e.index];
|
|
74
|
-
cell.outputs = e.outputs;
|
|
75
|
-
}
|
|
76
|
-
else if (e.kind === NotebookCellsChangeType.ChangeCellLanguage) {
|
|
77
|
-
this._assertIndex(e.index);
|
|
78
|
-
const cell = this.cells[e.index];
|
|
79
|
-
cell.language = e.language;
|
|
80
|
-
}
|
|
81
|
-
else if (e.kind === NotebookCellsChangeType.ChangeCellMetadata) {
|
|
82
|
-
this._assertIndex(e.index);
|
|
83
|
-
const cell = this.cells[e.index];
|
|
84
|
-
cell.metadata = e.metadata;
|
|
85
|
-
}
|
|
86
|
-
else if (e.kind === NotebookCellsChangeType.ChangeCellInternalMetadata) {
|
|
87
|
-
this._assertIndex(e.index);
|
|
88
|
-
const cell = this.cells[e.index];
|
|
89
|
-
cell.internalMetadata = e.internalMetadata;
|
|
90
|
-
}
|
|
91
|
-
else if (e.kind === NotebookCellsChangeType.ChangeDocumentMetadata) {
|
|
92
|
-
this.metadata = e.metadata;
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
_assertIndex(index) {
|
|
97
|
-
if (index < 0 || index >= this.cells.length) {
|
|
98
|
-
throw ( new Error(`Illegal index ${index}. Cells length: ${this.cells.length}`));
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
_spliceNotebookCells(splices) {
|
|
102
|
-
splices.reverse().forEach(splice => {
|
|
103
|
-
const cellDtos = splice[2];
|
|
104
|
-
const newCells = ( cellDtos.map(cell => {
|
|
105
|
-
return ( new MirrorCell(cell.handle, ( URI.parse(cell.url)), cell.source, cell.eol, cell.versionId, cell.language, cell.cellKind, cell.outputs, cell.metadata));
|
|
106
|
-
}));
|
|
107
|
-
this.cells.splice(splice[0], splice[1], ...newCells);
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
class CellSequence {
|
|
112
|
-
static async create(textModel) {
|
|
113
|
-
const hashValue = ( new Int32Array(textModel.cells.length));
|
|
114
|
-
await Promise.all(( textModel.cells.map(async (c, i) => {
|
|
115
|
-
hashValue[i] = await c.getComparisonValue();
|
|
116
|
-
})));
|
|
117
|
-
return ( new CellSequence(hashValue));
|
|
118
|
-
}
|
|
119
|
-
static async createWithCellId(textModel) {
|
|
120
|
-
const hashValue = ( new Map());
|
|
121
|
-
await Promise.all(( textModel.cells.map(async (c, i) => {
|
|
122
|
-
const value = await c.getComparisonValue();
|
|
123
|
-
const id = (c.metadata?.id || '');
|
|
124
|
-
hashValue.set(id, value);
|
|
125
|
-
})));
|
|
126
|
-
return hashValue;
|
|
127
|
-
}
|
|
128
|
-
constructor(hashValue) {
|
|
129
|
-
this.hashValue = hashValue;
|
|
130
|
-
}
|
|
131
|
-
getElements() {
|
|
132
|
-
return this.hashValue;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
class NotebookEditorSimpleWorker {
|
|
136
|
-
constructor() {
|
|
137
|
-
this._models = Object.create(null);
|
|
138
|
-
}
|
|
139
|
-
dispose() {
|
|
140
|
-
}
|
|
141
|
-
$acceptNewModel(uri, metadata, transientDocumentMetadata, cells) {
|
|
142
|
-
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));
|
|
143
|
-
}
|
|
144
|
-
$acceptModelChanged(strURL, event) {
|
|
145
|
-
const model = this._models[strURL];
|
|
146
|
-
model?.acceptModelChanged(event);
|
|
147
|
-
}
|
|
148
|
-
$acceptCellModelChanged(strURL, handle, event) {
|
|
149
|
-
const model = this._models[strURL];
|
|
150
|
-
model.cells.find(cell => cell.handle === handle)?.onEvents(event);
|
|
151
|
-
}
|
|
152
|
-
$acceptRemovedModel(strURL) {
|
|
153
|
-
if (!this._models[strURL]) {
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
delete this._models[strURL];
|
|
157
|
-
}
|
|
158
|
-
async $computeDiff(originalUrl, modifiedUrl) {
|
|
159
|
-
const original = this._getModel(originalUrl);
|
|
160
|
-
const modified = this._getModel(modifiedUrl);
|
|
161
|
-
const [originalSeq, modifiedSeq] = await Promise.all([
|
|
162
|
-
CellSequence.create(original),
|
|
163
|
-
CellSequence.create(modified),
|
|
164
|
-
]);
|
|
165
|
-
const diff = ( new LcsDiff(originalSeq, modifiedSeq));
|
|
166
|
-
const diffResult = diff.ComputeDiff(false);
|
|
167
|
-
const originalMetadata = filter(original.metadata, key => !original.transientDocumentMetadata[key]);
|
|
168
|
-
const modifiedMetadata = filter(modified.metadata, key => !modified.transientDocumentMetadata[key]);
|
|
169
|
-
return {
|
|
170
|
-
metadataChanged: JSON.stringify(originalMetadata) !== JSON.stringify(modifiedMetadata),
|
|
171
|
-
cellsDiff: (await this.$computeDiffWithCellIds(original, modified)) || diffResult,
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
async $computeDiffWithCellIds(original, modified) {
|
|
175
|
-
const originalCellIndexIds = ( original.cells.map((cell, index) => ({ index, id: (cell.metadata?.id || '') })));
|
|
176
|
-
const modifiedCellIndexIds = ( modified.cells.map((cell, index) => ({ index, id: (cell.metadata?.id || '') })));
|
|
177
|
-
const originalCellIds = ( originalCellIndexIds.map(c => c.id));
|
|
178
|
-
const modifiedCellIds = ( modifiedCellIndexIds.map(c => c.id));
|
|
179
|
-
const orderOrOriginalCellIds = originalCellIds.filter(id => modifiedCellIds.includes(id)).join(',');
|
|
180
|
-
const orderOrModifiedCellIds = modifiedCellIds.filter(id => originalCellIds.includes(id)).join(',');
|
|
181
|
-
if (( originalCellIndexIds.some(c => !c.id)) || ( modifiedCellIndexIds.some(c => !c.id)) || orderOrOriginalCellIds !== orderOrModifiedCellIds) {
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
const diffResult = { changes: [], quitEarly: false, };
|
|
185
|
-
const computeCellHashesById = async (notebook) => {
|
|
186
|
-
const hashValue = ( new Map());
|
|
187
|
-
await Promise.all(( notebook.cells.map(async (c, i) => {
|
|
188
|
-
const value = await c.getComparisonValue();
|
|
189
|
-
const id = (c.metadata?.id || '');
|
|
190
|
-
hashValue.set(id, value);
|
|
191
|
-
})));
|
|
192
|
-
return hashValue;
|
|
193
|
-
};
|
|
194
|
-
const [originalSeq, modifiedSeq] = await Promise.all([computeCellHashesById(original), computeCellHashesById(modified)]);
|
|
195
|
-
while (modifiedCellIndexIds.length) {
|
|
196
|
-
const modifiedCell = modifiedCellIndexIds.shift();
|
|
197
|
-
const originalCell = originalCellIndexIds.find(c => c.id === modifiedCell.id);
|
|
198
|
-
if (originalCell) {
|
|
199
|
-
const index = originalCellIndexIds.indexOf(originalCell);
|
|
200
|
-
const deletedFromOriginal = originalCellIndexIds.splice(0, index + 1);
|
|
201
|
-
if (deletedFromOriginal.length === 1) {
|
|
202
|
-
if (originalSeq.get(originalCell.id) === modifiedSeq.get(originalCell.id)) ;
|
|
203
|
-
else {
|
|
204
|
-
diffResult.changes.push({
|
|
205
|
-
originalStart: originalCell.index,
|
|
206
|
-
originalLength: 1,
|
|
207
|
-
modifiedStart: modifiedCell.index,
|
|
208
|
-
modifiedLength: 1
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
else {
|
|
213
|
-
diffResult.changes.push({
|
|
214
|
-
originalStart: deletedFromOriginal[0].index,
|
|
215
|
-
originalLength: deletedFromOriginal.length - 1,
|
|
216
|
-
modifiedStart: modifiedCell.index,
|
|
217
|
-
modifiedLength: 0
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
|
-
continue;
|
|
221
|
-
}
|
|
222
|
-
else {
|
|
223
|
-
diffResult.changes.push({
|
|
224
|
-
originalStart: originalCellIndexIds.length ? originalCellIndexIds[0].index : original.cells.length,
|
|
225
|
-
originalLength: 0,
|
|
226
|
-
modifiedStart: modifiedCell.index,
|
|
227
|
-
modifiedLength: 1
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
if (originalCellIndexIds.length) {
|
|
232
|
-
diffResult.changes.push({
|
|
233
|
-
originalStart: originalCellIndexIds[0].index,
|
|
234
|
-
originalLength: originalCellIndexIds.length,
|
|
235
|
-
modifiedStart: modifiedCellIndexIds.length,
|
|
236
|
-
modifiedLength: 0
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
return diffResult;
|
|
240
|
-
}
|
|
241
|
-
$canPromptRecommendation(modelUrl) {
|
|
242
|
-
const model = this._getModel(modelUrl);
|
|
243
|
-
const cells = model.cells;
|
|
244
|
-
for (let i = 0; i < cells.length; i++) {
|
|
245
|
-
const cell = cells[i];
|
|
246
|
-
if (cell.cellKind === CellKind.Markup) {
|
|
247
|
-
continue;
|
|
248
|
-
}
|
|
249
|
-
if (cell.language !== 'python') {
|
|
250
|
-
continue;
|
|
251
|
-
}
|
|
252
|
-
const searchParams = ( new SearchParams('import\\s*pandas|from\\s*pandas', true, false, null));
|
|
253
|
-
const searchData = searchParams.parseSearchRequest();
|
|
254
|
-
if (!searchData) {
|
|
255
|
-
continue;
|
|
256
|
-
}
|
|
257
|
-
const builder = ( new PieceTreeTextBufferBuilder());
|
|
258
|
-
builder.acceptChunk(cell.getValue());
|
|
259
|
-
const bufferFactory = builder.finish(true);
|
|
260
|
-
const textBuffer = bufferFactory.create(cell.eol).textBuffer;
|
|
261
|
-
const lineCount = textBuffer.getLineCount();
|
|
262
|
-
const maxLineCount = Math.min(lineCount, 20);
|
|
263
|
-
const range = ( new Range(1, 1, maxLineCount, textBuffer.getLineLength(maxLineCount) + 1));
|
|
264
|
-
const cellMatches = textBuffer.findMatchesLineByLine(range, searchData, true, 1);
|
|
265
|
-
if (cellMatches.length > 0) {
|
|
266
|
-
return true;
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
return false;
|
|
270
|
-
}
|
|
271
|
-
_getModel(uri) {
|
|
272
|
-
return this._models[uri];
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
function create(workerServer) {
|
|
276
|
-
return ( new NotebookEditorSimpleWorker());
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
export { NotebookEditorSimpleWorker, create };
|
package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookSimpleWorkerMain.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|