@codingame/monaco-vscode-notebook-service-override 25.1.2 → 26.0.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 (94) hide show
  1. package/index.js +2 -2
  2. package/package.json +3 -3
  3. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +112 -94
  4. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +95 -96
  5. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticEditorContrib.js +28 -19
  6. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticsActions.js +15 -9
  7. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/diagnosticCellStatusBarContrib.js +22 -17
  8. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.js +25 -10
  9. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +37 -44
  10. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +211 -115
  11. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.js +16 -18
  12. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookCellPausing.js +5 -8
  13. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +57 -49
  14. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.js +24 -11
  15. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +78 -76
  16. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/execute/executionEditorProgress.js +14 -15
  17. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +43 -28
  18. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +65 -34
  19. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +19 -16
  20. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/kernelDetection/notebookKernelDetection.js +6 -10
  21. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +15 -17
  22. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +28 -16
  23. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookMulticursor.js +211 -170
  24. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookSelectionHighlight.js +11 -11
  25. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +158 -156
  26. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookInlineVariables.js +109 -105
  27. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableContextKeys.js +1 -1
  28. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +28 -22
  29. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +26 -17
  30. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +23 -16
  31. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +72 -40
  32. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +233 -186
  33. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +22 -18
  34. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +239 -151
  35. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +85 -86
  36. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +25 -11
  37. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.js +13 -10
  38. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/apiActions.js +8 -5
  39. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/editActions.js +218 -196
  40. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +258 -255
  41. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +106 -98
  42. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/notebookIndentationActions.js +63 -49
  43. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.js +55 -64
  44. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/variablesActions.js +21 -25
  45. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +149 -129
  46. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.d.ts +57 -0
  47. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.js +286 -0
  48. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditorInput.d.ts +22 -0
  49. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditorInput.js +82 -0
  50. package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +452 -363
  51. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibilityHelp.js +44 -61
  52. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibleView.js +9 -11
  53. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +203 -207
  54. package/vscode/src/vs/workbench/contrib/notebook/browser/outputEditor/notebookOutputEditor.js +148 -104
  55. package/vscode/src/vs/workbench/contrib/notebook/browser/outputEditor/notebookOutputEditorInput.js +19 -11
  56. package/vscode/src/vs/workbench/contrib/notebook/browser/replEditorAccessibleView.js +9 -11
  57. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookCellStatusBarServiceImpl.js +9 -6
  58. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +34 -22
  59. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +29 -18
  60. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +70 -52
  61. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +31 -19
  62. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +78 -41
  63. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +37 -27
  64. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +9 -6
  65. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.js +8 -7
  66. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +214 -119
  67. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +38 -36
  68. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineDataSource.js +24 -25
  69. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineDataSourceFactory.js +2 -6
  70. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.js +26 -15
  71. package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.js +35 -15
  72. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +468 -258
  73. package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.d.ts +33 -0
  74. package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +113 -0
  75. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +74 -58
  76. package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.d.ts +1 -1
  77. package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.js +7 -10
  78. package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookCellMatching.js +72 -16
  79. package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookWebWorker.js +70 -51
  80. package/vscode/src/vs/workbench/contrib/replNotebook/browser/repl.contribution.js +195 -149
  81. package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditorAccessibilityHelp.js +60 -81
  82. package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.js +7 -12
  83. package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +104 -66
  84. package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +115 -77
  85. package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.js +42 -26
  86. package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopyManager.js +19 -12
  87. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.d.ts +0 -7
  88. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +0 -198
  89. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.d.ts +0 -8
  90. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.js +0 -333
  91. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext.d.ts +0 -2
  92. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext.js +0 -7
  93. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.d.ts +0 -13
  94. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +0 -261
@@ -20,7 +20,7 @@ import { StorageScope, StorageTarget } from '@codingame/monaco-vscode-api/vscode
20
20
  import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
21
21
  import { Memento } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/memento';
22
22
  import { notebooksExtensionPoint, notebookRendererExtensionPoint, notebookPreloadExtensionPoint } from '../notebookExtensionPoint.js';
23
- import { NotebookDiffEditorInput } from '@codingame/monaco-vscode-katex-common/vscode/vs/workbench/contrib/notebook/common/notebookDiffEditorInput';
23
+ import { NotebookDiffEditorInput } from '../../common/notebookDiffEditorInput.js';
24
24
  import { NotebookTextModel } from '../../common/model/notebookTextModel.js';
25
25
  import { NotebookEditorPriority, NotebookSetting, CellUri, NotebookRendererMatch, RENDERER_EQUIVALENT_EXTENSIONS, RENDERER_NOT_AVAILABLE, MimeTypeDisplayOrder, ACCESSIBLE_NOTEBOOK_DISPLAY_ORDER, NOTEBOOK_DISPLAY_ORDER } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
