@codingame/monaco-vscode-notebook-service-override 4.1.0 → 4.1.2

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/external/rollup-plugin-styles/dist/runtime/inject-css.js +3 -0
  2. package/external/tslib/tslib.es6.js +11 -0
  3. package/notebook.js +12 -12
  4. package/override/vs/platform/dialogs/common/dialogs.js +10 -0
  5. package/package.json +2 -2
  6. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.css.js +6 -0
  7. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +391 -0
  8. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.js +109 -0
  9. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +173 -0
  10. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +544 -0
  11. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.js +106 -0
  12. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookCellPausing.js +67 -0
  13. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +165 -0
  14. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.js +67 -0
  15. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +320 -0
  16. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/execute/executionEditorProgress.js +72 -0
  17. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/media/notebookFind.css.js +6 -0
  18. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +168 -0
  19. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +209 -0
  20. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +84 -0
  21. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/kernelDetection/notebookKernelDetection.js +82 -0
  22. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +67 -0
  23. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +101 -0
  24. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +393 -0
  25. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableContextKeys.js +5 -0
  26. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +97 -0
  27. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +120 -0
  28. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +60 -0
  29. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +150 -0
  30. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +656 -0
  31. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +77 -0
  32. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +517 -0
  33. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +159 -0
  34. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +56 -0
  35. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.js +94 -0
  36. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/apiActions.js +51 -0
  37. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +652 -0
  38. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +721 -0
  39. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +351 -0
  40. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +315 -0
  41. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.js +199 -0
  42. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.js +47 -0
  43. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +1297 -0
  44. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +284 -0
  45. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.js +563 -0
  46. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.js +115 -0
  47. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.js +39 -0
  48. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiff.css.js +6 -0
  49. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +313 -0
  50. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +911 -0
  51. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.js +13 -0
  52. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +395 -0
  53. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +185 -0
  54. package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +1187 -0
  55. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibility.js +159 -0
  56. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +451 -0
  57. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +192 -0
  58. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +106 -0
  59. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +510 -0
  60. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +130 -0
  61. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +341 -0
  62. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +111 -0
  63. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +28 -0
  64. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.js +65 -0
  65. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +641 -0
  66. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +200 -0
  67. package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.js +90 -0
  68. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +1002 -0
  69. package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +103 -0
  70. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +203 -0
  71. package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.js +80 -0
  72. package/vscode/src/vs/workbench/contrib/notebook/common/notebookProvider.js +98 -0
  73. package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.js +89 -0
  74. package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +386 -0
  75. package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +408 -0
  76. package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.js +144 -0
  77. package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopyManager.js +129 -0
