@codingame/monaco-vscode-notebook-service-override 4.0.0 → 4.1.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.
Files changed (77) hide show
  1. package/notebook.js +12 -12
  2. package/package.json +2 -2
  3. package/external/rollup-plugin-styles/dist/runtime/inject-css.js +0 -3
  4. package/external/tslib/tslib.es6.js +0 -11
  5. package/override/vs/platform/dialogs/common/dialogs.js +0 -10
  6. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.css.js +0 -6
  7. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +0 -391
  8. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.js +0 -109
  9. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +0 -173
  10. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +0 -544
  11. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.js +0 -106
  12. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookCellPausing.js +0 -67
  13. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +0 -165
  14. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.js +0 -67
  15. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +0 -320
  16. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/execute/executionEditorProgress.js +0 -72
  17. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/media/notebookFind.css.js +0 -6
  18. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +0 -168
  19. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +0 -209
  20. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +0 -84
  21. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/kernelDetection/notebookKernelDetection.js +0 -82
  22. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +0 -67
  23. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +0 -101
  24. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +0 -393
  25. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableContextKeys.js +0 -5
  26. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +0 -97
  27. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +0 -120
  28. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +0 -60
  29. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +0 -150
  30. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +0 -656
  31. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +0 -77
  32. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +0 -517
  33. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +0 -159
  34. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +0 -56
  35. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.js +0 -94
  36. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/apiActions.js +0 -51
  37. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +0 -652
  38. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +0 -721
  39. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +0 -351
  40. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +0 -315
  41. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.js +0 -199
  42. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.js +0 -47
  43. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +0 -1297
  44. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +0 -284
  45. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.js +0 -563
  46. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.js +0 -115
  47. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.js +0 -39
  48. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiff.css.js +0 -6
  49. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +0 -313
  50. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +0 -911
  51. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.js +0 -13
  52. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +0 -395
  53. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +0 -185
  54. package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +0 -1187
  55. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibility.js +0 -159
  56. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +0 -451
  57. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +0 -192
  58. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +0 -106
  59. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +0 -510
  60. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +0 -130
  61. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +0 -341
  62. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +0 -111
  63. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +0 -28
  64. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.js +0 -65
  65. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +0 -641
  66. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +0 -200
  67. package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.js +0 -90
  68. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +0 -1002
  69. package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +0 -103
  70. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +0 -203
  71. package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.js +0 -80
  72. package/vscode/src/vs/workbench/contrib/notebook/common/notebookProvider.js +0 -98
  73. package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.js +0 -89
  74. package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +0 -386
  75. package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +0 -408
  76. package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.js +0 -144
  77. package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopyManager.js +0 -129
