@codingame/monaco-vscode-notebook-service-override 37.0.0 → 37.2.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 (87) hide show
  1. package/index.js +5 -0
  2. package/package.json +3 -3
  3. package/vscode/src/vs/workbench/api/browser/mainThreadNotebook.d.ts +22 -0
  4. package/vscode/src/vs/workbench/api/browser/mainThreadNotebook.js +210 -0
  5. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocuments.d.ts +24 -0
  6. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocuments.js +138 -0
  7. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocumentsAndEditors.d.ts +29 -0
  8. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocumentsAndEditors.js +194 -0
  9. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookEditors.d.ts +27 -0
  10. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookEditors.js +149 -0
  11. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookKernels.d.ts +49 -0
  12. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookKernels.js +372 -0
  13. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookRenderers.d.ts +10 -0
  14. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookRenderers.js +26 -0
  15. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookSaveParticipant.d.ts +9 -0
  16. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookSaveParticipant.js +43 -0
  17. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +7 -7
  18. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +23 -23
  19. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticEditorContrib.js +3 -3
  20. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticsActions.js +6 -6
  21. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/diagnosticCellStatusBarContrib.js +3 -3
  22. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.js +1 -1
  23. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +3 -3
  24. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.d.ts +1 -1
  25. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +8 -8
  26. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +3 -3
  27. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +10 -10
  28. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/execute/executionEditorProgress.js +1 -1
  29. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +6 -6
  30. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +5 -5
  31. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +1 -1
  32. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +2 -2
  33. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +1 -1
  34. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookMulticursor.js +9 -9
  35. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookSelectionHighlight.js +1 -1
  36. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +14 -14
  37. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookInlineVariables.js +4 -4
  38. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +2 -2
  39. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +1 -1
  40. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +3 -3
  41. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.d.ts +1 -1
  42. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +11 -11
  43. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +1 -1
  44. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +13 -13
  45. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +4 -4
  46. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.js +2 -2
  47. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/editActions.js +27 -27
  48. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +25 -25
  49. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +22 -22
  50. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/notebookIndentationActions.js +7 -7
  51. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.js +15 -15
  52. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/variablesActions.js +3 -3
  53. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +22 -22
  54. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.d.ts +1 -1
  55. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.js +4 -4
  56. package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +64 -64
  57. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibilityHelp.js +10 -10
  58. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibleView.js +1 -1
  59. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +31 -31
  60. package/vscode/src/vs/workbench/contrib/notebook/browser/outputEditor/notebookOutputEditor.d.ts +1 -1
  61. package/vscode/src/vs/workbench/contrib/notebook/browser/outputEditor/notebookOutputEditor.js +9 -9
  62. package/vscode/src/vs/workbench/contrib/notebook/browser/outputEditor/notebookOutputEditorInput.d.ts +1 -1
  63. package/vscode/src/vs/workbench/contrib/notebook/browser/outputEditor/notebookOutputEditorInput.js +1 -1
  64. package/vscode/src/vs/workbench/contrib/notebook/browser/replEditorAccessibleView.js +1 -1
  65. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.d.ts +1 -1
  66. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +1 -1
  67. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.d.ts +1 -1
  68. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +2 -2
  69. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.d.ts +1 -1
  70. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +1 -1
  71. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +1 -1
  72. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +3 -3
  73. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +1 -1
  74. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.d.ts +1 -1
  75. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +1 -1
  76. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/OutlineEntry.js +1 -1
  77. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.js +2 -2
  78. package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.d.ts +1 -1
  79. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.d.ts +1 -1
  80. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +2 -2
  81. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModel.d.ts +87 -0
  82. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModel.js +352 -0
  83. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +1 -1
  84. package/vscode/src/vs/workbench/contrib/replNotebook/browser/repl.contribution.js +5 -5
  85. package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditorAccessibilityHelp.js +14 -14
  86. package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +12 -12
  87. package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +1 -1