26
26
  import { NotebookEditorInput } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookEditorInput';
@@ -37,15 +37,31 @@ import { IUriIdentityService } from '@codingame/monaco-vscode-api/vscode/vs/plat
37
37
  import { INotebookDocumentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/notebook/common/notebookDocumentService.service';
38
38
  import { MergeEditorInput } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mergeEditor/browser/mergeEditorInput';
39
39
  import { streamToBuffer, VSBuffer, bufferToStream } from '@codingame/monaco-vscode-api/vscode/vs/base/common/buffer';
40
- import { NotebookMultiDiffEditorInput } from '@codingame/monaco-vscode-katex-common/vscode/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditorInput';
40
+ import { NotebookMultiDiffEditorInput } from '../diff/notebookMultiDiffEditorInput.js';
41
41
  import { CancellationError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
42
42
 
43
43
  var NotebookProviderInfoStore_1, NotebookService_1;
44
44
  let NotebookProviderInfoStore = class NotebookProviderInfoStore extends Disposable {
45
- static { NotebookProviderInfoStore_1 = this; }
46
- static { this.CUSTOM_EDITORS_STORAGE_ID = 'notebookEditors'; }
47
- static { this.CUSTOM_EDITORS_ENTRY_ID = 'editors'; }
48
- constructor(storageService, extensionService, _editorResolverService, _configurationService, _accessibilityService, _instantiationService, _fileService, _notebookEditorModelResolverService, uriIdentService) {
45
+ static {
46
+ NotebookProviderInfoStore_1 = this;
47
+ }
48
+ static {
49
+ this.CUSTOM_EDITORS_STORAGE_ID = "notebookEditors";
50
+ }
51
+ static {
52
+ this.CUSTOM_EDITORS_ENTRY_ID = "editors";
53
+ }
54
+ constructor(
55
+ storageService,
56
+ extensionService,
57
+ _editorResolverService,
58
+ _configurationService,
59
+ _accessibilityService,
60
+ _instantiationService,
61
+ _fileService,
62
+ _notebookEditorModelResolverService,
63
+ uriIdentService
64
+ ) {
49
65
  super();
50
66
  this._editorResolverService = _editorResolverService;
51
67
  this._configurationService = _configurationService;
@@ -95,8 +111,7 @@ let NotebookProviderInfoStore = class NotebookProviderInfoStore extends Disposab
95
111
  if (existing) {
96
112
  if (!existing.extension && extension.description.isBuiltin && builtins.find(builtin => builtin.id === notebookContribution.type)) {
97
113
  builtinProvidersFromCache.get(notebookContribution.type)?.dispose();
98
- }
99
- else {
114
+ } else {
100
115
  extension.collector.error(`Notebook type '${notebookContribution.type}' already used`);
101
116
  continue;
102
117
  }
@@ -107,7 +122,7 @@ let NotebookProviderInfoStore = class NotebookProviderInfoStore extends Disposab
107
122
  displayName: notebookContribution.displayName,
108
123
  selectors: notebookContribution.selector || [],
109
124
  priority: this._convertPriority(notebookContribution.priority),
110
- providerDisplayName: extension.description.displayName ?? extension.description.identifier.value,
125
+ providerDisplayName: extension.description.displayName ?? extension.description.identifier.value
111
126
  })));
112
127
  }
113
128
  }
@@ -137,40 +152,46 @@ let NotebookProviderInfoStore = class NotebookProviderInfoStore extends Disposab
137
152
  id: notebookProviderInfo.id,
138
153
  label: notebookProviderInfo.displayName,
139
154
  detail: notebookProviderInfo.providerDisplayName,
140
- priority: notebookProviderInfo.priority,
155
+ priority: notebookProviderInfo.priority
141
156
  };
