@codingame/monaco-vscode-notebook-service-override 5.2.0 → 6.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/package.json +2 -2
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +26 -22
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +549 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticEditorContrib.js +133 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticsActions.js +58 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/diagnosticCellStatusBarContrib.js +65 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +6 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +29 -27
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.js +2 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookCellPausing.js +2 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.js +6 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +10 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +27 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +32 -24
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +5 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/kernelDetection/notebookKernelDetection.js +2 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +42 -40
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +77 -57
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +184 -99
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +2 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +56 -112
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.js +31 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +10 -14
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +6 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +3 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.js +10 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +7 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +6 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.js +21 -15
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +8 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +6 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +88 -86
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibilityHelp.js +94 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibleView.js +73 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +3 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +6 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +7 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +5 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +6 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +44 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.js +34 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.js +5 -3
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +67 -53
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +11 -3
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.js +11 -10
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookSimpleWorker.js +3 -2
- package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +5 -3
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +15 -12
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.js +4 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibility.js +0 -156
|
@@ -2,7 +2,8 @@ import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
|
2
2
|
import { PauseableEmitter, Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
3
3
|
import { Disposable, dispose } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
4
4
|
import { NotebookCellTextModel } from 'vscode/vscode/vs/workbench/contrib/notebook/common/model/notebookCellTextModel';
|
|
5
|
-
import { CellUri, NotebookCellsChangeType, CellKind, diff } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
5
|
+
import { CellUri, NotebookCellsChangeType, CellEditType, CellKind, diff } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
6
|
+
import { UndoRedoElementType } from 'vscode/vscode/vs/platform/undoRedo/common/undoRedo';
|
|
6
7
|
import { IUndoRedoService } from 'vscode/vscode/vs/platform/undoRedo/common/undoRedo.service';
|
|
7
8
|
import { SpliceCellsEdit, CellMetadataEdit, MoveCellEdit } from './cellEdit.js';
|
|
8
9
|
import { LcsDiff } from 'vscode/vscode/vs/base/common/diff/diff';
|
|
@@ -32,7 +33,7 @@ class StackOperation {
|
|
|
32
33
|
this._operations = [];
|
|
33
34
|
this._beginSelectionState = undefined;
|
|
34
35
|
this._resultSelectionState = undefined;
|
|
35
|
-
this.type =
|
|
36
|
+
this.type = UndoRedoElementType.Workspace;
|
|
36
37
|
this._beginSelectionState = selectionState;
|
|
37
38
|
this._beginAlternativeVersionId = beginAlternativeVersionId;
|
|
38
39
|
this._resultAlternativeVersionId = beginAlternativeVersionId;
|
|
@@ -57,31 +58,39 @@ class StackOperation {
|
|
|
57
58
|
}
|
|
58
59
|
async undo() {
|
|
59
60
|
this._pauseableEmitter.pause();
|
|
60
|
-
|
|
61
|
-
|
|
61
|
+
try {
|
|
62
|
+
for (let i = this._operations.length - 1; i >= 0; i--) {
|
|
63
|
+
await this._operations[i].undo();
|
|
64
|
+
}
|
|
65
|
+
this._postUndoRedo(this._beginAlternativeVersionId);
|
|
66
|
+
this._pauseableEmitter.fire({
|
|
67
|
+
rawEvents: [],
|
|
68
|
+
synchronous: undefined,
|
|
69
|
+
versionId: this.textModel.versionId,
|
|
70
|
+
endSelectionState: this._beginSelectionState
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
finally {
|
|
74
|
+
this._pauseableEmitter.resume();
|
|
62
75
|
}
|
|
63
|
-
this._postUndoRedo(this._beginAlternativeVersionId);
|
|
64
|
-
this._pauseableEmitter.fire({
|
|
65
|
-
rawEvents: [],
|
|
66
|
-
synchronous: undefined,
|
|
67
|
-
versionId: this.textModel.versionId,
|
|
68
|
-
endSelectionState: this._beginSelectionState
|
|
69
|
-
});
|
|
70
|
-
this._pauseableEmitter.resume();
|
|
71
76
|
}
|
|
72
77
|
async redo() {
|
|
73
78
|
this._pauseableEmitter.pause();
|
|
74
|
-
|
|
75
|
-
|
|
79
|
+
try {
|
|
80
|
+
for (let i = 0; i < this._operations.length; i++) {
|
|
81
|
+
await this._operations[i].redo();
|
|
82
|
+
}
|
|
83
|
+
this._postUndoRedo(this._resultAlternativeVersionId);
|
|
84
|
+
this._pauseableEmitter.fire({
|
|
85
|
+
rawEvents: [],
|
|
86
|
+
synchronous: undefined,
|
|
87
|
+
versionId: this.textModel.versionId,
|
|
88
|
+
endSelectionState: this._resultSelectionState
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
finally {
|
|
92
|
+
this._pauseableEmitter.resume();
|
|
76
93
|
}
|
|
77
|
-
this._postUndoRedo(this._resultAlternativeVersionId);
|
|
78
|
-
this._pauseableEmitter.fire({
|
|
79
|
-
rawEvents: [],
|
|
80
|
-
synchronous: undefined,
|
|
81
|
-
versionId: this.textModel.versionId,
|
|
82
|
-
endSelectionState: this._resultSelectionState
|
|
83
|
-
});
|
|
84
|
-
this._pauseableEmitter.resume();
|
|
85
94
|
}
|
|
86
95
|
}
|
|
87
96
|
class NotebookOperationManager {
|
|
@@ -118,6 +127,9 @@ class NotebookOperationManager {
|
|
|
118
127
|
}
|
|
119
128
|
}
|
|
120
129
|
class NotebookEventEmitter extends PauseableEmitter {
|
|
130
|
+
get isEmpty() {
|
|
131
|
+
return this._eventQueue.isEmpty();
|
|
132
|
+
}
|
|
121
133
|
isDirtyEvent() {
|
|
122
134
|
for (const e of this._eventQueue) {
|
|
123
135
|
for (let i = 0; i < e.rawEvents.length; i++) {
|
|
@@ -331,7 +343,7 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
331
343
|
const edits = NotebookTextModel_1.computeEdits(this, cells);
|
|
332
344
|
this.applyEdits([
|
|
333
345
|
...edits,
|
|
334
|
-
{ editType:
|
|
346
|
+
{ editType: CellEditType.DocumentMetadata, metadata }
|
|
335
347
|
], true, undefined, () => undefined, undefined, false);
|
|
336
348
|
}
|
|
337
349
|
static computeEdits(model, cells) {
|
|
@@ -340,7 +352,7 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
340
352
|
if (commonPrefix > 0) {
|
|
341
353
|
for (let i = 0; i < commonPrefix; i++) {
|
|
342
354
|
edits.push({
|
|
343
|
-
editType:
|
|
355
|
+
editType: CellEditType.Metadata,
|
|
344
356
|
index: i,
|
|
345
357
|
metadata: cells[i].metadata ?? {}
|
|
346
358
|
}, ...this._computeOutputEdit(i, model.cells[i].outputs, cells[i].outputs));
|
|
@@ -351,18 +363,18 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
351
363
|
}
|
|
352
364
|
const commonSuffix = this._commonSuffix(model.cells, model.cells.length - commonPrefix, commonPrefix, cells, cells.length - commonPrefix, commonPrefix);
|
|
353
365
|
if (commonSuffix > 0) {
|
|
354
|
-
edits.push({ editType:
|
|
366
|
+
edits.push({ editType: CellEditType.Replace, index: commonPrefix, count: model.cells.length - commonPrefix - commonSuffix, cells: cells.slice(commonPrefix, cells.length - commonSuffix) });
|
|
355
367
|
}
|
|
356
368
|
else if (commonPrefix > 0) {
|
|
357
|
-
edits.push({ editType:
|
|
369
|
+
edits.push({ editType: CellEditType.Replace, index: commonPrefix, count: model.cells.length - commonPrefix, cells: cells.slice(commonPrefix) });
|
|
358
370
|
}
|
|
359
371
|
else {
|
|
360
|
-
edits.push({ editType:
|
|
372
|
+
edits.push({ editType: CellEditType.Replace, index: 0, count: model.cells.length, cells });
|
|
361
373
|
}
|
|
362
374
|
if (commonSuffix > 0) {
|
|
363
375
|
for (let i = commonSuffix; i > 0; i--) {
|
|
364
376
|
edits.push({
|
|
365
|
-
editType:
|
|
377
|
+
editType: CellEditType.Metadata,
|
|
366
378
|
index: model.cells.length - i,
|
|
367
379
|
metadata: cells[cells.length - i].metadata ?? {}
|
|
368
380
|
}, ...this._computeOutputEdit(model.cells.length - i, model.cells[model.cells.length - i].outputs, cells[cells.length - i].outputs));
|
|
@@ -374,7 +386,7 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
374
386
|
if (a.length !== b.length) {
|
|
375
387
|
return [
|
|
376
388
|
{
|
|
377
|
-
editType:
|
|
389
|
+
editType: CellEditType.Output,
|
|
378
390
|
index: index,
|
|
379
391
|
outputs: b,
|
|
380
392
|
append: false
|
|
@@ -386,7 +398,7 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
386
398
|
}
|
|
387
399
|
return ( b.map((output, i) => {
|
|
388
400
|
return {
|
|
389
|
-
editType:
|
|
401
|
+
editType: CellEditType.OutputItems,
|
|
390
402
|
outputId: a[i].outputId,
|
|
391
403
|
items: output.outputs,
|
|
392
404
|
append: false
|
|
@@ -417,10 +429,12 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
417
429
|
return true;
|
|
418
430
|
}
|
|
419
431
|
finally {
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
432
|
+
if (!this._pauseableEmitter.isEmpty) {
|
|
433
|
+
const endSelections = endSelectionsComputer();
|
|
434
|
+
this._increaseVersionId(this._operationManager.isUndoStackEmpty() && !this._pauseableEmitter.isDirtyEvent());
|
|
435
|
+
this._operationManager.pushStackElement(this._alternativeVersionId, endSelections);
|
|
436
|
+
this._pauseableEmitter.fire({ rawEvents: [], versionId: this.versionId, synchronous: synchronous, endSelectionState: endSelections });
|
|
437
|
+
}
|
|
424
438
|
this._pauseableEmitter.resume();
|
|
425
439
|
}
|
|
426
440
|
}
|
|
@@ -443,15 +457,15 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
443
457
|
return null;
|
|
444
458
|
}
|
|
445
459
|
}
|
|
446
|
-
else if (edit.editType !==
|
|
460
|
+
else if (edit.editType !== CellEditType.DocumentMetadata) {
|
|
447
461
|
throw ( new Error('Invalid cell edit'));
|
|
448
462
|
}
|
|
449
463
|
return {
|
|
450
464
|
edit,
|
|
451
465
|
cellIndex,
|
|
452
|
-
end: (
|
|
466
|
+
end: (edit.editType === CellEditType.DocumentMetadata)
|
|
453
467
|
? undefined
|
|
454
|
-
: (edit.editType ===
|
|
468
|
+
: (edit.editType === CellEditType.Replace ? edit.index + edit.count : cellIndex),
|
|
455
469
|
originalIndex: index
|
|
456
470
|
};
|
|
457
471
|
})).filter(isDefined);
|
|
@@ -483,7 +497,7 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
483
497
|
const replaceEdits = [];
|
|
484
498
|
const otherEdits = [];
|
|
485
499
|
editsOnSameIndex.forEach(edit => {
|
|
486
|
-
if (edit.edit.editType ===
|
|
500
|
+
if (edit.edit.editType === CellEditType.Replace) {
|
|
487
501
|
replaceEdits.push(edit);
|
|
488
502
|
}
|
|
489
503
|
else {
|
|
@@ -495,10 +509,10 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
495
509
|
const flattenEdits = edits.flat();
|
|
496
510
|
for (const { edit, cellIndex } of flattenEdits) {
|
|
497
511
|
switch (edit.editType) {
|
|
498
|
-
case
|
|
512
|
+
case CellEditType.Replace:
|
|
499
513
|
this._replaceCells(edit.index, edit.count, edit.cells, synchronous, computeUndoRedo, beginSelectionState, undoRedoGroup);
|
|
500
514
|
break;
|
|
501
|
-
case
|
|
515
|
+
case CellEditType.Output: {
|
|
502
516
|
this._assertIndex(cellIndex);
|
|
503
517
|
const cell = this._cells[cellIndex];
|
|
504
518
|
if (edit.append) {
|
|
@@ -509,7 +523,7 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
509
523
|
}
|
|
510
524
|
break;
|
|
511
525
|
}
|
|
512
|
-
case
|
|
526
|
+
case CellEditType.OutputItems:
|
|
513
527
|
{
|
|
514
528
|
this._assertIndex(cellIndex);
|
|
515
529
|
const cell = this._cells[cellIndex];
|
|
@@ -521,26 +535,26 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
521
535
|
}
|
|
522
536
|
}
|
|
523
537
|
break;
|
|
524
|
-
case
|
|
538
|
+
case CellEditType.Metadata:
|
|
525
539
|
this._assertIndex(edit.index);
|
|
526
540
|
this._changeCellMetadata(this._cells[edit.index], edit.metadata, computeUndoRedo, beginSelectionState, undoRedoGroup);
|
|
527
541
|
break;
|
|
528
|
-
case
|
|
542
|
+
case CellEditType.PartialMetadata:
|
|
529
543
|
this._assertIndex(cellIndex);
|
|
530
544
|
this._changeCellMetadataPartial(this._cells[cellIndex], edit.metadata, computeUndoRedo, beginSelectionState, undoRedoGroup);
|
|
531
545
|
break;
|
|
532
|
-
case
|
|
546
|
+
case CellEditType.PartialInternalMetadata:
|
|
533
547
|
this._assertIndex(cellIndex);
|
|
534
548
|
this._changeCellInternalMetadataPartial(this._cells[cellIndex], edit.internalMetadata);
|
|
535
549
|
break;
|
|
536
|
-
case
|
|
550
|
+
case CellEditType.CellLanguage:
|
|
537
551
|
this._assertIndex(edit.index);
|
|
538
552
|
this._changeCellLanguage(this._cells[edit.index], edit.language, computeUndoRedo, beginSelectionState, undoRedoGroup);
|
|
539
553
|
break;
|
|
540
|
-
case
|
|
554
|
+
case CellEditType.DocumentMetadata:
|
|
541
555
|
this._updateNotebookCellMetadata(edit.metadata, computeUndoRedo, beginSelectionState, undoRedoGroup);
|
|
542
556
|
break;
|
|
543
|
-
case
|
|
557
|
+
case CellEditType.Move:
|
|
544
558
|
this._moveCellToIdx(edit.index, edit.length, edit.newIdx, synchronous, computeUndoRedo, beginSelectionState, undefined, undoRedoGroup);
|
|
545
559
|
break;
|
|
546
560
|
}
|
|
@@ -551,17 +565,17 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
551
565
|
rawEdits.forEach(edit => {
|
|
552
566
|
if (mergedEdits.length) {
|
|
553
567
|
const last = mergedEdits[mergedEdits.length - 1];
|
|
554
|
-
if (last.edit.editType ===
|
|
568
|
+
if (last.edit.editType === CellEditType.Output
|
|
555
569
|
&& last.edit.append
|
|
556
|
-
&& edit.edit.editType ===
|
|
570
|
+
&& edit.edit.editType === CellEditType.Output
|
|
557
571
|
&& edit.edit.append
|
|
558
572
|
&& last.cellIndex === edit.cellIndex) {
|
|
559
573
|
last.edit.outputs = [...last.edit.outputs, ...edit.edit.outputs];
|
|
560
574
|
}
|
|
561
|
-
else if (last.edit.editType ===
|
|
575
|
+
else if (last.edit.editType === CellEditType.Output
|
|
562
576
|
&& !last.edit.append
|
|
563
577
|
&& last.edit.outputs.length === 0
|
|
564
|
-
&& edit.edit.editType ===
|
|
578
|
+
&& edit.edit.editType === CellEditType.Output
|
|
565
579
|
&& edit.edit.append
|
|
566
580
|
&& last.cellIndex === edit.cellIndex) {
|
|
567
581
|
last.edit.append = false;
|
|
@@ -674,7 +688,7 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
674
688
|
const that = this;
|
|
675
689
|
this._operationManager.pushEditOperation(new (class {
|
|
676
690
|
constructor() {
|
|
677
|
-
this.type =
|
|
691
|
+
this.type = UndoRedoElementType.Resource;
|
|
678
692
|
this.label = 'Update Cell Metadata';
|
|
679
693
|
this.code = 'undoredo.textBufferEdit';
|
|
680
694
|
}
|
|
@@ -865,7 +879,7 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
865
879
|
const that = this;
|
|
866
880
|
this._operationManager.pushEditOperation(new (class {
|
|
867
881
|
constructor() {
|
|
868
|
-
this.type =
|
|
882
|
+
this.type = UndoRedoElementType.Resource;
|
|
869
883
|
this.label = 'Update Cell Language';
|
|
870
884
|
this.code = 'undoredo.textBufferEdit';
|
|
871
885
|
}
|
package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js
CHANGED
|
@@ -16,14 +16,16 @@ import { NotebookProviderInfo } from './notebookProvider.js';
|
|
|
16
16
|
import { assertIsDefined } from 'vscode/vscode/vs/base/common/types';
|
|
17
17
|
import { CancellationToken } from 'vscode/vscode/vs/base/common/cancellation';
|
|
18
18
|
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
|
|
19
|
+
import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry.service';
|
|
19
20
|
|
|
20
21
|
let NotebookModelReferenceCollection = class NotebookModelReferenceCollection extends ReferenceCollection {
|
|
21
|
-
constructor(_instantiationService, _notebookService, _logService, _configurationService) {
|
|
22
|
+
constructor(_instantiationService, _notebookService, _logService, _configurationService, _telemetryService) {
|
|
22
23
|
super();
|
|
23
24
|
this._instantiationService = _instantiationService;
|
|
24
25
|
this._notebookService = _notebookService;
|
|
25
26
|
this._logService = _logService;
|
|
26
27
|
this._configurationService = _configurationService;
|
|
28
|
+
this._telemetryService = _telemetryService;
|
|
27
29
|
this._disposables = ( new DisposableStore());
|
|
28
30
|
this._workingCopyManagers = ( new Map());
|
|
29
31
|
this._modelListener = ( new Map());
|
|
@@ -50,7 +52,12 @@ let NotebookModelReferenceCollection = class NotebookModelReferenceCollection ex
|
|
|
50
52
|
const workingCopyTypeId = NotebookWorkingCopyTypeIdentifier.create(viewType);
|
|
51
53
|
let workingCopyManager = this._workingCopyManagers.get(workingCopyTypeId);
|
|
52
54
|
if (!workingCopyManager) {
|
|
53
|
-
const factory = ( new NotebookFileWorkingCopyModelFactory(
|
|
55
|
+
const factory = ( new NotebookFileWorkingCopyModelFactory(
|
|
56
|
+
viewType,
|
|
57
|
+
this._notebookService,
|
|
58
|
+
this._configurationService,
|
|
59
|
+
this._telemetryService
|
|
60
|
+
));
|
|
54
61
|
workingCopyManager = this._instantiationService.createInstance(FileWorkingCopyManager, workingCopyTypeId, factory, factory);
|
|
55
62
|
this._workingCopyManagers.set(workingCopyTypeId, workingCopyManager);
|
|
56
63
|
}
|
|
@@ -103,7 +110,8 @@ NotebookModelReferenceCollection = ( __decorate([
|
|
|
103
110
|
( __param(0, IInstantiationService)),
|
|
104
111
|
( __param(1, INotebookService)),
|
|
105
112
|
( __param(2, ILogService)),
|
|
106
|
-
( __param(3, IConfigurationService))
|
|
113
|
+
( __param(3, IConfigurationService)),
|
|
114
|
+
( __param(4, ITelemetryService))
|
|
107
115
|
], NotebookModelReferenceCollection));
|
|
108
116
|
let NotebookModelResolverServiceImpl = class NotebookModelResolverServiceImpl {
|
|
109
117
|
constructor(instantiationService, _notebookService, _extensionService, _uriIdentService) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { parse } from 'vscode/vscode/vs/base/common/glob';
|
|
2
2
|
import { Iterable } from 'vscode/vscode/vs/base/common/iterator';
|
|
3
3
|
import { joinPath } from 'vscode/vscode/vs/base/common/resources';
|
|
4
|
+
import { RendererMessagingSpec, NotebookRendererMatch } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
4
5
|
|
|
5
6
|
class DependencyList {
|
|
6
7
|
constructor(value) {
|
|
@@ -34,32 +35,32 @@ class NotebookOutputRendererInfo {
|
|
|
34
35
|
this.mimeTypeGlobs = ( this.mimeTypes.map(pattern => parse(pattern)));
|
|
35
36
|
this.hardDependencies = ( new DependencyList(descriptor.dependencies ?? Iterable.empty()));
|
|
36
37
|
this.optionalDependencies = ( new DependencyList(descriptor.optionalDependencies ?? Iterable.empty()));
|
|
37
|
-
this.messaging = descriptor.requiresMessaging ??
|
|
38
|
+
this.messaging = descriptor.requiresMessaging ?? RendererMessagingSpec.Never;
|
|
38
39
|
}
|
|
39
40
|
matchesWithoutKernel(mimeType) {
|
|
40
41
|
if (!this.matchesMimeTypeOnly(mimeType)) {
|
|
41
|
-
return
|
|
42
|
+
return NotebookRendererMatch.Never;
|
|
42
43
|
}
|
|
43
44
|
if (this.hardDependencies.defined) {
|
|
44
|
-
return
|
|
45
|
+
return NotebookRendererMatch.WithHardKernelDependency;
|
|
45
46
|
}
|
|
46
47
|
if (this.optionalDependencies.defined) {
|
|
47
|
-
return
|
|
48
|
+
return NotebookRendererMatch.WithOptionalKernelDependency;
|
|
48
49
|
}
|
|
49
|
-
return
|
|
50
|
+
return NotebookRendererMatch.Pure;
|
|
50
51
|
}
|
|
51
52
|
matches(mimeType, kernelProvides) {
|
|
52
53
|
if (!this.matchesMimeTypeOnly(mimeType)) {
|
|
53
|
-
return
|
|
54
|
+
return NotebookRendererMatch.Never;
|
|
54
55
|
}
|
|
55
56
|
if (this.hardDependencies.defined) {
|
|
56
57
|
return this.hardDependencies.matches(kernelProvides)
|
|
57
|
-
?
|
|
58
|
-
:
|
|
58
|
+
? NotebookRendererMatch.WithHardKernelDependency
|
|
59
|
+
: NotebookRendererMatch.Never;
|
|
59
60
|
}
|
|
60
61
|
return this.optionalDependencies.matches(kernelProvides)
|
|
61
|
-
?
|
|
62
|
-
:
|
|
62
|
+
? NotebookRendererMatch.WithOptionalKernelDependency
|
|
63
|
+
: NotebookRendererMatch.Pure;
|
|
63
64
|
}
|
|
64
65
|
matchesMimeTypeOnly(mimeType) {
|
|
65
66
|
if (this.entrypoint.extends) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { LcsDiff } from 'vscode/vscode/vs/base/common/diff/diff';
|
|
2
2
|
import { numberHash, doHash, hash } from 'vscode/vscode/vs/base/common/hash';
|
|
3
3
|
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
4
|
+
import { DefaultEndOfLine, EndOfLinePreference } from 'vscode/vscode/vs/editor/common/model';
|
|
4
5
|
import { PieceTreeTextBufferBuilder } from 'vscode/vscode/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeTextBufferBuilder';
|
|
5
6
|
import { NotebookCellsChangeType, CellKind } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
6
7
|
import { Range } from 'vscode/vscode/vs/editor/common/core/range';
|
|
@@ -21,7 +22,7 @@ class MirrorCell {
|
|
|
21
22
|
const builder = ( new PieceTreeTextBufferBuilder());
|
|
22
23
|
builder.acceptChunk(Array.isArray(this._source) ? this._source.join('\n') : this._source);
|
|
23
24
|
const bufferFactory = builder.finish(true);
|
|
24
|
-
this._textBuffer = bufferFactory.create(
|
|
25
|
+
this._textBuffer = bufferFactory.create(DefaultEndOfLine.LF).textBuffer;
|
|
25
26
|
return this._textBuffer;
|
|
26
27
|
}
|
|
27
28
|
primaryKey() {
|
|
@@ -47,7 +48,7 @@ class MirrorCell {
|
|
|
47
48
|
}
|
|
48
49
|
getValue() {
|
|
49
50
|
const fullRange = this.getFullModelRange();
|
|
50
|
-
return this.textBuffer.getValueInRange(fullRange,
|
|
51
|
+
return this.textBuffer.getValueInRange(fullRange, EndOfLinePreference.LF);
|
|
51
52
|
}
|
|
52
53
|
getComparisonValue() {
|
|
53
54
|
if (this._primaryKey !== null) {
|
|
@@ -12,10 +12,12 @@ import { SaveSourceRegistry } from 'vscode/vscode/vs/workbench/common/editor';
|
|
|
12
12
|
import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService.service';
|
|
13
13
|
import { IPathService } from 'vscode/vscode/vs/workbench/services/path/common/pathService.service';
|
|
14
14
|
import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
|
|
15
|
+
import { StoredFileWorkingCopyState } from 'vscode/vscode/vs/workbench/services/workingCopy/common/storedFileWorkingCopy';
|
|
15
16
|
import { StoredFileWorkingCopyManager } from './storedFileWorkingCopyManager.js';
|
|
16
17
|
import { UntitledFileWorkingCopy } from './untitledFileWorkingCopy.js';
|
|
17
18
|
import { UntitledFileWorkingCopyManager } from './untitledFileWorkingCopyManager.js';
|
|
18
19
|
import { IWorkingCopyFileService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyFileService.service';
|
|
20
|
+
import { SnapshotContext } from 'vscode/vscode/vs/workbench/services/workingCopy/common/fileWorkingCopy';
|
|
19
21
|
import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label.service';
|
|
20
22
|
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
21
23
|
import { INotificationService } from 'vscode/vscode/vs/platform/notification/common/notification.service';
|
|
@@ -107,7 +109,7 @@ let FileWorkingCopyManager = class FileWorkingCopyManager extends Disposable {
|
|
|
107
109
|
}
|
|
108
110
|
registerListeners() {
|
|
109
111
|
this._register(this.stored.onDidResolve(workingCopy => {
|
|
110
|
-
if (workingCopy.isReadonly() || workingCopy.hasState(
|
|
112
|
+
if (workingCopy.isReadonly() || workingCopy.hasState(StoredFileWorkingCopyState.ORPHAN)) {
|
|
111
113
|
this._onDidChange.fire([workingCopy.resource]);
|
|
112
114
|
}
|
|
113
115
|
}));
|
|
@@ -121,7 +123,7 @@ let FileWorkingCopyManager = class FileWorkingCopyManager extends Disposable {
|
|
|
121
123
|
return undefined;
|
|
122
124
|
}
|
|
123
125
|
const isReadonly = workingCopy.isReadonly();
|
|
124
|
-
const isOrphaned = workingCopy.hasState(
|
|
126
|
+
const isOrphaned = workingCopy.hasState(StoredFileWorkingCopyState.ORPHAN);
|
|
125
127
|
if (isReadonly && isOrphaned) {
|
|
126
128
|
return {
|
|
127
129
|
color: listErrorForeground,
|
|
@@ -210,7 +212,7 @@ let FileWorkingCopyManager = class FileWorkingCopyManager extends Disposable {
|
|
|
210
212
|
let sourceContents;
|
|
211
213
|
const sourceWorkingCopy = this.get(source);
|
|
212
214
|
if (sourceWorkingCopy?.isResolved()) {
|
|
213
|
-
sourceContents = await sourceWorkingCopy.model.snapshot(
|
|
215
|
+
sourceContents = await sourceWorkingCopy.model.snapshot(SnapshotContext.Save, CancellationToken.None);
|
|
214
216
|
}
|
|
215
217
|
else {
|
|
216
218
|
sourceContents = (await this.fileService.readFileStream(source)).value;
|
|
@@ -2,9 +2,10 @@ import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
|
2
2
|
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
3
3
|
import { DisposableStore, dispose } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
4
4
|
import { Emitter, Event } from 'vscode/vscode/vs/base/common/event';
|
|
5
|
-
import { StoredFileWorkingCopy } from 'vscode/vscode/vs/workbench/services/workingCopy/common/storedFileWorkingCopy';
|
|
5
|
+
import { StoredFileWorkingCopyState, StoredFileWorkingCopy } from 'vscode/vscode/vs/workbench/services/workingCopy/common/storedFileWorkingCopy';
|
|
6
6
|
import { ResourceMap } from 'vscode/vscode/vs/base/common/map';
|
|
7
7
|
import { ResourceQueue, Promises } from 'vscode/vscode/vs/base/common/async';
|
|
8
|
+
import { FileChangeType, FileOperation } from 'vscode/vscode/vs/platform/files/common/files';
|
|
8
9
|
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
|
|
9
10
|
import { ILifecycleService } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle.service';
|
|
10
11
|
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
@@ -24,6 +25,7 @@ import { IWorkingCopyEditorService } from 'vscode/vscode/vs/workbench/services/w
|
|
|
24
25
|
import { IWorkingCopyService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyService.service';
|
|
25
26
|
import { isWeb } from 'vscode/vscode/vs/base/common/platform';
|
|
26
27
|
import { onUnexpectedError } from 'vscode/vscode/vs/base/common/errors';
|
|
28
|
+
import { SnapshotContext } from 'vscode/vscode/vs/workbench/services/workingCopy/common/fileWorkingCopy';
|
|
27
29
|
|
|
28
30
|
const _moduleId = "vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager";
|
|
29
31
|
let StoredFileWorkingCopyManager = class StoredFileWorkingCopyManager extends BaseFileWorkingCopyManager {
|
|
@@ -79,7 +81,7 @@ let StoredFileWorkingCopyManager = class StoredFileWorkingCopyManager extends Ba
|
|
|
79
81
|
}
|
|
80
82
|
onBeforeShutdownWeb() {
|
|
81
83
|
if (( (this.workingCopies.some(
|
|
82
|
-
workingCopy => workingCopy.hasState(
|
|
84
|
+
workingCopy => workingCopy.hasState(StoredFileWorkingCopyState.PENDING_SAVE)
|
|
83
85
|
)))) {
|
|
84
86
|
return true;
|
|
85
87
|
}
|
|
@@ -87,9 +89,9 @@ let StoredFileWorkingCopyManager = class StoredFileWorkingCopyManager extends Ba
|
|
|
87
89
|
}
|
|
88
90
|
async onWillShutdownDesktop() {
|
|
89
91
|
let pendingSavedWorkingCopies;
|
|
90
|
-
while ((pendingSavedWorkingCopies = this.workingCopies.filter(workingCopy => workingCopy.hasState(
|
|
92
|
+
while ((pendingSavedWorkingCopies = this.workingCopies.filter(workingCopy => workingCopy.hasState(StoredFileWorkingCopyState.PENDING_SAVE))).length > 0) {
|
|
91
93
|
await Promises.settled(( (pendingSavedWorkingCopies.map(
|
|
92
|
-
workingCopy => workingCopy.joinState(
|
|
94
|
+
workingCopy => workingCopy.joinState(StoredFileWorkingCopyState.PENDING_SAVE)
|
|
93
95
|
))));
|
|
94
96
|
}
|
|
95
97
|
}
|
|
@@ -115,7 +117,7 @@ let StoredFileWorkingCopyManager = class StoredFileWorkingCopyManager extends Ba
|
|
|
115
117
|
resolveWorkingCopy = schemeOrEvent === workingCopy.resource.scheme;
|
|
116
118
|
}
|
|
117
119
|
else {
|
|
118
|
-
resolveWorkingCopy = schemeOrEvent.contains(workingCopy.resource,
|
|
120
|
+
resolveWorkingCopy = schemeOrEvent.contains(workingCopy.resource, FileChangeType.UPDATED, FileChangeType.ADDED);
|
|
119
121
|
}
|
|
120
122
|
if (resolveWorkingCopy) {
|
|
121
123
|
this.queueWorkingCopyReload(workingCopy);
|
|
@@ -136,7 +138,7 @@ let StoredFileWorkingCopyManager = class StoredFileWorkingCopyManager extends Ba
|
|
|
136
138
|
}
|
|
137
139
|
}
|
|
138
140
|
onWillRunWorkingCopyFileOperation(e) {
|
|
139
|
-
if (e.operation ===
|
|
141
|
+
if (e.operation === FileOperation.MOVE || e.operation === FileOperation.COPY) {
|
|
140
142
|
e.waitUntil((async () => {
|
|
141
143
|
const workingCopiesToRestore = [];
|
|
142
144
|
for (const { source, target } of e.files) {
|
|
@@ -162,7 +164,7 @@ let StoredFileWorkingCopyManager = class StoredFileWorkingCopyManager extends Ba
|
|
|
162
164
|
workingCopiesToRestore.push({
|
|
163
165
|
source: sourceResource,
|
|
164
166
|
target: targetResource,
|
|
165
|
-
snapshot: sourceWorkingCopy.isDirty() ? await sourceWorkingCopy.model?.snapshot(
|
|
167
|
+
snapshot: sourceWorkingCopy.isDirty() ? await sourceWorkingCopy.model?.snapshot(SnapshotContext.Save, CancellationToken.None) : undefined
|
|
166
168
|
});
|
|
167
169
|
}
|
|
168
170
|
}
|
|
@@ -172,7 +174,7 @@ let StoredFileWorkingCopyManager = class StoredFileWorkingCopyManager extends Ba
|
|
|
172
174
|
}
|
|
173
175
|
}
|
|
174
176
|
onDidFailWorkingCopyFileOperation(e) {
|
|
175
|
-
if ((
|
|
177
|
+
if ((e.operation === FileOperation.MOVE || e.operation === FileOperation.COPY)) {
|
|
176
178
|
const workingCopiesToRestore = this.mapCorrelationIdToWorkingCopiesToRestore.get(e.correlationId);
|
|
177
179
|
if (workingCopiesToRestore) {
|
|
178
180
|
this.mapCorrelationIdToWorkingCopiesToRestore.delete(e.correlationId);
|
|
@@ -186,7 +188,7 @@ let StoredFileWorkingCopyManager = class StoredFileWorkingCopyManager extends Ba
|
|
|
186
188
|
}
|
|
187
189
|
onDidRunWorkingCopyFileOperation(e) {
|
|
188
190
|
switch (e.operation) {
|
|
189
|
-
case
|
|
191
|
+
case FileOperation.CREATE:
|
|
190
192
|
e.waitUntil((async () => {
|
|
191
193
|
for (const { target } of e.files) {
|
|
192
194
|
const workingCopy = this.get(target);
|
|
@@ -196,14 +198,15 @@ let StoredFileWorkingCopyManager = class StoredFileWorkingCopyManager extends Ba
|
|
|
196
198
|
}
|
|
197
199
|
})());
|
|
198
200
|
break;
|
|
199
|
-
case
|
|
200
|
-
case
|
|
201
|
+
case FileOperation.MOVE:
|
|
202
|
+
case FileOperation.COPY:
|
|
201
203
|
e.waitUntil((async () => {
|
|
202
204
|
const workingCopiesToRestore = this.mapCorrelationIdToWorkingCopiesToRestore.get(e.correlationId);
|
|
203
205
|
if (workingCopiesToRestore) {
|
|
204
206
|
this.mapCorrelationIdToWorkingCopiesToRestore.delete(e.correlationId);
|
|
205
207
|
await Promises.settled(( (workingCopiesToRestore.map(async (workingCopyToRestore) => {
|
|
206
|
-
|
|
208
|
+
const target = this.uriIdentityService.asCanonicalUri(workingCopyToRestore.target);
|
|
209
|
+
await this.resolve(target, {
|
|
207
210
|
reload: { async: false },
|
|
208
211
|
contents: workingCopyToRestore.snapshot
|
|
209
212
|
});
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
2
|
import { Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
3
|
+
import { WorkingCopyCapabilities } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopy';
|
|
4
|
+
import { SnapshotContext } from 'vscode/vscode/vs/workbench/services/workingCopy/common/fileWorkingCopy';
|
|
3
5
|
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
4
6
|
import { IWorkingCopyService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyService.service';
|
|
5
7
|
import { CancellationToken } from 'vscode/vscode/vs/base/common/cancellation';
|
|
@@ -22,7 +24,7 @@ let UntitledFileWorkingCopy = class UntitledFileWorkingCopy extends Disposable {
|
|
|
22
24
|
this.saveDelegate = saveDelegate;
|
|
23
25
|
this.workingCopyBackupService = workingCopyBackupService;
|
|
24
26
|
this.logService = logService;
|
|
25
|
-
this.capabilities = this.isScratchpad ?
|
|
27
|
+
this.capabilities = this.isScratchpad ? WorkingCopyCapabilities.Untitled | WorkingCopyCapabilities.Scratchpad : WorkingCopyCapabilities.Untitled;
|
|
26
28
|
this._model = undefined;
|
|
27
29
|
this._onDidChangeContent = this._register(( new Emitter()));
|
|
28
30
|
this.onDidChangeContent = this._onDidChangeContent.event;
|
|
@@ -105,7 +107,7 @@ let UntitledFileWorkingCopy = class UntitledFileWorkingCopy extends Disposable {
|
|
|
105
107
|
async backup(token) {
|
|
106
108
|
let content = undefined;
|
|
107
109
|
if (this.isResolved()) {
|
|
108
|
-
content = await raceCancellation(this.model.snapshot(
|
|
110
|
+
content = await raceCancellation(this.model.snapshot(SnapshotContext.Backup, token), token);
|
|
109
111
|
}
|
|
110
112
|
else if (this.initialContents) {
|
|
111
113
|
content = this.initialContents.value;
|