@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.
Files changed (84) 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/index.d.ts +1 -0
  4. package/index.js +1 -0
  5. package/notebook.d.ts +5 -0
  6. package/notebook.js +44 -0
  7. package/override/vs/platform/dialogs/common/dialogs.js +8 -0
  8. package/package.json +32 -0
  9. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.css.js +6 -0
  10. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +387 -0
  11. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +668 -0
  12. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.js +109 -0
  13. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController.js +319 -0
  14. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/notebookVisibleCellObserver.js +58 -0
  15. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +173 -0
  16. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +485 -0
  17. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.js +106 -0
  18. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookCellPausing.js +67 -0
  19. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +165 -0
  20. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.js +67 -0
  21. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +238 -0
  22. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/execute/executionEditorProgress.js +72 -0
  23. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/media/notebookFind.css.js +6 -0
  24. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +168 -0
  25. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget.js +317 -0
  26. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +209 -0
  27. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +87 -0
  28. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/kernelDetection/notebookKernelDetection.js +82 -0
  29. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +67 -0
  30. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +93 -0
  31. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +383 -0
  32. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +51 -0
  33. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +46 -0
  34. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +135 -0
  35. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +383 -0
  36. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +117 -0
  37. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +511 -0
  38. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +168 -0
  39. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +57 -0
  40. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.js +94 -0
  41. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/apiActions.js +51 -0
  42. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +702 -0
  43. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +268 -0
  44. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.js +45 -0
  45. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +1297 -0
  46. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +284 -0
  47. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.js +563 -0
  48. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.js +108 -0
  49. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.js +39 -0
  50. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiff.css.js +6 -0
  51. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +313 -0
  52. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +872 -0
  53. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.js +13 -0
  54. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +393 -0
  55. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +175 -0
  56. package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +1121 -0
  57. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibility.js +159 -0
  58. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +339 -0
  59. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookCellStatusBarServiceImpl.js +41 -0
  60. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +182 -0
  61. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +106 -0
  62. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +509 -0
  63. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +133 -0
  64. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +342 -0
  65. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +111 -0
  66. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +28 -0
  67. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.js +65 -0
  68. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +666 -0
  69. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +200 -0
  70. package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.js +80 -0
  71. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +1001 -0
  72. package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +103 -0
  73. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +202 -0
  74. package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.js +80 -0
  75. package/vscode/src/vs/workbench/contrib/notebook/common/notebookProvider.js +98 -0
  76. package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookSimpleWorker.js +217 -0
  77. package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.js +89 -0
  78. package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +372 -0
  79. package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopy.js +706 -0
  80. package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +407 -0
  81. package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.js +144 -0
  82. package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopyManager.js +129 -0
  83. package/worker.js +1 -0
  84. package/workers/notebook.worker.js +9 -0
@@ -0,0 +1,200 @@
1
+ import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
2
+ import { Disposable, DisposableStore, toDisposable, dispose } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
3
+ import { SimpleWorkerClient } from 'monaco-editor/esm/vs/base/common/worker/simpleWorker.js';
4
+ import { DefaultWorkerFactory } from 'monaco-editor/esm/vs/base/browser/defaultWorkerFactory.js';
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,80 @@
1
+ class MoveCellEdit {
2
+ constructor(resource, fromIndex, length, toIndex, editingDelegate, beforedSelections, endSelections) {
3
+ this.resource = resource;
4
+ this.fromIndex = fromIndex;
5
+ this.length = length;
6
+ this.toIndex = toIndex;
7
+ this.editingDelegate = editingDelegate;
8
+ this.beforedSelections = beforedSelections;
9
+ this.endSelections = endSelections;
10
+ this.type = 0 ;
11
+ this.label = 'Move Cell';
12
+ this.code = 'undoredo.notebooks.moveCell';
13
+ }
14
+ undo() {
15
+ if (!this.editingDelegate.moveCell) {
16
+ throw new Error('Notebook Move Cell not implemented for Undo/Redo');
17
+ }
18
+ this.editingDelegate.moveCell(this.toIndex, this.length, this.fromIndex, this.endSelections, this.beforedSelections);
19
+ }
20
+ redo() {
21
+ if (!this.editingDelegate.moveCell) {
22
+ throw new Error('Notebook Move Cell not implemented for Undo/Redo');
23
+ }
24
+ this.editingDelegate.moveCell(this.fromIndex, this.length, this.toIndex, this.beforedSelections, this.endSelections);
25
+ }
26
+ }
27
+ class SpliceCellsEdit {
28
+ constructor(resource, diffs, editingDelegate, beforeHandles, endHandles) {
29
+ this.resource = resource;
30
+ this.diffs = diffs;
31
+ this.editingDelegate = editingDelegate;
32
+ this.beforeHandles = beforeHandles;
33
+ this.endHandles = endHandles;
34
+ this.type = 0 ;
35
+ this.label = 'Insert Cell';
36
+ this.code = 'undoredo.notebooks.insertCell';
37
+ }
38
+ undo() {
39
+ if (!this.editingDelegate.replaceCell) {
40
+ throw new Error('Notebook Replace Cell not implemented for Undo/Redo');
41
+ }
42
+ this.diffs.forEach(diff => {
43
+ this.editingDelegate.replaceCell(diff[0], diff[2].length, diff[1], this.beforeHandles);
44
+ });
45
+ }
46
+ redo() {
47
+ if (!this.editingDelegate.replaceCell) {
48
+ throw new Error('Notebook Replace Cell not implemented for Undo/Redo');
49
+ }
50
+ this.diffs.reverse().forEach(diff => {
51
+ this.editingDelegate.replaceCell(diff[0], diff[1].length, diff[2], this.endHandles);
52
+ });
53
+ }
54
+ }
55
+ class CellMetadataEdit {
56
+ constructor(resource, index, oldMetadata, newMetadata, editingDelegate) {
57
+ this.resource = resource;
58
+ this.index = index;
59
+ this.oldMetadata = oldMetadata;
60
+ this.newMetadata = newMetadata;
61
+ this.editingDelegate = editingDelegate;
62
+ this.type = 0 ;
63
+ this.label = 'Update Cell Metadata';
64
+ this.code = 'undoredo.notebooks.updateCellMetadata';
65
+ }
66
+ undo() {
67
+ if (!this.editingDelegate.updateCellMetadata) {
68
+ return;
69
+ }
70
+ this.editingDelegate.updateCellMetadata(this.index, this.oldMetadata);
71
+ }
72
+ redo() {
73
+ if (!this.editingDelegate.updateCellMetadata) {
74
+ return;
75
+ }
76
+ this.editingDelegate.updateCellMetadata(this.index, this.newMetadata);
77
+ }
78
+ }
79
+
80
+ export { CellMetadataEdit, MoveCellEdit, SpliceCellsEdit };