@codingame/monaco-vscode-notebook-service-override 25.1.2 → 26.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +2 -2
- package/package.json +3 -3
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +112 -94
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +95 -96
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticEditorContrib.js +28 -19
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticsActions.js +15 -9
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/diagnosticCellStatusBarContrib.js +22 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.js +25 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +37 -44
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +211 -115
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.js +16 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookCellPausing.js +5 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +57 -49
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.js +24 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +78 -76
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/execute/executionEditorProgress.js +14 -15
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +43 -28
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +65 -34
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +19 -16
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/kernelDetection/notebookKernelDetection.js +6 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +15 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +28 -16
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookMulticursor.js +211 -170
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookSelectionHighlight.js +11 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +158 -156
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookInlineVariables.js +109 -105
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableContextKeys.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +28 -22
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +26 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +23 -16
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +72 -40
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +233 -186
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +22 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +239 -151
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +85 -86
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +25 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.js +13 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/apiActions.js +8 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/editActions.js +218 -196
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +258 -255
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +106 -98
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/notebookIndentationActions.js +63 -49
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.js +55 -64
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/variablesActions.js +21 -25
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +149 -129
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.d.ts +57 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.js +286 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditorInput.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditorInput.js +82 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +452 -363
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibilityHelp.js +44 -61
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibleView.js +9 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +203 -207
- package/vscode/src/vs/workbench/contrib/notebook/browser/outputEditor/notebookOutputEditor.js +148 -104
- package/vscode/src/vs/workbench/contrib/notebook/browser/outputEditor/notebookOutputEditorInput.js +19 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/replEditorAccessibleView.js +9 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookCellStatusBarServiceImpl.js +9 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +34 -22
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +29 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +70 -52
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +31 -19
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +78 -41
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +37 -27
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +9 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.js +8 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +214 -119
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +38 -36
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineDataSource.js +24 -25
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineDataSourceFactory.js +2 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.js +26 -15
- package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.js +35 -15
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +468 -258
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.d.ts +33 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +113 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +74 -58
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.js +7 -10
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookCellMatching.js +72 -16
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookWebWorker.js +70 -51
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/repl.contribution.js +195 -149
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditorAccessibilityHelp.js +60 -81
- package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.js +7 -12
- package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +104 -66
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +115 -77
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.js +42 -26
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopyManager.js +19 -12
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.d.ts +0 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +0 -198
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.d.ts +0 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.js +0 -333
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext.js +0 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.d.ts +0 -13
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +0 -261
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { IResourceDiffEditorInput, IResourceSideBySideEditorInput, IUntypedEditorInput } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor";
|
|
2
|
+
import { EditorInput } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor/editorInput";
|
|
3
|
+
import { EditorModel } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor/editorModel";
|
|
4
|
+
import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
5
|
+
import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
6
|
+
import { INotebookDiffEditorModel, IResolvedNotebookEditorModel } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon";
|
|
7
|
+
import { DiffEditorInput } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor/diffEditorInput";
|
|
8
|
+
import { NotebookEditorInput } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookEditorInput";
|
|
9
|
+
import { IEditorService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service";
|
|
10
|
+
declare class NotebookDiffEditorModel extends EditorModel implements INotebookDiffEditorModel {
|
|
11
|
+
readonly original: IResolvedNotebookEditorModel;
|
|
12
|
+
readonly modified: IResolvedNotebookEditorModel;
|
|
13
|
+
constructor(original: IResolvedNotebookEditorModel, modified: IResolvedNotebookEditorModel);
|
|
14
|
+
}
|
|
15
|
+
export declare class NotebookDiffEditorInput extends DiffEditorInput {
|
|
16
|
+
readonly original: NotebookEditorInput;
|
|
17
|
+
readonly modified: NotebookEditorInput;
|
|
18
|
+
readonly viewType: string;
|
|
19
|
+
static create(instantiationService: IInstantiationService, resource: URI, name: string | undefined, description: string | undefined, originalResource: URI, viewType: string): NotebookDiffEditorInput;
|
|
20
|
+
static readonly ID: string;
|
|
21
|
+
private _modifiedTextModel;
|
|
22
|
+
private _originalTextModel;
|
|
23
|
+
get resource(): URI;
|
|
24
|
+
get editorId(): string;
|
|
25
|
+
private _cachedModel;
|
|
26
|
+
constructor(name: string | undefined, description: string | undefined, original: NotebookEditorInput, modified: NotebookEditorInput, viewType: string, editorService: IEditorService);
|
|
27
|
+
get typeId(): string;
|
|
28
|
+
resolve(): Promise<NotebookDiffEditorModel>;
|
|
29
|
+
toUntyped(): IResourceDiffEditorInput & IResourceSideBySideEditorInput;
|
|
30
|
+
matches(otherInput: EditorInput | IUntypedEditorInput): boolean;
|
|
31
|
+
dispose(): void;
|
|
32
|
+
}
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { isResourceDiffEditorInput } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor';
|
|
4
|
+
import { EditorModel } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor/editorModel';
|
|
5
|
+
import { DiffEditorInput } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor/diffEditorInput';
|
|
6
|
+
import { NotebookEditorInput } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookEditorInput';
|
|
7
|
+
import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
8
|
+
|
|
9
|
+
var NotebookDiffEditorInput_1;
|
|
10
|
+
class NotebookDiffEditorModel extends EditorModel {
|
|
11
|
+
constructor(original, modified) {
|
|
12
|
+
super();
|
|
13
|
+
this.original = original;
|
|
14
|
+
this.modified = modified;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
let NotebookDiffEditorInput = class NotebookDiffEditorInput extends DiffEditorInput {
|
|
18
|
+
static {
|
|
19
|
+
NotebookDiffEditorInput_1 = this;
|
|
20
|
+
}
|
|
21
|
+
static create(
|
|
22
|
+
instantiationService,
|
|
23
|
+
resource,
|
|
24
|
+
name,
|
|
25
|
+
description,
|
|
26
|
+
originalResource,
|
|
27
|
+
viewType
|
|
28
|
+
) {
|
|
29
|
+
const original = NotebookEditorInput.getOrCreate(instantiationService, originalResource, undefined, viewType);
|
|
30
|
+
const modified = NotebookEditorInput.getOrCreate(instantiationService, resource, undefined, viewType);
|
|
31
|
+
return instantiationService.createInstance(NotebookDiffEditorInput_1, name, description, original, modified, viewType);
|
|
32
|
+
}
|
|
33
|
+
static {
|
|
34
|
+
this.ID = "workbench.input.diffNotebookInput";
|
|
35
|
+
}
|
|
36
|
+
get resource() {
|
|
37
|
+
return this.modified.resource;
|
|
38
|
+
}
|
|
39
|
+
get editorId() {
|
|
40
|
+
return this.viewType;
|
|
41
|
+
}
|
|
42
|
+
constructor(name, description, original, modified, viewType, editorService) {
|
|
43
|
+
super(name, description, original, modified, undefined, editorService);
|
|
44
|
+
this.original = original;
|
|
45
|
+
this.modified = modified;
|
|
46
|
+
this.viewType = viewType;
|
|
47
|
+
this._modifiedTextModel = null;
|
|
48
|
+
this._originalTextModel = null;
|
|
49
|
+
this._cachedModel = undefined;
|
|
50
|
+
}
|
|
51
|
+
get typeId() {
|
|
52
|
+
return NotebookDiffEditorInput_1.ID;
|
|
53
|
+
}
|
|
54
|
+
async resolve() {
|
|
55
|
+
const [originalEditorModel, modifiedEditorModel] = await Promise.all([this.original.resolve(), this.modified.resolve()]);
|
|
56
|
+
this._cachedModel?.dispose();
|
|
57
|
+
if (!modifiedEditorModel) {
|
|
58
|
+
throw ( new Error(
|
|
59
|
+
`Fail to resolve modified editor model for resource ${this.modified.resource} with notebookType ${this.viewType}`
|
|
60
|
+
));
|
|
61
|
+
}
|
|
62
|
+
if (!originalEditorModel) {
|
|
63
|
+
throw ( new Error(
|
|
64
|
+
`Fail to resolve original editor model for resource ${this.original.resource} with notebookType ${this.viewType}`
|
|
65
|
+
));
|
|
66
|
+
}
|
|
67
|
+
this._originalTextModel = originalEditorModel;
|
|
68
|
+
this._modifiedTextModel = modifiedEditorModel;
|
|
69
|
+
this._cachedModel = ( new NotebookDiffEditorModel(this._originalTextModel, this._modifiedTextModel));
|
|
70
|
+
return this._cachedModel;
|
|
71
|
+
}
|
|
72
|
+
toUntyped() {
|
|
73
|
+
const original = {
|
|
74
|
+
resource: this.original.resource
|
|
75
|
+
};
|
|
76
|
+
const modified = {
|
|
77
|
+
resource: this.resource
|
|
78
|
+
};
|
|
79
|
+
return {
|
|
80
|
+
original,
|
|
81
|
+
modified,
|
|
82
|
+
primary: modified,
|
|
83
|
+
secondary: original,
|
|
84
|
+
options: {
|
|
85
|
+
override: this.viewType
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
matches(otherInput) {
|
|
90
|
+
if (this === otherInput) {
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
if (otherInput instanceof NotebookDiffEditorInput_1) {
|
|
94
|
+
return this.modified.matches(otherInput.modified) && this.original.matches(otherInput.original) && this.viewType === otherInput.viewType;
|
|
95
|
+
}
|
|
96
|
+
if (isResourceDiffEditorInput(otherInput)) {
|
|
97
|
+
return this.modified.matches(otherInput.modified) && this.original.matches(otherInput.original) && this.editorId !== undefined && (this.editorId === otherInput.options?.override || otherInput.options?.override === undefined);
|
|
98
|
+
}
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
dispose() {
|
|
102
|
+
super.dispose();
|
|
103
|
+
this._cachedModel?.dispose();
|
|
104
|
+
this._cachedModel = undefined;
|
|
105
|
+
this.original.dispose();
|
|
106
|
+
this.modified.dispose();
|
|
107
|
+
this._originalTextModel = null;
|
|
108
|
+
this._modifiedTextModel = null;
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
NotebookDiffEditorInput = NotebookDiffEditorInput_1 = ( __decorate([( __param(5, IEditorService))], NotebookDiffEditorInput));
|
|
112
|
+
|
|
113
|
+
export { NotebookDiffEditorInput };
|
package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js
CHANGED
|
@@ -21,7 +21,13 @@ import { INotebookLoggingService } from '@codingame/monaco-vscode-api/vscode/vs/
|
|
|
21
21
|
import { parse } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/notebook/common/notebookDocumentService';
|
|
22
22
|
|
|
23
23
|
let NotebookModelReferenceCollection = class NotebookModelReferenceCollection extends ReferenceCollection {
|
|
24
|
-
constructor(
|
|
24
|
+
constructor(
|
|
25
|
+
_instantiationService,
|
|
26
|
+
_notebookService,
|
|
27
|
+
_configurationService,
|
|
28
|
+
_telemetryService,
|
|
29
|
+
_notebookLoggingService
|
|
30
|
+
) {
|
|
25
31
|
super();
|
|
26
32
|
this._instantiationService = _instantiationService;
|
|
27
33
|
this._notebookService = _notebookService;
|
|
@@ -69,25 +75,37 @@ let NotebookModelReferenceCollection = class NotebookModelReferenceCollection ex
|
|
|
69
75
|
this._telemetryService,
|
|
70
76
|
this._notebookLoggingService
|
|
71
77
|
));
|
|
72
|
-
workingCopyManager = this._instantiationService.createInstance(
|
|
78
|
+
workingCopyManager = this._instantiationService.createInstance(FileWorkingCopyManager, workingCopyTypeId, factory, factory);
|
|
73
79
|
this._workingCopyManagers.set(workingCopyTypeId, workingCopyManager);
|
|
74
80
|
}
|
|
75
|
-
const isScratchpadView = isScratchpad || (notebookType ===
|
|
76
|
-
const model = this._instantiationService.createInstance(
|
|
77
|
-
|
|
81
|
+
const isScratchpadView = isScratchpad || (notebookType === "interactive" && this._configurationService.getValue(NotebookSetting.InteractiveWindowPromptToSave) !== true);
|
|
82
|
+
const model = this._instantiationService.createInstance(
|
|
83
|
+
SimpleNotebookEditorModel,
|
|
84
|
+
uri,
|
|
85
|
+
hasAssociatedFilePath,
|
|
86
|
+
notebookType,
|
|
87
|
+
workingCopyManager,
|
|
88
|
+
isScratchpadView
|
|
89
|
+
);
|
|
90
|
+
const result = await model.load({
|
|
91
|
+
limits
|
|
92
|
+
});
|
|
78
93
|
let onDirtyAutoReference;
|
|
79
|
-
this._modelListener.set(result, combinedDisposable(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
onDirtyAutoReference
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
94
|
+
this._modelListener.set(result, combinedDisposable(
|
|
95
|
+
result.onDidSave(() => this._onDidSaveNotebook.fire(result.resource)),
|
|
96
|
+
result.onDidChangeDirty(() => {
|
|
97
|
+
const isDirty = result.isDirty();
|
|
98
|
+
this._dirtyStates.set(result.resource, isDirty);
|
|
99
|
+
if (isDirty && !onDirtyAutoReference) {
|
|
100
|
+
onDirtyAutoReference = this.acquire(key, notebookType);
|
|
101
|
+
} else if (onDirtyAutoReference) {
|
|
102
|
+
onDirtyAutoReference.dispose();
|
|
103
|
+
onDirtyAutoReference = undefined;
|
|
104
|
+
}
|
|
105
|
+
this._onDidChangeDirty.fire(result);
|
|
106
|
+
}),
|
|
107
|
+
toDisposable(() => onDirtyAutoReference?.dispose())
|
|
108
|
+
));
|
|
91
109
|
return result;
|
|
92
110
|
}
|
|
93
111
|
destroyReferencedObject(key, object) {
|
|
@@ -107,25 +125,22 @@ let NotebookModelReferenceCollection = class NotebookModelReferenceCollection ex
|
|
|
107
125
|
this._modelListener.get(model)?.dispose();
|
|
108
126
|
this._modelListener.delete(model);
|
|
109
127
|
model.dispose();
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
finally {
|
|
128
|
+
} catch (err) {
|
|
129
|
+
this._notebookLoggingService.error("NotebookModelCollection", "FAILED to destory notebook - " + err);
|
|
130
|
+
} finally {
|
|
115
131
|
this.modelsToDispose.delete(key);
|
|
116
132
|
}
|
|
117
133
|
})();
|
|
118
134
|
}
|
|
119
135
|
};
|
|
120
|
-
NotebookModelReferenceCollection = ( __decorate([
|
|
121
|
-
( __param(0, IInstantiationService)),
|
|
122
|
-
( __param(1, INotebookService)),
|
|
123
|
-
( __param(2, IConfigurationService)),
|
|
124
|
-
( __param(3, ITelemetryService)),
|
|
125
|
-
( __param(4, INotebookLoggingService))
|
|
126
|
-
], NotebookModelReferenceCollection));
|
|
136
|
+
NotebookModelReferenceCollection = ( __decorate([( __param(0, IInstantiationService)), ( __param(1, INotebookService)), ( __param(2, IConfigurationService)), ( __param(3, ITelemetryService)), ( __param(4, INotebookLoggingService))], NotebookModelReferenceCollection));
|
|
127
137
|
let NotebookModelResolverServiceImpl = class NotebookModelResolverServiceImpl {
|
|
128
|
-
constructor(
|
|
138
|
+
constructor(
|
|
139
|
+
instantiationService,
|
|
140
|
+
_notebookService,
|
|
141
|
+
_extensionService,
|
|
142
|
+
_uriIdentService
|
|
143
|
+
) {
|
|
129
144
|
this._notebookService = _notebookService;
|
|
130
145
|
this._extensionService = _extensionService;
|
|
131
146
|
this._uriIdentService = _uriIdentService;
|
|
@@ -144,13 +159,15 @@ let NotebookModelResolverServiceImpl = class NotebookModelResolverServiceImpl {
|
|
|
144
159
|
createUntitledUri(notebookType) {
|
|
145
160
|
const info = this._notebookService.getContributedNotebookType(assertReturnsDefined(notebookType));
|
|
146
161
|
if (!info) {
|
|
147
|
-
throw ( new Error(
|
|
162
|
+
throw ( new Error("UNKNOWN notebook type: " + notebookType));
|
|
148
163
|
}
|
|
149
|
-
const suffix = NotebookProviderInfo.possibleFileEnding(info.selectors) ??
|
|
150
|
-
for (let counter = 1
|
|
151
|
-
const candidate = ( URI.from(
|
|
152
|
-
|
|
153
|
-
|
|
164
|
+
const suffix = NotebookProviderInfo.possibleFileEnding(info.selectors) ?? "";
|
|
165
|
+
for (let counter = 1; ; counter++) {
|
|
166
|
+
const candidate = ( URI.from({
|
|
167
|
+
scheme: Schemas.untitled,
|
|
168
|
+
path: `Untitled-${counter}${suffix}`,
|
|
169
|
+
query: notebookType
|
|
170
|
+
}));
|
|
154
171
|
if (!this._notebookService.getNotebookTextModel(candidate) && !this._data.isListeningToModel(candidate)) {
|
|
155
172
|
return candidate;
|
|
156
173
|
}
|
|
@@ -158,7 +175,7 @@ let NotebookModelResolverServiceImpl = class NotebookModelResolverServiceImpl {
|
|
|
158
175
|
}
|
|
159
176
|
async validateResourceViewType(uri, viewType) {
|
|
160
177
|
if (!uri && !viewType) {
|
|
161
|
-
throw ( new Error(
|
|
178
|
+
throw ( new Error("Must provide at least one of resource or viewType"));
|
|
162
179
|
}
|
|
163
180
|
if (uri?.scheme === CellUri.scheme) {
|
|
164
181
|
const originalUri = uri;
|
|
@@ -172,20 +189,20 @@ let NotebookModelResolverServiceImpl = class NotebookModelResolverServiceImpl {
|
|
|
172
189
|
if (!viewType) {
|
|
173
190
|
if (existingNotebook) {
|
|
174
191
|
viewType = existingNotebook.viewType;
|
|
175
|
-
}
|
|
176
|
-
else {
|
|
192
|
+
} else {
|
|
177
193
|
await this._extensionService.whenInstalledExtensionsRegistered();
|
|
178
194
|
const providers = this._notebookService.getContributedNotebookTypes(resource);
|
|
179
|
-
viewType = providers.find(provider => provider.priority ===
|
|
180
|
-
providers.find(provider => provider.priority === 'default')?.id ??
|
|
181
|
-
providers[0]?.id;
|
|
195
|
+
viewType = providers.find(provider => provider.priority === "exclusive")?.id ?? providers.find(provider => provider.priority === "default")?.id ?? providers[0]?.id;
|
|
182
196
|
}
|
|
183
197
|
}
|
|
184
198
|
if (!viewType) {
|
|
185
199
|
throw ( new Error(`Missing viewType for '${resource}'`));
|
|
186
200
|
}
|
|
187
201
|
if (existingNotebook && existingNotebook.viewType !== viewType) {
|
|
188
|
-
await this._onWillFailWithConflict.fireAsync({
|
|
202
|
+
await this._onWillFailWithConflict.fireAsync({
|
|
203
|
+
resource: resource,
|
|
204
|
+
viewType
|
|
205
|
+
}, CancellationToken.None);
|
|
189
206
|
const existingViewType2 = this._notebookService.getNotebookTextModel(resource)?.viewType;
|
|
190
207
|
if (existingViewType2 && existingViewType2 !== viewType) {
|
|
191
208
|
throw ( new Error(
|
|
@@ -193,7 +210,10 @@ let NotebookModelResolverServiceImpl = class NotebookModelResolverServiceImpl {
|
|
|
193
210
|
));
|
|
194
211
|
}
|
|
195
212
|
}
|
|
196
|
-
return {
|
|
213
|
+
return {
|
|
214
|
+
resource,
|
|
215
|
+
viewType
|
|
216
|
+
};
|
|
197
217
|
}
|
|
198
218
|
async createUntitledNotebookTextModel(viewType) {
|
|
199
219
|
const resource = this._uriIdentService.asCanonicalUri(this.createUntitledUri(viewType));
|
|
@@ -204,13 +224,13 @@ let NotebookModelResolverServiceImpl = class NotebookModelResolverServiceImpl {
|
|
|
204
224
|
let hasAssociatedFilePath;
|
|
205
225
|
if (URI.isUri(arg0)) {
|
|
206
226
|
resource = arg0;
|
|
207
|
-
}
|
|
208
|
-
else if (arg0.untitledResource) {
|
|
227
|
+
} else if (arg0.untitledResource) {
|
|
209
228
|
if (arg0.untitledResource.scheme === Schemas.untitled) {
|
|
210
229
|
resource = arg0.untitledResource;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
|
|
230
|
+
} else {
|
|
231
|
+
resource = arg0.untitledResource.with({
|
|
232
|
+
scheme: Schemas.untitled
|
|
233
|
+
});
|
|
214
234
|
hasAssociatedFilePath = true;
|
|
215
235
|
}
|
|
216
236
|
}
|
|
@@ -220,20 +240,16 @@ let NotebookModelResolverServiceImpl = class NotebookModelResolverServiceImpl {
|
|
|
220
240
|
const model = await reference.object;
|
|
221
241
|
return {
|
|
222
242
|
object: model,
|
|
223
|
-
dispose() {
|
|
243
|
+
dispose() {
|
|
244
|
+
reference.dispose();
|
|
245
|
+
}
|
|
224
246
|
};
|
|
225
|
-
}
|
|
226
|
-
catch (err) {
|
|
247
|
+
} catch (err) {
|
|
227
248
|
reference.dispose();
|
|
228
249
|
throw err;
|
|
229
250
|
}
|
|
230
251
|
}
|
|
231
252
|
};
|
|
232
|
-
NotebookModelResolverServiceImpl = ( __decorate([
|
|
233
|
-
( __param(0, IInstantiationService)),
|
|
234
|
-
( __param(1, INotebookService)),
|
|
235
|
-
( __param(2, IExtensionService)),
|
|
236
|
-
( __param(3, IUriIdentityService))
|
|
237
|
-
], NotebookModelResolverServiceImpl));
|
|
253
|
+
NotebookModelResolverServiceImpl = ( __decorate([( __param(0, IInstantiationService)), ( __param(1, INotebookService)), ( __param(2, IExtensionService)), ( __param(3, IUriIdentityService))], NotebookModelResolverServiceImpl));
|
|
238
254
|
|
|
239
255
|
export { NotebookModelResolverServiceImpl };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
2
2
|
import { ExtensionIdentifier, IExtensionDescription } from "@codingame/monaco-vscode-api/vscode/vs/platform/extensions/common/extensions";
|
|
3
|
-
import { INotebookRendererInfo, ContributedNotebookRendererEntrypoint, NotebookRendererMatch, RendererMessagingSpec, NotebookRendererEntrypoint, INotebookStaticPreloadInfo
|
|
3
|
+
import { INotebookRendererInfo, ContributedNotebookRendererEntrypoint, NotebookRendererMatch, RendererMessagingSpec, NotebookRendererEntrypoint, INotebookStaticPreloadInfo } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon";
|
|
4
4
|
declare class DependencyList {
|
|
5
5
|
private readonly value;
|
|
6
6
|
readonly defined: boolean;
|
|
@@ -19,13 +19,12 @@ class NotebookOutputRendererInfo {
|
|
|
19
19
|
this.extensionId = descriptor.extension.identifier;
|
|
20
20
|
this.extensionLocation = descriptor.extension.extensionLocation;
|
|
21
21
|
this.isBuiltin = descriptor.extension.isBuiltin;
|
|
22
|
-
if (typeof descriptor.entrypoint ===
|
|
22
|
+
if (typeof descriptor.entrypoint === "string") {
|
|
23
23
|
this.entrypoint = {
|
|
24
24
|
extends: undefined,
|
|
25
25
|
path: joinPath(this.extensionLocation, descriptor.entrypoint)
|
|
26
26
|
};
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
27
|
+
} else {
|
|
29
28
|
this.entrypoint = {
|
|
30
29
|
extends: descriptor.entrypoint.extends,
|
|
31
30
|
path: joinPath(this.extensionLocation, descriptor.entrypoint.path)
|
|
@@ -33,7 +32,9 @@ class NotebookOutputRendererInfo {
|
|
|
33
32
|
}
|
|
34
33
|
this.displayName = descriptor.displayName;
|
|
35
34
|
this.mimeTypes = descriptor.mimeTypes;
|
|
36
|
-
this.mimeTypeGlobs = ( this.mimeTypes.map(pattern => parse(pattern, {
|
|
35
|
+
this.mimeTypeGlobs = ( this.mimeTypes.map(pattern => parse(pattern, {
|
|
36
|
+
ignoreCase: true
|
|
37
|
+
})));
|
|
37
38
|
this.hardDependencies = ( new DependencyList(descriptor.dependencies ?? Iterable.empty()));
|
|
38
39
|
this.optionalDependencies = ( new DependencyList(descriptor.optionalDependencies ?? Iterable.empty()));
|
|
39
40
|
this.messaging = descriptor.requiresMessaging ?? RendererMessagingSpec.Never;
|
|
@@ -55,13 +56,9 @@ class NotebookOutputRendererInfo {
|
|
|
55
56
|
return NotebookRendererMatch.Never;
|
|
56
57
|
}
|
|
57
58
|
if (this.hardDependencies.defined) {
|
|
58
|
-
return this.hardDependencies.matches(kernelProvides)
|
|
59
|
-
? NotebookRendererMatch.WithHardKernelDependency
|
|
60
|
-
: NotebookRendererMatch.Never;
|
|
59
|
+
return this.hardDependencies.matches(kernelProvides) ? NotebookRendererMatch.WithHardKernelDependency : NotebookRendererMatch.Never;
|
|
61
60
|
}
|
|
62
|
-
return this.optionalDependencies.matches(kernelProvides)
|
|
63
|
-
? NotebookRendererMatch.WithOptionalKernelDependency
|
|
64
|
-
: NotebookRendererMatch.Pure;
|
|
61
|
+
return this.optionalDependencies.matches(kernelProvides) ? NotebookRendererMatch.WithOptionalKernelDependency : NotebookRendererMatch.Pure;
|
|
65
62
|
}
|
|
66
63
|
matchesMimeTypeOnly(mimeType) {
|
|
67
64
|
if (this.entrypoint.extends) {
|
|
@@ -4,7 +4,7 @@ import { computeLevenshteinDistance } from '@codingame/monaco-vscode-api/vscode/
|
|
|
4
4
|
function matchCellBasedOnSimilarties(modifiedCells, originalCells) {
|
|
5
5
|
const cache = {
|
|
6
6
|
modifiedToOriginal: ( new Map()),
|
|
7
|
-
originalToModified: ( new Map())
|
|
7
|
+
originalToModified: ( new Map())
|
|
8
8
|
};
|
|
9
9
|
const results = [];
|
|
10
10
|
const mappedOriginalCellToModifiedCell = ( new Map());
|
|
@@ -23,14 +23,35 @@ function matchCellBasedOnSimilarties(modifiedCells, originalCells) {
|
|
|
23
23
|
};
|
|
24
24
|
for (let i = 0; i < modifiedCells.length; i++) {
|
|
25
25
|
const modifiedCell = modifiedCells[i];
|
|
26
|
-
const {
|
|
26
|
+
const {
|
|
27
|
+
index,
|
|
28
|
+
editCount: dist,
|
|
29
|
+
percentage
|
|
30
|
+
} = computeClosestCell({
|
|
31
|
+
cell: modifiedCell,
|
|
32
|
+
index: i
|
|
33
|
+
}, originalCells, true, cache, canOriginalIndexBeMappedToModifiedIndex);
|
|
27
34
|
if (index >= 0 && dist === 0) {
|
|
28
35
|
trackMappedIndexes(i, index);
|
|
29
|
-
results.push({
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
36
|
+
results.push({
|
|
37
|
+
modified: i,
|
|
38
|
+
original: index,
|
|
39
|
+
dist,
|
|
40
|
+
percentage,
|
|
41
|
+
possibleOriginal: index
|
|
42
|
+
});
|
|
43
|
+
} else {
|
|
44
|
+
originalIndexWithMostEdits.set(index, {
|
|
45
|
+
dist: dist,
|
|
46
|
+
modifiedIndex: i
|
|
47
|
+
});
|
|
48
|
+
results.push({
|
|
49
|
+
modified: i,
|
|
50
|
+
original: -1,
|
|
51
|
+
dist: dist,
|
|
52
|
+
percentage,
|
|
53
|
+
possibleOriginal: index
|
|
54
|
+
});
|
|
34
55
|
}
|
|
35
56
|
}
|
|
36
57
|
results.forEach((result, i) => {
|
|
@@ -57,7 +78,9 @@ function matchCellBasedOnSimilarties(modifiedCells, originalCells) {
|
|
|
57
78
|
}
|
|
58
79
|
});
|
|
59
80
|
const modifiedCell = modifiedCells[i];
|
|
60
|
-
if (result.original === -1 && result.possibleOriginal >= 0 && !( unavailableIndexes.has(result.possibleOriginal)) && canOriginalIndexBeMappedToModifiedIndex(result.possibleOriginal, {
|
|
81
|
+
if (result.original === -1 && result.possibleOriginal >= 0 && !( unavailableIndexes.has(result.possibleOriginal)) && canOriginalIndexBeMappedToModifiedIndex(result.possibleOriginal, {
|
|
82
|
+
editCount: result.dist
|
|
83
|
+
})) {
|
|
61
84
|
trackMappedIndexes(i, result.possibleOriginal);
|
|
62
85
|
result.original = result.possibleOriginal;
|
|
63
86
|
return;
|
|
@@ -73,7 +96,13 @@ function matchCellBasedOnSimilarties(modifiedCells, originalCells) {
|
|
|
73
96
|
}
|
|
74
97
|
}
|
|
75
98
|
}
|
|
76
|
-
const {
|
|
99
|
+
const {
|
|
100
|
+
index,
|
|
101
|
+
percentage
|
|
102
|
+
} = computeClosestCell({
|
|
103
|
+
cell: modifiedCell,
|
|
104
|
+
index: i
|
|
105
|
+
}, originalCells, false, cache, (originalIndex, originalValue) => {
|
|
77
106
|
if (( unavailableIndexes.has(originalIndex))) {
|
|
78
107
|
return false;
|
|
79
108
|
}
|
|
@@ -106,7 +135,7 @@ function matchCellBasedOnSimilarties(modifiedCells, originalCells) {
|
|
|
106
135
|
}
|
|
107
136
|
const nextOriginalCell = (i > 0 && originalCells.length > results[i - 1].original) ? results[i - 1].original + 1 : -1;
|
|
108
137
|
const nextOriginalCellValue = i > 0 && nextOriginalCell >= 0 && nextOriginalCell < originalCells.length ? originalCells[nextOriginalCell].getValue() : undefined;
|
|
109
|
-
if (index >= 0 && i > 0 && typeof nextOriginalCellValue ===
|
|
138
|
+
if (index >= 0 && i > 0 && typeof nextOriginalCellValue === "string" && !( mappedOriginalCellToModifiedCell.has(nextOriginalCell))) {
|
|
110
139
|
if (modifiedCell.getValue().includes(nextOriginalCellValue) || nextOriginalCellValue.includes(modifiedCell.getValue())) {
|
|
111
140
|
trackMappedIndexes(i, nextOriginalCell);
|
|
112
141
|
results[i].original = nextOriginalCell;
|
|
@@ -121,14 +150,27 @@ function matchCellBasedOnSimilarties(modifiedCells, originalCells) {
|
|
|
121
150
|
});
|
|
122
151
|
return results;
|
|
123
152
|
}
|
|
124
|
-
function computeClosestCell(
|
|
153
|
+
function computeClosestCell(
|
|
154
|
+
{
|
|
155
|
+
cell,
|
|
156
|
+
index: cellIndex
|
|
157
|
+
},
|
|
158
|
+
arr,
|
|
159
|
+
ignoreEmptyCells,
|
|
160
|
+
cache,
|
|
161
|
+
canOriginalIndexBeMappedToModifiedIndex
|
|
162
|
+
) {
|
|
125
163
|
let min_edits = Infinity;
|
|
126
164
|
let min_index = -1;
|
|
127
165
|
const internalId = cell.internalMetadata?.internalId;
|
|
128
166
|
if (internalId) {
|
|
129
167
|
const internalIdIndex = arr.findIndex(cell => cell.internalMetadata?.internalId === internalId);
|
|
130
168
|
if (internalIdIndex >= 0) {
|
|
131
|
-
return {
|
|
169
|
+
return {
|
|
170
|
+
index: internalIdIndex,
|
|
171
|
+
editCount: 0,
|
|
172
|
+
percentage: Number.MAX_SAFE_INTEGER
|
|
173
|
+
};
|
|
132
174
|
}
|
|
133
175
|
}
|
|
134
176
|
for (let i = 0; i < arr.length; i++) {
|
|
@@ -137,7 +179,9 @@ function computeClosestCell({ cell, index: cellIndex }, arr, ignoreEmptyCells, c
|
|
|
137
179
|
}
|
|
138
180
|
const str = arr[i].getValue();
|
|
139
181
|
const cacheEntry = cache.modifiedToOriginal.get(cellIndex) ?? ( new Map());
|
|
140
|
-
const value = cacheEntry.get(i) ?? {
|
|
182
|
+
const value = cacheEntry.get(i) ?? {
|
|
183
|
+
editCount: computeNumberOfEdits(cell, arr[i])
|
|
184
|
+
};
|
|
141
185
|
cacheEntry.set(i, value);
|
|
142
186
|
cache.modifiedToOriginal.set(cellIndex, cacheEntry);
|
|
143
187
|
const originalCacheEntry = cache.originalToModified.get(i) ?? ( new Map());
|
|
@@ -150,7 +194,11 @@ function computeClosestCell({ cell, index: cellIndex }, arr, ignoreEmptyCells, c
|
|
|
150
194
|
continue;
|
|
151
195
|
}
|
|
152
196
|
if (str === cell.getValue() && cell.getValue().length > 0) {
|
|
153
|
-
return {
|
|
197
|
+
return {
|
|
198
|
+
index: i,
|
|
199
|
+
editCount: 0,
|
|
200
|
+
percentage: 0
|
|
201
|
+
};
|
|
154
202
|
}
|
|
155
203
|
if (value.editCount < min_edits) {
|
|
156
204
|
min_edits = value.editCount;
|
|
@@ -158,10 +206,18 @@ function computeClosestCell({ cell, index: cellIndex }, arr, ignoreEmptyCells, c
|
|
|
158
206
|
}
|
|
159
207
|
}
|
|
160
208
|
if (min_index === -1) {
|
|
161
|
-
return {
|
|
209
|
+
return {
|
|
210
|
+
index: -1,
|
|
211
|
+
editCount: Number.MAX_SAFE_INTEGER,
|
|
212
|
+
percentage: Number.MAX_SAFE_INTEGER
|
|
213
|
+
};
|
|
162
214
|
}
|
|
163
215
|
const percentage = !cell.getValue().length && !arr[min_index].getValue().length ? 0 : (cell.getValue().length ? (min_edits * 100 / cell.getValue().length) : Number.MAX_SAFE_INTEGER);
|
|
164
|
-
return {
|
|
216
|
+
return {
|
|
217
|
+
index: min_index,
|
|
218
|
+
editCount: min_edits,
|
|
219
|
+
percentage
|
|
220
|
+
};
|
|
165
221
|
}
|
|
166
222
|
function computeNumberOfEdits(modified, original) {
|
|
167
223
|
if (modified.getValue() === original.getValue()) {
|