142
157
  const notebookEditorOptions = {
143
158
  canHandleDiff: () => !!this._configurationService.getValue(NotebookSetting.textDiffEditorPreview) && !this._accessibilityService.isScreenReaderOptimized(),
144
- canSupportResource: (resource) => {
159
+ canSupportResource: resource => {
145
160
  if (resource.scheme === Schemas.vscodeNotebookCellOutput) {
146
161
  const params = ( new URLSearchParams(resource.query));
147
- return params.get('openIn') === 'notebook';
162
+ return params.get("openIn") === "notebook";
148
163
  }
149
164
  return resource.scheme === Schemas.untitled || resource.scheme === Schemas.vscodeNotebookCell || this._fileService.hasProvider(resource);
150
165
  }
151
166
  };
152
- const notebookEditorInputFactory = async ({ resource, options }) => {
167
+ const notebookEditorInputFactory = async (
168
+ {
169
+ resource,
170
+ options
171
+ }
172
+ ) => {
153
173
  let data;
154
174
  if (resource.scheme === Schemas.vscodeNotebookCellOutput) {
155
175
  const outputUriData = CellUri.parseCellOutputUri(resource);
156
176
  if (!outputUriData || !outputUriData.notebook || outputUriData.cellHandle === undefined) {
157
- throw ( new Error('Invalid cell output uri'));
177
+ throw ( new Error("Invalid cell output uri"));
158
178
  }
159
179
  data = {
160
180
  notebook: outputUriData.notebook,
161
181
  handle: outputUriData.cellHandle
162
182
  };
163
- }
164
- else {
183
+ } else {
165
184
  data = CellUri.parse(resource);
166
185
  }
167
186
  let notebookUri;
168
187
  let cellOptions;
169
188
  if (data) {
170
189
  notebookUri = this.uriIdentService.asCanonicalUri(data.notebook);
171
- cellOptions = { resource, options };
172
- }
173
- else {
190
+ cellOptions = {
191
+ resource,
192
+ options
193
+ };
194
+ } else {
174
195
  notebookUri = this.uriIdentService.asCanonicalUri(resource);
175
196
  }
176
197
  if (!cellOptions) {
@@ -179,57 +200,108 @@ let NotebookProviderInfoStore = class NotebookProviderInfoStore extends Disposab
179
200
  let notebookOptions;
180
201
  if (resource.scheme === Schemas.vscodeNotebookCellOutput) {
181
202
  if (data?.handle === undefined || !data?.notebook) {
182
- throw ( new Error('Invalid cell handle'));
203
+ throw ( new Error("Invalid cell handle"));
183
204
  }
184
205
  const cellUri = CellUri.generate(data.notebook, data.handle);
185
- cellOptions = { resource: cellUri, options };
186
- const cellIndex = await this._notebookEditorModelResolverService.resolve(notebookUri)
187
- .then(model => model.object.notebook.cells.findIndex(cell => cell.handle === data?.handle))
188
- .then(index => index >= 0 ? index : 0);
189
- const cellIndexesToRanges = [{ start: cellIndex, end: cellIndex + 1 }];
206
+ cellOptions = {
207
+ resource: cellUri,
208
+ options
209
+ };
210
+ const cellIndex = await this._notebookEditorModelResolverService.resolve(notebookUri).then(
211
+ model => model.object.notebook.cells.findIndex(cell => cell.handle === data?.handle)
212
+ ).then(index => index >= 0 ? index : 0);
213
+ const cellIndexesToRanges = [{
214
+ start: cellIndex,
215
+ end: cellIndex + 1
216
+ }];
190
217
  notebookOptions = {
191
218
  ...options,
192
219
  cellOptions,
193
220
  viewState: undefined,
194
221
  cellSelections: cellIndexesToRanges
195
222
  };
196
- }
197
- else {
223
+ } else {
198
224
  notebookOptions = {
199
225
  ...options,
200
226
  cellOptions,
201
- viewState: undefined,
227
+ viewState: undefined
202
228
  };
203
229
  }
204
230
  const preferredResourceParam = cellOptions?.resource;
205
- const editor = NotebookEditorInput.getOrCreate(this._instantiationService, notebookUri, preferredResourceParam, notebookProviderInfo.id);
206
- return { editor, options: notebookOptions };
231
+ const editor = NotebookEditorInput.getOrCreate(
232
+ this._instantiationService,
233
+ notebookUri,
234
+ preferredResourceParam,
235
+ notebookProviderInfo.id
236
+ );
237
+ return {
238
+ editor,
239
+ options: notebookOptions
240
+ };
207
241
  };
208
- const notebookUntitledEditorFactory = async ({ resource, options }) => {
209
- const ref = await this._notebookEditorModelResolverService.resolve({ untitledResource: resource }, notebookProviderInfo.id);
242
+ const notebookUntitledEditorFactory = async (
243
+ {
244
+ resource,
245
+ options
246
+ }
247
+ ) => {
248
+ const ref = await this._notebookEditorModelResolverService.resolve({
249
+ untitledResource: resource
250
+ }, notebookProviderInfo.id);
210
251
  Event.once(ref.object.notebook.onWillDispose)(() => {
211
252
  ref.dispose();
212
253
  });
213
- return { editor: NotebookEditorInput.getOrCreate(this._instantiationService, ref.object.resource, undefined, notebookProviderInfo.id), options };
254
+ return {
255
+ editor: NotebookEditorInput.getOrCreate(
256
+ this._instantiationService,
257
+ ref.object.resource,
258
+ undefined,
259
+ notebookProviderInfo.id
260
+ ),
261
+ options
262
+ };
214
263
  };
215
264
  const notebookDiffEditorInputFactory = (diffEditorInput, group) => {
216
- const { modified, original, label, description } = diffEditorInput;
217
- if (this._configurationService.getValue('notebook.experimental.enableNewDiffEditor')) {
218
- return { editor: NotebookMultiDiffEditorInput.create(this._instantiationService, modified.resource, label, description, original.resource, notebookProviderInfo.id) };
265
+ const {
266
+ modified,
267
+ original,
268
+ label,
269
+ description
270
+ } = diffEditorInput;
271
+ if (this._configurationService.getValue("notebook.experimental.enableNewDiffEditor")) {
272
+ return {
273
+ editor: NotebookMultiDiffEditorInput.create(
274
+ this._instantiationService,
275
+ modified.resource,
276
+ label,
277
+ description,
278
+ original.resource,
279
+ notebookProviderInfo.id
280
+ )
281
+ };
219
282
  }
220
- return { editor: NotebookDiffEditorInput.create(this._instantiationService, modified.resource, label, description, original.resource, notebookProviderInfo.id) };
283
+ return {
284
+ editor: NotebookDiffEditorInput.create(
285
+ this._instantiationService,
286
+ modified.resource,
287
+ label,
288
+ description,
289
+ original.resource,
290
+ notebookProviderInfo.id
291
+ )
292
+ };
221
293
  };
222
- const mergeEditorInputFactory = (mergeEditor) => {
294
+ const mergeEditorInputFactory = mergeEditor => {
223
295
  return {
224
296
  editor: this._instantiationService.createInstance(MergeEditorInput, mergeEditor.base.resource, {
225
297
  uri: mergeEditor.input1.resource,
226
298
  title: mergeEditor.input1.label ?? basename(mergeEditor.input1.resource),
227
- description: mergeEditor.input1.description ?? '',
299
+ description: mergeEditor.input1.description ?? "",
228
300
  detail: mergeEditor.input1.detail
229
301
  }, {
230
302
  uri: mergeEditor.input2.resource,
231
303
  title: mergeEditor.input2.label ?? basename(mergeEditor.input2.resource),
232
- description: mergeEditor.input2.description ?? '',
304
+ description: mergeEditor.input2.description ?? "",
233
305
  detail: mergeEditor.input2.detail
234
306
  }, mergeEditor.result.resource)
235
307
  };
@@ -242,7 +314,7 @@ let NotebookProviderInfoStore = class NotebookProviderInfoStore extends Disposab
242
314
  };
243
315
  const notebookCellFactoryObject = {
244
316
  createEditorInput: notebookEditorInputFactory,
245
- createDiffEditorInput: notebookDiffEditorInputFactory,
317
+ createDiffEditorInput: notebookDiffEditorInputFactory
246
318
  };
247
319
  disposables.add(this._configurationService.onDidChangeConfiguration(e => {
248
320
  if (e.affectsConfiguration(NotebookSetting.textDiffEditorPreview)) {
@@ -250,8 +322,7 @@ let NotebookProviderInfoStore = class NotebookProviderInfoStore extends Disposab
250
322
  if (canHandleDiff) {
251
323
  notebookFactoryObject.createDiffEditorInput = notebookDiffEditorInputFactory;
252
324
  notebookCellFactoryObject.createDiffEditorInput = notebookDiffEditorInputFactory;
253
- }
254
- else {
325
+ } else {
255
326
  notebookFactoryObject.createDiffEditorInput = undefined;
256
327
  notebookCellFactoryObject.createDiffEditorInput = undefined;
257
328
  }
@@ -262,14 +333,23 @@ let NotebookProviderInfoStore = class NotebookProviderInfoStore extends Disposab
262
333
  if (canHandleDiff) {
263
334
  notebookFactoryObject.createDiffEditorInput = notebookDiffEditorInputFactory;
264
335
  notebookCellFactoryObject.createDiffEditorInput = notebookDiffEditorInputFactory;
265
- }
266
- else {
336
+ } else {
267
337
  notebookFactoryObject.createDiffEditorInput = undefined;
268
338
  notebookCellFactoryObject.createDiffEditorInput = undefined;
269
339
  }
270
340
  }));
271
- disposables.add(this._editorResolverService.registerEditor(globPattern, notebookEditorInfo, notebookEditorOptions, notebookFactoryObject));
272
- disposables.add(this._editorResolverService.registerEditor(`${Schemas.vscodeNotebookCell}:/**/${globPattern}`, { ...notebookEditorInfo, priority: RegisteredEditorPriority.exclusive }, notebookEditorOptions, notebookCellFactoryObject));
341
+ disposables.add(this._editorResolverService.registerEditor(
342
+ globPattern,
343
+ notebookEditorInfo,
344
+ notebookEditorOptions,
345
+ notebookFactoryObject
346
+ ));
347
+ disposables.add(
348
+ this._editorResolverService.registerEditor(`${Schemas.vscodeNotebookCell}:/**/${globPattern}`, {
349
+ ...notebookEditorInfo,
350
+ priority: RegisteredEditorPriority.exclusive
351
+ }, notebookEditorOptions, notebookCellFactoryObject)
352
+ );
273
353
  }
274
354
  return disposables;
275
355
  }
@@ -319,24 +399,14 @@ let NotebookProviderInfoStore = class NotebookProviderInfoStore extends Disposab
319
399
  return ( this._contributedEditors.values());
320
400
  }
321
401
  };
322
- NotebookProviderInfoStore = NotebookProviderInfoStore_1 = ( __decorate([
323
- ( __param(0, IStorageService)),
324
- ( __param(1, IExtensionService)),
325
- ( __param(2, IEditorResolverService)),
326
- ( __param(3, IConfigurationService)),
327
- ( __param(4, IAccessibilityService)),
328
- ( __param(5, IInstantiationService)),
329
- ( __param(6, IFileService)),
330
- ( __param(7, INotebookEditorModelResolverService)),
331
- ( __param(8, IUriIdentityService))
332
- ], NotebookProviderInfoStore));
402
+ NotebookProviderInfoStore = NotebookProviderInfoStore_1 = ( __decorate([( __param(0, IStorageService)), ( __param(1, IExtensionService)), ( __param(2, IEditorResolverService)), ( __param(3, IConfigurationService)), ( __param(4, IAccessibilityService)), ( __param(5, IInstantiationService)), ( __param(6, IFileService)), ( __param(7, INotebookEditorModelResolverService)), ( __param(8, IUriIdentityService))], NotebookProviderInfoStore));
333
403
  let NotebookOutputRendererInfoStore = class NotebookOutputRendererInfoStore {
334
404
  constructor(storageService) {
335
405
  this.contributedRenderers = ( new Map());
336
406
  this.preferredMimetype = ( new Lazy(
337
407
  () => this.preferredMimetypeMemento.getMemento(StorageScope.WORKSPACE, StorageTarget.MACHINE)
338
408
  ));
339
- this.preferredMimetypeMemento = ( new Memento('workbench.editor.notebook.preferredRenderer2', storageService));
409
+ this.preferredMimetypeMemento = ( new Memento("workbench.editor.notebook.preferredRenderer2", storageService));
340
410
  }
341
411
  clear() {
342
412
  this.contributedRenderers.clear();
@@ -358,15 +428,16 @@ let NotebookOutputRendererInfoStore = class NotebookOutputRendererInfoStore {
358
428
  const forNotebook = mementoObj[notebookProviderInfo.id];
359
429
  if (forNotebook) {
360
430
  forNotebook[mimeType] = rendererId;
361
- }
362
- else {
363
- mementoObj[notebookProviderInfo.id] = { [mimeType]: rendererId };
431
+ } else {
432
+ mementoObj[notebookProviderInfo.id] = {
433
+ [mimeType]: rendererId
434
+ };
364
435
  }
365
436
  this.preferredMimetypeMemento.saveMemento();
366
437
  }
367
438
  findBestRenderers(notebookProviderInfo, mimeType, kernelProvides) {
368
439
  let ReuseOrder;
369
- (function (ReuseOrder) {
440
+ (function(ReuseOrder) {
370
441
  ReuseOrder[ReuseOrder["PreviouslySelected"] = 256] = "PreviouslySelected";
371
442
  ReuseOrder[ReuseOrder["SameExtensionAsNotebook"] = 512] = "SameExtensionAsNotebook";
372
443
  ReuseOrder[ReuseOrder["OtherRenderer"] = 768] = "OtherRenderer";
@@ -375,36 +446,37 @@ let NotebookOutputRendererInfoStore = class NotebookOutputRendererInfoStore {
375
446
  const preferred = notebookProviderInfo && this.preferredMimetype.value[notebookProviderInfo.id]?.[mimeType];
376
447
  const notebookExtId = notebookProviderInfo?.extension?.value;
377
448
  const notebookId = notebookProviderInfo?.id;
378
- const renderers = ( Array.from(( this.contributedRenderers.values()))
379
- .map(renderer => {
380
- const ownScore = kernelProvides === undefined
381
- ? renderer.matchesWithoutKernel(mimeType)
382
- : renderer.matches(mimeType, kernelProvides);
449
+ const renderers = ( Array.from(( this.contributedRenderers.values())).map(renderer => {
450
+ const ownScore = kernelProvides === undefined ? renderer.matchesWithoutKernel(mimeType) : renderer.matches(mimeType, kernelProvides);
383
451
  if (ownScore === NotebookRendererMatch.Never) {
384
452
  return undefined;
385
453
  }
386
454
  const rendererExtId = renderer.extensionId.value;
387
- const reuseScore = preferred === renderer.id
388
- ? ReuseOrder.PreviouslySelected
389
- : rendererExtId === notebookExtId || RENDERER_EQUIVALENT_EXTENSIONS.get(rendererExtId)?.has(notebookId)
390
- ? ReuseOrder.SameExtensionAsNotebook
391
- : renderer.isBuiltin ? ReuseOrder.BuiltIn : ReuseOrder.OtherRenderer;
455
+ const reuseScore = preferred === renderer.id ? ReuseOrder.PreviouslySelected : rendererExtId === notebookExtId || RENDERER_EQUIVALENT_EXTENSIONS.get(rendererExtId)?.has(notebookId) ? ReuseOrder.SameExtensionAsNotebook : renderer.isBuiltin ? ReuseOrder.BuiltIn : ReuseOrder.OtherRenderer;
392
456
  return {
393
- ordered: { mimeType, rendererId: renderer.id, isTrusted: true },
394
- score: reuseScore | ownScore,
457
+ ordered: {
458
+ mimeType,
459
+ rendererId: renderer.id,
460
+ isTrusted: true
461
+ },
462
+ score: reuseScore | ownScore
395
463
  };
396
464
  })).filter(isDefined);
397
465
  if (renderers.length === 0) {
398
- return [{ mimeType, rendererId: RENDERER_NOT_AVAILABLE, isTrusted: true }];
466
+ return [{
467
+ mimeType,
468
+ rendererId: RENDERER_NOT_AVAILABLE,
469
+ isTrusted: true
470
+ }];
399
471
  }
400
472
  return ( renderers.sort((a, b) => a.score - b.score).map(r => r.ordered));
401
473
  }
402
474
  };
403
- NotebookOutputRendererInfoStore = ( __decorate([
404
- ( __param(0, IStorageService))
405
- ], NotebookOutputRendererInfoStore));
475
+ NotebookOutputRendererInfoStore = ( __decorate([( __param(0, IStorageService))], NotebookOutputRendererInfoStore));
406
476
  class ModelData {
407
- get uri() { return this.model.uri; }
477
+ get uri() {
478
+ return this.model.uri;
479
+ }
408
480
  constructor(model, onWillDispose) {
409
481
  this.model = model;
410
482
  this._modelEventListeners = ( new DisposableStore());
@@ -418,15 +490,26 @@ class ModelData {
418
490
  }
419
491
  }
420
492
  let NotebookService = class NotebookService extends Disposable {
421
- static { NotebookService_1 = this; }
422
- static { this._storageNotebookViewTypeProvider = 'notebook.viewTypeProvider'; }
493
+ static {
494
+ NotebookService_1 = this;
495
+ }
496
+ static {
497
+ this._storageNotebookViewTypeProvider = "notebook.viewTypeProvider";
498
+ }
423
499
  get notebookProviderInfoStore() {
424
500
  if (!this._notebookProviderInfoStore) {
425
501
  this._notebookProviderInfoStore = this._register(this._instantiationService.createInstance(NotebookProviderInfoStore));
426
502
  }
427
503
  return this._notebookProviderInfoStore;
428
504
  }
429
- constructor(_extensionService, _configurationService, _accessibilityService, _instantiationService, _storageService, _notebookDocumentService) {
505
+ constructor(
506
+ _extensionService,
507
+ _configurationService,
508
+ _accessibilityService,
509
+ _instantiationService,
510
+ _storageService,
511
+ _notebookDocumentService
512
+ ) {
430
513
  super();
431
514
  this._extensionService = _extensionService;
432
515
  this._configurationService = _configurationService;
@@ -456,7 +539,7 @@ let NotebookService = class NotebookService extends Disposable {
456
539
  this._onDidChangeEditorTypes = this._register(( new Emitter()));
457
540
  this.onDidChangeEditorTypes = this._onDidChangeEditorTypes.event;
458
541
  this._lastClipboardIsCopy = true;
459
- notebookRendererExtensionPoint.setHandler((renderers) => {
542
+ notebookRendererExtensionPoint.setHandler(renderers => {
460
543
  this._notebookRenderersInfoStore.clear();
461
544
  for (const extension of renderers) {
462
545
  for (const notebookContribution of extension.value) {
@@ -477,7 +560,7 @@ let NotebookService = class NotebookService extends Disposable {
477
560
  mimeTypes: notebookContribution.mimeTypes || [],
478
561
  dependencies: notebookContribution.dependencies,
479
562
  optionalDependencies: notebookContribution.optionalDependencies,
480
- requiresMessaging: notebookContribution.requiresMessaging,
563
+ requiresMessaging: notebookContribution.requiresMessaging
481
564
  })));
482
565
  }
483
566
  }
@@ -486,7 +569,7 @@ let NotebookService = class NotebookService extends Disposable {
486
569
  notebookPreloadExtensionPoint.setHandler(extensions => {
487
570
  this._notebookStaticPreloadInfoStore.clear();
488
571
  for (const extension of extensions) {
489
- if (!isProposedApiEnabled(extension.description, 'contribNotebookStaticPreloads')) {
572
+ if (!isProposedApiEnabled(extension.description, "contribNotebookStaticPreloads")) {
490
573
  continue;
491
574
  }
492
575
  for (const notebookContribution of extension.value) {
@@ -503,7 +586,7 @@ let NotebookService = class NotebookService extends Disposable {
503
586
  type,
504
587
  extension: extension.description,
505
588
  entrypoint: notebookContribution.entrypoint,
506
- localResourceRoots: notebookContribution.localResourceRoots ?? [],
589
+ localResourceRoots: notebookContribution.localResourceRoots ?? []
507
590
  })));
508
591
  }
509
592
  }
@@ -511,9 +594,7 @@ let NotebookService = class NotebookService extends Disposable {
511
594
  const updateOrder = () => {
512
595
  this._displayOrder = ( new MimeTypeDisplayOrder(
513
596
  this._configurationService.getValue(NotebookSetting.displayOrder) || [],
514
- this._accessibilityService.isScreenReaderOptimized()
515
- ? ACCESSIBLE_NOTEBOOK_DISPLAY_ORDER
516
- : NOTEBOOK_DISPLAY_ORDER
597
+ this._accessibilityService.isScreenReaderOptimized() ? ACCESSIBLE_NOTEBOOK_DISPLAY_ORDER : NOTEBOOK_DISPLAY_ORDER
517
598
  ));
518
599
  };
519
600
  updateOrder();
@@ -559,7 +640,9 @@ let NotebookService = class NotebookService extends Disposable {
559
640
  priority: data.priority || RegisteredEditorPriority.default,
560
641
  selectors: []
561
642
  }));
562
- info.update({ selectors: data.filenamePattern });
643
+ info.update({
644
+ selectors: data.filenamePattern
645
+ });
563
646
  const reg = this.notebookProviderInfoStore.add(info);
564
647
  this._onDidChangeEditorTypes.fire();
565
648
  return toDisposable(() => {
@@ -579,7 +662,9 @@ let NotebookService = class NotebookService extends Disposable {
579
662
  });
580
663
  }
581
664
  registerNotebookSerializer(viewType, extensionData, serializer) {
582
- this.notebookProviderInfoStore.get(viewType)?.update({ options: serializer.options });
665
+ this.notebookProviderInfoStore.get(viewType)?.update({
666
+ options: serializer.options
667
+ });
583
668
  this._viewTypeCache[viewType] = extensionData.id.value;
584
669
  this._persistMementos();
585
670
  return this._registerProviderData(viewType, ( new SimpleNotebookProviderInfo(viewType, serializer, extensionData)));
@@ -588,13 +673,13 @@ let NotebookService = class NotebookService extends Disposable {
588
673
  const selected = this.notebookProviderInfoStore.get(viewType);
589
674
  if (!selected) {
590
675
  const knownProvider = this.getViewTypeProvider(viewType);
591
- const actions = knownProvider ? [
592
- toAction({
593
- id: 'workbench.notebook.action.installMissingViewType', label: ( localize(9691, "Install extension for '{0}'", viewType)), run: async () => {
594
- await this._instantiationService.createInstance(InstallRecommendedExtensionAction, knownProvider).run();
595
- }
596
- })
597
- ] : [];
676
+ const actions = knownProvider ? [toAction({
677
+ id: "workbench.notebook.action.installMissingViewType",
678
+ label: ( localize(10011, "Install extension for '{0}'", viewType)),
679
+ run: async () => {
680
+ await this._instantiationService.createInstance(InstallRecommendedExtensionAction, knownProvider).run();
681
+ }
682
+ })] : [];
598
683
  throw createErrorWithActions(`UNKNOWN notebook type '${viewType}'`, actions);
599
684
  }
600
685
  await this.canResolve(selected.id);
@@ -646,11 +731,18 @@ let NotebookService = class NotebookService extends Disposable {
646
731
  }
647
732
  const info = await this.withNotebookDataProvider(viewType);
648
733
  if (!(info instanceof SimpleNotebookProviderInfo)) {
649
- throw ( new Error('CANNOT open file notebook with this provider'));
734
+ throw ( new Error("CANNOT open file notebook with this provider"));
650
735
  }
651
736
  const bytes = stream ? await streamToBuffer(stream) : VSBuffer.fromByteArray([]);
652
737
  const data = await info.serializer.dataToNotebook(bytes);
653
- const notebookModel = this._instantiationService.createInstance(NotebookTextModel, info.viewType, uri, data.cells, data.metadata, info.serializer.options);
738
+ const notebookModel = this._instantiationService.createInstance(
739
+ NotebookTextModel,
740
+ info.viewType,
741
+ uri,
742
+ data.cells,
743
+ data.metadata,
744
+ info.serializer.options
745
+ );
654
746
  const modelData = ( new ModelData(notebookModel, this._onWillDisposeDocument.bind(this)));
655
747
  this._models.set(uri, modelData);
656
748
  this._notebookDocumentService.addNotebookDocument(modelData);
@@ -666,13 +758,17 @@ let NotebookService = class NotebookService extends Disposable {
666
758
  }
667
759
  const info = await this.withNotebookDataProvider(model.viewType);
668
760
  if (!(info instanceof SimpleNotebookProviderInfo)) {
669
- throw ( new Error('CANNOT open file notebook with this provider'));
761
+ throw ( new Error("CANNOT open file notebook with this provider"));
670
762
  }
671
763
  const serializer = info.serializer;
672
764
  const outputSizeLimit = this._configurationService.getValue(NotebookSetting.outputBackupSizeLimit) * 1024;
673
- const data = model.createSnapshot({ context: context, outputSizeLimit: outputSizeLimit, transientOptions: serializer.options });
765
+ const data = model.createSnapshot({
766
+ context: context,
767
+ outputSizeLimit: outputSizeLimit,
768
+ transientOptions: serializer.options
769
+ });
674
770
  const indentAmount = model.metadata.indentAmount;
675
- if (typeof indentAmount === 'string' && indentAmount) {
771
+ if (typeof indentAmount === "string" && indentAmount) {
676
772
  data.metadata.indentAmount = indentAmount;
677
773
  }
678
774
  const bytes = await serializer.notebookToData(data);
@@ -688,7 +784,7 @@ let NotebookService = class NotebookService extends Disposable {
688
784
  }
689
785
  const info = await this.withNotebookDataProvider(model.viewType);
690
786
  if (!(info instanceof SimpleNotebookProviderInfo)) {
691
- throw ( new Error('CANNOT open file notebook with this provider'));
787
+ throw ( new Error("CANNOT open file notebook with this provider"));
692
788
  }
693
789
  const serializer = info.serializer;
694
790
  const bytes = await streamToBuffer(snapshot);
@@ -718,9 +814,11 @@ let NotebookService = class NotebookService extends Disposable {
718
814
  getOutputMimeTypeInfo(textModel, kernelProvides, output) {
719
815
  const sorted = this._displayOrder.sort(( new Set(( output.outputs.map(op => op.mime)))));
720
816
  const notebookProviderInfo = this.notebookProviderInfoStore.get(textModel.viewType);
721
- return sorted
722
- .flatMap(mimeType => this._notebookRenderersInfoStore.findBestRenderers(notebookProviderInfo, mimeType, kernelProvides))
723
- .sort((a, b) => (a.rendererId === RENDERER_NOT_AVAILABLE ? 1 : 0) - (b.rendererId === RENDERER_NOT_AVAILABLE ? 1 : 0));
817
+ return sorted.flatMap(
818
+ mimeType => this._notebookRenderersInfoStore.findBestRenderers(notebookProviderInfo, mimeType, kernelProvides)
819
+ ).sort(
820
+ (a, b) => (a.rendererId === RENDERER_NOT_AVAILABLE ? 1 : 0) - (b.rendererId === RENDERER_NOT_AVAILABLE ? 1 : 0)
821
+ );
724
822
  }
725
823
  getContributedNotebookTypes(resource) {
726
824
  if (resource) {
@@ -736,8 +834,9 @@ let NotebookService = class NotebookService extends Disposable {
736
834
  if (!contribution.length) {
737
835
  return false;
738
836
  }
739
- return ( contribution.some(info => info.matches(resource) &&
740
- (info.priority === RegisteredEditorPriority.default || info.priority === RegisteredEditorPriority.exclusive)));
837
+ return ( contribution.some(
838
+ info => info.matches(resource) && (info.priority === RegisteredEditorPriority.default || info.priority === RegisteredEditorPriority.exclusive)
839
+ ));
741
840
  }
742
841
  getContributedNotebookType(viewType) {
743
842
  return this.notebookProviderInfoStore.get(viewType);
@@ -757,18 +856,14 @@ let NotebookService = class NotebookService extends Disposable {
757
856
  }
758
857
  getToCopy() {
759
858
  if (this._cutItems) {
760
- return { items: this._cutItems, isCopy: this._lastClipboardIsCopy };
859
+ return {
860
+ items: this._cutItems,
861
+ isCopy: this._lastClipboardIsCopy
862
+ };
761
863
  }
762
864
  return undefined;
763
865
  }
764
866
  };
765
- NotebookService = NotebookService_1 = ( __decorate([
766
- ( __param(0, IExtensionService)),
767
- ( __param(1, IConfigurationService)),
768
- ( __param(2, IAccessibilityService)),
769
- ( __param(3, IInstantiationService)),
770
- ( __param(4, IStorageService)),
771
- ( __param(5, INotebookDocumentService))
772
- ], NotebookService));
867
+ NotebookService = NotebookService_1 = ( __decorate([( __param(0, IExtensionService)), ( __param(1, IConfigurationService)), ( __param(2, IAccessibilityService)), ( __param(3, IInstantiationService)), ( __param(4, IStorageService)), ( __param(5, INotebookDocumentService))], NotebookService));
773
868
 
774
869
  export { NotebookOutputRendererInfoStore, NotebookProviderInfoStore, NotebookService };