@@ -1,911 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
2
- import { localizeWithPath } from 'vscode/vscode/vs/nls';
3
- import { append, $ as $$1, addStandardDisposableGenericMouseDownListener, addStandardDisposableGenericMouseUpListener, scheduleAtNextAnimationFrame } from 'vscode/vscode/vs/base/browser/dom';
4
- import { findLastIdx } from 'vscode/vscode/vs/base/common/arraysFind';
5
- import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
6
- import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry';
7
- import { registerThemingParticipant, IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService';
8
- import { getDefaultNotebookCreationOptions } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookEditorWidget';
9
- import { CancellationTokenSource } from 'vscode/vscode/vs/base/common/cancellation';
10
- import { SideBySideDiffElementViewModel, SingleSideDiffElementViewModel } from './diffElementViewModel.js';
11
- import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
12
- import { CellDiffSingleSideRenderer, CellDiffSideBySideRenderer, NotebookTextDiffList, NotebookCellTextDiffListDelegate } from './notebookDiffList.js';
13
- import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
14
- import 'vscode/vscode/vs/platform/theme/common/colorUtils';
15
- import { foreground, focusBorder } from 'vscode/vscode/vs/platform/theme/common/colors/baseColors';
16
- import 'vscode/vscode/vs/platform/theme/common/colors/chartsColors';
17
- import { editorBackground, diffDiagonalFill } from 'vscode/vscode/vs/platform/theme/common/colors/editorColors';
18
- import 'vscode/vscode/vs/platform/theme/common/colors/inputColors';
19
- import 'vscode/vscode/vs/platform/theme/common/colors/listColors';
20
- import 'vscode/vscode/vs/platform/theme/common/colors/menuColors';
21
- import 'vscode/vscode/vs/platform/theme/common/colors/minimapColors';
22
- import 'vscode/vscode/vs/platform/theme/common/colors/miscColors';
23
- import 'vscode/vscode/vs/platform/theme/common/colors/quickpickColors';
24
- import 'vscode/vscode/vs/platform/theme/common/colors/searchColors';
25
- import { INotebookEditorWorkerService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/services/notebookWorkerService';
26
- import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
27
- import { BareFontInfo } from 'vscode/vscode/vs/editor/common/config/fontInfo';
28
- import { PixelRatio } from 'vscode/vscode/vs/base/browser/pixelRatio';
29
- import { DiffSide, DIFF_CELL_MARGIN } from './notebookDiffEditorBrowser.js';
30
- import { Emitter, Event } from 'vscode/vscode/vs/base/common/event';
31
- import { DisposableStore, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
32
- import { EditorPane } from 'vscode/vscode/vs/workbench/browser/parts/editor/editorPane';
33
- import { NOTEBOOK_DIFF_EDITOR_ID, NotebookSetting, CellUri } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
34
- import { SequencerByKey } from 'vscode/vscode/vs/base/common/async';
35
- import { generateUuid } from 'vscode/vscode/vs/base/common/uuid';
36
- import { DiffNestedCellViewModel } from './diffNestedCellViewModel.js';
37
- import { BackLayerWebView } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView';
38
- import { NotebookDiffEditorEventDispatcher, NotebookDiffLayoutChangedEvent } from './eventDispatcher.js';
39
- import { FontMeasurements } from 'vscode/vscode/vs/editor/browser/config/fontMeasurements';
40
- import { NotebookOptions } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookOptions';
41
- import { INotebookExecutionStateService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookExecutionStateService';
42
- import { cellRangesToIndexes, cellIndexesToRanges } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookRange';
43
- import { NotebookDiffOverviewRuler } from './notebookDiffOverviewRuler.js';
44
- import { registerZIndex, ZIndex } from 'vscode/vscode/vs/platform/layout/browser/zIndexRegistry';
45
- import { ICodeEditorService } from 'vscode/vscode/vs/editor/browser/services/codeEditorService';
46
-
47
- var NotebookTextDiffEditor_1;
48
- const $ = $$1;
49
- class NotebookDiffEditorSelection {
50
- constructor(selections) {
51
- this.selections = selections;
52
- }
53
- compare(other) {
54
- if (!(other instanceof NotebookDiffEditorSelection)) {
55
- return 3 ;
56
- }
57
- if (this.selections.length !== other.selections.length) {
58
- return 3 ;
59
- }
60
- for (let i = 0; i < this.selections.length; i++) {
61
- if (this.selections[i] !== other.selections[i]) {
62
- return 3 ;
63
- }
64
- }
65
- return 1 ;
66
- }
67
- restore(options) {
68
- const notebookOptions = {
69
- cellSelections: cellIndexesToRanges(this.selections)
70
- };
71
- Object.assign(notebookOptions, options);
72
- return notebookOptions;
73
- }
74
- }
75
- let NotebookTextDiffEditor = class NotebookTextDiffEditor extends EditorPane {
76
- static { NotebookTextDiffEditor_1 = this; }
77
- static { this.ENTIRE_DIFF_OVERVIEW_WIDTH = 30; }
78
- static { this.ID = NOTEBOOK_DIFF_EDITOR_ID; }
79
- get textModel() {
80
- return this._model?.modified.notebook;
81
- }
82
- get notebookOptions() {
83
- return this._notebookOptions;
84
- }
85
- get isDisposed() {
86
- return this._isDisposed;
87
- }
88
- constructor(group, instantiationService, themeService, contextKeyService, notebookEditorWorkerService, configurationService, telemetryService, storageService, notebookExecutionStateService, codeEditorService) {
89
- super(NotebookTextDiffEditor_1.ID, group, telemetryService, themeService, storageService);
90
- this.instantiationService = instantiationService;
91
- this.contextKeyService = contextKeyService;
92
- this.notebookEditorWorkerService = notebookEditorWorkerService;
93
- this.configurationService = configurationService;
94
- this.creationOptions = getDefaultNotebookCreationOptions();
95
- this._dimension = null;
96
- this._diffElementViewModels = [];
97
- this._modifiedWebview = null;
98
- this._originalWebview = null;
99
- this._webviewTransparentCover = null;
100
- this._onMouseUp = this._register(( new Emitter()));
101
- this.onMouseUp = this._onMouseUp.event;
102
- this._onDidScroll = this._register(( new Emitter()));
103
- this.onDidScroll = this._onDidScroll.event;
104
- this.onDidChangeScroll = this._onDidScroll.event;
105
- this._model = null;
106
- this._modifiedResourceDisposableStore = this._register(( new DisposableStore()));
107
- this._insetModifyQueueByOutputId = ( new SequencerByKey());
108
- this._onDidDynamicOutputRendered = this._register(( new Emitter()));
109
- this.onDidDynamicOutputRendered = this._onDidDynamicOutputRendered.event;
110
- this._localStore = this._register(( new DisposableStore()));
111
- this._onDidChangeSelection = this._register(( new Emitter()));
112
- this.onDidChangeSelection = this._onDidChangeSelection.event;
113
- this._isDisposed = false;
114
- this.pendingLayouts = ( new WeakMap());
115
- this._notebookOptions = ( new NotebookOptions(
116
- this.window,
117
- this.configurationService,
118
- notebookExecutionStateService,
119
- codeEditorService,
120
- false
121
- ));
122
- this._register(this._notebookOptions);
123
- this._revealFirst = true;
124
- }
125
- get fontInfo() {
126
- if (!this._fontInfo) {
127
- this._fontInfo = this.createFontInfo();
128
- }
129
- return this._fontInfo;
130
- }
131
- createFontInfo() {
132
- const editorOptions = this.configurationService.getValue('editor');
133
- return FontMeasurements.readFontInfo(this.window, BareFontInfo.createFromRawSettings(editorOptions, PixelRatio.getInstance(this.window).value));
134
- }
135
- isOverviewRulerEnabled() {
136
- return this.configurationService.getValue(NotebookSetting.diffOverviewRuler) ?? false;
137
- }
138
- getSelection() {
139
- const selections = this._list.getFocus();
140
- return ( new NotebookDiffEditorSelection(selections));
141
- }
142
- toggleNotebookCellSelection(cell) {
143
- }
144
- updatePerformanceMetadata(cellId, executionId, duration, rendererId) {
145
- }
146
- async focusNotebookCell(cell, focus) {
147
- }
148
- async focusNextNotebookCell(cell, focus) {
149
- }
150
- didFocusOutputInputChange(inputFocused) {
151
- }
152
- getScrollTop() {
153
- return this._list?.scrollTop ?? 0;
154
- }
155
- getScrollHeight() {
156
- return this._list?.scrollHeight ?? 0;
157
- }
158
- getScrollPosition() {
159
- return {
160
- scrollTop: this.getScrollTop(),
161
- scrollLeft: this._list?.scrollLeft ?? 0
162
- };
163
- }
164
- setScrollPosition(scrollPosition) {
165
- if (!this._list) {
166
- return;
167
- }
168
- this._list.scrollTop = scrollPosition.scrollTop;
169
- if (scrollPosition.scrollLeft !== undefined) {
170
- this._list.scrollLeft = scrollPosition.scrollLeft;
171
- }
172
- }
173
- delegateVerticalScrollbarPointerDown(browserEvent) {
174
- this._list?.delegateVerticalScrollbarPointerDown(browserEvent);
175
- }
176
- updateOutputHeight(cellInfo, output, outputHeight, isInit) {
177
- const diffElement = cellInfo.diffElement;
178
- const cell = this.getCellByInfo(cellInfo);
179
- const outputIndex = cell.outputsViewModels.indexOf(output);
180
- if (diffElement instanceof SideBySideDiffElementViewModel) {
181
- const info = CellUri.parse(cellInfo.cellUri);
182
- if (!info) {
183
- return;
184
- }
185
- diffElement.updateOutputHeight(( info.notebook.toString()) === this._model?.original.resource.toString() ? DiffSide.Original : DiffSide.Modified, outputIndex, outputHeight);
186
- }
187
- else {
188
- diffElement.updateOutputHeight(diffElement.type === 'insert' ? DiffSide.Modified : DiffSide.Original, outputIndex, outputHeight);
189
- }
190
- if (isInit) {
191
- this._onDidDynamicOutputRendered.fire({ cell, output });
192
- }
193
- }
194
- setMarkupCellEditState(cellId, editState) {
195
- }
196
- didStartDragMarkupCell(cellId, event) {
197
- }
198
- didDragMarkupCell(cellId, event) {
199
- }
200
- didEndDragMarkupCell(cellId) {
201
- }
202
- didDropMarkupCell(cellId) {
203
- }
204
- didResizeOutput(cellId) {
205
- }
206
- createEditor(parent) {
207
- this._rootElement = append(parent, $$1('.notebook-text-diff-editor'));
208
- this._overflowContainer = document.createElement('div');
209
- this._overflowContainer.classList.add('notebook-overflow-widget-container', 'monaco-editor');
210
- append(parent, this._overflowContainer);
211
- const renderers = [
212
- this.instantiationService.createInstance(CellDiffSingleSideRenderer, this),
213
- this.instantiationService.createInstance(CellDiffSideBySideRenderer, this),
214
- ];
215
- this._listViewContainer = append(this._rootElement, $$1('.notebook-diff-list-view'));
216
- this._list = this.instantiationService.createInstance(NotebookTextDiffList, 'NotebookTextDiff', this._listViewContainer, this.instantiationService.createInstance(NotebookCellTextDiffListDelegate, this.window), renderers, this.contextKeyService, {
217
- setRowLineHeight: false,
218
- setRowHeight: false,
219
- supportDynamicHeights: true,
220
- horizontalScrolling: false,
221
- keyboardSupport: false,
222
- mouseSupport: true,
223
- multipleSelectionSupport: false,
224
- typeNavigationEnabled: true,
225
- paddingBottom: 0,
226
- styleController: (_suffix) => { return this._list; },
227
- overrideStyles: {
228
- listBackground: editorBackground,
229
- listActiveSelectionBackground: editorBackground,
230
- listActiveSelectionForeground: foreground,
231
- listFocusAndSelectionBackground: editorBackground,
232
- listFocusAndSelectionForeground: foreground,
233
- listFocusBackground: editorBackground,
234
- listFocusForeground: foreground,
235
- listHoverForeground: foreground,
236
- listHoverBackground: editorBackground,
237
- listHoverOutline: focusBorder,
238
- listFocusOutline: focusBorder,
239
- listInactiveSelectionBackground: editorBackground,
240
- listInactiveSelectionForeground: foreground,
241
- listInactiveFocusBackground: editorBackground,
242
- listInactiveFocusOutline: editorBackground,
243
- },
244
- accessibilityProvider: {
245
- getAriaLabel() { return null; },
246
- getWidgetAriaLabel() {
247
- return ( localizeWithPath(
248
- 'vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor',
249
- 'notebookTreeAriaLabel',
250
- "Notebook Text Diff"
251
- ));
252
- }
253
- },
254
- });
255
- this._register(this._list);
256
- this._register(this._list.onMouseUp(e => {
257
- if (e.element) {
258
- this._onMouseUp.fire({ event: e.browserEvent, target: e.element });
259
- }
260
- }));
261
- this._register(this._list.onDidScroll(() => {
262
- this._onDidScroll.fire();
263
- }));
264
- this._register(this._list.onDidChangeFocus(() => this._onDidChangeSelection.fire({ reason: 2 })));
265
- this._overviewRulerContainer = document.createElement('div');
266
- this._overviewRulerContainer.classList.add('notebook-overview-ruler-container');
267
- this._rootElement.appendChild(this._overviewRulerContainer);
268
- this._registerOverviewRuler();
269
- this._webviewTransparentCover = append(this._list.rowsContainer, $('.webview-cover'));
270
- this._webviewTransparentCover.style.display = 'none';
271
- this._register(addStandardDisposableGenericMouseDownListener(this._overflowContainer, (e) => {
272
- if (e.target.classList.contains('slider') && this._webviewTransparentCover) {
273
- this._webviewTransparentCover.style.display = 'block';
274
- }
275
- }));
276
- this._register(addStandardDisposableGenericMouseUpListener(this._overflowContainer, () => {
277
- if (this._webviewTransparentCover) {
278
- this._webviewTransparentCover.style.display = 'none';
279
- }
280
- }));
281
- this._register(this._list.onDidScroll(e => {
282
- this._webviewTransparentCover.style.top = `${e.scrollTop}px`;
283
- }));
284
- }
285
- _registerOverviewRuler() {
286
- this._overviewRuler = this._register(this.instantiationService.createInstance(NotebookDiffOverviewRuler, this, NotebookTextDiffEditor_1.ENTIRE_DIFF_OVERVIEW_WIDTH, this._overviewRulerContainer));
287
- }
288
- _updateOutputsOffsetsInWebview(scrollTop, scrollHeight, activeWebview, getActiveNestedCell, diffSide) {
289
- activeWebview.element.style.height = `${scrollHeight}px`;
290
- if (activeWebview.insetMapping) {
291
- const updateItems = [];
292
- const removedItems = [];
293
- activeWebview.insetMapping.forEach((value, key) => {
294
- const cell = getActiveNestedCell(value.cellInfo.diffElement);
295
- if (!cell) {
296
- return;
297
- }
298
- const viewIndex = this._list.indexOf(value.cellInfo.diffElement);
299
- if (viewIndex === undefined) {
300
- return;
301
- }
302
- if (cell.outputsViewModels.indexOf(key) < 0) {
303
- removedItems.push(key);
304
- }
305
- else {
306
- const cellTop = this._list.getCellViewScrollTop(value.cellInfo.diffElement);
307
- const outputIndex = cell.outputsViewModels.indexOf(key);
308
- const outputOffset = value.cellInfo.diffElement.getOutputOffsetInCell(diffSide, outputIndex);
309
- updateItems.push({
310
- cell,
311
- output: key,
312
- cellTop: cellTop,
313
- outputOffset: outputOffset,
314
- forceDisplay: false
315
- });
316
- }
317
- });
318
- activeWebview.removeInsets(removedItems);
319
- if (updateItems.length) {
320
- activeWebview.updateScrollTops(updateItems, []);
321
- }
322
- }
323
- }
324
- async setInput(input, options, context, token) {
325
- await super.setInput(input, options, context, token);
326
- const model = await input.resolve();
327
- if (this._model !== model) {
328
- this._detachModel();
329
- this._model = model;
330
- this._attachModel();
331
- }
332
- this._model = model;
333
- if (this._model === null) {
334
- return;
335
- }
336
- this._revealFirst = true;
337
- this._modifiedResourceDisposableStore.clear();
338
- this._layoutCancellationTokenSource = ( new CancellationTokenSource());
339
- this._modifiedResourceDisposableStore.add(Event.any(this._model.original.notebook.onDidChangeContent, this._model.modified.notebook.onDidChangeContent)(e => {
340
- if (this._model !== null) {
341
- this._layoutCancellationTokenSource?.dispose();
342
- this._layoutCancellationTokenSource = ( new CancellationTokenSource());
343
- this.updateLayout(this._layoutCancellationTokenSource.token);
344
- }
345
- }));
346
- await this._createOriginalWebview(generateUuid(), this._model.original.viewType, this._model.original.resource);
347
- if (this._originalWebview) {
348
- this._modifiedResourceDisposableStore.add(this._originalWebview);
349
- }
350
- await this._createModifiedWebview(generateUuid(), this._model.modified.viewType, this._model.modified.resource);
351
- if (this._modifiedWebview) {
352
- this._modifiedResourceDisposableStore.add(this._modifiedWebview);
353
- }
354
- await this.updateLayout(this._layoutCancellationTokenSource.token, options?.cellSelections ? cellRangesToIndexes(options.cellSelections) : undefined);
355
- }
356
- _detachModel() {
357
- this._localStore.clear();
358
- this._originalWebview?.dispose();
359
- this._originalWebview?.element.remove();
360
- this._originalWebview = null;
361
- this._modifiedWebview?.dispose();
362
- this._modifiedWebview?.element.remove();
363
- this._modifiedWebview = null;
364
- this._modifiedResourceDisposableStore.clear();
365
- this._list.clear();
366
- }
367
- _attachModel() {
368
- this._eventDispatcher = ( new NotebookDiffEditorEventDispatcher());
369
- const updateInsets = () => {
370
- scheduleAtNextAnimationFrame(this.window, () => {
371
- if (this._isDisposed) {
372
- return;
373
- }
374
- if (this._modifiedWebview) {
375
- this._updateOutputsOffsetsInWebview(this._list.scrollTop, this._list.scrollHeight, this._modifiedWebview, (diffElement) => {
376
- return diffElement.modified;
377
- }, DiffSide.Modified);
378
- }
379
- if (this._originalWebview) {
380
- this._updateOutputsOffsetsInWebview(this._list.scrollTop, this._list.scrollHeight, this._originalWebview, (diffElement) => {
381
- return diffElement.original;
382
- }, DiffSide.Original);
383
- }
384
- });
385
- };
386
- this._localStore.add(this._list.onDidChangeContentHeight(() => {
387
- updateInsets();
388
- }));
389
- this._localStore.add(this._eventDispatcher.onDidChangeCellLayout(() => {
390
- updateInsets();
391
- }));
392
- }
393
- async _createModifiedWebview(id, viewType, resource) {
394
- this._modifiedWebview?.dispose();
395
- this._modifiedWebview = this.instantiationService.createInstance(BackLayerWebView, this, id, viewType, resource, {
396
- ...this._notebookOptions.computeDiffWebviewOptions(),
397
- fontFamily: this._generateFontFamily()
398
- }, undefined);
399
- this._list.rowsContainer.insertAdjacentElement('afterbegin', this._modifiedWebview.element);
400
- this._modifiedWebview.createWebview(this.window);
401
- this._modifiedWebview.element.style.width = `calc(50% - 16px)`;
402
- this._modifiedWebview.element.style.left = `calc(50%)`;
403
- }
404
- _generateFontFamily() {
405
- return this.fontInfo.fontFamily ?? `"SF Mono", Monaco, Menlo, Consolas, "Ubuntu Mono", "Liberation Mono", "DejaVu Sans Mono", "Courier New", monospace`;
406
- }
407
- async _createOriginalWebview(id, viewType, resource) {
408
- this._originalWebview?.dispose();
409
- this._originalWebview = this.instantiationService.createInstance(BackLayerWebView, this, id, viewType, resource, {
410
- ...this._notebookOptions.computeDiffWebviewOptions(),
411
- fontFamily: this._generateFontFamily()
412
- }, undefined);
413
- this._list.rowsContainer.insertAdjacentElement('afterbegin', this._originalWebview.element);
414
- this._originalWebview.createWebview(this.window);
415
- this._originalWebview.element.style.width = `calc(50% - 16px)`;
416
- this._originalWebview.element.style.left = `16px`;
417
- }
418
- setOptions(options) {
419
- const selections = options?.cellSelections ? cellRangesToIndexes(options.cellSelections) : undefined;
420
- if (selections) {
421
- this._list.setFocus(selections);
422
- }
423
- }
424
- async updateLayout(token, selections) {
425
- if (!this._model) {
426
- return;
427
- }
428
- const diffResult = await this.notebookEditorWorkerService.computeDiff(this._model.original.resource, this._model.modified.resource);
429
- if (token.isCancellationRequested) {
430
- return;
431
- }
432
- NotebookTextDiffEditor_1.prettyChanges(this._model, diffResult.cellsDiff);
433
- const { viewModels, firstChangeIndex } = NotebookTextDiffEditor_1.computeDiff(this.instantiationService, this.configurationService, this._model, this._eventDispatcher, diffResult, this.fontInfo);
434
- const isSame = this._isViewModelTheSame(viewModels);
435
- if (!isSame) {
436
- this._originalWebview?.removeInsets([...this._originalWebview?.insetMapping.keys()]);
437
- this._modifiedWebview?.removeInsets([...this._modifiedWebview?.insetMapping.keys()]);
438
- this._setViewModel(viewModels);
439
- }
440
- if (this._revealFirst && firstChangeIndex !== -1 && firstChangeIndex < this._list.length) {
441
- this._revealFirst = false;
442
- this._list.setFocus([firstChangeIndex]);
443
- this._list.reveal(firstChangeIndex, 0.3);
444
- }
445
- if (selections) {
446
- this._list.setFocus(selections);
447
- }
448
- }
449
- _isViewModelTheSame(viewModels) {
450
- let isSame = true;
451
- if (this._diffElementViewModels.length === viewModels.length) {
452
- for (let i = 0; i < viewModels.length; i++) {
453
- const a = this._diffElementViewModels[i];
454
- const b = viewModels[i];
455
- if (a.original?.textModel.getHashValue() !== b.original?.textModel.getHashValue()
456
- || a.modified?.textModel.getHashValue() !== b.modified?.textModel.getHashValue()) {
457
- isSame = false;
458
- break;
459
- }
460
- }
461
- }
462
- else {
463
- isSame = false;
464
- }
465
- return isSame;
466
- }
467
- _setViewModel(viewModels) {
468
- this._diffElementViewModels = viewModels;
469
- this._list.splice(0, this._list.length, this._diffElementViewModels);
470
- if (this.isOverviewRulerEnabled()) {
471
- this._overviewRuler.updateViewModels(this._diffElementViewModels, this._eventDispatcher);
472
- }
473
- }
474
- static prettyChanges(model, diffResult) {
475
- const changes = diffResult.changes;
476
- for (let i = 0; i < diffResult.changes.length - 1; i++) {
477
- const curr = changes[i];
478
- const next = changes[i + 1];
479
- const x = curr.originalStart;
480
- const y = curr.modifiedStart;
481
- if (curr.originalLength === 1
482
- && curr.modifiedLength === 0
483
- && next.originalStart === x + 2
484
- && next.originalLength === 0
485
- && next.modifiedStart === y + 1
486
- && next.modifiedLength === 1
487
- && model.original.notebook.cells[x].getHashValue() === model.modified.notebook.cells[y + 1].getHashValue()
488
- && model.original.notebook.cells[x + 1].getHashValue() === model.modified.notebook.cells[y].getHashValue()) {
489
- curr.originalStart = x;
490
- curr.originalLength = 0;
491
- curr.modifiedStart = y;
492
- curr.modifiedLength = 1;
493
- next.originalStart = x + 1;
494
- next.originalLength = 1;
495
- next.modifiedStart = y + 2;
496
- next.modifiedLength = 0;
497
- i++;
498
- }
499
- }
500
- }
501
- static computeDiff(instantiationService, configurationService, model, eventDispatcher, diffResult, fontInfo) {
502
- const cellChanges = diffResult.cellsDiff.changes;
503
- const diffElementViewModels = [];
504
- const originalModel = model.original.notebook;
505
- const modifiedModel = model.modified.notebook;
506
- let originalCellIndex = 0;
507
- let modifiedCellIndex = 0;
508
- let firstChangeIndex = -1;
509
- const initData = {
510
- metadataStatusHeight: configurationService.getValue('notebook.diff.ignoreMetadata') ? 0 : 25,
511
- outputStatusHeight: configurationService.getValue('notebook.diff.ignoreOutputs') || !!(modifiedModel.transientOptions.transientOutputs) ? 0 : 25,
512
- fontInfo
513
- };
514
- for (let i = 0; i < cellChanges.length; i++) {
515
- const change = cellChanges[i];
516
- for (let j = 0; j < change.originalStart - originalCellIndex; j++) {
517
- const originalCell = originalModel.cells[originalCellIndex + j];
518
- const modifiedCell = modifiedModel.cells[modifiedCellIndex + j];
519
- if (originalCell.getHashValue() === modifiedCell.getHashValue()) {
520
- diffElementViewModels.push(( new SideBySideDiffElementViewModel(
521
- model.modified.notebook,
522
- model.original.notebook,
523
- instantiationService.createInstance(DiffNestedCellViewModel, originalCell),
524
- instantiationService.createInstance(DiffNestedCellViewModel, modifiedCell),
525
- 'unchanged',
526
- eventDispatcher,
527
- initData
528
- )));
529
- }
530
- else {
531
- if (firstChangeIndex === -1) {
532
- firstChangeIndex = diffElementViewModels.length;
533
- }
534
- diffElementViewModels.push(( new SideBySideDiffElementViewModel(
535
- model.modified.notebook,
536
- model.original.notebook,
537
- instantiationService.createInstance(DiffNestedCellViewModel, originalCell),
538
- instantiationService.createInstance(DiffNestedCellViewModel, modifiedCell),
539
- 'modified',
540
- eventDispatcher,
541
- initData
542
- )));
543
- }
544
- }
545
- const modifiedLCS = NotebookTextDiffEditor_1.computeModifiedLCS(instantiationService, change, originalModel, modifiedModel, eventDispatcher, initData);
546
- if (modifiedLCS.length && firstChangeIndex === -1) {
547
- firstChangeIndex = diffElementViewModels.length;
548
- }
549
- diffElementViewModels.push(...modifiedLCS);
550
- originalCellIndex = change.originalStart + change.originalLength;
551
- modifiedCellIndex = change.modifiedStart + change.modifiedLength;
552
- }
553
- for (let i = originalCellIndex; i < originalModel.cells.length; i++) {
554
- diffElementViewModels.push(( new SideBySideDiffElementViewModel(
555
- model.modified.notebook,
556
- model.original.notebook,
557
- instantiationService.createInstance(DiffNestedCellViewModel, originalModel.cells[i]),
558
- instantiationService.createInstance(DiffNestedCellViewModel, modifiedModel.cells[i - originalCellIndex + modifiedCellIndex]),
559
- 'unchanged',
560
- eventDispatcher,
561
- initData
562
- )));
563
- }
564
- return {
565
- viewModels: diffElementViewModels,
566
- firstChangeIndex
567
- };
568
- }
569
- static computeModifiedLCS(instantiationService, change, originalModel, modifiedModel, eventDispatcher, initData) {
570
- const result = [];
571
- const modifiedLen = Math.min(change.originalLength, change.modifiedLength);
572
- for (let j = 0; j < modifiedLen; j++) {
573
- const isTheSame = originalModel.cells[change.originalStart + j].equal(modifiedModel.cells[change.modifiedStart + j]);
574
- result.push(( new SideBySideDiffElementViewModel(
575
- modifiedModel,
576
- originalModel,
577
- instantiationService.createInstance(DiffNestedCellViewModel, originalModel.cells[change.originalStart + j]),
578
- instantiationService.createInstance(DiffNestedCellViewModel, modifiedModel.cells[change.modifiedStart + j]),
579
- isTheSame ? 'unchanged' : 'modified',
580
- eventDispatcher,
581
- initData
582
- )));
583
- }
584
- for (let j = modifiedLen; j < change.originalLength; j++) {
585
- result.push(( new SingleSideDiffElementViewModel(
586
- originalModel,
587
- modifiedModel,
588
- instantiationService.createInstance(DiffNestedCellViewModel, originalModel.cells[change.originalStart + j]),
589
- undefined,
590
- 'delete',
591
- eventDispatcher,
592
- initData
593
- )));
594
- }
595
- for (let j = modifiedLen; j < change.modifiedLength; j++) {
596
- result.push(( new SingleSideDiffElementViewModel(
597
- modifiedModel,
598
- originalModel,
599
- undefined,
600
- instantiationService.createInstance(DiffNestedCellViewModel, modifiedModel.cells[change.modifiedStart + j]),
601
- 'insert',
602
- eventDispatcher,
603
- initData
604
- )));
605
- }
606
- return result;
607
- }
608
- scheduleOutputHeightAck(cellInfo, outputId, height) {
609
- const diffElement = cellInfo.diffElement;
610
- let diffSide = DiffSide.Original;
611
- if (diffElement instanceof SideBySideDiffElementViewModel) {
612
- const info = CellUri.parse(cellInfo.cellUri);
613
- if (!info) {
614
- return;
615
- }
616
- diffSide = ( info.notebook.toString()) === this._model?.original.resource.toString() ? DiffSide.Original : DiffSide.Modified;
617
- }
618
- else {
619
- diffSide = diffElement.type === 'insert' ? DiffSide.Modified : DiffSide.Original;
620
- }
621
- const webview = diffSide === DiffSide.Modified ? this._modifiedWebview : this._originalWebview;
622
- scheduleAtNextAnimationFrame(this.window, () => {
623
- webview?.ackHeight([{ cellId: cellInfo.cellId, outputId, height }]);
624
- }, 10);
625
- }
626
- layoutNotebookCell(cell, height) {
627
- const relayout = (cell, height) => {
628
- this._list.updateElementHeight2(cell, height);
629
- };
630
- if (( this.pendingLayouts.has(cell))) {
631
- this.pendingLayouts.get(cell).dispose();
632
- }
633
- let r;
634
- const layoutDisposable = scheduleAtNextAnimationFrame(this.window, () => {
635
- this.pendingLayouts.delete(cell);
636
- relayout(cell, height);
637
- r();
638
- });
639
- this.pendingLayouts.set(cell, toDisposable(() => {
640
- layoutDisposable.dispose();
641
- r();
642
- }));
643
- return ( new Promise(resolve => { r = resolve; }));
644
- }
645
- setScrollTop(scrollTop) {
646
- this._list.scrollTop = scrollTop;
647
- }
648
- triggerScroll(event) {
649
- this._list.triggerScrollFromMouseWheelEvent(event);
650
- }
651
- previousChange() {
652
- let currFocus = this._list.getFocus()[0];
653
- if (isNaN(currFocus) || currFocus < 0) {
654
- currFocus = 0;
655
- }
656
- let prevChangeIndex = currFocus - 1;
657
- while (prevChangeIndex >= 0) {
658
- const vm = this._diffElementViewModels[prevChangeIndex];
659
- if (vm.type !== 'unchanged') {
660
- break;
661
- }
662
- prevChangeIndex--;
663
- }
664
- if (prevChangeIndex >= 0) {
665
- this._list.setFocus([prevChangeIndex]);
666
- this._list.reveal(prevChangeIndex);
667
- }
668
- else {
669
- const index = findLastIdx(this._diffElementViewModels, vm => vm.type !== 'unchanged');
670
- if (index >= 0) {
671
- this._list.setFocus([index]);
672
- this._list.reveal(index);
673
- }
674
- }
675
- }
676
- nextChange() {
677
- let currFocus = this._list.getFocus()[0];
678
- if (isNaN(currFocus) || currFocus < 0) {
679
- currFocus = 0;
680
- }
681
- let nextChangeIndex = currFocus + 1;
682
- while (nextChangeIndex < this._diffElementViewModels.length) {
683
- const vm = this._diffElementViewModels[nextChangeIndex];
684
- if (vm.type !== 'unchanged') {
685
- break;
686
- }
687
- nextChangeIndex++;
688
- }
689
- if (nextChangeIndex < this._diffElementViewModels.length) {
690
- this._list.setFocus([nextChangeIndex]);
691
- this._list.reveal(nextChangeIndex);
692
- }
693
- else {
694
- const index = this._diffElementViewModels.findIndex(vm => vm.type !== 'unchanged');
695
- if (index >= 0) {
696
- this._list.setFocus([index]);
697
- this._list.reveal(index);
698
- }
699
- }
700
- }
701
- createOutput(cellDiffViewModel, cellViewModel, output, getOffset, diffSide) {
702
- this._insetModifyQueueByOutputId.queue(output.source.model.outputId + (diffSide === DiffSide.Modified ? '-right' : 'left'), async () => {
703
- const activeWebview = diffSide === DiffSide.Modified ? this._modifiedWebview : this._originalWebview;
704
- if (!activeWebview) {
705
- return;
706
- }
707
- if (!( activeWebview.insetMapping.has(output.source))) {
708
- const cellTop = this._list.getCellViewScrollTop(cellDiffViewModel);
709
- await activeWebview.createOutput({ diffElement: cellDiffViewModel, cellHandle: cellViewModel.handle, cellId: cellViewModel.id, cellUri: cellViewModel.uri }, output, cellTop, getOffset());
710
- }
711
- else {
712
- const cellTop = this._list.getCellViewScrollTop(cellDiffViewModel);
713
- const outputIndex = cellViewModel.outputsViewModels.indexOf(output.source);
714
- const outputOffset = cellDiffViewModel.getOutputOffsetInCell(diffSide, outputIndex);
715
- activeWebview.updateScrollTops([{
716
- cell: cellViewModel,
717
- output: output.source,
718
- cellTop,
719
- outputOffset,
720
- forceDisplay: true
721
- }], []);
722
- }
723
- });
724
- }
725
- updateMarkupCellHeight() {
726
- }
727
- getCellByInfo(cellInfo) {
728
- return cellInfo.diffElement.getCellByUri(cellInfo.cellUri);
729
- }
730
- getCellById(cellId) {
731
- throw new Error('Not implemented');
732
- }
733
- removeInset(cellDiffViewModel, cellViewModel, displayOutput, diffSide) {
734
- this._insetModifyQueueByOutputId.queue(displayOutput.model.outputId + (diffSide === DiffSide.Modified ? '-right' : 'left'), async () => {
735
- const activeWebview = diffSide === DiffSide.Modified ? this._modifiedWebview : this._originalWebview;
736
- if (!activeWebview) {
737
- return;
738
- }
739
- if (!( activeWebview.insetMapping.has(displayOutput))) {
740
- return;
741
- }
742
- activeWebview.removeInsets([displayOutput]);
743
- });
744
- }
745
- showInset(cellDiffViewModel, cellViewModel, displayOutput, diffSide) {
746
- this._insetModifyQueueByOutputId.queue(displayOutput.model.outputId + (diffSide === DiffSide.Modified ? '-right' : 'left'), async () => {
747
- const activeWebview = diffSide === DiffSide.Modified ? this._modifiedWebview : this._originalWebview;
748
- if (!activeWebview) {
749
- return;
750
- }
751
- if (!( activeWebview.insetMapping.has(displayOutput))) {
752
- return;
753
- }
754
- const cellTop = this._list.getCellViewScrollTop(cellDiffViewModel);
755
- const outputIndex = cellViewModel.outputsViewModels.indexOf(displayOutput);
756
- const outputOffset = cellDiffViewModel.getOutputOffsetInCell(diffSide, outputIndex);
757
- activeWebview.updateScrollTops([{
758
- cell: cellViewModel,
759
- output: displayOutput,
760
- cellTop,
761
- outputOffset,
762
- forceDisplay: true,
763
- }], []);
764
- });
765
- }
766
- hideInset(cellDiffViewModel, cellViewModel, output) {
767
- this._modifiedWebview?.hideInset(output);
768
- this._originalWebview?.hideInset(output);
769
- }
770
- getDomNode() {
771
- return this._rootElement;
772
- }
773
- getOverflowContainerDomNode() {
774
- return this._overflowContainer;
775
- }
776
- getControl() {
777
- return this;
778
- }
779
- clearInput() {
780
- super.clearInput();
781
- this._modifiedResourceDisposableStore.clear();
782
- this._list?.splice(0, this._list?.length || 0);
783
- this._model = null;
784
- this._diffElementViewModels.forEach(vm => vm.dispose());
785
- this._diffElementViewModels = [];
786
- }
787
- deltaCellOutputContainerClassNames(diffSide, cellId, added, removed) {
788
- if (diffSide === DiffSide.Original) {
789
- this._originalWebview?.deltaCellContainerClassNames(cellId, added, removed);
790
- }
791
- else {
792
- this._modifiedWebview?.deltaCellContainerClassNames(cellId, added, removed);
793
- }
794
- }
795
- getLayoutInfo() {
796
- if (!this._list) {
797
- throw new Error('Editor is not initalized successfully');
798
- }
799
- return {
800
- width: this._dimension.width,
801
- height: this._dimension.height,
802
- fontInfo: this.fontInfo,
803
- scrollHeight: this._list?.getScrollHeight() ?? 0,
804
- stickyHeight: 0,
805
- };
806
- }
807
- getCellOutputLayoutInfo(nestedCell) {
808
- if (!this._model) {
809
- throw new Error('Editor is not attached to model yet');
810
- }
811
- const documentModel = CellUri.parse(nestedCell.uri);
812
- if (!documentModel) {
813
- throw new Error('Nested cell in the diff editor has wrong Uri');
814
- }
815
- const belongToOriginalDocument = ( this._model.original.notebook.uri.toString()) === ( documentModel.notebook.toString());
816
- const viewModel = this._diffElementViewModels.find(element => {
817
- const textModel = belongToOriginalDocument ? element.original : element.modified;
818
- if (!textModel) {
819
- return false;
820
- }
821
- if (( textModel.uri.toString()) === ( nestedCell.uri.toString())) {
822
- return true;
823
- }
824
- return false;
825
- });
826
- if (!viewModel) {
827
- throw new Error('Nested cell in the diff editor does not match any diff element');
828
- }
829
- if (viewModel.type === 'unchanged') {
830
- return this.getLayoutInfo();
831
- }
832
- if (viewModel.type === 'insert' || viewModel.type === 'delete') {
833
- return {
834
- width: this._dimension.width / 2,
835
- height: this._dimension.height / 2,
836
- fontInfo: this.fontInfo
837
- };
838
- }
839
- if (viewModel.checkIfOutputsModified()) {
840
- return {
841
- width: this._dimension.width / 2,
842
- height: this._dimension.height / 2,
843
- fontInfo: this.fontInfo
844
- };
845
- }
846
- else {
847
- return this.getLayoutInfo();
848
- }
849
- }
850
- layout(dimension, _position) {
851
- this._rootElement.classList.toggle('mid-width', dimension.width < 1000 && dimension.width >= 600);
852
- this._rootElement.classList.toggle('narrow-width', dimension.width < 600);
853
- const overviewRulerEnabled = this.isOverviewRulerEnabled();
854
- this._dimension = dimension.with(dimension.width - (overviewRulerEnabled ? NotebookTextDiffEditor_1.ENTIRE_DIFF_OVERVIEW_WIDTH : 0));
855
- this._listViewContainer.style.height = `${dimension.height}px`;
856
- this._listViewContainer.style.width = `${this._dimension.width}px`;
857
- this._list?.layout(this._dimension.height, this._dimension.width);
858
- if (this._modifiedWebview) {
859
- this._modifiedWebview.element.style.width = `calc(50% - 16px)`;
860
- this._modifiedWebview.element.style.left = `calc(50%)`;
861
- }
862
- if (this._originalWebview) {
863
- this._originalWebview.element.style.width = `calc(50% - 16px)`;
864
- this._originalWebview.element.style.left = `16px`;
865
- }
866
- if (this._webviewTransparentCover) {
867
- this._webviewTransparentCover.style.height = `${this._dimension.height}px`;
868
- this._webviewTransparentCover.style.width = `${this._dimension.width}px`;
869
- }
870
- if (overviewRulerEnabled) {
871
- this._overviewRuler.layout();
872
- }
873
- this._eventDispatcher?.emit([( new NotebookDiffLayoutChangedEvent({ width: true, fontInfo: true }, this.getLayoutInfo()))]);
874
- }
875
- dispose() {
876
- this._isDisposed = true;
877
- this._layoutCancellationTokenSource?.dispose();
878
- this._detachModel();
879
- super.dispose();
880
- }
881
- };
882
- NotebookTextDiffEditor = NotebookTextDiffEditor_1 = ( __decorate([
883
- ( __param(1, IInstantiationService)),
884
- ( __param(2, IThemeService)),
885
- ( __param(3, IContextKeyService)),
886
- ( __param(4, INotebookEditorWorkerService)),
887
- ( __param(5, IConfigurationService)),
888
- ( __param(6, ITelemetryService)),
889
- ( __param(7, IStorageService)),
890
- ( __param(8, INotebookExecutionStateService)),
891
- ( __param(9, ICodeEditorService))
892
- ], NotebookTextDiffEditor));
893
- registerZIndex(ZIndex.Base, 10, 'notebook-diff-view-viewport-slider');
894
- registerThemingParticipant((theme, collector) => {
895
- const diffDiagonalFillColor = theme.getColor(diffDiagonalFill);
896
- collector.addRule(`
897
- .notebook-text-diff-editor .diagonal-fill {
898
- background-image: linear-gradient(
899
- -45deg,
900
- ${diffDiagonalFillColor} 12.5%,
901
- #0000 12.5%, #0000 50%,
902
- ${diffDiagonalFillColor} 50%, ${diffDiagonalFillColor} 62.5%,
903
- #0000 62.5%, #0000 100%
904
- );
905
- background-size: 8px 8px;
906
- }
907
- `);
908
- collector.addRule(`.notebook-text-diff-editor .cell-body { margin: ${DIFF_CELL_MARGIN}px; }`);
909
- });
910
-
911
- export { NotebookTextDiffEditor };