@codingame/monaco-vscode-notebook-service-override 11.1.2 → 12.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.d.ts +2 -1
- package/index.js +64 -1
- package/package.json +47 -15
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.d.ts +38 -0
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +43 -41
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +109 -130
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticEditorContrib.d.ts +25 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticEditorContrib.js +13 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticsActions.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticsActions.js +72 -19
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/diagnosticCellStatusBarContrib.d.ts +7 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/diagnosticCellStatusBarContrib.js +23 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.d.ts +14 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.js +4 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +30 -28
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookSynchronizerService.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookSynchronizerService.js +76 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.d.ts +21 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +61 -58
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.js +5 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookCellPausing.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookCellPausing.js +4 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.d.ts +28 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +8 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.d.ts +20 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.js +10 -9
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +52 -50
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/execute/executionEditorProgress.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/execute/executionEditorProgress.js +3 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/media/notebookFind.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +28 -28
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +51 -50
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +21 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/kernelDetection/notebookKernelDetection.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/kernelDetection/notebookKernelDetection.js +4 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.d.ts +11 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +3 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +6 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookMulticursor.d.ts +69 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookMulticursor.js +460 -382
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookSelectionHighlight.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookSelectionHighlight.js +124 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +87 -145
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableContextKeys.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableContextKeys.js +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.d.ts +27 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +16 -15
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.d.ts +38 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +8 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.d.ts +34 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +9 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.d.ts +53 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +40 -36
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.d.ts +112 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +115 -116
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +4 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.d.ts +32 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +111 -117
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +11 -9
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +5 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.js +7 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/apiActions.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/apiActions.js +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +113 -198
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.js +25 -23
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/editActions.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/editActions.js +115 -145
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +76 -147
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +45 -77
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +30 -35
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/notebookIndentationActions.d.ts +27 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/notebookIndentationActions.js +19 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.d.ts +30 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.js +59 -52
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/variablesActions.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/variablesActions.js +11 -21
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +69 -113
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.d.ts +14 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +194 -184
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibilityHelp.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibilityHelp.js +51 -51
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibleView.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibleView.js +14 -36
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.d.ts +48 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +57 -56
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookCellStatusBarServiceImpl.d.ts +16 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookCellStatusBarServiceImpl.js +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.d.ts +43 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +29 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.d.ts +30 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +17 -16
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.d.ts +46 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +14 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.d.ts +25 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +21 -19
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.d.ts +57 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +7 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.d.ts +20 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +30 -26
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +6 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.d.ts +23 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.js +2 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.d.ts +134 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +164 -121
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.d.ts +14 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +2 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.d.ts +21 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.js +37 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.d.ts +56 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.js +6 -3
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.d.ts +101 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +131 -55
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.d.ts +29 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +4 -3
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.d.ts +48 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.js +12 -10
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookProvider.d.ts +38 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookProvider.js +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookSimpleWorker.d.ts +50 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookSimpleWorker.js +75 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookSimpleWorkerMain.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookSimpleWorkerMain.js +2 -1
- package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.d.ts +31 -0
- package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.js +2 -1
- package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.d.ts +78 -0
- package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +45 -42
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.d.ts +96 -0
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +57 -54
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.d.ts +74 -0
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.js +6 -3
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopyManager.d.ts +53 -0
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopyManager.js +2 -1
- package/worker.js +2 -1
- package/workers/notebook.worker.d.ts +1 -0
- package/notebook.js +0 -50
- package/workers/notebook.worker.js +0 -1
package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
|
|
2
|
+
import 'vscode/vscode/vs/base/common/event';
|
|
3
|
+
import 'vscode/vscode/vs/base/common/htmlContent';
|
|
4
|
+
import 'vscode/vscode/vs/base/common/filters';
|
|
5
|
+
import 'vscode/vscode/vs/base/common/strings';
|
|
6
|
+
import 'vscode/vscode/vs/base/common/themables';
|
|
7
|
+
import 'vscode/vscode/vs/base/common/keyCodes';
|
|
8
|
+
import 'vscode/vscode/vs/base/common/lifecycle';
|
|
9
|
+
import 'marked';
|
|
10
|
+
import 'vscode/vscode/vs/base/common/charCode';
|
|
11
|
+
import 'vscode/vscode/vs/base/common/marshallingIds';
|
|
12
|
+
import 'vscode/vscode/vs/base/common/path';
|
|
13
|
+
import 'vscode/vscode/vs/base/common/platform';
|
|
14
|
+
import 'vscode/vscode/vs/base/common/network';
|
|
15
|
+
import 'vscode/vscode/vs/base/common/resources';
|
|
16
|
+
import 'vscode/vscode/vs/base/browser/dom';
|
|
17
|
+
import 'vscode/vscode/vs/base/browser/dompurify/dompurify';
|
|
18
|
+
import 'vscode/vscode/vs/base/browser/formattedTextRenderer';
|
|
19
|
+
import 'vscode/vscode/vs/base/browser/browser';
|
|
20
|
+
import 'vscode/vscode/vs/base/common/keybindings';
|
|
21
|
+
import 'vscode/vscode/vs/editor/contrib/documentSymbols/browser/outlineModel';
|
|
22
|
+
import 'vscode/vscode/vs/nls';
|
|
23
|
+
import 'vscode/vscode/vs/editor/common/model';
|
|
24
|
+
import 'vscode/vscode/vs/editor/contrib/folding/browser/foldingRanges';
|
|
25
|
+
import 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
26
|
+
import 'vscode/vscode/vs/base/common/codicons';
|
|
27
|
+
import 'vscode/vscode/vs/platform/markers/common/markers';
|
|
28
|
+
import '@codingame/monaco-vscode-e28ac690-06d5-5ee9-92d1-02df70296354-common/vscode/vs/workbench/contrib/notebook/browser/notebookIcons';
|
|
29
|
+
import 'vscode/vscode/vs/editor/common/languages';
|
|
30
|
+
import 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
31
|
+
|
|
32
|
+
var NotebookOutlineConstants;
|
|
33
|
+
(function (NotebookOutlineConstants) {
|
|
34
|
+
NotebookOutlineConstants[NotebookOutlineConstants["NonHeaderOutlineLevel"] = 7] = "NonHeaderOutlineLevel";
|
|
35
|
+
})(NotebookOutlineConstants || (NotebookOutlineConstants = {}));
|
|
36
|
+
|
|
37
|
+
export { NotebookOutlineConstants };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { IResourceUndoRedoElement, UndoRedoElementType } from "vscode/vscode/vs/platform/undoRedo/common/undoRedo";
|
|
2
|
+
import { URI } from "vscode/vscode/vs/base/common/uri";
|
|
3
|
+
import { NotebookCellTextModel } from "@codingame/monaco-vscode-c465110a-57c0-59d7-a6b2-be0a4db7e517-common/vscode/vs/workbench/contrib/notebook/common/model/notebookCellTextModel";
|
|
4
|
+
import { ISelectionState, NotebookCellMetadata } from "vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon";
|
|
5
|
+
export interface ITextCellEditingDelegate {
|
|
6
|
+
insertCell?(index: number, cell: NotebookCellTextModel, endSelections?: ISelectionState): void;
|
|
7
|
+
deleteCell?(index: number, endSelections?: ISelectionState): void;
|
|
8
|
+
replaceCell?(index: number, count: number, cells: NotebookCellTextModel[], endSelections?: ISelectionState): void;
|
|
9
|
+
moveCell?(fromIndex: number, length: number, toIndex: number, beforeSelections: ISelectionState | undefined, endSelections?: ISelectionState): void;
|
|
10
|
+
updateCellMetadata?(index: number, newMetadata: NotebookCellMetadata): void;
|
|
11
|
+
}
|
|
12
|
+
export declare class MoveCellEdit implements IResourceUndoRedoElement {
|
|
13
|
+
resource: URI;
|
|
14
|
+
private fromIndex;
|
|
15
|
+
private length;
|
|
16
|
+
private toIndex;
|
|
17
|
+
private editingDelegate;
|
|
18
|
+
private beforedSelections;
|
|
19
|
+
private endSelections;
|
|
20
|
+
type: UndoRedoElementType.Resource;
|
|
21
|
+
get label(): "Move Cell" | "Move Cells";
|
|
22
|
+
code: string;
|
|
23
|
+
constructor(resource: URI, fromIndex: number, length: number, toIndex: number, editingDelegate: ITextCellEditingDelegate, beforedSelections: ISelectionState | undefined, endSelections: ISelectionState | undefined);
|
|
24
|
+
undo(): void;
|
|
25
|
+
redo(): void;
|
|
26
|
+
}
|
|
27
|
+
export declare class SpliceCellsEdit implements IResourceUndoRedoElement {
|
|
28
|
+
resource: URI;
|
|
29
|
+
private diffs;
|
|
30
|
+
private editingDelegate;
|
|
31
|
+
private beforeHandles;
|
|
32
|
+
private endHandles;
|
|
33
|
+
type: UndoRedoElementType.Resource;
|
|
34
|
+
get label(): "Insert Cells" | "Insert Cell" | "Delete Cells" | "Delete Cell";
|
|
35
|
+
code: string;
|
|
36
|
+
constructor(resource: URI, diffs: [
|
|
37
|
+
number,
|
|
38
|
+
NotebookCellTextModel[],
|
|
39
|
+
NotebookCellTextModel[]
|
|
40
|
+
][], editingDelegate: ITextCellEditingDelegate, beforeHandles: ISelectionState | undefined, endHandles: ISelectionState | undefined);
|
|
41
|
+
undo(): void;
|
|
42
|
+
redo(): void;
|
|
43
|
+
}
|
|
44
|
+
export declare class CellMetadataEdit implements IResourceUndoRedoElement {
|
|
45
|
+
resource: URI;
|
|
46
|
+
readonly index: number;
|
|
47
|
+
readonly oldMetadata: NotebookCellMetadata;
|
|
48
|
+
readonly newMetadata: NotebookCellMetadata;
|
|
49
|
+
private editingDelegate;
|
|
50
|
+
type: UndoRedoElementType.Resource;
|
|
51
|
+
label: string;
|
|
52
|
+
code: string;
|
|
53
|
+
constructor(resource: URI, index: number, oldMetadata: NotebookCellMetadata, newMetadata: NotebookCellMetadata, editingDelegate: ITextCellEditingDelegate);
|
|
54
|
+
undo(): void;
|
|
55
|
+
redo(): void | Promise<void>;
|
|
56
|
+
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
|
|
2
|
+
import { UndoRedoElementType } from 'vscode/vscode/vs/platform/undoRedo/common/undoRedo';
|
|
3
|
+
|
|
1
4
|
class MoveCellEdit {
|
|
2
5
|
get label() {
|
|
3
6
|
return this.length === 1 ? 'Move Cell' : 'Move Cells';
|
|
@@ -10,7 +13,7 @@ class MoveCellEdit {
|
|
|
10
13
|
this.editingDelegate = editingDelegate;
|
|
11
14
|
this.beforedSelections = beforedSelections;
|
|
12
15
|
this.endSelections = endSelections;
|
|
13
|
-
this.type =
|
|
16
|
+
this.type = UndoRedoElementType.Resource;
|
|
14
17
|
this.code = 'undoredo.textBufferEdit';
|
|
15
18
|
}
|
|
16
19
|
undo() {
|
|
@@ -42,7 +45,7 @@ class SpliceCellsEdit {
|
|
|
42
45
|
this.editingDelegate = editingDelegate;
|
|
43
46
|
this.beforeHandles = beforeHandles;
|
|
44
47
|
this.endHandles = endHandles;
|
|
45
|
-
this.type =
|
|
48
|
+
this.type = UndoRedoElementType.Resource;
|
|
46
49
|
this.code = 'undoredo.textBufferEdit';
|
|
47
50
|
}
|
|
48
51
|
undo() {
|
|
@@ -69,7 +72,7 @@ class CellMetadataEdit {
|
|
|
69
72
|
this.oldMetadata = oldMetadata;
|
|
70
73
|
this.newMetadata = newMetadata;
|
|
71
74
|
this.editingDelegate = editingDelegate;
|
|
72
|
-
this.type =
|
|
75
|
+
this.type = UndoRedoElementType.Resource;
|
|
73
76
|
this.label = 'Update Cell Metadata';
|
|
74
77
|
this.code = 'undoredo.textBufferEdit';
|
|
75
78
|
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { Event } from "vscode/vscode/vs/base/common/event";
|
|
2
|
+
import { Disposable } from "vscode/vscode/vs/base/common/lifecycle";
|
|
3
|
+
import { URI } from "vscode/vscode/vs/base/common/uri";
|
|
4
|
+
import { Position } from "vscode/vscode/vs/editor/common/core/position";
|
|
5
|
+
import { ILanguageService } from "vscode/vscode/vs/editor/common/languages/language";
|
|
6
|
+
import { FindMatch } from "vscode/vscode/vs/editor/common/model";
|
|
7
|
+
import { IModelService } from "vscode/vscode/vs/editor/common/services/model";
|
|
8
|
+
import { UndoRedoGroup } from "vscode/vscode/vs/platform/undoRedo/common/undoRedo";
|
|
9
|
+
import { IUndoRedoService } from "vscode/vscode/vs/platform/undoRedo/common/undoRedo.service";
|
|
10
|
+
import { ILanguageDetectionService } from "vscode/vscode/vs/workbench/services/languageDetection/common/languageDetectionWorkerService.service";
|
|
11
|
+
import { ICellDto2, ICellEditOperation, INotebookSnapshotOptions, INotebookTextModel, ISelectionState, NotebookCellDefaultCollapseConfig, NotebookData, NotebookDocumentMetadata, NotebookTextModelChangedEvent, NotebookTextModelWillAddRemoveEvent, TransientOptions } from "vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon";
|
|
12
|
+
import { INotebookExecutionStateService } from "vscode/vscode/vs/workbench/contrib/notebook/common/notebookExecutionStateService.service";
|
|
13
|
+
import { NotebookCellTextModel } from "@codingame/monaco-vscode-c465110a-57c0-59d7-a6b2-be0a4db7e517-common/vscode/vs/workbench/contrib/notebook/common/model/notebookCellTextModel";
|
|
14
|
+
export declare class NotebookTextModel extends Disposable implements INotebookTextModel {
|
|
15
|
+
readonly viewType: string;
|
|
16
|
+
readonly uri: URI;
|
|
17
|
+
private readonly _undoService;
|
|
18
|
+
private readonly _modelService;
|
|
19
|
+
private readonly _languageService;
|
|
20
|
+
private readonly _languageDetectionService;
|
|
21
|
+
private readonly _notebookExecutionStateService;
|
|
22
|
+
private _isDisposed;
|
|
23
|
+
private readonly _onWillDispose;
|
|
24
|
+
private readonly _onWillAddRemoveCells;
|
|
25
|
+
private readonly _onDidChangeContent;
|
|
26
|
+
readonly onWillDispose: Event<void>;
|
|
27
|
+
readonly onWillAddRemoveCells: Event<NotebookTextModelWillAddRemoveEvent>;
|
|
28
|
+
readonly onDidChangeContent: Event<NotebookTextModelChangedEvent>;
|
|
29
|
+
private _cellhandlePool;
|
|
30
|
+
private readonly _cellListeners;
|
|
31
|
+
private _cells;
|
|
32
|
+
private _defaultCollapseConfig;
|
|
33
|
+
metadata: NotebookDocumentMetadata;
|
|
34
|
+
transientOptions: TransientOptions;
|
|
35
|
+
private _versionId;
|
|
36
|
+
private _notebookSpecificAlternativeId;
|
|
37
|
+
private _alternativeVersionId;
|
|
38
|
+
private _operationManager;
|
|
39
|
+
private _pauseableEmitter;
|
|
40
|
+
get length(): number;
|
|
41
|
+
get cells(): readonly NotebookCellTextModel[];
|
|
42
|
+
get versionId(): number;
|
|
43
|
+
get alternativeVersionId(): string;
|
|
44
|
+
get notebookType(): string;
|
|
45
|
+
constructor(viewType: string, uri: URI, cells: ICellDto2[], metadata: NotebookDocumentMetadata, options: TransientOptions, _undoService: IUndoRedoService, _modelService: IModelService, _languageService: ILanguageService, _languageDetectionService: ILanguageDetectionService, _notebookExecutionStateService: INotebookExecutionStateService);
|
|
46
|
+
setCellCollapseDefault(collapseConfig: NotebookCellDefaultCollapseConfig | undefined): void;
|
|
47
|
+
_initialize(cells: ICellDto2[], triggerDirty?: boolean): void;
|
|
48
|
+
private _bindCellContentHandler;
|
|
49
|
+
private _generateAlternativeId;
|
|
50
|
+
dispose(): void;
|
|
51
|
+
pushStackElement(): void;
|
|
52
|
+
private _getCellIndexByHandle;
|
|
53
|
+
private _getCellIndexWithOutputIdHandleFromEdits;
|
|
54
|
+
private _getCellIndexWithOutputIdHandle;
|
|
55
|
+
reset(cells: ICellDto2[], metadata: NotebookDocumentMetadata, transientOptions: TransientOptions): void;
|
|
56
|
+
createSnapshot(options: INotebookSnapshotOptions): NotebookData;
|
|
57
|
+
restoreSnapshot(snapshot: NotebookData, transientOptions?: TransientOptions): void;
|
|
58
|
+
static computeEdits(model: NotebookTextModel, cells: ICellDto2[], executingHandles?: number[]): ICellEditOperation[];
|
|
59
|
+
private static _computeOutputEdit;
|
|
60
|
+
private static _commonPrefix;
|
|
61
|
+
private static _commonSuffix;
|
|
62
|
+
applyEdits(rawEdits: ICellEditOperation[], synchronous: boolean, beginSelectionState: ISelectionState | undefined, endSelectionsComputer: () => ISelectionState | undefined, undoRedoGroup: UndoRedoGroup | undefined, computeUndoRedo: boolean): boolean;
|
|
63
|
+
private _doApplyEdits;
|
|
64
|
+
private _mergeCellEdits;
|
|
65
|
+
private _getDefaultCollapseState;
|
|
66
|
+
private _replaceCells;
|
|
67
|
+
private _increaseVersionId;
|
|
68
|
+
private _overwriteAlternativeVersionId;
|
|
69
|
+
private _updateNotebookCellMetadata;
|
|
70
|
+
private _insertNewCell;
|
|
71
|
+
private _removeCell;
|
|
72
|
+
private _replaceNewCells;
|
|
73
|
+
private _isDocumentMetadataChanged;
|
|
74
|
+
private _isCellMetadataChanged;
|
|
75
|
+
private _customMetadataEqual;
|
|
76
|
+
private _changeCellMetadataPartial;
|
|
77
|
+
private _changeCellMetadata;
|
|
78
|
+
private _changeCellInternalMetadataPartial;
|
|
79
|
+
private _changeCellLanguage;
|
|
80
|
+
private _spliceNotebookCellOutputs2;
|
|
81
|
+
private _spliceNotebookCellOutputs;
|
|
82
|
+
private _appendNotebookCellOutputItems;
|
|
83
|
+
private _replaceNotebookCellOutputItems;
|
|
84
|
+
private _moveCellToIdx;
|
|
85
|
+
private _assertIndex;
|
|
86
|
+
private _indexIsInvalid;
|
|
87
|
+
findNextMatch(searchString: string, searchStart: {
|
|
88
|
+
cellIndex: number;
|
|
89
|
+
position: Position;
|
|
90
|
+
}, isRegex: boolean, matchCase: boolean, wordSeparators: string | null, searchEnd?: {
|
|
91
|
+
cellIndex: number;
|
|
92
|
+
position: Position;
|
|
93
|
+
}): {
|
|
94
|
+
cell: NotebookCellTextModel;
|
|
95
|
+
match: FindMatch;
|
|
96
|
+
} | null;
|
|
97
|
+
findMatches(searchString: string, isRegex: boolean, matchCase: boolean, wordSeparators: string | null): {
|
|
98
|
+
cell: NotebookCellTextModel;
|
|
99
|
+
matches: FindMatch[];
|
|
100
|
+
}[];
|
|
101
|
+
}
|
|
@@ -1,22 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { Disposable, dispose } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
4
|
-
import { NotebookCellTextModel } from '@codingame/monaco-vscode-chat-interactive-notebook-search-common/vscode/vs/workbench/contrib/notebook/common/model/notebookCellTextModel';
|
|
5
|
-
import { CellUri, NotebookCellsChangeType, CellKind, diff } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
6
|
-
import { IUndoRedoService } from 'vscode/vscode/vs/platform/undoRedo/common/undoRedo.service';
|
|
7
|
-
import { SpliceCellsEdit, CellMetadataEdit, MoveCellEdit } from './cellEdit.js';
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6';
|
|
8
3
|
import { LcsDiff } from 'vscode/vscode/vs/base/common/diff/diff';
|
|
4
|
+
import { PauseableEmitter, Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
9
5
|
import { hash } from 'vscode/vscode/vs/base/common/hash';
|
|
10
|
-
import {
|
|
11
|
-
import { IModelService } from 'vscode/vscode/vs/editor/common/services/model';
|
|
6
|
+
import { Disposable, dispose } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
12
7
|
import { Schemas } from 'vscode/vscode/vs/base/common/network';
|
|
8
|
+
import { filter } from 'vscode/vscode/vs/base/common/objects';
|
|
13
9
|
import { isEqual } from 'vscode/vscode/vs/base/common/resources';
|
|
14
|
-
import { ILanguageService } from 'vscode/vscode/vs/editor/common/languages/language';
|
|
15
|
-
import { TextModel } from 'vscode/vscode/vs/editor/common/model/textModel';
|
|
16
10
|
import { isDefined } from 'vscode/vscode/vs/base/common/types';
|
|
17
|
-
import {
|
|
11
|
+
import { Position } from 'vscode/vscode/vs/editor/common/core/position';
|
|
18
12
|
import { Range } from 'vscode/vscode/vs/editor/common/core/range';
|
|
13
|
+
import { ILanguageService } from 'vscode/vscode/vs/editor/common/languages/language';
|
|
14
|
+
import { TextModel } from 'vscode/vscode/vs/editor/common/model/textModel';
|
|
19
15
|
import { SearchParams } from 'vscode/vscode/vs/editor/common/model/textModelSearch';
|
|
16
|
+
import { IModelService } from 'vscode/vscode/vs/editor/common/services/model';
|
|
17
|
+
import { UndoRedoElementType } from 'vscode/vscode/vs/platform/undoRedo/common/undoRedo';
|
|
18
|
+
import { IUndoRedoService } from 'vscode/vscode/vs/platform/undoRedo/common/undoRedo.service';
|
|
19
|
+
import { ILanguageDetectionService } from 'vscode/vscode/vs/workbench/services/languageDetection/common/languageDetectionWorkerService.service';
|
|
20
|
+
import { SnapshotContext } from '@codingame/monaco-vscode-9d05a43d-c330-5ff1-937e-fde4a3852931-common/vscode/vs/workbench/services/workingCopy/common/fileWorkingCopy';
|
|
21
|
+
import { CellUri, NotebookCellsChangeType, NotebookCellExecutionState, CellEditType, CellKind, diff } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
22
|
+
import { INotebookExecutionStateService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookExecutionStateService.service';
|
|
23
|
+
import { SpliceCellsEdit, CellMetadataEdit, MoveCellEdit } from './cellEdit.js';
|
|
24
|
+
import { NotebookCellOutputTextModel } from '@codingame/monaco-vscode-c465110a-57c0-59d7-a6b2-be0a4db7e517-common/vscode/vs/workbench/contrib/notebook/common/model/notebookCellOutputTextModel';
|
|
25
|
+
import { NotebookCellTextModel } from '@codingame/monaco-vscode-c465110a-57c0-59d7-a6b2-be0a4db7e517-common/vscode/vs/workbench/contrib/notebook/common/model/notebookCellTextModel';
|
|
20
26
|
|
|
21
27
|
var NotebookTextModel_1;
|
|
22
28
|
class StackOperation {
|
|
@@ -34,7 +40,7 @@ class StackOperation {
|
|
|
34
40
|
this._operations = [];
|
|
35
41
|
this._beginSelectionState = undefined;
|
|
36
42
|
this._resultSelectionState = undefined;
|
|
37
|
-
this.type =
|
|
43
|
+
this.type = UndoRedoElementType.Workspace;
|
|
38
44
|
this._beginSelectionState = selectionState;
|
|
39
45
|
this._beginAlternativeVersionId = beginAlternativeVersionId;
|
|
40
46
|
this._resultAlternativeVersionId = beginAlternativeVersionId;
|
|
@@ -158,7 +164,7 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
158
164
|
get notebookType() {
|
|
159
165
|
return this.viewType;
|
|
160
166
|
}
|
|
161
|
-
constructor(viewType, uri, cells, metadata, options, _undoService, _modelService, _languageService, _languageDetectionService) {
|
|
167
|
+
constructor(viewType, uri, cells, metadata, options, _undoService, _modelService, _languageService, _languageDetectionService, _notebookExecutionStateService) {
|
|
162
168
|
super();
|
|
163
169
|
this.viewType = viewType;
|
|
164
170
|
this.uri = uri;
|
|
@@ -166,6 +172,7 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
166
172
|
this._modelService = _modelService;
|
|
167
173
|
this._languageService = _languageService;
|
|
168
174
|
this._languageDetectionService = _languageDetectionService;
|
|
175
|
+
this._notebookExecutionStateService = _notebookExecutionStateService;
|
|
169
176
|
this._isDisposed = false;
|
|
170
177
|
this._onWillDispose = this._register(( new Emitter()));
|
|
171
178
|
this._onWillAddRemoveCells = this._register(( new Emitter()));
|
|
@@ -354,19 +361,57 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
354
361
|
}
|
|
355
362
|
reset(cells, metadata, transientOptions) {
|
|
356
363
|
this.transientOptions = transientOptions;
|
|
357
|
-
const
|
|
364
|
+
const executions = this._notebookExecutionStateService.getCellExecutionsForNotebook(this.uri);
|
|
365
|
+
const executingCellHandles = ( executions.filter(exe => exe.state === NotebookCellExecutionState.Executing).map(exe => exe.cellHandle));
|
|
366
|
+
const edits = NotebookTextModel_1.computeEdits(this, cells, executingCellHandles);
|
|
358
367
|
this.applyEdits([
|
|
359
368
|
...edits,
|
|
360
|
-
{ editType:
|
|
369
|
+
{ editType: CellEditType.DocumentMetadata, metadata }
|
|
361
370
|
], true, undefined, () => undefined, undefined, false);
|
|
362
371
|
}
|
|
363
|
-
|
|
372
|
+
createSnapshot(options) {
|
|
373
|
+
const transientOptions = options.transientOptions ?? this.transientOptions;
|
|
374
|
+
const data = {
|
|
375
|
+
metadata: filter(this.metadata, key => !transientOptions.transientDocumentMetadata[key]),
|
|
376
|
+
cells: [],
|
|
377
|
+
};
|
|
378
|
+
let outputSize = 0;
|
|
379
|
+
for (const cell of this.cells) {
|
|
380
|
+
const cellData = {
|
|
381
|
+
cellKind: cell.cellKind,
|
|
382
|
+
language: cell.language,
|
|
383
|
+
mime: cell.mime,
|
|
384
|
+
source: cell.getValue(),
|
|
385
|
+
outputs: [],
|
|
386
|
+
internalMetadata: cell.internalMetadata
|
|
387
|
+
};
|
|
388
|
+
if (options.context === SnapshotContext.Backup && options.outputSizeLimit > 0) {
|
|
389
|
+
cell.outputs.forEach(output => {
|
|
390
|
+
output.outputs.forEach(item => {
|
|
391
|
+
outputSize += item.data.byteLength;
|
|
392
|
+
});
|
|
393
|
+
});
|
|
394
|
+
if (outputSize > options.outputSizeLimit) {
|
|
395
|
+
throw ( new Error('Notebook too large to backup'));
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
cellData.outputs = !transientOptions.transientOutputs ? cell.outputs : [];
|
|
399
|
+
cellData.metadata = filter(cell.metadata, key => !transientOptions.transientCellMetadata[key]);
|
|
400
|
+
data.cells.push(cellData);
|
|
401
|
+
}
|
|
402
|
+
return data;
|
|
403
|
+
}
|
|
404
|
+
restoreSnapshot(snapshot, transientOptions) {
|
|
405
|
+
this.reset(snapshot.cells, snapshot.metadata, transientOptions ?? this.transientOptions);
|
|
406
|
+
}
|
|
407
|
+
static computeEdits(model, cells, executingHandles = []) {
|
|
364
408
|
const edits = [];
|
|
365
|
-
const
|
|
409
|
+
const isExecuting = (cell) => executingHandles.includes(cell.handle);
|
|
410
|
+
const commonPrefix = this._commonPrefix(model.cells, model.cells.length, 0, cells, cells.length, 0, isExecuting);
|
|
366
411
|
if (commonPrefix > 0) {
|
|
367
412
|
for (let i = 0; i < commonPrefix; i++) {
|
|
368
413
|
edits.push({
|
|
369
|
-
editType:
|
|
414
|
+
editType: CellEditType.Metadata,
|
|
370
415
|
index: i,
|
|
371
416
|
metadata: cells[i].metadata ?? {}
|
|
372
417
|
}, ...this._computeOutputEdit(i, model.cells[i].outputs, cells[i].outputs));
|
|
@@ -375,20 +420,20 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
375
420
|
if (model.cells.length === cells.length && commonPrefix === model.cells.length) {
|
|
376
421
|
return edits;
|
|
377
422
|
}
|
|
378
|
-
const commonSuffix = this._commonSuffix(model.cells, model.cells.length - commonPrefix, commonPrefix, cells, cells.length - commonPrefix, commonPrefix);
|
|
423
|
+
const commonSuffix = this._commonSuffix(model.cells, model.cells.length - commonPrefix, commonPrefix, cells, cells.length - commonPrefix, commonPrefix, isExecuting);
|
|
379
424
|
if (commonSuffix > 0) {
|
|
380
|
-
edits.push({ editType:
|
|
425
|
+
edits.push({ editType: CellEditType.Replace, index: commonPrefix, count: model.cells.length - commonPrefix - commonSuffix, cells: cells.slice(commonPrefix, cells.length - commonSuffix) });
|
|
381
426
|
}
|
|
382
427
|
else if (commonPrefix > 0) {
|
|
383
|
-
edits.push({ editType:
|
|
428
|
+
edits.push({ editType: CellEditType.Replace, index: commonPrefix, count: model.cells.length - commonPrefix, cells: cells.slice(commonPrefix) });
|
|
384
429
|
}
|
|
385
430
|
else {
|
|
386
|
-
edits.push({ editType:
|
|
431
|
+
edits.push({ editType: CellEditType.Replace, index: 0, count: model.cells.length, cells });
|
|
387
432
|
}
|
|
388
433
|
if (commonSuffix > 0) {
|
|
389
434
|
for (let i = commonSuffix; i > 0; i--) {
|
|
390
435
|
edits.push({
|
|
391
|
-
editType:
|
|
436
|
+
editType: CellEditType.Metadata,
|
|
392
437
|
index: model.cells.length - i,
|
|
393
438
|
metadata: cells[cells.length - i].metadata ?? {}
|
|
394
439
|
}, ...this._computeOutputEdit(model.cells.length - i, model.cells[model.cells.length - i].outputs, cells[cells.length - i].outputs));
|
|
@@ -400,7 +445,7 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
400
445
|
if (a.length !== b.length) {
|
|
401
446
|
return [
|
|
402
447
|
{
|
|
403
|
-
editType:
|
|
448
|
+
editType: CellEditType.Output,
|
|
404
449
|
index: index,
|
|
405
450
|
outputs: b,
|
|
406
451
|
append: false
|
|
@@ -412,25 +457,25 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
412
457
|
}
|
|
413
458
|
return ( b.map((output, i) => {
|
|
414
459
|
return {
|
|
415
|
-
editType:
|
|
460
|
+
editType: CellEditType.OutputItems,
|
|
416
461
|
outputId: a[i].outputId,
|
|
417
462
|
items: output.outputs,
|
|
418
463
|
append: false
|
|
419
464
|
};
|
|
420
465
|
}));
|
|
421
466
|
}
|
|
422
|
-
static _commonPrefix(a, aLen, aDelta, b, bLen, bDelta) {
|
|
467
|
+
static _commonPrefix(a, aLen, aDelta, b, bLen, bDelta, isExecuting) {
|
|
423
468
|
const maxResult = Math.min(aLen, bLen);
|
|
424
469
|
let result = 0;
|
|
425
|
-
for (let i = 0; i < maxResult && a[aDelta + i].fastEqual(b[bDelta + i]); i++) {
|
|
470
|
+
for (let i = 0; i < maxResult && a[aDelta + i].fastEqual(b[bDelta + i], isExecuting(a[aDelta + i])); i++) {
|
|
426
471
|
result++;
|
|
427
472
|
}
|
|
428
473
|
return result;
|
|
429
474
|
}
|
|
430
|
-
static _commonSuffix(a, aLen, aDelta, b, bLen, bDelta) {
|
|
475
|
+
static _commonSuffix(a, aLen, aDelta, b, bLen, bDelta, isExecuting) {
|
|
431
476
|
const maxResult = Math.min(aLen, bLen);
|
|
432
477
|
let result = 0;
|
|
433
|
-
for (let i = 0; i < maxResult && a[aDelta + aLen - i - 1].fastEqual(b[bDelta + bLen - i - 1]); i++) {
|
|
478
|
+
for (let i = 0; i < maxResult && a[aDelta + aLen - i - 1].fastEqual(b[bDelta + bLen - i - 1], isExecuting(a[aDelta + aLen - i - 1])); i++) {
|
|
434
479
|
result++;
|
|
435
480
|
}
|
|
436
481
|
return result;
|
|
@@ -471,15 +516,15 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
471
516
|
return null;
|
|
472
517
|
}
|
|
473
518
|
}
|
|
474
|
-
else if (edit.editType !==
|
|
519
|
+
else if (edit.editType !== CellEditType.DocumentMetadata) {
|
|
475
520
|
throw ( new Error('Invalid cell edit'));
|
|
476
521
|
}
|
|
477
522
|
return {
|
|
478
523
|
edit,
|
|
479
524
|
cellIndex,
|
|
480
|
-
end: (
|
|
525
|
+
end: (edit.editType === CellEditType.DocumentMetadata)
|
|
481
526
|
? undefined
|
|
482
|
-
: (edit.editType ===
|
|
527
|
+
: (edit.editType === CellEditType.Replace ? edit.index + edit.count : cellIndex),
|
|
483
528
|
originalIndex: index
|
|
484
529
|
};
|
|
485
530
|
})).filter(isDefined);
|
|
@@ -511,7 +556,7 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
511
556
|
const replaceEdits = [];
|
|
512
557
|
const otherEdits = [];
|
|
513
558
|
editsOnSameIndex.forEach(edit => {
|
|
514
|
-
if (edit.edit.editType ===
|
|
559
|
+
if (edit.edit.editType === CellEditType.Replace) {
|
|
515
560
|
replaceEdits.push(edit);
|
|
516
561
|
}
|
|
517
562
|
else {
|
|
@@ -523,10 +568,10 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
523
568
|
const flattenEdits = edits.flat();
|
|
524
569
|
for (const { edit, cellIndex } of flattenEdits) {
|
|
525
570
|
switch (edit.editType) {
|
|
526
|
-
case
|
|
571
|
+
case CellEditType.Replace:
|
|
527
572
|
this._replaceCells(edit.index, edit.count, edit.cells, synchronous, computeUndoRedo, beginSelectionState, undoRedoGroup);
|
|
528
573
|
break;
|
|
529
|
-
case
|
|
574
|
+
case CellEditType.Output: {
|
|
530
575
|
this._assertIndex(cellIndex);
|
|
531
576
|
const cell = this._cells[cellIndex];
|
|
532
577
|
if (edit.append) {
|
|
@@ -537,7 +582,7 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
537
582
|
}
|
|
538
583
|
break;
|
|
539
584
|
}
|
|
540
|
-
case
|
|
585
|
+
case CellEditType.OutputItems:
|
|
541
586
|
{
|
|
542
587
|
this._assertIndex(cellIndex);
|
|
543
588
|
const cell = this._cells[cellIndex];
|
|
@@ -549,26 +594,26 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
549
594
|
}
|
|
550
595
|
}
|
|
551
596
|
break;
|
|
552
|
-
case
|
|
597
|
+
case CellEditType.Metadata:
|
|
553
598
|
this._assertIndex(edit.index);
|
|
554
599
|
this._changeCellMetadata(this._cells[edit.index], edit.metadata, computeUndoRedo, beginSelectionState, undoRedoGroup);
|
|
555
600
|
break;
|
|
556
|
-
case
|
|
601
|
+
case CellEditType.PartialMetadata:
|
|
557
602
|
this._assertIndex(cellIndex);
|
|
558
603
|
this._changeCellMetadataPartial(this._cells[cellIndex], edit.metadata, computeUndoRedo, beginSelectionState, undoRedoGroup);
|
|
559
604
|
break;
|
|
560
|
-
case
|
|
605
|
+
case CellEditType.PartialInternalMetadata:
|
|
561
606
|
this._assertIndex(cellIndex);
|
|
562
607
|
this._changeCellInternalMetadataPartial(this._cells[cellIndex], edit.internalMetadata);
|
|
563
608
|
break;
|
|
564
|
-
case
|
|
609
|
+
case CellEditType.CellLanguage:
|
|
565
610
|
this._assertIndex(edit.index);
|
|
566
611
|
this._changeCellLanguage(this._cells[edit.index], edit.language, computeUndoRedo, beginSelectionState, undoRedoGroup);
|
|
567
612
|
break;
|
|
568
|
-
case
|
|
613
|
+
case CellEditType.DocumentMetadata:
|
|
569
614
|
this._updateNotebookCellMetadata(edit.metadata, computeUndoRedo, beginSelectionState, undoRedoGroup);
|
|
570
615
|
break;
|
|
571
|
-
case
|
|
616
|
+
case CellEditType.Move:
|
|
572
617
|
this._moveCellToIdx(edit.index, edit.length, edit.newIdx, synchronous, computeUndoRedo, beginSelectionState, undefined, undoRedoGroup);
|
|
573
618
|
break;
|
|
574
619
|
}
|
|
@@ -579,17 +624,17 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
579
624
|
rawEdits.forEach(edit => {
|
|
580
625
|
if (mergedEdits.length) {
|
|
581
626
|
const last = mergedEdits[mergedEdits.length - 1];
|
|
582
|
-
if (last.edit.editType ===
|
|
627
|
+
if (last.edit.editType === CellEditType.Output
|
|
583
628
|
&& last.edit.append
|
|
584
|
-
&& edit.edit.editType ===
|
|
629
|
+
&& edit.edit.editType === CellEditType.Output
|
|
585
630
|
&& edit.edit.append
|
|
586
631
|
&& last.cellIndex === edit.cellIndex) {
|
|
587
632
|
last.edit.outputs = [...last.edit.outputs, ...edit.edit.outputs];
|
|
588
633
|
}
|
|
589
|
-
else if (last.edit.editType ===
|
|
634
|
+
else if (last.edit.editType === CellEditType.Output
|
|
590
635
|
&& !last.edit.append
|
|
591
636
|
&& last.edit.outputs.length === 0
|
|
592
|
-
&& edit.edit.editType ===
|
|
637
|
+
&& edit.edit.editType === CellEditType.Output
|
|
593
638
|
&& edit.edit.append
|
|
594
639
|
&& last.cellIndex === edit.cellIndex) {
|
|
595
640
|
last.edit.append = false;
|
|
@@ -702,7 +747,7 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
702
747
|
const that = this;
|
|
703
748
|
this._operationManager.pushEditOperation(new (class {
|
|
704
749
|
constructor() {
|
|
705
|
-
this.type =
|
|
750
|
+
this.type = UndoRedoElementType.Resource;
|
|
706
751
|
this.label = 'Update Cell Metadata';
|
|
707
752
|
this.code = 'undoredo.textBufferEdit';
|
|
708
753
|
}
|
|
@@ -893,7 +938,7 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
893
938
|
const that = this;
|
|
894
939
|
this._operationManager.pushEditOperation(new (class {
|
|
895
940
|
constructor() {
|
|
896
|
-
this.type =
|
|
941
|
+
this.type = UndoRedoElementType.Resource;
|
|
897
942
|
this.label = 'Update Cell Language';
|
|
898
943
|
this.code = 'undoredo.textBufferEdit';
|
|
899
944
|
}
|
|
@@ -1011,7 +1056,7 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
1011
1056
|
_indexIsInvalid(index) {
|
|
1012
1057
|
return index < 0 || index >= this._cells.length;
|
|
1013
1058
|
}
|
|
1014
|
-
findNextMatch(searchString, searchStart, isRegex, matchCase, wordSeparators) {
|
|
1059
|
+
findNextMatch(searchString, searchStart, isRegex, matchCase, wordSeparators, searchEnd) {
|
|
1015
1060
|
this._assertIndex(searchStart.cellIndex);
|
|
1016
1061
|
const searchParams = ( new SearchParams(searchString, isRegex, matchCase, wordSeparators));
|
|
1017
1062
|
const searchData = searchParams.parseSearchRequest();
|
|
@@ -1020,29 +1065,60 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
1020
1065
|
}
|
|
1021
1066
|
let cellIndex = searchStart.cellIndex;
|
|
1022
1067
|
let searchStartPosition = searchStart.position;
|
|
1023
|
-
|
|
1068
|
+
let searchEndCell = this._cells.length;
|
|
1069
|
+
while (cellIndex < searchEndCell) {
|
|
1024
1070
|
const cell = this._cells[cellIndex];
|
|
1071
|
+
const wrapFlag = searchEnd && cellIndex === searchEnd.cellIndex && searchStartPosition.isBefore(searchEnd.position);
|
|
1025
1072
|
const searchRange = ( new Range(
|
|
1026
1073
|
searchStartPosition.lineNumber,
|
|
1027
1074
|
searchStartPosition.column,
|
|
1028
|
-
cell.textBuffer.getLineCount(),
|
|
1029
|
-
cell.textBuffer.getLineMaxColumn(cell.textBuffer.getLineCount())
|
|
1075
|
+
(wrapFlag) ? searchEnd.position.lineNumber : cell.textBuffer.getLineCount(),
|
|
1076
|
+
(wrapFlag) ? searchEnd.position.column : cell.textBuffer.getLineMaxColumn(cell.textBuffer.getLineCount())
|
|
1030
1077
|
));
|
|
1031
1078
|
const result = cell.textBuffer.findMatchesLineByLine(searchRange, searchData, false, 1);
|
|
1032
1079
|
if (result.length > 0) {
|
|
1033
1080
|
return { cell, match: result[0] };
|
|
1034
1081
|
}
|
|
1082
|
+
else if (wrapFlag) {
|
|
1083
|
+
break;
|
|
1084
|
+
}
|
|
1035
1085
|
cellIndex++;
|
|
1036
|
-
|
|
1086
|
+
if (searchEnd && cellIndex >= this._cells.length) {
|
|
1087
|
+
cellIndex = 0;
|
|
1088
|
+
searchEndCell = searchEnd.cellIndex + 1;
|
|
1089
|
+
}
|
|
1090
|
+
searchStartPosition = ( new Position(1, 1));
|
|
1037
1091
|
}
|
|
1038
1092
|
return null;
|
|
1039
1093
|
}
|
|
1094
|
+
findMatches(searchString, isRegex, matchCase, wordSeparators) {
|
|
1095
|
+
const searchParams = ( new SearchParams(searchString, isRegex, matchCase, wordSeparators));
|
|
1096
|
+
const searchData = searchParams.parseSearchRequest();
|
|
1097
|
+
if (!searchData) {
|
|
1098
|
+
return [];
|
|
1099
|
+
}
|
|
1100
|
+
const results = [];
|
|
1101
|
+
for (const cell of this._cells) {
|
|
1102
|
+
const searchRange = ( new Range(
|
|
1103
|
+
1,
|
|
1104
|
+
1,
|
|
1105
|
+
cell.textBuffer.getLineCount(),
|
|
1106
|
+
cell.textBuffer.getLineMaxColumn(cell.textBuffer.getLineCount())
|
|
1107
|
+
));
|
|
1108
|
+
const matches = cell.textBuffer.findMatchesLineByLine(searchRange, searchData, false, 1000);
|
|
1109
|
+
if (matches.length > 0) {
|
|
1110
|
+
results.push({ cell, matches: matches });
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
return results;
|
|
1114
|
+
}
|
|
1040
1115
|
};
|
|
1041
1116
|
NotebookTextModel = NotebookTextModel_1 = ( __decorate([
|
|
1042
1117
|
( __param(5, IUndoRedoService)),
|
|
1043
1118
|
( __param(6, IModelService)),
|
|
1044
1119
|
( __param(7, ILanguageService)),
|
|
1045
|
-
( __param(8, ILanguageDetectionService))
|
|
1120
|
+
( __param(8, ILanguageDetectionService)),
|
|
1121
|
+
( __param(9, INotebookExecutionStateService))
|
|
1046
1122
|
], NotebookTextModel));
|
|
1047
1123
|
class OutputSequence {
|
|
1048
1124
|
constructor(outputs) {
|
package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { IInstantiationService } from "vscode/vscode/vs/platform/instantiation/common/instantiation";
|
|
2
|
+
import { URI } from "vscode/vscode/vs/base/common/uri";
|
|
3
|
+
import { IResolvedNotebookEditorModel, NotebookEditorModelCreationOptions } from "vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon";
|
|
4
|
+
import { IReference } from "vscode/vscode/vs/base/common/lifecycle";
|
|
5
|
+
import { INotebookService } from "vscode/vscode/vs/workbench/contrib/notebook/common/notebookService.service";
|
|
6
|
+
import { Event } from "vscode/vscode/vs/base/common/event";
|
|
7
|
+
import { IExtensionService } from "vscode/vscode/vs/workbench/services/extensions/common/extensions.service";
|
|
8
|
+
import { IUriIdentityService } from "vscode/vscode/vs/platform/uriIdentity/common/uriIdentity.service";
|
|
9
|
+
import { INotebookConflictEvent, IUntitledNotebookResource } from "vscode/vscode/vs/workbench/contrib/notebook/common/notebookEditorModelResolverService";
|
|
10
|
+
import { INotebookEditorModelResolverService } from "vscode/vscode/vs/workbench/contrib/notebook/common/notebookEditorModelResolverService.service";
|
|
11
|
+
export declare class NotebookModelResolverServiceImpl implements INotebookEditorModelResolverService {
|
|
12
|
+
private readonly _notebookService;
|
|
13
|
+
private readonly _extensionService;
|
|
14
|
+
private readonly _uriIdentService;
|
|
15
|
+
readonly _serviceBrand: undefined;
|
|
16
|
+
private readonly _data;
|
|
17
|
+
readonly onDidSaveNotebook: Event<URI>;
|
|
18
|
+
readonly onDidChangeDirty: Event<IResolvedNotebookEditorModel>;
|
|
19
|
+
private readonly _onWillFailWithConflict;
|
|
20
|
+
readonly onWillFailWithConflict: Event<INotebookConflictEvent>;
|
|
21
|
+
constructor(instantiationService: IInstantiationService, _notebookService: INotebookService, _extensionService: IExtensionService, _uriIdentService: IUriIdentityService);
|
|
22
|
+
dispose(): void;
|
|
23
|
+
isDirty(resource: URI): boolean;
|
|
24
|
+
private createUntitledUri;
|
|
25
|
+
private validateResourceViewType;
|
|
26
|
+
createUntitledNotebookTextModel(viewType: string): Promise<import("./model/notebookTextModel.js").NotebookTextModel>;
|
|
27
|
+
resolve(resource: URI, viewType?: string, options?: NotebookEditorModelCreationOptions): Promise<IReference<IResolvedNotebookEditorModel>>;
|
|
28
|
+
resolve(resource: IUntitledNotebookResource, viewType: string, options: NotebookEditorModelCreationOptions): Promise<IReference<IResolvedNotebookEditorModel>>;
|
|
29
|
+
}
|