@@ -0,0 +1,200 @@
1
+ import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
2
+ import { Disposable, DisposableStore, toDisposable, dispose } from 'vscode/vscode/vs/base/common/lifecycle';
3
+ import { SimpleWorkerClient } from 'vscode/vscode/vs/base/common/worker/simpleWorker';
4
+ import { DefaultWorkerFactory } from 'vscode/vscode/vs/base/browser/defaultWorkerFactory';
5
+ import { NotebookCellsChangeType } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
6
+ import { INotebookService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookService';
7
+
8
+ let NotebookEditorWorkerServiceImpl = class NotebookEditorWorkerServiceImpl extends Disposable {
9
+ constructor(notebookService) {
10
+ super();
11
+ this._workerManager = this._register(( new WorkerManager(notebookService)));
12
+ }
13
+ canComputeDiff(original, modified) {
14
+ throw new Error('Method not implemented.');
15
+ }
16
+ computeDiff(original, modified) {
17
+ return this._workerManager.withWorker().then(client => {
18
+ return client.computeDiff(original, modified);
19
+ });
20
+ }
21
+ canPromptRecommendation(model) {
22
+ return this._workerManager.withWorker().then(client => {
23
+ return client.canPromptRecommendation(model);
24
+ });
25
+ }
26
+ };
27
+ NotebookEditorWorkerServiceImpl = ( __decorate([
28
+ ( __param(0, INotebookService))
29
+ ], NotebookEditorWorkerServiceImpl));
30
+ class WorkerManager extends Disposable {
31
+ constructor(_notebookService) {
32
+ super();
33
+ this._notebookService = _notebookService;
34
+ this._editorWorkerClient = null;
35
+ }
36
+ withWorker() {
37
+ if (!this._editorWorkerClient) {
38
+ this._editorWorkerClient = ( new NotebookWorkerClient(this._notebookService, 'notebookEditorWorkerService'));
39
+ }
40
+ return Promise.resolve(this._editorWorkerClient);
41
+ }
42
+ }
43
+ class NotebookEditorModelManager extends Disposable {
44
+ constructor(_proxy, _notebookService) {
45
+ super();
46
+ this._proxy = _proxy;
47
+ this._notebookService = _notebookService;
48
+ this._syncedModels = Object.create(null);
49
+ this._syncedModelsLastUsedTime = Object.create(null);
50
+ }
51
+ ensureSyncedResources(resources) {
52
+ for (const resource of resources) {
53
+ const resourceStr = ( resource.toString());
54
+ if (!this._syncedModels[resourceStr]) {
55
+ this._beginModelSync(resource);
56
+ }
57
+ if (this._syncedModels[resourceStr]) {
58
+ this._syncedModelsLastUsedTime[resourceStr] = (( new Date())).getTime();
59
+ }
60
+ }
61
+ }
62
+ _beginModelSync(resource) {
63
+ const model = this._notebookService.listNotebookDocuments().find(document => ( document.uri.toString()) === ( resource.toString()));
64
+ if (!model) {
65
+ return;
66
+ }
67
+ const modelUrl = ( resource.toString());
68
+ this._proxy.acceptNewModel(( model.uri.toString()), {
69
+ cells: ( model.cells.map(cell => ({
70
+ handle: cell.handle,
71
+ uri: cell.uri,
72
+ source: cell.getValue(),
73
+ eol: cell.textBuffer.getEOL(),
74
+ language: cell.language,
75
+ mime: cell.mime,
76
+ cellKind: cell.cellKind,
77
+ outputs: ( cell.outputs.map(op => ({ outputId: op.outputId, outputs: op.outputs }))),
78
+ metadata: cell.metadata,
79
+ internalMetadata: cell.internalMetadata,
80
+ }))),
81
+ metadata: model.metadata
82
+ });
83
+ const toDispose = ( new DisposableStore());
84
+ const cellToDto = (cell) => {
85
+ return {
86
+ handle: cell.handle,
87
+ uri: cell.uri,
88
+ source: cell.textBuffer.getLinesContent(),
89
+ eol: cell.textBuffer.getEOL(),
90
+ language: cell.language,
91
+ cellKind: cell.cellKind,
92
+ outputs: ( cell.outputs.map(op => ({ outputId: op.outputId, outputs: op.outputs }))),
93
+ metadata: cell.metadata,
94
+ internalMetadata: cell.internalMetadata,
95
+ };
96
+ };
97
+ toDispose.add(model.onDidChangeContent((event) => {
98
+ const dto = ( event.rawEvents.map(e => {
99
+ const data = e.kind === NotebookCellsChangeType.ModelChange || e.kind === NotebookCellsChangeType.Initialize
100
+ ? {
101
+ kind: e.kind,
102
+ versionId: event.versionId,
103
+ changes: ( e.changes.map(diff => [diff[0], diff[1], ( diff[2].map(cell => cellToDto(cell)))]))
104
+ }
105
+ : (e.kind === NotebookCellsChangeType.Move
106
+ ? {
107
+ kind: e.kind,
108
+ index: e.index,
109
+ length: e.length,
110
+ newIdx: e.newIdx,
111
+ versionId: event.versionId,
112
+ cells: ( e.cells.map(cell => cellToDto(cell)))
113
+ }
114
+ : e);
115
+ return data;
116
+ }));
117
+ this._proxy.acceptModelChanged(( modelUrl.toString()), {
118
+ rawEvents: dto,
119
+ versionId: event.versionId
120
+ });
121
+ }));
122
+ toDispose.add(model.onWillDispose(() => {
123
+ this._stopModelSync(modelUrl);
124
+ }));
125
+ toDispose.add(toDisposable(() => {
126
+ this._proxy.acceptRemovedModel(modelUrl);
127
+ }));
128
+ this._syncedModels[modelUrl] = toDispose;
129
+ }
130
+ _stopModelSync(modelUrl) {
131
+ const toDispose = this._syncedModels[modelUrl];
132
+ delete this._syncedModels[modelUrl];
133
+ delete this._syncedModelsLastUsedTime[modelUrl];
134
+ dispose(toDispose);
135
+ }
136
+ }
137
+ class NotebookWorkerHost {
138
+ constructor(workerClient) {
139
+ this._workerClient = workerClient;
140
+ }
141
+ fhr(method, args) {
142
+ return this._workerClient.fhr(method, args);
143
+ }
144
+ }
145
+ class NotebookWorkerClient extends Disposable {
146
+ constructor(_notebookService, label) {
147
+ super();
148
+ this._notebookService = _notebookService;
149
+ this._workerFactory = ( new DefaultWorkerFactory(label));
150
+ this._worker = null;
151
+ this._modelManager = null;
152
+ }
153
+ fhr(method, args) {
154
+ throw new Error(`Not implemented!`);
155
+ }
156
+ computeDiff(original, modified) {
157
+ return this._withSyncedResources([original, modified]).then(proxy => {
158
+ return proxy.computeDiff(( original.toString()), ( modified.toString()));
159
+ });
160
+ }
161
+ canPromptRecommendation(modelUri) {
162
+ return this._withSyncedResources([modelUri]).then(proxy => {
163
+ return proxy.canPromptRecommendation(( modelUri.toString()));
164
+ });
165
+ }
166
+ _getOrCreateModelManager(proxy) {
167
+ if (!this._modelManager) {
168
+ this._modelManager = this._register(( new NotebookEditorModelManager(proxy, this._notebookService)));
169
+ }
170
+ return this._modelManager;
171
+ }
172
+ _withSyncedResources(resources) {
173
+ return this._getProxy().then((proxy) => {
174
+ this._getOrCreateModelManager(proxy).ensureSyncedResources(resources);
175
+ return proxy;
176
+ });
177
+ }
178
+ _getOrCreateWorker() {
179
+ if (!this._worker) {
180
+ try {
181
+ this._worker = this._register(( new SimpleWorkerClient(
182
+ this._workerFactory,
183
+ 'vs/workbench/contrib/notebook/common/services/notebookSimpleWorker',
184
+ ( new NotebookWorkerHost(this))
185
+ )));
186
+ }
187
+ catch (err) {
188
+ throw (err);
189
+ }
190
+ }
191
+ return this._worker;
192
+ }
193
+ _getProxy() {
194
+ return this._getOrCreateWorker().getProxyObject().then(undefined, (err) => {
195
+ throw (err);
196
+ });
197
+ }
198
+ }
199
+
200
+ export { NotebookEditorWorkerServiceImpl };
@@ -0,0 +1,90 @@
1
+ class MoveCellEdit {
2
+ get label() {
3
+ return this.length === 1 ? 'Move Cell' : 'Move Cells';
4
+ }
5
+ constructor(resource, fromIndex, length, toIndex, editingDelegate, beforedSelections, endSelections) {
6
+ this.resource = resource;
7
+ this.fromIndex = fromIndex;
8
+ this.length = length;
9
+ this.toIndex = toIndex;
10
+ this.editingDelegate = editingDelegate;
11
+ this.beforedSelections = beforedSelections;
12
+ this.endSelections = endSelections;
13
+ this.type = 0 ;
14
+ this.code = 'undoredo.textBufferEdit';
15
+ }
16
+ undo() {
17
+ if (!this.editingDelegate.moveCell) {
18
+ throw new Error('Notebook Move Cell not implemented for Undo/Redo');
19
+ }
20
+ this.editingDelegate.moveCell(this.toIndex, this.length, this.fromIndex, this.endSelections, this.beforedSelections);
21
+ }
22
+ redo() {
23
+ if (!this.editingDelegate.moveCell) {
24
+ throw new Error('Notebook Move Cell not implemented for Undo/Redo');
25
+ }
26
+ this.editingDelegate.moveCell(this.fromIndex, this.length, this.toIndex, this.beforedSelections, this.endSelections);
27
+ }
28
+ }
29
+ class SpliceCellsEdit {
30
+ get label() {
31
+ if (this.diffs.length === 1 && this.diffs[0][1].length === 0) {
32
+ return this.diffs[0][2].length > 1 ? 'Insert Cells' : 'Insert Cell';
33
+ }
34
+ if (this.diffs.length === 1 && this.diffs[0][2].length === 0) {
35
+ return this.diffs[0][1].length > 1 ? 'Delete Cells' : 'Delete Cell';
36
+ }
37
+ return 'Insert Cell';
38
+ }
39
+ constructor(resource, diffs, editingDelegate, beforeHandles, endHandles) {
40
+ this.resource = resource;
41
+ this.diffs = diffs;
42
+ this.editingDelegate = editingDelegate;
43
+ this.beforeHandles = beforeHandles;
44
+ this.endHandles = endHandles;
45
+ this.type = 0 ;
46
+ this.code = 'undoredo.textBufferEdit';
47
+ }
48
+ undo() {
49
+ if (!this.editingDelegate.replaceCell) {
50
+ throw new Error('Notebook Replace Cell not implemented for Undo/Redo');
51
+ }
52
+ this.diffs.forEach(diff => {
53
+ this.editingDelegate.replaceCell(diff[0], diff[2].length, diff[1], this.beforeHandles);
54
+ });
55
+ }
56
+ redo() {
57
+ if (!this.editingDelegate.replaceCell) {
58
+ throw new Error('Notebook Replace Cell not implemented for Undo/Redo');
59
+ }
60
+ this.diffs.reverse().forEach(diff => {
61
+ this.editingDelegate.replaceCell(diff[0], diff[1].length, diff[2], this.endHandles);
62
+ });
63
+ }
64
+ }
65
+ class CellMetadataEdit {
66
+ constructor(resource, index, oldMetadata, newMetadata, editingDelegate) {
67
+ this.resource = resource;
68
+ this.index = index;
69
+ this.oldMetadata = oldMetadata;
70
+ this.newMetadata = newMetadata;
71
+ this.editingDelegate = editingDelegate;
72
+ this.type = 0 ;
73
+ this.label = 'Update Cell Metadata';
74
+ this.code = 'undoredo.textBufferEdit';
75
+ }
76
+ undo() {
77
+ if (!this.editingDelegate.updateCellMetadata) {
78
+ return;
79
+ }
80
+ this.editingDelegate.updateCellMetadata(this.index, this.oldMetadata);
81
+ }
82
+ redo() {
83
+ if (!this.editingDelegate.updateCellMetadata) {
84
+ return;
85
+ }
86
+ this.editingDelegate.updateCellMetadata(this.index, this.newMetadata);
87
+ }
88
+ }
89
+
90
+ export { CellMetadataEdit, MoveCellEdit, SpliceCellsEdit };