@@ -0,0 +1,352 @@
1
+
2
+ import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
+ import { streamToBuffer } from '@codingame/monaco-vscode-api/vscode/vs/base/common/buffer';
4
+ import { CancellationError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
5
+ import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
6
+ import { DisposableStore, Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
7
+ import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
8
+ import { hasKey, assertType } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
9
+ import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
10
+ import { FileOperationError, FileOperationResult } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files';
11
+ import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service';
12
+ import { EditorModel } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor/editorModel';
13
+ import { NotebookCellsChangeType, NotebookSetting } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
14
+ import { INotebookLoggingService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookLoggingService.service';
15
+ import { SimpleNotebookProviderInfo } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookService';
16
+ import { INotebookService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookService.service';
17
+ import { IFilesConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/filesConfiguration/common/filesConfigurationService.service';
18
+ import { StoredFileWorkingCopyState } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/workingCopy/common/storedFileWorkingCopy';
19
+ import { WorkingCopyCapabilities } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/workingCopy/common/workingCopy';
20
+
21
+ var SimpleNotebookEditorModel_1;
22
+ let SimpleNotebookEditorModel = SimpleNotebookEditorModel_1 = class SimpleNotebookEditorModel extends EditorModel {
23
+ constructor(
24
+ resource,
25
+ _hasAssociatedFilePath,
26
+ viewType,
27
+ _workingCopyManager,
28
+ scratchpad,
29
+ _filesConfigurationService
30
+ ) {
31
+ super();
32
+ this.resource = resource;
33
+ this._hasAssociatedFilePath = _hasAssociatedFilePath;
34
+ this.viewType = viewType;
35
+ this._workingCopyManager = _workingCopyManager;
36
+ this._filesConfigurationService = _filesConfigurationService;
37
+ this._onDidChangeDirty = this._register(( new Emitter()));
38
+ this._onDidSave = this._register(( new Emitter()));
39
+ this._onDidChangeOrphaned = this._register(( new Emitter()));
40
+ this._onDidChangeReadonly = this._register(( new Emitter()));
41
+ this._onDidRevertUntitled = this._register(( new Emitter()));
42
+ this.onDidChangeDirty = this._onDidChangeDirty.event;
43
+ this.onDidSave = this._onDidSave.event;
44
+ this.onDidChangeOrphaned = this._onDidChangeOrphaned.event;
45
+ this.onDidChangeReadonly = this._onDidChangeReadonly.event;
46
+ this.onDidRevertUntitled = this._onDidRevertUntitled.event;
47
+ this._workingCopyListeners = this._register(( new DisposableStore()));
48
+ this.scratchPad = scratchpad;
49
+ }
50
+ dispose() {
51
+ this._workingCopy?.dispose();
52
+ super.dispose();
53
+ }
54
+ get notebook() {
55
+ return this._workingCopy?.model?.notebookModel;
56
+ }
57
+ isResolved() {
58
+ return Boolean(this._workingCopy?.model?.notebookModel);
59
+ }
60
+ async canDispose() {
61
+ if (!this._workingCopy) {
62
+ return true;
63
+ }
64
+ if (SimpleNotebookEditorModel_1._isStoredFileWorkingCopy(this._workingCopy)) {
65
+ return this._workingCopyManager.stored.canDispose(this._workingCopy);
66
+ } else {
67
+ return true;
68
+ }
69
+ }
70
+ isDirty() {
71
+ return this._workingCopy?.isDirty() ?? false;
72
+ }
73
+ isModified() {
74
+ return this._workingCopy?.isModified() ?? false;
75
+ }
76
+ isOrphaned() {
77
+ return SimpleNotebookEditorModel_1._isStoredFileWorkingCopy(this._workingCopy) && this._workingCopy.hasState(StoredFileWorkingCopyState.ORPHAN);
78
+ }
79
+ hasAssociatedFilePath() {
80
+ return !SimpleNotebookEditorModel_1._isStoredFileWorkingCopy(this._workingCopy) && !!this._workingCopy?.hasAssociatedFilePath;
81
+ }
82
+ isReadonly() {
83
+ if (SimpleNotebookEditorModel_1._isStoredFileWorkingCopy(this._workingCopy)) {
84
+ return this._workingCopy?.isReadonly();
85
+ } else {
86
+ return this._filesConfigurationService.isReadonly(this.resource);
87
+ }
88
+ }
89
+ get hasErrorState() {
90
+ if (this._workingCopy && hasKey(this._workingCopy, {
91
+ hasState: true
92
+ })) {
93
+ return this._workingCopy.hasState(StoredFileWorkingCopyState.ERROR);
94
+ }
95
+ return false;
96
+ }
97
+ async revert(options) {
98
+ assertType(this.isResolved());
99
+ return this._workingCopy.revert(options);
100
+ }
101
+ async save(options) {
102
+ assertType(this.isResolved());
103
+ return this._workingCopy.save(options);
104
+ }
105
+ async load(options) {
106
+ if (!this._workingCopy || !this._workingCopy.model) {
107
+ if (this.resource.scheme === Schemas.untitled) {
108
+ if (this._hasAssociatedFilePath) {
109
+ this._workingCopy = await this._workingCopyManager.resolve({
110
+ associatedResource: this.resource
111
+ });
112
+ } else {
113
+ this._workingCopy = await this._workingCopyManager.resolve({
114
+ untitledResource: this.resource,
115
+ isScratchpad: this.scratchPad
116
+ });
117
+ }
118
+ this._register(this._workingCopy.onDidRevert(() => this._onDidRevertUntitled.fire()));
119
+ } else {
120
+ this._workingCopy = await this._workingCopyManager.resolve(this.resource, {
121
+ limits: options?.limits,
122
+ reload: options?.forceReadFromFile ? {
123
+ async: false,
124
+ force: true
125
+ } : undefined
126
+ });
127
+ this._workingCopyListeners.add(this._workingCopy.onDidSave(e => this._onDidSave.fire(e)));
128
+ this._workingCopyListeners.add(
129
+ this._workingCopy.onDidChangeOrphaned(() => this._onDidChangeOrphaned.fire())
130
+ );
131
+ this._workingCopyListeners.add(
132
+ this._workingCopy.onDidChangeReadonly(() => this._onDidChangeReadonly.fire())
133
+ );
134
+ }
135
+ this._workingCopyListeners.add(
136
+ this._workingCopy.onDidChangeDirty(() => this._onDidChangeDirty.fire(), undefined)
137
+ );
138
+ this._workingCopyListeners.add(this._workingCopy.onWillDispose(() => {
139
+ this._workingCopyListeners.clear();
140
+ this._workingCopy?.model?.dispose();
141
+ }));
142
+ } else {
143
+ await this._workingCopyManager.resolve(this.resource, {
144
+ reload: {
145
+ async: !options?.forceReadFromFile,
146
+ force: options?.forceReadFromFile
147
+ },
148
+ limits: options?.limits
149
+ });
150
+ }
151
+ assertType(this.isResolved());
152
+ return this;
153
+ }
154
+ async saveAs(target) {
155
+ const newWorkingCopy = await this._workingCopyManager.saveAs(this.resource, target);
156
+ if (!newWorkingCopy) {
157
+ return undefined;
158
+ }
159
+ return {
160
+ resource: newWorkingCopy.resource
161
+ };
162
+ }
163
+ static _isStoredFileWorkingCopy(candidate) {
164
+ const isUntitled = candidate && candidate.capabilities & WorkingCopyCapabilities.Untitled;
165
+ return !isUntitled;
166
+ }
167
+ };
168
+ SimpleNotebookEditorModel = SimpleNotebookEditorModel_1 = ( __decorate([( __param(5, IFilesConfigurationService))], SimpleNotebookEditorModel));
169
+ class NotebookFileWorkingCopyModel extends Disposable {
170
+ constructor(
171
+ _notebookModel,
172
+ _notebookService,
173
+ _configurationService,
174
+ _telemetryService,
175
+ _notebookLogService
176
+ ) {
177
+ super();
178
+ this._notebookModel = _notebookModel;
179
+ this._notebookService = _notebookService;
180
+ this._configurationService = _configurationService;
181
+ this._telemetryService = _telemetryService;
182
+ this._notebookLogService = _notebookLogService;
183
+ this._onDidChangeContent = this._register(( new Emitter()));
184
+ this.onDidChangeContent = this._onDidChangeContent.event;
185
+ this.configuration = undefined;
186
+ this.onWillDispose = _notebookModel.onWillDispose.bind(_notebookModel);
187
+ this._register(_notebookModel.onDidChangeContent(e => {
188
+ for (const rawEvent of e.rawEvents) {
189
+ if (rawEvent.kind === NotebookCellsChangeType.Initialize) {
190
+ continue;
191
+ }
192
+ if (rawEvent.transient) {
193
+ continue;
194
+ }
195
+ this._onDidChangeContent.fire({
196
+ isRedoing: false,
197
+ isUndoing: false,
198
+ isInitial: false
199
+ });
200
+ break;
201
+ }
202
+ }));
203
+ const saveWithReducedCommunication = this._configurationService.getValue(NotebookSetting.remoteSaving);
204
+ if (saveWithReducedCommunication || _notebookModel.uri.scheme === Schemas.vscodeRemote) {
205
+ this.configuration = {
206
+ backupDelay: 10000
207
+ };
208
+ }
209
+ if (saveWithReducedCommunication) {
210
+ this.setSaveDelegate().catch(
211
+ error => this._notebookLogService.error("WorkingCopyModel", `Failed to set save delegate: ${error}`)
212
+ );
213
+ }
214
+ }
215
+ async setSaveDelegate() {
216
+ await this.getNotebookSerializer();
217
+ this.save = async (options, token) => {
218
+ try {
219
+ let serializer = this._notebookService.tryGetDataProviderSync(this.notebookModel.viewType)?.serializer;
220
+ if (!serializer) {
221
+ this._notebookLogService.info(
222
+ "WorkingCopyModel",
223
+ "No serializer found for notebook model, checking if provider still needs to be resolved"
224
+ );
225
+ serializer = await this.getNotebookSerializer().catch(error => {
226
+ this._notebookLogService.error("WorkingCopyModel", `Failed to get notebook serializer: ${error}`);
227
+ this.save = undefined;
228
+ throw ( new NotebookSaveError("Failed to get notebook serializer"));
229
+ });
230
+ }
231
+ if (token.isCancellationRequested) {
232
+ throw ( new CancellationError());
233
+ }
234
+ const stat = await serializer.save(this._notebookModel.uri, this._notebookModel.versionId, options, token);
235
+ return stat;
236
+ } catch (error) {
237
+ if (!token.isCancellationRequested && error.name !== "Canceled") {
238
+ const isIPynb = this._notebookModel.viewType === "jupyter-notebook" || this._notebookModel.viewType === "interactive";
239
+ const errorMessage = getSaveErrorMessage(error);
240
+ this._telemetryService.publicLogError2("notebook/SaveError", {
241
+ isRemote: this._notebookModel.uri.scheme === Schemas.vscodeRemote,
242
+ isIPyNbWorkerSerializer: isIPynb && this._configurationService.getValue("ipynb.experimental.serialization"),
243
+ error: errorMessage
244
+ });
245
+ }
246
+ throw error;
247
+ }
248
+ };
249
+ }
250
+ dispose() {
251
+ this._notebookModel.dispose();
252
+ super.dispose();
253
+ }
254
+ get notebookModel() {
255
+ return this._notebookModel;
256
+ }
257
+ async snapshot(context, token) {
258
+ return this._notebookService.createNotebookTextDocumentSnapshot(this._notebookModel.uri, context, token);
259
+ }
260
+ async update(stream, token) {
261
+ const serializer = await this.getNotebookSerializer();
262
+ const bytes = await streamToBuffer(stream);
263
+ const data = await serializer.dataToNotebook(bytes);
264
+ if (token.isCancellationRequested) {
265
+ throw ( new CancellationError());
266
+ }
267
+ this._notebookLogService.info(
268
+ "WorkingCopyModel",
269
+ "Notebook content updated from file system - " + ( this._notebookModel.uri.toString())
270
+ );
271
+ this._notebookModel.reset(data.cells, data.metadata, serializer.options);
272
+ }
273
+ async getNotebookSerializer() {
274
+ const info = await this._notebookService.withNotebookDataProvider(this.notebookModel.viewType);
275
+ if (!(info instanceof SimpleNotebookProviderInfo)) {
276
+ const message = "CANNOT open notebook with this provider";
277
+ throw ( new NotebookSaveError(message));
278
+ }
279
+ return info.serializer;
280
+ }
281
+ get versionId() {
282
+ return this._notebookModel.alternativeVersionId;
283
+ }
284
+ pushStackElement() {
285
+ this._notebookModel.pushStackElement();
286
+ }
287
+ }
288
+ let NotebookFileWorkingCopyModelFactory = class NotebookFileWorkingCopyModelFactory {
289
+ constructor(
290
+ _viewType,
291
+ _notebookService,
292
+ _configurationService,
293
+ _telemetryService,
294
+ _notebookLogService
295
+ ) {
296
+ this._viewType = _viewType;
297
+ this._notebookService = _notebookService;
298
+ this._configurationService = _configurationService;
299
+ this._telemetryService = _telemetryService;
300
+ this._notebookLogService = _notebookLogService;
301
+ }
302
+ async createModel(resource, stream, token) {
303
+ const notebookModel = this._notebookService.getNotebookTextModel(resource) ?? (await this._notebookService.createNotebookTextModel(this._viewType, resource, stream));
304
+ return ( new NotebookFileWorkingCopyModel(
305
+ notebookModel,
306
+ this._notebookService,
307
+ this._configurationService,
308
+ this._telemetryService,
309
+ this._notebookLogService
310
+ ));
311
+ }
312
+ };
313
+ NotebookFileWorkingCopyModelFactory = ( __decorate([( __param(1, INotebookService)), ( __param(2, IConfigurationService)), ( __param(3, ITelemetryService)), ( __param(4, INotebookLoggingService))], NotebookFileWorkingCopyModelFactory));
314
+ class NotebookSaveError extends Error {
315
+ constructor(message) {
316
+ super(message);
317
+ this.name = "NotebookSaveError";
318
+ }
319
+ }
320
+ function getSaveErrorMessage(error) {
321
+ if (error.name === "NotebookSaveError") {
322
+ return error.message;
323
+ } else if (error instanceof FileOperationError) {
324
+ switch (error.fileOperationResult) {
325
+ case FileOperationResult.FILE_IS_DIRECTORY:
326
+ return "File is a directory";
327
+ case FileOperationResult.FILE_NOT_FOUND:
328
+ return "File not found";
329
+ case FileOperationResult.FILE_NOT_MODIFIED_SINCE:
330
+ return "File not modified since";
331
+ case FileOperationResult.FILE_MODIFIED_SINCE:
332
+ return "File modified since";
333
+ case FileOperationResult.FILE_MOVE_CONFLICT:
334
+ return "File move conflict";
335
+ case FileOperationResult.FILE_WRITE_LOCKED:
336
+ return "File write locked";
337
+ case FileOperationResult.FILE_PERMISSION_DENIED:
338
+ return "File permission denied";
339
+ case FileOperationResult.FILE_TOO_LARGE:
340
+ return "File too large";
341
+ case FileOperationResult.FILE_INVALID_PATH:
342
+ return "File invalid path";
343
+ case FileOperationResult.FILE_NOT_DIRECTORY:
344
+ return "File not directory";
345
+ case FileOperationResult.FILE_OTHER_ERROR:
346
+ return "File other error";
347
+ }
348
+ }
349
+ return "Unknown error";
350
+ }
351
+
352
+ export { NotebookFileWorkingCopyModel, NotebookFileWorkingCopyModelFactory, SimpleNotebookEditorModel };
@@ -3,7 +3,7 @@ import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib
3
3
  import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
4
4
  import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
5
5
  import { NotebookWorkingCopyTypeIdentifier, NotebookSetting, CellUri } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
6
- import { NotebookFileWorkingCopyModelFactory, SimpleNotebookEditorModel } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookEditorModel';
6
+ import { NotebookFileWorkingCopyModelFactory, SimpleNotebookEditorModel } from './notebookEditorModel.js';
7
7
  import { ReferenceCollection, DisposableStore, dispose, combinedDisposable, toDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
8
8
  import { INotebookService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookService.service';
9
9
  import { Emitter, AsyncEmitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
@@ -35,8 +35,8 @@ import { getReplView } from '@codingame/monaco-vscode-api/vscode/vs/workbench/co
35
35
  import { REPL_VIEW_ID } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/debug/common/debug';
36
36
  import { InlineChatController } from '@codingame/monaco-vscode-katex-common/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatController';
37
37
  import { IInteractiveHistoryService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/interactive/browser/interactiveHistoryService.service';
38
- import { NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/controller/coreActions';
39
- import { executeIcon } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/notebookIcons';
38
+ import { NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT } from '@codingame/monaco-vscode-katex-common/vscode/vs/workbench/contrib/notebook/browser/controller/coreActions';
39
+ import { executeIcon } from '@codingame/monaco-vscode-katex-common/vscode/vs/workbench/contrib/notebook/browser/notebookIcons';
40
40
  import { ReplEditorAccessibleView } from '../../notebook/browser/replEditorAccessibleView.js';
41
41
  import { INotebookEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/services/notebookEditorService.service';
42
42
  import { REPL_EDITOR_ID, NotebookSetting, NotebookWorkingCopyTypeIdentifier, CellKind, CellEditType } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
@@ -232,7 +232,7 @@ registerAction2(class extends Action2 {
232
232
  constructor() {
233
233
  super({
234
234
  id: "repl.focusLastItemExecuted",
235
- title: ( localize2(15382, "Focus Most Recent REPL Execution")),
235
+ title: ( localize2(15602, "Focus Most Recent REPL Execution")),
236
236
  category: "REPL",
237
237
  menu: {
238
238
  id: MenuId.CommandPalette,
@@ -282,7 +282,7 @@ registerAction2(class extends Action2 {
282
282
  constructor() {
283
283
  super({
284
284
  id: "repl.input.focus",
285
- title: ( localize2(15383, "Focus Input Editor")),
285
+ title: ( localize2(15603, "Focus Input Editor")),
286
286
  category: "REPL",
287
287
  menu: {
288
288
  id: MenuId.CommandPalette,
@@ -327,7 +327,7 @@ registerAction2(class extends Action2 {
327
327
  constructor() {
328
328
  super({
329
329
  id: "repl.execute",
330
- title: ( localize2(15384, "Execute REPL input")),
330
+ title: ( localize2(15604, "Execute REPL input")),
331
331
  category: "REPL",
332
332
  keybinding: [{
333
333
  when: ( ContextKeyExpr.and(IS_COMPOSITE_NOTEBOOK, ( ContextKeyExpr.equals("activeEditor", "workbench.editor.repl")), ( NOTEBOOK_CELL_LIST_FOCUSED.negate()))),
@@ -19,28 +19,28 @@ class ReplEditorInputAccessibilityHelp {
19
19
  }
20
20
  function getAccessibilityInputHelpText() {
21
21
  return [( localize(
22
- 15386,
22
+ 15606,
23
23
  "You are in a REPL Editor Input box which will accept code to be executed in the REPL."
24
24
  )), ( localize(
25
- 15387,
25
+ 15607,
26
26
  "The Execute command{0} will evaluate the expression in the input box.",
27
27
  "<keybinding:repl.execute>"
28
28
  )), ( localize(
29
- 15388,
29
+ 15608,
30
30
  "The setting `accessibility.replEditor.readLastExecutionOutput` controls if output will be automatically read when execution completes."
31
31
  )), ( localize(
32
- 15389,
32
+ 15609,
33
33
  "The setting `accessibility.replEditor.autoFocusReplExecution` controls if focus will automatically move to the REPL after executing code."
34
34
  )), ( localize(
35
- 15390,
35
+ 15610,
36
36
  "The Focus Last executed command{0} will move focus to the last executed item in the REPL history.",
37
37
  "<keybinding:repl.focusLastItemExecuted>"
38
38
  )), ( localize(
39
- 15391,
39
+ 15611,
40
40
  "When you run the Open Accessbility View command{0} from this input box, the output from the last execution will be shown in the accessibility view.",
41
41
  "<keybinding:editor.action.accessibleView>"
42
42
  )), ( localize(
43
- 15392,
43
+ 15612,
44
44
  "The Focus Input Editor command{0} will bring the focus back to this editor.",
45
45
  "<keybinding:repl.input.focus>"
46
46
  ))].join("\n");
@@ -58,30 +58,30 @@ class ReplEditorHistoryAccessibilityHelp {
58
58
  }
59
59
  function getAccessibilityHistoryHelpText() {
60
60
  return [( localize(
61
- 15393,
61
+ 15613,
62
62
  "You are in a REPL History which is a list of cells that have been executed in the REPL. Each cell has an input, an output, and the cell container."
63
63
  )), ( localize(
64
- 15394,
64
+ 15614,
65
65
  "The Edit Cell command{0} will move focus to the read-only editor for the input of the cell.",
66
66
  "<keybinding:notebook.cell.edit>"
67
67
  )), ( localize(
68
- 15395,
68
+ 15615,
69
69
  "The Quit Edit command{0} will move focus to the cell container, where the up and down arrows will also move focus between cells in the history.",
70
70
  "<keybinding:notebook.cell.quitEdit>"
71
71
  )), ( localize(
72
- 15396,
72
+ 15616,
73
73
  "Run the Open Accessbility View command{0} while navigating the history for an accessible view of the item's output.",
74
74
  "<keybinding:editor.action.accessibleView>"
75
75
  )), ( localize(
76
- 15397,
76
+ 15617,
77
77
  "The Focus Output command{0} will set focus on the output when focused on a previously executed item.",
78
78
  "<keybinding:notebook.cell.focusInOutput>"
79
79
  )), ( localize(
80
- 15398,
80
+ 15618,
81
81
  "The Focus Input Editor command{0} will move focus to the REPL input box.",
82
82
  "<keybinding:repl.input.focus>"
83
83
  )), ( localize(
84
- 15390,
84
+ 15610,
85
85
  "The Focus Last executed command{0} will move focus to the last executed item in the REPL history.",
86
86
  "<keybinding:repl.focusLastItemExecuted>"
87
87
  ))].join("\n");
@@ -51,10 +51,10 @@ let FileWorkingCopyManager = class FileWorkingCopyManager extends Disposable {
51
51
  FileWorkingCopyManager_1 = this;
52
52
  }
53
53
  static {
54
- this.FILE_WORKING_COPY_SAVE_CREATE_SOURCE = SaveSourceRegistry.registerSource("fileWorkingCopyCreate.source", ( localize(20054, "File Created")));
54
+ this.FILE_WORKING_COPY_SAVE_CREATE_SOURCE = SaveSourceRegistry.registerSource("fileWorkingCopyCreate.source", ( localize(20386, "File Created")));
55
55
  }
56
56
  static {
57
- this.FILE_WORKING_COPY_SAVE_REPLACE_SOURCE = SaveSourceRegistry.registerSource("fileWorkingCopyReplace.source", ( localize(20055, "File Replaced")));
57
+ this.FILE_WORKING_COPY_SAVE_REPLACE_SOURCE = SaveSourceRegistry.registerSource("fileWorkingCopyReplace.source", ( localize(20387, "File Replaced")));
58
58
  }
59
59
  constructor(
60
60
  workingCopyTypeId,
@@ -133,7 +133,7 @@ let FileWorkingCopyManager = class FileWorkingCopyManager extends Disposable {
133
133
  constructor(stored) {
134
134
  super();
135
135
  this.stored = stored;
136
- this.label = ( localize(20056, "File Working Copy Decorations"));
136
+ this.label = ( localize(20388, "File Working Copy Decorations"));
137
137
  this._onDidChange = this._register(( new Emitter()));
138
138
  this.onDidChange = this._onDidChange.event;
139
139
  this.registerListeners();
@@ -166,20 +166,20 @@ let FileWorkingCopyManager = class FileWorkingCopyManager extends Disposable {
166
166
  color: listErrorForeground,
167
167
  letter: Codicon.lockSmall,
168
168
  strikethrough: true,
169
- tooltip: ( localize(20057, "Deleted, Read-only"))
169
+ tooltip: ( localize(20389, "Deleted, Read-only"))
170
170
  };
171
171
  }
172
172
  else if (isReadonly) {
173
173
  return {
174
174
  letter: Codicon.lockSmall,
175
- tooltip: ( localize(20058, "Read-only"))
175
+ tooltip: ( localize(20390, "Read-only"))
176
176
  };
177
177
  }
178
178
  else if (isOrphaned) {
179
179
  return {
180
180
  color: listErrorForeground,
181
181
  strikethrough: true,
182
- tooltip: ( localize(20059, "Deleted"))
182
+ tooltip: ( localize(20391, "Deleted"))
183
183
  };
184
184
  }
185
185
  return undefined;
@@ -334,17 +334,17 @@ let FileWorkingCopyManager = class FileWorkingCopyManager extends Disposable {
334
334
  } = await this.dialogService.confirm({
335
335
  type: "warning",
336
336
  message: ( localize(
337
- 20060,
337
+ 20392,
338
338
  "'{0}' already exists. Do you want to replace it?",
339
339
  basename(resource)
340
340
  )),
341
341
  detail: ( localize(
342
- 20061,
342
+ 20393,
343
343
  "A file or folder with the name '{0}' already exists in the folder '{1}'. Replacing it will overwrite its current contents.",
344
344
  basename(resource),
345
345
  basename(dirname(resource))
346
346
  )),
347
- primaryButton: ( localize(20062, "&&Replace"))
347
+ primaryButton: ( localize(20394, "&&Replace"))
348
348
  });
349
349
  return confirmed;
350
350
  }
@@ -354,12 +354,12 @@ let FileWorkingCopyManager = class FileWorkingCopyManager extends Disposable {
354
354
  } = await this.dialogService.confirm({
355
355
  type: "warning",
356
356
  message: ( localize(
357
- 20063,
357
+ 20395,
358
358
  "'{0}' is marked as read-only. Do you want to save anyway?",
359
359
  basename(resource)
360
360
  )),
361
- detail: ( localize(20064, "Paths can be configured as read-only via settings.")),
362
- primaryButton: ( localize(20065, "&&Save Anyway"))
361
+ detail: ( localize(20396, "Paths can be configured as read-only via settings.")),
362
+ primaryButton: ( localize(20397, "&&Save Anyway"))
363
363
  });
364
364
  return confirmed;
365
365
  }
@@ -109,7 +109,7 @@ let StoredFileWorkingCopyManager = class StoredFileWorkingCopyManager extends Ba
109
109
  this._register(
110
110
  this.lifecycleService.onWillShutdown(event => event.join(this.onWillShutdownDesktop(), {
111
111
  id: "join.fileWorkingCopyManager",
112
- label: ( localize(20083, "Saving working copies"))
112
+ label: ( localize(20415, "Saving working copies"))
113
113
  }))
114
114
  );
115
115
  }