@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,1121 @@
1
+ import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
+ import { Schemas } from 'monaco-editor/esm/vs/base/common/network.js';
3
+ import { Disposable, dispose, DisposableStore } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
4
+ import { parse } from 'monaco-editor/esm/vs/base/common/marshalling.js';
5
+ import { isEqual, extname } from 'monaco-editor/esm/vs/base/common/resources.js';
6
+ import { assertType } from 'monaco-editor/esm/vs/base/common/types.js';
7
+ import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
8
+ import { toFormattedString } from 'vscode/vscode/vs/base/common/jsonFormatter';
9
+ import { IModelService } from 'monaco-editor/esm/vs/editor/common/services/model.js';
10
+ import { ILanguageService } from 'monaco-editor/esm/vs/editor/common/languages/language.js';
11
+ import { ITextModelService } from 'monaco-editor/esm/vs/editor/common/services/resolverService.js';
12
+ import * as nls from 'monaco-editor/esm/vs/nls.js';
13
+ import { Extensions as Extensions$1 } from 'monaco-editor/esm/vs/platform/configuration/common/configurationRegistry.js';
14
+ import { SyncDescriptor } from 'monaco-editor/esm/vs/platform/instantiation/common/descriptors.js';
15
+ import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
16
+ import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js';
17
+ import { EditorPaneDescriptor } from 'vscode/vscode/vs/workbench/browser/editor';
18
+ import { Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
19
+ import { EditorExtensions } from 'vscode/vscode/vs/workbench/common/editor';
20
+ import { NotebookEditor } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookEditor';
21
+ import { NotebookEditorInput } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookEditorInput';
22
+ import { INotebookService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookService';
23
+ import './services/notebookServiceImpl.js';
24
+ import { NotebookSetting, CellUri, CellKind, NotebookWorkingCopyTypeIdentifier } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
25
+ import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
26
+ import { IUndoRedoService } from 'monaco-editor/esm/vs/platform/undoRedo/common/undoRedo.js';
27
+ import { INotebookEditorModelResolverService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookEditorModelResolverService';
28
+ import { NotebookDiffEditorInput } from '../common/notebookDiffEditorInput.js';
29
+ import { NotebookTextDiffEditor } from './diff/notebookDiffEditor.js';
30
+ import './services/notebookWorkerServiceImpl.js';
31
+ import { Event } from 'monaco-editor/esm/vs/base/common/event.js';
32
+ import './services/notebookEditorServiceImpl.js';
33
+ import { Extensions as Extensions$2 } from 'monaco-editor/esm/vs/platform/jsonschemas/common/jsonContributionRegistry.js';
34
+ import { getFormattedMetadataJSON, getStreamOutputData } from './diff/diffElementViewModel.js';
35
+ import './services/notebookKernelServiceImpl.js';
36
+ import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
37
+ import { IWorkingCopyEditorService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyEditorService';
38
+ import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
39
+ import { ILabelService } from 'monaco-editor/esm/vs/platform/label/common/label.js';
40
+ import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
41
+ import './services/notebookRendererMessagingServiceImpl.js';
42
+ import 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/coreActions';
43
+ import 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/insertCellActions';
44
+ import './controller/executeActions.js';
45
+ import './controller/layoutActions.js';
46
+ import 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/editActions';
47
+ import 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/cellOutputActions';
48
+ import './controller/apiActions.js';
49
+ import 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/foldingController';
50
+ import './contrib/editorHint/emptyCellEditorHint.js';
51
+ import './contrib/clipboard/notebookClipboard.js';
52
+ import './contrib/find/notebookFind.js';
53
+ import './contrib/format/formatting.js';
54
+ import './contrib/saveParticipants/saveParticipants.js';
55
+ import './contrib/gettingStarted/notebookGettingStarted.js';
56
+ import './contrib/layout/layoutActions.js';
57
+ import './contrib/marker/markerProvider.js';
58
+ import './contrib/navigation/arrow.js';
59
+ import './contrib/outline/notebookOutline.js';
60
+ import './contrib/profile/notebookProfile.js';
61
+ import './contrib/cellStatusBar/statusBarProviders.js';
62
+ import './contrib/cellStatusBar/contributedStatusBarItemController.js';
63
+ import './contrib/cellStatusBar/executionStatusBarItemController.js';
64
+ import './contrib/editorStatusBar/editorStatusBar.js';
65
+ import './contrib/undoRedo/notebookUndoRedo.js';
66
+ import './contrib/cellCommands/cellCommands.js';
67
+ import './contrib/viewportWarmup/viewportWarmup.js';
68
+ import './contrib/troubleshoot/layout.js';
69
+ import './contrib/debug/notebookBreakpoints.js';
70
+ import './contrib/debug/notebookCellPausing.js';
71
+ import './contrib/debug/notebookDebugDecorations.js';
72
+ import './contrib/execute/executionEditorProgress.js';
73
+ import './contrib/kernelDetection/notebookKernelDetection.js';
74
+ import './diff/notebookDiffActions.js';
75
+ import { editorOptionsRegistry } from 'monaco-editor/esm/vs/editor/common/config/editorOptions.js';
76
+ import './services/notebookExecutionStateServiceImpl.js';
77
+ import './services/notebookExecutionServiceImpl.js';
78
+ import './services/notebookKeymapServiceImpl.js';
79
+ import { PLAINTEXT_LANGUAGE_ID } from 'monaco-editor/esm/vs/editor/common/languages/modesRegistry.js';
80
+ import { ILanguageFeaturesService } from 'monaco-editor/esm/vs/editor/common/services/languageFeatures.js';
81
+ import { COMMENTEDITOR_DECORATION_KEY } from 'vscode/vscode/vs/workbench/contrib/comments/browser/commentReply';
82
+ import { ICodeEditorService } from 'monaco-editor/esm/vs/editor/browser/services/codeEditorService.js';
83
+ import './services/notebookKernelHistoryServiceImpl.js';
84
+ import './services/notebookLoggingServiceImpl.js';
85
+ import product from 'monaco-editor/esm/vs/platform/product/common/product.js';
86
+ import { NOTEBOOK_IS_ACTIVE_EDITOR, NOTEBOOK_OUTPUT_FOCUSED } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookContextKeys';
87
+ import { runAccessibilityHelpAction, showAccessibleOutput } from './notebookAccessibility.js';
88
+ import { IAccessibleViewService } from 'vscode/vscode/vs/workbench/contrib/accessibility/browser/accessibleView';
89
+ import { ContextKeyExpr } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
90
+ import { AccessibilityHelpAction, AccessibleViewAction } from 'vscode/vscode/vs/workbench/contrib/accessibility/browser/accessibleViewActions';
91
+ import { NotebookVariables } from './contrib/notebookVariables/notebookVariables.js';
92
+
93
+ var NotebookContribution_1;
94
+ ( Registry.as(EditorExtensions.EditorPane)).registerEditorPane(EditorPaneDescriptor.create(NotebookEditor, NotebookEditor.ID, 'Notebook Editor'), [
95
+ ( new SyncDescriptor(NotebookEditorInput))
96
+ ]);
97
+ ( Registry.as(EditorExtensions.EditorPane)).registerEditorPane(EditorPaneDescriptor.create(NotebookTextDiffEditor, NotebookTextDiffEditor.ID, 'Notebook Diff Editor'), [
98
+ ( new SyncDescriptor(NotebookDiffEditorInput))
99
+ ]);
100
+ class NotebookDiffEditorSerializer {
101
+ canSerialize() {
102
+ return true;
103
+ }
104
+ serialize(input) {
105
+ assertType(input instanceof NotebookDiffEditorInput);
106
+ return JSON.stringify({
107
+ resource: input.resource,
108
+ originalResource: input.original.resource,
109
+ name: input.getName(),
110
+ originalName: input.original.getName(),
111
+ textDiffName: input.getName(),
112
+ viewType: input.viewType,
113
+ });
114
+ }
115
+ deserialize(instantiationService, raw) {
116
+ const data = parse(raw);
117
+ if (!data) {
118
+ return undefined;
119
+ }
120
+ const { resource, originalResource, name, viewType } = data;
121
+ if (!data || !URI.isUri(resource) || !URI.isUri(originalResource) || typeof name !== 'string' || typeof viewType !== 'string') {
122
+ return undefined;
123
+ }
124
+ const input = NotebookDiffEditorInput.create(instantiationService, resource, name, undefined, originalResource, viewType);
125
+ return input;
126
+ }
127
+ static canResolveBackup(editorInput, backupResource) {
128
+ return false;
129
+ }
130
+ }
131
+ class NotebookEditorSerializer {
132
+ canSerialize() {
133
+ return true;
134
+ }
135
+ serialize(input) {
136
+ assertType(input instanceof NotebookEditorInput);
137
+ const data = {
138
+ resource: input.resource,
139
+ preferredResource: input.preferredResource,
140
+ viewType: input.viewType,
141
+ options: input.options
142
+ };
143
+ return JSON.stringify(data);
144
+ }
145
+ deserialize(instantiationService, raw) {
146
+ const data = parse(raw);
147
+ if (!data) {
148
+ return undefined;
149
+ }
150
+ const { resource, preferredResource, viewType, options } = data;
151
+ if (!data || !URI.isUri(resource) || typeof viewType !== 'string') {
152
+ return undefined;
153
+ }
154
+ const input = NotebookEditorInput.getOrCreate(instantiationService, resource, preferredResource, viewType, options);
155
+ return input;
156
+ }
157
+ }
158
+ ( Registry.as(EditorExtensions.EditorFactory)).registerEditorSerializer(NotebookEditorInput.ID, NotebookEditorSerializer);
159
+ ( Registry.as(EditorExtensions.EditorFactory)).registerEditorSerializer(NotebookDiffEditorInput.ID, NotebookDiffEditorSerializer);
160
+ let NotebookContribution = NotebookContribution_1 = class NotebookContribution extends Disposable {
161
+ constructor(undoRedoService, configurationService, codeEditorService) {
162
+ super();
163
+ this.codeEditorService = codeEditorService;
164
+ this.updateCellUndoRedoComparisonKey(configurationService, undoRedoService);
165
+ this._register(configurationService.onDidChangeConfiguration(e => {
166
+ if (e.affectsConfiguration(NotebookSetting.undoRedoPerCell)) {
167
+ this.updateCellUndoRedoComparisonKey(configurationService, undoRedoService);
168
+ }
169
+ }));
170
+ this.codeEditorService.registerDecorationType('comment-controller', COMMENTEDITOR_DECORATION_KEY, {});
171
+ }
172
+ updateCellUndoRedoComparisonKey(configurationService, undoRedoService) {
173
+ const undoRedoPerCell = configurationService.getValue(NotebookSetting.undoRedoPerCell);
174
+ if (!undoRedoPerCell) {
175
+ if (!this._uriComparisonKeyComputer) {
176
+ this._uriComparisonKeyComputer = undoRedoService.registerUriComparisonKeyComputer(CellUri.scheme, {
177
+ getComparisonKey: (uri) => {
178
+ if (undoRedoPerCell) {
179
+ return ( uri.toString());
180
+ }
181
+ return NotebookContribution_1._getCellUndoRedoComparisonKey(uri);
182
+ }
183
+ });
184
+ }
185
+ }
186
+ else {
187
+ this._uriComparisonKeyComputer?.dispose();
188
+ this._uriComparisonKeyComputer = undefined;
189
+ }
190
+ }
191
+ static _getCellUndoRedoComparisonKey(uri) {
192
+ const data = CellUri.parse(uri);
193
+ if (!data) {
194
+ return ( uri.toString());
195
+ }
196
+ return ( data.notebook.toString());
197
+ }
198
+ dispose() {
199
+ super.dispose();
200
+ this._uriComparisonKeyComputer?.dispose();
201
+ }
202
+ };
203
+ NotebookContribution = NotebookContribution_1 = ( __decorate([
204
+ ( __param(0, IUndoRedoService)),
205
+ ( __param(1, IConfigurationService)),
206
+ ( __param(2, ICodeEditorService))
207
+ ], NotebookContribution));
208
+ let CellContentProvider = class CellContentProvider {
209
+ constructor(textModelService, _modelService, _languageService, _notebookModelResolverService) {
210
+ this._modelService = _modelService;
211
+ this._languageService = _languageService;
212
+ this._notebookModelResolverService = _notebookModelResolverService;
213
+ this._registration = textModelService.registerTextModelContentProvider(CellUri.scheme, this);
214
+ }
215
+ dispose() {
216
+ this._registration.dispose();
217
+ }
218
+ async provideTextContent(resource) {
219
+ const existing = this._modelService.getModel(resource);
220
+ if (existing) {
221
+ return existing;
222
+ }
223
+ const data = CellUri.parse(resource);
224
+ if (!data) {
225
+ return null;
226
+ }
227
+ const ref = await this._notebookModelResolverService.resolve(data.notebook);
228
+ let result = null;
229
+ if (!ref.object.isResolved()) {
230
+ return null;
231
+ }
232
+ for (const cell of ref.object.notebook.cells) {
233
+ if (( cell.uri.toString()) === ( resource.toString())) {
234
+ const bufferFactory = {
235
+ create: (defaultEOL) => {
236
+ const newEOL = (defaultEOL === 2 ? '\r\n' : '\n');
237
+ cell.textBuffer.setEOL(newEOL);
238
+ return { textBuffer: cell.textBuffer, disposable: Disposable.None };
239
+ },
240
+ getFirstLineText: (limit) => {
241
+ return cell.textBuffer.getLineContent(1).substring(0, limit);
242
+ }
243
+ };
244
+ const languageId = this._languageService.getLanguageIdByLanguageName(cell.language);
245
+ const languageSelection = languageId ? this._languageService.createById(languageId) : (cell.cellKind === CellKind.Markup ? this._languageService.createById('markdown') : this._languageService.createByFilepathOrFirstLine(resource, cell.textBuffer.getLineContent(1)));
246
+ result = this._modelService.createModel(bufferFactory, languageSelection, resource);
247
+ break;
248
+ }
249
+ }
250
+ if (!result) {
251
+ ref.dispose();
252
+ return null;
253
+ }
254
+ const once = Event.any(result.onWillDispose, ref.object.notebook.onWillDispose)(() => {
255
+ once.dispose();
256
+ ref.dispose();
257
+ });
258
+ return result;
259
+ }
260
+ };
261
+ CellContentProvider = ( __decorate([
262
+ ( __param(0, ITextModelService)),
263
+ ( __param(1, IModelService)),
264
+ ( __param(2, ILanguageService)),
265
+ ( __param(3, INotebookEditorModelResolverService))
266
+ ], CellContentProvider));
267
+ let CellInfoContentProvider = class CellInfoContentProvider {
268
+ constructor(textModelService, _modelService, _languageService, _labelService, _notebookModelResolverService) {
269
+ this._modelService = _modelService;
270
+ this._languageService = _languageService;
271
+ this._labelService = _labelService;
272
+ this._notebookModelResolverService = _notebookModelResolverService;
273
+ this._disposables = [];
274
+ this._disposables.push(textModelService.registerTextModelContentProvider(Schemas.vscodeNotebookCellMetadata, {
275
+ provideTextContent: this.provideMetadataTextContent.bind(this)
276
+ }));
277
+ this._disposables.push(textModelService.registerTextModelContentProvider(Schemas.vscodeNotebookCellOutput, {
278
+ provideTextContent: this.provideOutputTextContent.bind(this)
279
+ }));
280
+ this._disposables.push(this._labelService.registerFormatter({
281
+ scheme: Schemas.vscodeNotebookCellMetadata,
282
+ formatting: {
283
+ label: '${path} (metadata)',
284
+ separator: '/'
285
+ }
286
+ }));
287
+ this._disposables.push(this._labelService.registerFormatter({
288
+ scheme: Schemas.vscodeNotebookCellOutput,
289
+ formatting: {
290
+ label: '${path} (output)',
291
+ separator: '/'
292
+ }
293
+ }));
294
+ }
295
+ dispose() {
296
+ dispose(this._disposables);
297
+ }
298
+ async provideMetadataTextContent(resource) {
299
+ const existing = this._modelService.getModel(resource);
300
+ if (existing) {
301
+ return existing;
302
+ }
303
+ const data = CellUri.parseCellPropertyUri(resource, Schemas.vscodeNotebookCellMetadata);
304
+ if (!data) {
305
+ return null;
306
+ }
307
+ const ref = await this._notebookModelResolverService.resolve(data.notebook);
308
+ let result = null;
309
+ const mode = this._languageService.createById('json');
310
+ for (const cell of ref.object.notebook.cells) {
311
+ if (cell.handle === data.handle) {
312
+ const metadataSource = getFormattedMetadataJSON(ref.object.notebook, cell.metadata, cell.language);
313
+ result = this._modelService.createModel(metadataSource, mode, resource);
314
+ break;
315
+ }
316
+ }
317
+ if (!result) {
318
+ ref.dispose();
319
+ return null;
320
+ }
321
+ const once = result.onWillDispose(() => {
322
+ once.dispose();
323
+ ref.dispose();
324
+ });
325
+ return result;
326
+ }
327
+ parseStreamOutput(op) {
328
+ if (!op) {
329
+ return;
330
+ }
331
+ const streamOutputData = getStreamOutputData(op.outputs);
332
+ if (streamOutputData) {
333
+ return {
334
+ content: streamOutputData,
335
+ mode: this._languageService.createById(PLAINTEXT_LANGUAGE_ID)
336
+ };
337
+ }
338
+ return;
339
+ }
340
+ _getResult(data, cell) {
341
+ let result = undefined;
342
+ const mode = this._languageService.createById('json');
343
+ const op = cell.outputs.find(op => op.outputId === data.outputId || op.alternativeOutputId === data.outputId);
344
+ const streamOutputData = this.parseStreamOutput(op);
345
+ if (streamOutputData) {
346
+ result = streamOutputData;
347
+ return result;
348
+ }
349
+ const obj = ( cell.outputs.map(output => ({
350
+ metadata: output.metadata,
351
+ outputItems: ( output.outputs.map(opit => ({
352
+ mimeType: opit.mime,
353
+ data: ( opit.data.toString())
354
+ })))
355
+ })));
356
+ const outputSource = toFormattedString(obj, {});
357
+ result = {
358
+ content: outputSource,
359
+ mode
360
+ };
361
+ return result;
362
+ }
363
+ async provideOutputTextContent(resource) {
364
+ const existing = this._modelService.getModel(resource);
365
+ if (existing) {
366
+ return existing;
367
+ }
368
+ const data = CellUri.parseCellOutputUri(resource);
369
+ if (!data) {
370
+ return null;
371
+ }
372
+ const ref = await this._notebookModelResolverService.resolve(data.notebook);
373
+ const cell = ref.object.notebook.cells.find(cell => !!cell.outputs.find(op => op.outputId === data.outputId || op.alternativeOutputId === data.outputId));
374
+ if (!cell) {
375
+ ref.dispose();
376
+ return null;
377
+ }
378
+ const result = this._getResult(data, cell);
379
+ if (!result) {
380
+ ref.dispose();
381
+ return null;
382
+ }
383
+ const model = this._modelService.createModel(result.content, result.mode, resource);
384
+ const cellModelListener = Event.any(cell.onDidChangeOutputs ?? Event.None, cell.onDidChangeOutputItems ?? Event.None)(() => {
385
+ const newResult = this._getResult(data, cell);
386
+ if (!newResult) {
387
+ return;
388
+ }
389
+ model.setValue(newResult.content);
390
+ model.setLanguage(newResult.mode.languageId);
391
+ });
392
+ const once = model.onWillDispose(() => {
393
+ once.dispose();
394
+ cellModelListener.dispose();
395
+ ref.dispose();
396
+ });
397
+ return model;
398
+ }
399
+ };
400
+ CellInfoContentProvider = ( __decorate([
401
+ ( __param(0, ITextModelService)),
402
+ ( __param(1, IModelService)),
403
+ ( __param(2, ILanguageService)),
404
+ ( __param(3, ILabelService)),
405
+ ( __param(4, INotebookEditorModelResolverService))
406
+ ], CellInfoContentProvider));
407
+ class RegisterSchemasContribution extends Disposable {
408
+ constructor() {
409
+ super();
410
+ this.registerMetadataSchemas();
411
+ }
412
+ registerMetadataSchemas() {
413
+ const jsonRegistry = ( Registry.as(Extensions$2.JSONContribution));
414
+ const metadataSchema = {
415
+ properties: {
416
+ ['language']: {
417
+ type: 'string',
418
+ description: 'The language for the cell'
419
+ }
420
+ },
421
+ additionalProperties: true,
422
+ allowTrailingCommas: true,
423
+ allowComments: true
424
+ };
425
+ jsonRegistry.registerSchema('vscode://schemas/notebook/cellmetadata', metadataSchema);
426
+ }
427
+ }
428
+ let NotebookEditorManager = class NotebookEditorManager {
429
+ constructor(_editorService, _notebookEditorModelService, editorGroups) {
430
+ this._editorService = _editorService;
431
+ this._notebookEditorModelService = _notebookEditorModelService;
432
+ this._disposables = ( new DisposableStore());
433
+ this._disposables.add(Event.debounce(this._notebookEditorModelService.onDidChangeDirty, (last, current) => !last ? [current] : [...last, current], 100)(this._openMissingDirtyNotebookEditors, this));
434
+ this._disposables.add(_notebookEditorModelService.onWillFailWithConflict(e => {
435
+ for (const group of editorGroups.groups) {
436
+ const conflictInputs = group.editors.filter(input => input instanceof NotebookEditorInput && input.viewType !== e.viewType && isEqual(input.resource, e.resource));
437
+ const p = group.closeEditors(conflictInputs);
438
+ e.waitUntil(p);
439
+ }
440
+ }));
441
+ }
442
+ dispose() {
443
+ this._disposables.dispose();
444
+ }
445
+ _openMissingDirtyNotebookEditors(models) {
446
+ const result = [];
447
+ for (const model of models) {
448
+ if (model.isDirty() && !this._editorService.isOpened({ resource: model.resource, typeId: NotebookEditorInput.ID, editorId: model.viewType }) && extname(model.resource) !== '.interactive') {
449
+ result.push({
450
+ resource: model.resource,
451
+ options: { inactive: true, preserveFocus: true, pinned: true, override: model.viewType }
452
+ });
453
+ }
454
+ }
455
+ if (result.length > 0) {
456
+ this._editorService.openEditors(result);
457
+ }
458
+ }
459
+ };
460
+ NotebookEditorManager = ( __decorate([
461
+ ( __param(0, IEditorService)),
462
+ ( __param(1, INotebookEditorModelResolverService)),
463
+ ( __param(2, IEditorGroupsService))
464
+ ], NotebookEditorManager));
465
+ let SimpleNotebookWorkingCopyEditorHandler = class SimpleNotebookWorkingCopyEditorHandler extends Disposable {
466
+ constructor(_instantiationService, _workingCopyEditorService, _extensionService, _notebookService) {
467
+ super();
468
+ this._instantiationService = _instantiationService;
469
+ this._workingCopyEditorService = _workingCopyEditorService;
470
+ this._extensionService = _extensionService;
471
+ this._notebookService = _notebookService;
472
+ this._installHandler();
473
+ }
474
+ async handles(workingCopy) {
475
+ const viewType = this.handlesSync(workingCopy);
476
+ if (!viewType) {
477
+ return false;
478
+ }
479
+ return this._notebookService.canResolve(viewType);
480
+ }
481
+ handlesSync(workingCopy) {
482
+ const viewType = this._getViewType(workingCopy);
483
+ if (!viewType || viewType === 'interactive') {
484
+ return undefined;
485
+ }
486
+ return viewType;
487
+ }
488
+ isOpen(workingCopy, editor) {
489
+ if (!this.handlesSync(workingCopy)) {
490
+ return false;
491
+ }
492
+ return editor instanceof NotebookEditorInput && editor.viewType === this._getViewType(workingCopy) && isEqual(workingCopy.resource, editor.resource);
493
+ }
494
+ createEditor(workingCopy) {
495
+ return NotebookEditorInput.getOrCreate(this._instantiationService, workingCopy.resource, undefined, this._getViewType(workingCopy));
496
+ }
497
+ async _installHandler() {
498
+ await this._extensionService.whenInstalledExtensionsRegistered();
499
+ this._register(this._workingCopyEditorService.registerHandler(this));
500
+ }
501
+ _getViewType(workingCopy) {
502
+ return NotebookWorkingCopyTypeIdentifier.parse(workingCopy.typeId);
503
+ }
504
+ };
505
+ SimpleNotebookWorkingCopyEditorHandler = ( __decorate([
506
+ ( __param(0, IInstantiationService)),
507
+ ( __param(1, IWorkingCopyEditorService)),
508
+ ( __param(2, IExtensionService)),
509
+ ( __param(3, INotebookService))
510
+ ], SimpleNotebookWorkingCopyEditorHandler));
511
+ let NotebookLanguageSelectorScoreRefine = class NotebookLanguageSelectorScoreRefine {
512
+ constructor(_notebookService, languageFeaturesService) {
513
+ this._notebookService = _notebookService;
514
+ languageFeaturesService.setNotebookTypeResolver(this._getNotebookInfo.bind(this));
515
+ }
516
+ _getNotebookInfo(uri) {
517
+ const cellUri = CellUri.parse(uri);
518
+ if (!cellUri) {
519
+ return undefined;
520
+ }
521
+ const notebook = this._notebookService.getNotebookTextModel(cellUri.notebook);
522
+ if (!notebook) {
523
+ return undefined;
524
+ }
525
+ return {
526
+ uri: notebook.uri,
527
+ type: notebook.viewType
528
+ };
529
+ }
530
+ };
531
+ NotebookLanguageSelectorScoreRefine = ( __decorate([
532
+ ( __param(0, INotebookService)),
533
+ ( __param(1, ILanguageFeaturesService))
534
+ ], NotebookLanguageSelectorScoreRefine));
535
+ class NotebookAccessibilityHelpContribution extends Disposable {
536
+ constructor() {
537
+ super();
538
+ this._register(AccessibilityHelpAction.addImplementation(105, 'notebook', async (accessor) => {
539
+ const codeEditor = accessor.get(ICodeEditorService).getActiveCodeEditor() || accessor.get(ICodeEditorService).getFocusedCodeEditor();
540
+ if (!codeEditor) {
541
+ return;
542
+ }
543
+ runAccessibilityHelpAction(accessor, codeEditor);
544
+ }, NOTEBOOK_IS_ACTIVE_EDITOR));
545
+ }
546
+ }
547
+ class NotebookAccessibleViewContribution extends Disposable {
548
+ constructor() {
549
+ super();
550
+ this._register(AccessibleViewAction.addImplementation(100, 'notebook', accessor => {
551
+ const accessibleViewService = accessor.get(IAccessibleViewService);
552
+ const editorService = accessor.get(IEditorService);
553
+ return showAccessibleOutput(accessibleViewService, editorService);
554
+ }, ( ContextKeyExpr.and(NOTEBOOK_OUTPUT_FOCUSED, ( ContextKeyExpr.equals('resourceExtname', '.ipynb'))))));
555
+ }
556
+ }
557
+ const workbenchContributionsRegistry = ( Registry.as(Extensions.Workbench));
558
+ workbenchContributionsRegistry.registerWorkbenchContribution(NotebookContribution, 1 );
559
+ workbenchContributionsRegistry.registerWorkbenchContribution(CellContentProvider, 1 );
560
+ workbenchContributionsRegistry.registerWorkbenchContribution(CellInfoContentProvider, 1 );
561
+ workbenchContributionsRegistry.registerWorkbenchContribution(RegisterSchemasContribution, 1 );
562
+ workbenchContributionsRegistry.registerWorkbenchContribution(NotebookEditorManager, 2 );
563
+ workbenchContributionsRegistry.registerWorkbenchContribution(NotebookLanguageSelectorScoreRefine, 2 );
564
+ workbenchContributionsRegistry.registerWorkbenchContribution(SimpleNotebookWorkingCopyEditorHandler, 2 );
565
+ workbenchContributionsRegistry.registerWorkbenchContribution(NotebookAccessibilityHelpContribution, 4 );
566
+ workbenchContributionsRegistry.registerWorkbenchContribution(NotebookAccessibleViewContribution, 4 );
567
+ workbenchContributionsRegistry.registerWorkbenchContribution(NotebookVariables, 4 );
568
+ const schemas = {};
569
+ function isConfigurationPropertySchema(x) {
570
+ return (typeof x.type !== 'undefined' || typeof x.anyOf !== 'undefined');
571
+ }
572
+ for (const editorOption of editorOptionsRegistry) {
573
+ const schema = editorOption.schema;
574
+ if (schema) {
575
+ if (isConfigurationPropertySchema(schema)) {
576
+ schemas[`editor.${editorOption.name}`] = schema;
577
+ }
578
+ else {
579
+ for (const key in schema) {
580
+ if (Object.hasOwnProperty.call(schema, key)) {
581
+ schemas[key] = schema[key];
582
+ }
583
+ }
584
+ }
585
+ }
586
+ }
587
+ const editorOptionsCustomizationSchema = {
588
+ description: ( nls.localizeWithPath(
589
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
590
+ 'notebook.editorOptions.experimentalCustomization',
591
+ 'Settings for code editors used in notebooks. This can be used to customize most editor.* settings.'
592
+ )),
593
+ default: {},
594
+ allOf: [
595
+ {
596
+ properties: schemas,
597
+ }
598
+ ],
599
+ tags: ['notebookLayout']
600
+ };
601
+ const configurationRegistry = ( Registry.as(Extensions$1.Configuration));
602
+ configurationRegistry.registerConfiguration({
603
+ id: 'notebook',
604
+ order: 100,
605
+ title: ( nls.localizeWithPath(
606
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
607
+ 'notebookConfigurationTitle',
608
+ "Notebook"
609
+ )),
610
+ type: 'object',
611
+ properties: {
612
+ [NotebookSetting.displayOrder]: {
613
+ description: ( nls.localizeWithPath(
614
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
615
+ 'notebook.displayOrder.description',
616
+ "Priority list for output mime types"
617
+ )),
618
+ type: 'array',
619
+ items: {
620
+ type: 'string'
621
+ },
622
+ default: []
623
+ },
624
+ [NotebookSetting.cellToolbarLocation]: {
625
+ description: ( nls.localizeWithPath(
626
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
627
+ 'notebook.cellToolbarLocation.description',
628
+ "Where the cell toolbar should be shown, or whether it should be hidden."
629
+ )),
630
+ type: 'object',
631
+ additionalProperties: {
632
+ markdownDescription: ( nls.localizeWithPath(
633
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
634
+ 'notebook.cellToolbarLocation.viewType',
635
+ "Configure the cell toolbar position for for specific file types"
636
+ )),
637
+ type: 'string',
638
+ enum: ['left', 'right', 'hidden']
639
+ },
640
+ default: {
641
+ 'default': 'right'
642
+ },
643
+ tags: ['notebookLayout']
644
+ },
645
+ [NotebookSetting.showCellStatusBar]: {
646
+ description: ( nls.localizeWithPath(
647
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
648
+ 'notebook.showCellStatusbar.description',
649
+ "Whether the cell status bar should be shown."
650
+ )),
651
+ type: 'string',
652
+ enum: ['hidden', 'visible', 'visibleAfterExecute'],
653
+ enumDescriptions: [
654
+ ( nls.localizeWithPath(
655
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
656
+ 'notebook.showCellStatusbar.hidden.description',
657
+ "The cell Status bar is always hidden."
658
+ )),
659
+ ( nls.localizeWithPath(
660
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
661
+ 'notebook.showCellStatusbar.visible.description',
662
+ "The cell Status bar is always visible."
663
+ )),
664
+ ( nls.localizeWithPath(
665
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
666
+ 'notebook.showCellStatusbar.visibleAfterExecute.description',
667
+ "The cell Status bar is hidden until the cell has executed. Then it becomes visible to show the execution status."
668
+ ))
669
+ ],
670
+ default: 'visible',
671
+ tags: ['notebookLayout']
672
+ },
673
+ [NotebookSetting.textDiffEditorPreview]: {
674
+ description: ( nls.localizeWithPath(
675
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
676
+ 'notebook.diff.enablePreview.description',
677
+ "Whether to use the enhanced text diff editor for notebook."
678
+ )),
679
+ type: 'boolean',
680
+ default: true,
681
+ tags: ['notebookLayout']
682
+ },
683
+ [NotebookSetting.diffOverviewRuler]: {
684
+ description: ( nls.localizeWithPath(
685
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
686
+ 'notebook.diff.enableOverviewRuler.description',
687
+ "Whether to render the overview ruler in the diff editor for notebook."
688
+ )),
689
+ type: 'boolean',
690
+ default: false,
691
+ tags: ['notebookLayout']
692
+ },
693
+ [NotebookSetting.cellToolbarVisibility]: {
694
+ markdownDescription: ( nls.localizeWithPath(
695
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
696
+ 'notebook.cellToolbarVisibility.description',
697
+ "Whether the cell toolbar should appear on hover or click."
698
+ )),
699
+ type: 'string',
700
+ enum: ['hover', 'click'],
701
+ default: 'click',
702
+ tags: ['notebookLayout']
703
+ },
704
+ [NotebookSetting.undoRedoPerCell]: {
705
+ description: ( nls.localizeWithPath(
706
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
707
+ 'notebook.undoRedoPerCell.description',
708
+ "Whether to use separate undo/redo stack for each cell."
709
+ )),
710
+ type: 'boolean',
711
+ default: true,
712
+ tags: ['notebookLayout']
713
+ },
714
+ [NotebookSetting.compactView]: {
715
+ description: ( nls.localizeWithPath(
716
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
717
+ 'notebook.compactView.description',
718
+ "Control whether the notebook editor should be rendered in a compact form. For example, when turned on, it will decrease the left margin width."
719
+ )),
720
+ type: 'boolean',
721
+ default: true,
722
+ tags: ['notebookLayout']
723
+ },
724
+ [NotebookSetting.focusIndicator]: {
725
+ description: ( nls.localizeWithPath(
726
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
727
+ 'notebook.focusIndicator.description',
728
+ "Controls where the focus indicator is rendered, either along the cell borders or on the left gutter."
729
+ )),
730
+ type: 'string',
731
+ enum: ['border', 'gutter'],
732
+ default: 'gutter',
733
+ tags: ['notebookLayout']
734
+ },
735
+ [NotebookSetting.insertToolbarLocation]: {
736
+ description: ( nls.localizeWithPath(
737
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
738
+ 'notebook.insertToolbarPosition.description',
739
+ "Control where the insert cell actions should appear."
740
+ )),
741
+ type: 'string',
742
+ enum: ['betweenCells', 'notebookToolbar', 'both', 'hidden'],
743
+ enumDescriptions: [
744
+ ( nls.localizeWithPath(
745
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
746
+ 'insertToolbarLocation.betweenCells',
747
+ "A toolbar that appears on hover between cells."
748
+ )),
749
+ ( nls.localizeWithPath(
750
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
751
+ 'insertToolbarLocation.notebookToolbar',
752
+ "The toolbar at the top of the notebook editor."
753
+ )),
754
+ ( nls.localizeWithPath(
755
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
756
+ 'insertToolbarLocation.both',
757
+ "Both toolbars."
758
+ )),
759
+ ( nls.localizeWithPath(
760
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
761
+ 'insertToolbarLocation.hidden',
762
+ "The insert actions don't appear anywhere."
763
+ )),
764
+ ],
765
+ default: 'both',
766
+ tags: ['notebookLayout']
767
+ },
768
+ [NotebookSetting.globalToolbar]: {
769
+ description: ( nls.localizeWithPath(
770
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
771
+ 'notebook.globalToolbar.description',
772
+ "Control whether to render a global toolbar inside the notebook editor."
773
+ )),
774
+ type: 'boolean',
775
+ default: true,
776
+ tags: ['notebookLayout']
777
+ },
778
+ [NotebookSetting.stickyScroll]: {
779
+ description: ( nls.localizeWithPath(
780
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
781
+ 'notebook.stickyScroll.description',
782
+ "Experimental. Control whether to render notebook Sticky Scroll headers in the notebook editor."
783
+ )),
784
+ type: 'boolean',
785
+ default: false,
786
+ tags: ['notebookLayout']
787
+ },
788
+ [NotebookSetting.consolidatedOutputButton]: {
789
+ description: ( nls.localizeWithPath(
790
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
791
+ 'notebook.consolidatedOutputButton.description',
792
+ "Control whether outputs action should be rendered in the output toolbar."
793
+ )),
794
+ type: 'boolean',
795
+ default: true,
796
+ tags: ['notebookLayout']
797
+ },
798
+ [NotebookSetting.showFoldingControls]: {
799
+ description: ( nls.localizeWithPath(
800
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
801
+ 'notebook.showFoldingControls.description',
802
+ "Controls when the Markdown header folding arrow is shown."
803
+ )),
804
+ type: 'string',
805
+ enum: ['always', 'never', 'mouseover'],
806
+ enumDescriptions: [
807
+ ( nls.localizeWithPath(
808
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
809
+ 'showFoldingControls.always',
810
+ "The folding controls are always visible."
811
+ )),
812
+ ( nls.localizeWithPath(
813
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
814
+ 'showFoldingControls.never',
815
+ "Never show the folding controls and reduce the gutter size."
816
+ )),
817
+ ( nls.localizeWithPath(
818
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
819
+ 'showFoldingControls.mouseover',
820
+ "The folding controls are visible only on mouseover."
821
+ )),
822
+ ],
823
+ default: 'mouseover',
824
+ tags: ['notebookLayout']
825
+ },
826
+ [NotebookSetting.dragAndDropEnabled]: {
827
+ description: ( nls.localizeWithPath(
828
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
829
+ 'notebook.dragAndDrop.description',
830
+ "Control whether the notebook editor should allow moving cells through drag and drop."
831
+ )),
832
+ type: 'boolean',
833
+ default: true,
834
+ tags: ['notebookLayout']
835
+ },
836
+ [NotebookSetting.consolidatedRunButton]: {
837
+ description: ( nls.localizeWithPath(
838
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
839
+ 'notebook.consolidatedRunButton.description',
840
+ "Control whether extra actions are shown in a dropdown next to the run button."
841
+ )),
842
+ type: 'boolean',
843
+ default: false,
844
+ tags: ['notebookLayout']
845
+ },
846
+ [NotebookSetting.globalToolbarShowLabel]: {
847
+ description: ( nls.localizeWithPath(
848
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
849
+ 'notebook.globalToolbarShowLabel',
850
+ "Control whether the actions on the notebook toolbar should render label or not."
851
+ )),
852
+ type: 'string',
853
+ enum: ['always', 'never', 'dynamic'],
854
+ default: 'always',
855
+ tags: ['notebookLayout']
856
+ },
857
+ [NotebookSetting.textOutputLineLimit]: {
858
+ markdownDescription: ( nls.localizeWithPath(
859
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
860
+ 'notebook.textOutputLineLimit',
861
+ "Controls how many lines of text are displayed in a text output. If {0} is enabled, this setting is used to determine the scroll height of the output.",
862
+ '`#notebook.output.scrolling#`'
863
+ )),
864
+ type: 'number',
865
+ default: 30,
866
+ tags: ['notebookLayout', 'notebookOutputLayout']
867
+ },
868
+ [NotebookSetting.markupFontSize]: {
869
+ markdownDescription: ( nls.localizeWithPath(
870
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
871
+ 'notebook.markup.fontSize',
872
+ "Controls the font size in pixels of rendered markup in notebooks. When set to {0}, 120% of {1} is used.",
873
+ '`0`',
874
+ '`#editor.fontSize#`'
875
+ )),
876
+ type: 'number',
877
+ default: 0,
878
+ tags: ['notebookLayout']
879
+ },
880
+ [NotebookSetting.cellEditorOptionsCustomizations]: editorOptionsCustomizationSchema,
881
+ [NotebookSetting.interactiveWindowCollapseCodeCells]: {
882
+ markdownDescription: ( nls.localizeWithPath(
883
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
884
+ 'notebook.interactiveWindow.collapseCodeCells',
885
+ "Controls whether code cells in the interactive window are collapsed by default."
886
+ )),
887
+ type: 'string',
888
+ enum: ['always', 'never', 'fromEditor'],
889
+ default: 'fromEditor'
890
+ },
891
+ [NotebookSetting.outputLineHeight]: {
892
+ markdownDescription: ( nls.localizeWithPath(
893
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
894
+ 'notebook.outputLineHeight',
895
+ "Line height of the output text within notebook cells.\n - When set to 0, editor line height is used.\n - Values between 0 and 8 will be used as a multiplier with the font size.\n - Values greater than or equal to 8 will be used as effective values."
896
+ )),
897
+ type: 'number',
898
+ default: 0,
899
+ tags: ['notebookLayout', 'notebookOutputLayout']
900
+ },
901
+ [NotebookSetting.outputFontSize]: {
902
+ markdownDescription: ( nls.localizeWithPath(
903
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
904
+ 'notebook.outputFontSize',
905
+ "Font size for the output text within notebook cells. When set to 0, {0} is used.",
906
+ '`#editor.fontSize#`'
907
+ )),
908
+ type: 'number',
909
+ default: 0,
910
+ tags: ['notebookLayout', 'notebookOutputLayout']
911
+ },
912
+ [NotebookSetting.outputFontFamily]: {
913
+ markdownDescription: ( nls.localizeWithPath(
914
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
915
+ 'notebook.outputFontFamily',
916
+ "The font family of the output text within notebook cells. When set to empty, the {0} is used.",
917
+ '`#editor.fontFamily#`'
918
+ )),
919
+ type: 'string',
920
+ tags: ['notebookLayout', 'notebookOutputLayout']
921
+ },
922
+ [NotebookSetting.outputScrolling]: {
923
+ markdownDescription: ( nls.localizeWithPath(
924
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
925
+ 'notebook.outputScrolling',
926
+ "Initially render notebook outputs in a scrollable region when longer than the limit."
927
+ )),
928
+ type: 'boolean',
929
+ tags: ['notebookLayout', 'notebookOutputLayout'],
930
+ default: typeof product.quality === 'string' && product.quality !== 'stable'
931
+ },
932
+ [NotebookSetting.outputWordWrap]: {
933
+ markdownDescription: ( nls.localizeWithPath(
934
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
935
+ 'notebook.outputWordWrap',
936
+ "Controls whether the lines in output should wrap."
937
+ )),
938
+ type: 'boolean',
939
+ tags: ['notebookLayout', 'notebookOutputLayout'],
940
+ default: false
941
+ },
942
+ [NotebookSetting.formatOnSave]: {
943
+ markdownDescription: ( nls.localizeWithPath(
944
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
945
+ 'notebook.formatOnSave',
946
+ "Format a notebook on save. A formatter must be available, the file must not be saved after delay, and the editor must not be shutting down."
947
+ )),
948
+ type: 'boolean',
949
+ tags: ['notebookLayout'],
950
+ default: false
951
+ },
952
+ [NotebookSetting.insertFinalNewline]: {
953
+ markdownDescription: ( nls.localizeWithPath(
954
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
955
+ 'notebook.insertFinalNewline',
956
+ "When enabled, insert a final new line into the end of code cells when saving a notebook."
957
+ )),
958
+ type: 'boolean',
959
+ tags: ['notebookLayout'],
960
+ default: false
961
+ },
962
+ [NotebookSetting.codeActionsOnSave]: {
963
+ markdownDescription: ( nls.localizeWithPath(
964
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
965
+ 'notebook.codeActionsOnSave',
966
+ 'Run a series of Code Actions for a notebook on save. Code Actions must be specified, the file must not be saved after delay, and the editor must not be shutting down. Example: `"notebook.source.organizeImports": "explicit"`'
967
+ )),
968
+ type: 'object',
969
+ additionalProperties: {
970
+ type: ['string', 'boolean'],
971
+ enum: ['explicit', 'never', true, false],
972
+ enumDescriptions: [( nls.localizeWithPath(
973
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
974
+ 'explicit',
975
+ 'Triggers Code Actions only when explicitly saved.'
976
+ )), ( nls.localizeWithPath(
977
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
978
+ 'never',
979
+ 'Never triggers Code Actions on save.'
980
+ )), ( nls.localizeWithPath(
981
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
982
+ 'explicitBoolean',
983
+ 'Triggers Code Actions only when explicitly saved. This value will be deprecated in favor of "explicit".'
984
+ )), ( nls.localizeWithPath(
985
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
986
+ 'neverBoolean',
987
+ 'Triggers Code Actions only when explicitly saved. This value will be deprecated in favor of "never".'
988
+ ))],
989
+ },
990
+ default: {}
991
+ },
992
+ [NotebookSetting.formatOnCellExecution]: {
993
+ markdownDescription: ( nls.localizeWithPath(
994
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
995
+ 'notebook.formatOnCellExecution',
996
+ "Format a notebook cell upon execution. A formatter must be available."
997
+ )),
998
+ type: 'boolean',
999
+ default: false
1000
+ },
1001
+ [NotebookSetting.confirmDeleteRunningCell]: {
1002
+ markdownDescription: ( nls.localizeWithPath(
1003
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
1004
+ 'notebook.confirmDeleteRunningCell',
1005
+ "Control whether a confirmation prompt is required to delete a running cell."
1006
+ )),
1007
+ type: 'boolean',
1008
+ default: true
1009
+ },
1010
+ [NotebookSetting.findScope]: {
1011
+ markdownDescription: ( nls.localizeWithPath(
1012
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
1013
+ 'notebook.findScope',
1014
+ "Customize the Find Widget behavior for searching within notebook cells. When both markup source and markup preview are enabled, the Find Widget will search either the source code or preview based on the current state of the cell."
1015
+ )),
1016
+ type: 'object',
1017
+ properties: {
1018
+ markupSource: {
1019
+ type: 'boolean',
1020
+ default: true
1021
+ },
1022
+ markupPreview: {
1023
+ type: 'boolean',
1024
+ default: true
1025
+ },
1026
+ codeSource: {
1027
+ type: 'boolean',
1028
+ default: true
1029
+ },
1030
+ codeOutput: {
1031
+ type: 'boolean',
1032
+ default: true
1033
+ }
1034
+ },
1035
+ default: {
1036
+ markupSource: true,
1037
+ markupPreview: true,
1038
+ codeSource: true,
1039
+ codeOutput: true
1040
+ },
1041
+ tags: ['notebookLayout']
1042
+ },
1043
+ [NotebookSetting.remoteSaving]: {
1044
+ markdownDescription: ( nls.localizeWithPath(
1045
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
1046
+ 'notebook.remoteSaving',
1047
+ "Enables the incremental saving of notebooks in Remote environment. When enabled, only the changes to the notebook are sent to the extension host, improving performance for large notebooks and slow network connections."
1048
+ )),
1049
+ type: 'boolean',
1050
+ default: typeof product.quality === 'string' && product.quality !== 'stable'
1051
+ },
1052
+ [NotebookSetting.scrollToRevealCell]: {
1053
+ markdownDescription: ( nls.localizeWithPath(
1054
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
1055
+ 'notebook.scrolling.revealNextCellOnExecute.description',
1056
+ "How far to scroll when revealing the next cell upon running {0}.",
1057
+ 'notebook.cell.executeAndSelectBelow'
1058
+ )),
1059
+ type: 'string',
1060
+ enum: ['fullCell', 'firstLine', 'none'],
1061
+ markdownEnumDescriptions: [
1062
+ ( nls.localizeWithPath(
1063
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
1064
+ 'notebook.scrolling.revealNextCellOnExecute.fullCell.description',
1065
+ 'Scroll to fully reveal the next cell.'
1066
+ )),
1067
+ ( nls.localizeWithPath(
1068
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
1069
+ 'notebook.scrolling.revealNextCellOnExecute.firstLine.description',
1070
+ 'Scroll to reveal the first line of the next cell.'
1071
+ )),
1072
+ ( nls.localizeWithPath(
1073
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
1074
+ 'notebook.scrolling.revealNextCellOnExecute.none.description',
1075
+ 'Do not scroll.'
1076
+ )),
1077
+ ],
1078
+ default: 'fullCell'
1079
+ },
1080
+ [NotebookSetting.anchorToFocusedCell]: {
1081
+ markdownDescription: ( nls.localizeWithPath(
1082
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
1083
+ 'notebook.scrolling.anchorToFocusedCell.description',
1084
+ "Experimental. Keep the focused cell steady while surrounding cells change size."
1085
+ )),
1086
+ type: 'string',
1087
+ enum: ['auto', 'on', 'off'],
1088
+ markdownEnumDescriptions: [
1089
+ ( nls.localizeWithPath(
1090
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
1091
+ 'notebook.scrolling.anchorToFocusedCell.auto.description',
1092
+ "Anchor the viewport to the focused cell depending on context unless {0} is set to {1}.",
1093
+ 'notebook.scrolling.revealCellBehavior',
1094
+ 'none'
1095
+ )),
1096
+ ( nls.localizeWithPath(
1097
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
1098
+ 'notebook.scrolling.anchorToFocusedCell.on.description',
1099
+ "Always anchor the viewport to the focused cell."
1100
+ )),
1101
+ ( nls.localizeWithPath(
1102
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
1103
+ 'notebook.scrolling.anchorToFocusedCell.off.description',
1104
+ "The focused cell may shift around as cells resize."
1105
+ ))
1106
+ ],
1107
+ default: 'auto'
1108
+ },
1109
+ [NotebookSetting.cellChat]: {
1110
+ markdownDescription: ( nls.localizeWithPath(
1111
+ 'vs/workbench/contrib/notebook/browser/notebook.contribution',
1112
+ 'notebook.cellChat',
1113
+ "Enable experimental cell chat for notebooks."
1114
+ )),
1115
+ type: 'boolean',
1116
+ default: false
1117
+ }
1118
+ }
1119
+ });
1120
+
1121
+ export { NotebookContribution };