@codingame/monaco-vscode-notebook-service-override 1.85.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/external/rollup-plugin-styles/dist/runtime/inject-css.js +3 -0
- package/external/tslib/tslib.es6.js +11 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/notebook.d.ts +5 -0
- package/notebook.js +44 -0
- package/override/vs/platform/dialogs/common/dialogs.js +8 -0
- package/package.json +32 -0
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +387 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +668 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.js +109 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController.js +319 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/notebookVisibleCellObserver.js +58 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +173 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +485 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.js +106 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookCellPausing.js +67 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +165 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.js +67 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +238 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/execute/executionEditorProgress.js +72 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/media/notebookFind.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +168 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget.js +317 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +209 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +87 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/kernelDetection/notebookKernelDetection.js +82 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +67 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +93 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +383 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +51 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +46 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +135 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +383 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +117 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +511 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +168 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +57 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.js +94 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/apiActions.js +51 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +702 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +268 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.js +45 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +1297 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +284 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.js +563 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.js +108 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.js +39 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiff.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +313 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +872 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.js +13 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +393 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +175 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +1121 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibility.js +159 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +339 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookCellStatusBarServiceImpl.js +41 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +182 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +106 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +509 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +133 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +342 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +111 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +28 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.js +65 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +666 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +200 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.js +80 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +1001 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +103 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +202 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.js +80 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookProvider.js +98 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookSimpleWorker.js +217 -0
- package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.js +89 -0
- package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +372 -0
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopy.js +706 -0
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +407 -0
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.js +144 -0
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopyManager.js +129 -0
- package/worker.js +1 -0
- package/workers/notebook.worker.js +9 -0
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import * as dom from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
3
|
+
import * as nls from 'monaco-editor/esm/vs/nls.js';
|
|
4
|
+
import { Disposable, DisposableStore } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
5
|
+
import { SideBySideDiffElementViewModel } from './diffElementViewModel.js';
|
|
6
|
+
import { DiffSide } from './notebookDiffEditorBrowser.js';
|
|
7
|
+
import { INotebookService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookService';
|
|
8
|
+
import { ThemeIcon } from 'monaco-editor/esm/vs/base/common/themables.js';
|
|
9
|
+
import { mimetypeIcon } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookIcons';
|
|
10
|
+
import { StandardKeyboardEvent } from 'monaco-editor/esm/vs/base/browser/keyboardEvent.js';
|
|
11
|
+
import { IQuickInputService } from 'monaco-editor/esm/vs/platform/quickinput/common/quickInput.js';
|
|
12
|
+
|
|
13
|
+
class OutputElement extends Disposable {
|
|
14
|
+
constructor(_notebookEditor, _notebookTextModel, _notebookService, _quickInputService, _diffElementViewModel, _diffSide, _nestedCell, _outputContainer, output) {
|
|
15
|
+
super();
|
|
16
|
+
this._notebookEditor = _notebookEditor;
|
|
17
|
+
this._notebookTextModel = _notebookTextModel;
|
|
18
|
+
this._notebookService = _notebookService;
|
|
19
|
+
this._quickInputService = _quickInputService;
|
|
20
|
+
this._diffElementViewModel = _diffElementViewModel;
|
|
21
|
+
this._diffSide = _diffSide;
|
|
22
|
+
this._nestedCell = _nestedCell;
|
|
23
|
+
this._outputContainer = _outputContainer;
|
|
24
|
+
this.output = output;
|
|
25
|
+
this.resizeListener = this._register(( new DisposableStore()));
|
|
26
|
+
}
|
|
27
|
+
render(index, beforeElement) {
|
|
28
|
+
const outputItemDiv = document.createElement('div');
|
|
29
|
+
let result = undefined;
|
|
30
|
+
const [mimeTypes, pick] = this.output.resolveMimeTypes(this._notebookTextModel, undefined);
|
|
31
|
+
const pickedMimeTypeRenderer = mimeTypes[pick];
|
|
32
|
+
if (mimeTypes.length > 1) {
|
|
33
|
+
outputItemDiv.style.position = 'relative';
|
|
34
|
+
const mimeTypePicker = dom.$('.multi-mimetype-output');
|
|
35
|
+
mimeTypePicker.classList.add(...ThemeIcon.asClassNameArray(mimetypeIcon));
|
|
36
|
+
mimeTypePicker.tabIndex = 0;
|
|
37
|
+
mimeTypePicker.title = ( nls.localizeWithPath(
|
|
38
|
+
'vs/workbench/contrib/notebook/browser/diff/diffElementOutputs',
|
|
39
|
+
'mimeTypePicker',
|
|
40
|
+
"Choose a different output mimetype, available mimetypes: {0}",
|
|
41
|
+
( mimeTypes.map(mimeType => mimeType.mimeType)).join(', ')
|
|
42
|
+
));
|
|
43
|
+
outputItemDiv.appendChild(mimeTypePicker);
|
|
44
|
+
this.resizeListener.add(dom.addStandardDisposableListener(mimeTypePicker, 'mousedown', async (e) => {
|
|
45
|
+
if (e.leftButton) {
|
|
46
|
+
e.preventDefault();
|
|
47
|
+
e.stopPropagation();
|
|
48
|
+
await this.pickActiveMimeTypeRenderer(this._notebookTextModel, this.output);
|
|
49
|
+
}
|
|
50
|
+
}));
|
|
51
|
+
this.resizeListener.add((dom.addDisposableListener(mimeTypePicker, dom.EventType.KEY_DOWN, async (e) => {
|
|
52
|
+
const event = ( new StandardKeyboardEvent(e));
|
|
53
|
+
if ((event.equals(3 ) || event.equals(10 ))) {
|
|
54
|
+
e.preventDefault();
|
|
55
|
+
e.stopPropagation();
|
|
56
|
+
await this.pickActiveMimeTypeRenderer(this._notebookTextModel, this.output);
|
|
57
|
+
}
|
|
58
|
+
})));
|
|
59
|
+
}
|
|
60
|
+
const innerContainer = dom.$('.output-inner-container');
|
|
61
|
+
dom.append(outputItemDiv, innerContainer);
|
|
62
|
+
if (mimeTypes.length !== 0) {
|
|
63
|
+
const renderer = this._notebookService.getRendererInfo(pickedMimeTypeRenderer.rendererId);
|
|
64
|
+
result = renderer
|
|
65
|
+
? { type: 1 , renderer, source: this.output, mimeType: pickedMimeTypeRenderer.mimeType }
|
|
66
|
+
: this._renderMissingRenderer(this.output, pickedMimeTypeRenderer.mimeType);
|
|
67
|
+
this.output.pickedMimeType = pickedMimeTypeRenderer;
|
|
68
|
+
}
|
|
69
|
+
this.domNode = outputItemDiv;
|
|
70
|
+
this.renderResult = result;
|
|
71
|
+
if (!result) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (beforeElement) {
|
|
75
|
+
this._outputContainer.insertBefore(outputItemDiv, beforeElement);
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
this._outputContainer.appendChild(outputItemDiv);
|
|
79
|
+
}
|
|
80
|
+
this._notebookEditor.createOutput(this._diffElementViewModel, this._nestedCell, result, () => this.getOutputOffsetInCell(index), this._diffElementViewModel instanceof SideBySideDiffElementViewModel
|
|
81
|
+
? this._diffSide
|
|
82
|
+
: this._diffElementViewModel.type === 'insert' ? DiffSide.Modified : DiffSide.Original);
|
|
83
|
+
}
|
|
84
|
+
_renderMissingRenderer(viewModel, preferredMimeType) {
|
|
85
|
+
if (!viewModel.model.outputs.length) {
|
|
86
|
+
return this._renderMessage(viewModel, ( nls.localizeWithPath(
|
|
87
|
+
'vs/workbench/contrib/notebook/browser/diff/diffElementOutputs',
|
|
88
|
+
'empty',
|
|
89
|
+
"Cell has no output"
|
|
90
|
+
)));
|
|
91
|
+
}
|
|
92
|
+
if (!preferredMimeType) {
|
|
93
|
+
const mimeTypes = ( viewModel.model.outputs.map(op => op.mime));
|
|
94
|
+
const mimeTypesMessage = mimeTypes.join(', ');
|
|
95
|
+
return this._renderMessage(viewModel, ( nls.localizeWithPath(
|
|
96
|
+
'vs/workbench/contrib/notebook/browser/diff/diffElementOutputs',
|
|
97
|
+
'noRenderer.2',
|
|
98
|
+
"No renderer could be found for output. It has the following mimetypes: {0}",
|
|
99
|
+
mimeTypesMessage
|
|
100
|
+
)));
|
|
101
|
+
}
|
|
102
|
+
return this._renderSearchForMimetype(viewModel, preferredMimeType);
|
|
103
|
+
}
|
|
104
|
+
_renderSearchForMimetype(viewModel, mimeType) {
|
|
105
|
+
const query = `@tag:notebookRenderer ${mimeType}`;
|
|
106
|
+
const p = dom.$('p', undefined, `No renderer could be found for mimetype "${mimeType}", but one might be available on the Marketplace.`);
|
|
107
|
+
const a = dom.$('a', { href: `command:workbench.extensions.search?%22${query}%22`, class: 'monaco-button monaco-text-button', tabindex: 0, role: 'button', style: 'padding: 8px; text-decoration: none; color: rgb(255, 255, 255); background-color: rgb(14, 99, 156); max-width: 200px;' }, `Search Marketplace`);
|
|
108
|
+
return {
|
|
109
|
+
type: 0 ,
|
|
110
|
+
source: viewModel,
|
|
111
|
+
htmlContent: p.outerHTML + a.outerHTML,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
_renderMessage(viewModel, message) {
|
|
115
|
+
const el = dom.$('p', undefined, message);
|
|
116
|
+
return { type: 0 , source: viewModel, htmlContent: el.outerHTML };
|
|
117
|
+
}
|
|
118
|
+
async pickActiveMimeTypeRenderer(notebookTextModel, viewModel) {
|
|
119
|
+
const [mimeTypes, currIndex] = viewModel.resolveMimeTypes(notebookTextModel, undefined);
|
|
120
|
+
const items = ( mimeTypes.filter(mimeType => mimeType.isTrusted).map((mimeType, index) => ({
|
|
121
|
+
label: mimeType.mimeType,
|
|
122
|
+
id: mimeType.mimeType,
|
|
123
|
+
index: index,
|
|
124
|
+
picked: index === currIndex,
|
|
125
|
+
detail: this.generateRendererInfo(mimeType.rendererId),
|
|
126
|
+
description: index === currIndex ? ( nls.localizeWithPath(
|
|
127
|
+
'vs/workbench/contrib/notebook/browser/diff/diffElementOutputs',
|
|
128
|
+
'curruentActiveMimeType',
|
|
129
|
+
"Currently Active"
|
|
130
|
+
)) : undefined
|
|
131
|
+
})));
|
|
132
|
+
const picker = this._quickInputService.createQuickPick();
|
|
133
|
+
picker.items = items;
|
|
134
|
+
picker.activeItems = items.filter(item => !!item.picked);
|
|
135
|
+
picker.placeholder = items.length !== mimeTypes.length
|
|
136
|
+
? ( nls.localizeWithPath(
|
|
137
|
+
'vs/workbench/contrib/notebook/browser/diff/diffElementOutputs',
|
|
138
|
+
'promptChooseMimeTypeInSecure.placeHolder',
|
|
139
|
+
"Select mimetype to render for current output. Rich mimetypes are available only when the notebook is trusted"
|
|
140
|
+
))
|
|
141
|
+
: ( nls.localizeWithPath(
|
|
142
|
+
'vs/workbench/contrib/notebook/browser/diff/diffElementOutputs',
|
|
143
|
+
'promptChooseMimeType.placeHolder',
|
|
144
|
+
"Select mimetype to render for current output"
|
|
145
|
+
));
|
|
146
|
+
const pick = await ( new Promise(resolve => {
|
|
147
|
+
picker.onDidAccept(() => {
|
|
148
|
+
resolve(picker.selectedItems.length === 1 ? picker.selectedItems[0].index : undefined);
|
|
149
|
+
picker.dispose();
|
|
150
|
+
});
|
|
151
|
+
picker.show();
|
|
152
|
+
}));
|
|
153
|
+
if (pick === undefined) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
if (pick !== currIndex) {
|
|
157
|
+
const index = this._nestedCell.outputsViewModels.indexOf(viewModel);
|
|
158
|
+
const nextElement = this.domNode.nextElementSibling;
|
|
159
|
+
this.resizeListener.clear();
|
|
160
|
+
const element = this.domNode;
|
|
161
|
+
if (element) {
|
|
162
|
+
element.parentElement?.removeChild(element);
|
|
163
|
+
this._notebookEditor.removeInset(this._diffElementViewModel, this._nestedCell, viewModel, this._diffSide);
|
|
164
|
+
}
|
|
165
|
+
viewModel.pickedMimeType = mimeTypes[pick];
|
|
166
|
+
this.render(index, nextElement);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
generateRendererInfo(renderId) {
|
|
170
|
+
const renderInfo = this._notebookService.getRendererInfo(renderId);
|
|
171
|
+
if (renderInfo) {
|
|
172
|
+
const displayName = renderInfo.displayName !== '' ? renderInfo.displayName : renderInfo.id;
|
|
173
|
+
return `${displayName} (${renderInfo.extensionId.value})`;
|
|
174
|
+
}
|
|
175
|
+
return ( nls.localizeWithPath(
|
|
176
|
+
'vs/workbench/contrib/notebook/browser/diff/diffElementOutputs',
|
|
177
|
+
'builtinRenderInfo',
|
|
178
|
+
"built-in"
|
|
179
|
+
));
|
|
180
|
+
}
|
|
181
|
+
getCellOutputCurrentIndex() {
|
|
182
|
+
return this._diffElementViewModel.getNestedCellViewModel(this._diffSide).outputs.indexOf(this.output.model);
|
|
183
|
+
}
|
|
184
|
+
updateHeight(index, height) {
|
|
185
|
+
this._diffElementViewModel.updateOutputHeight(this._diffSide, index, height);
|
|
186
|
+
}
|
|
187
|
+
getOutputOffsetInContainer(index) {
|
|
188
|
+
return this._diffElementViewModel.getOutputOffsetInContainer(this._diffSide, index);
|
|
189
|
+
}
|
|
190
|
+
getOutputOffsetInCell(index) {
|
|
191
|
+
return this._diffElementViewModel.getOutputOffsetInCell(this._diffSide, index);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
let OutputContainer = class OutputContainer extends Disposable {
|
|
195
|
+
constructor(_editor, _notebookTextModel, _diffElementViewModel, _nestedCellViewModel, _diffSide, _outputContainer, _notebookService, _quickInputService) {
|
|
196
|
+
super();
|
|
197
|
+
this._editor = _editor;
|
|
198
|
+
this._notebookTextModel = _notebookTextModel;
|
|
199
|
+
this._diffElementViewModel = _diffElementViewModel;
|
|
200
|
+
this._nestedCellViewModel = _nestedCellViewModel;
|
|
201
|
+
this._diffSide = _diffSide;
|
|
202
|
+
this._outputContainer = _outputContainer;
|
|
203
|
+
this._notebookService = _notebookService;
|
|
204
|
+
this._quickInputService = _quickInputService;
|
|
205
|
+
this._outputEntries = ( new Map());
|
|
206
|
+
this._register(this._diffElementViewModel.onDidLayoutChange(() => {
|
|
207
|
+
this._outputEntries.forEach((value, key) => {
|
|
208
|
+
const index = _nestedCellViewModel.outputs.indexOf(key.model);
|
|
209
|
+
if (index >= 0) {
|
|
210
|
+
const top = this._diffElementViewModel.getOutputOffsetInContainer(this._diffSide, index);
|
|
211
|
+
value.domNode.style.top = `${top}px`;
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
}));
|
|
215
|
+
this._register(this._nestedCellViewModel.textModel.onDidChangeOutputs(splice => {
|
|
216
|
+
this._updateOutputs(splice);
|
|
217
|
+
}));
|
|
218
|
+
}
|
|
219
|
+
_updateOutputs(splice) {
|
|
220
|
+
const removedKeys = [];
|
|
221
|
+
this._outputEntries.forEach((value, key) => {
|
|
222
|
+
if (this._nestedCellViewModel.outputsViewModels.indexOf(key) < 0) {
|
|
223
|
+
removedKeys.push(key);
|
|
224
|
+
this._outputContainer.removeChild(value.domNode);
|
|
225
|
+
this._editor.removeInset(this._diffElementViewModel, this._nestedCellViewModel, key, this._diffSide);
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
removedKeys.forEach(key => {
|
|
229
|
+
this._outputEntries.get(key)?.dispose();
|
|
230
|
+
this._outputEntries.delete(key);
|
|
231
|
+
});
|
|
232
|
+
let prevElement = undefined;
|
|
233
|
+
const outputsToRender = this._nestedCellViewModel.outputsViewModels;
|
|
234
|
+
outputsToRender.reverse().forEach(output => {
|
|
235
|
+
if (( this._outputEntries.has(output))) {
|
|
236
|
+
prevElement = this._outputEntries.get(output).domNode;
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
const currIndex = this._nestedCellViewModel.outputsViewModels.indexOf(output);
|
|
240
|
+
this._renderOutput(output, currIndex, prevElement);
|
|
241
|
+
prevElement = this._outputEntries.get(output)?.domNode;
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
render() {
|
|
245
|
+
for (let index = 0; index < this._nestedCellViewModel.outputsViewModels.length; index++) {
|
|
246
|
+
const currOutput = this._nestedCellViewModel.outputsViewModels[index];
|
|
247
|
+
this._renderOutput(currOutput, index, undefined);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
showOutputs() {
|
|
251
|
+
for (let index = 0; index < this._nestedCellViewModel.outputsViewModels.length; index++) {
|
|
252
|
+
const currOutput = this._nestedCellViewModel.outputsViewModels[index];
|
|
253
|
+
this._editor.showInset(this._diffElementViewModel, currOutput.cellViewModel, currOutput, this._diffSide);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
hideOutputs() {
|
|
257
|
+
this._outputEntries.forEach((outputElement, cellOutputViewModel) => {
|
|
258
|
+
this._editor.hideInset(this._diffElementViewModel, this._nestedCellViewModel, cellOutputViewModel);
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
_renderOutput(currOutput, index, beforeElement) {
|
|
262
|
+
if (!( this._outputEntries.has(currOutput))) {
|
|
263
|
+
this._outputEntries.set(currOutput, ( new OutputElement(
|
|
264
|
+
this._editor,
|
|
265
|
+
this._notebookTextModel,
|
|
266
|
+
this._notebookService,
|
|
267
|
+
this._quickInputService,
|
|
268
|
+
this._diffElementViewModel,
|
|
269
|
+
this._diffSide,
|
|
270
|
+
this._nestedCellViewModel,
|
|
271
|
+
this._outputContainer,
|
|
272
|
+
currOutput
|
|
273
|
+
)));
|
|
274
|
+
}
|
|
275
|
+
const renderElement = this._outputEntries.get(currOutput);
|
|
276
|
+
renderElement.render(index, beforeElement);
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
OutputContainer = ( __decorate([
|
|
280
|
+
( __param(6, INotebookService)),
|
|
281
|
+
( __param(7, IQuickInputService))
|
|
282
|
+
], OutputContainer));
|
|
283
|
+
|
|
284
|
+
export { OutputContainer, OutputElement };
|