@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,383 @@
1
+ import { __decorate, __param } from '../../../../../../../../../external/tslib/tslib.es6.js';
2
+ import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
3
+ import { IconLabel } from 'monaco-editor/esm/vs/base/browser/ui/iconLabel/iconLabel.js';
4
+ import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
5
+ import { createMatches } from 'monaco-editor/esm/vs/base/common/filters.js';
6
+ import { DisposableStore, Disposable, toDisposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
7
+ import { ThemeIcon } from 'monaco-editor/esm/vs/base/common/themables.js';
8
+ import { getIconClassesForLanguageId } from 'monaco-editor/esm/vs/editor/common/services/getIconClasses.js';
9
+ import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
10
+ import { Extensions as Extensions$1 } from 'monaco-editor/esm/vs/platform/configuration/common/configurationRegistry.js';
11
+ import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
12
+ import { MarkerSeverity } from 'monaco-editor/esm/vs/platform/markers/common/markers.js';
13
+ import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js';
14
+ import { listErrorForeground, listWarningForeground } from 'monaco-editor/esm/vs/platform/theme/common/colorRegistry.js';
15
+ import { IThemeService } from 'monaco-editor/esm/vs/platform/theme/common/themeService.js';
16
+ import { Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
17
+ import { NotebookEditor } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookEditor';
18
+ import { NotebookCellOutlineProvider } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineProvider';
19
+ import { NotebookSetting, CellKind } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
20
+ import { SIDE_GROUP, IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
21
+ import { IOutlineService } from 'vscode/vscode/vs/workbench/services/outline/browser/outline';
22
+ import { Range } from 'monaco-editor/esm/vs/editor/common/core/range.js';
23
+ import { mainWindow } from 'monaco-editor/esm/vs/base/browser/window.js';
24
+ import { WindowIdleValue } from 'monaco-editor/esm/vs/base/browser/dom.js';
25
+
26
+ var NotebookCellOutline_1;
27
+ class NotebookOutlineTemplate {
28
+ static { this.templateId = 'NotebookOutlineRenderer'; }
29
+ constructor(container, iconClass, iconLabel, decoration) {
30
+ this.container = container;
31
+ this.iconClass = iconClass;
32
+ this.iconLabel = iconLabel;
33
+ this.decoration = decoration;
34
+ }
35
+ }
36
+ let NotebookOutlineRenderer = class NotebookOutlineRenderer {
37
+ constructor(_themeService, _configurationService) {
38
+ this._themeService = _themeService;
39
+ this._configurationService = _configurationService;
40
+ this.templateId = NotebookOutlineTemplate.templateId;
41
+ }
42
+ renderTemplate(container) {
43
+ container.classList.add('notebook-outline-element', 'show-file-icons');
44
+ const iconClass = document.createElement('div');
45
+ container.append(iconClass);
46
+ const iconLabel = ( new IconLabel(container, { supportHighlights: true }));
47
+ const decoration = document.createElement('div');
48
+ decoration.className = 'element-decoration';
49
+ container.append(decoration);
50
+ return ( new NotebookOutlineTemplate(container, iconClass, iconLabel, decoration));
51
+ }
52
+ renderElement(node, _index, template, _height) {
53
+ const extraClasses = [];
54
+ const options = {
55
+ matches: createMatches(node.filterData),
56
+ labelEscapeNewLines: true,
57
+ extraClasses,
58
+ };
59
+ if (node.element.cell.cellKind === CellKind.Code && this._themeService.getFileIconTheme().hasFileIcons && !node.element.isExecuting) {
60
+ template.iconClass.className = '';
61
+ extraClasses.push(...getIconClassesForLanguageId(node.element.cell.language ?? ''));
62
+ }
63
+ else {
64
+ template.iconClass.className = 'element-icon ' + ThemeIcon.asClassNameArray(node.element.icon).join(' ');
65
+ }
66
+ template.iconLabel.setLabel(node.element.label, undefined, options);
67
+ const { markerInfo } = node.element;
68
+ template.container.style.removeProperty('--outline-element-color');
69
+ template.decoration.innerText = '';
70
+ if (markerInfo) {
71
+ const problem = this._configurationService.getValue('problems.visibility');
72
+ const useBadges = this._configurationService.getValue("outline.problems.badges" );
73
+ if (!useBadges || !problem) {
74
+ template.decoration.classList.remove('bubble');
75
+ template.decoration.innerText = '';
76
+ }
77
+ else if (markerInfo.count === 0) {
78
+ template.decoration.classList.add('bubble');
79
+ template.decoration.innerText = '\uea71';
80
+ }
81
+ else {
82
+ template.decoration.classList.remove('bubble');
83
+ template.decoration.innerText = markerInfo.count > 9 ? '9+' : String(markerInfo.count);
84
+ }
85
+ const color = this._themeService.getColorTheme().getColor(markerInfo.topSev === MarkerSeverity.Error ? listErrorForeground : listWarningForeground);
86
+ if (problem === undefined) {
87
+ return;
88
+ }
89
+ const useColors = this._configurationService.getValue("outline.problems.colors" );
90
+ if (!useColors || !problem) {
91
+ template.container.style.removeProperty('--outline-element-color');
92
+ template.decoration.style.setProperty('--outline-element-color', color?.toString() ?? 'inherit');
93
+ }
94
+ else {
95
+ template.container.style.setProperty('--outline-element-color', color?.toString() ?? 'inherit');
96
+ }
97
+ }
98
+ }
99
+ disposeTemplate(templateData) {
100
+ templateData.iconLabel.dispose();
101
+ }
102
+ };
103
+ NotebookOutlineRenderer = ( __decorate([
104
+ ( __param(0, IThemeService)),
105
+ ( __param(1, IConfigurationService))
106
+ ], NotebookOutlineRenderer));
107
+ class NotebookOutlineAccessibility {
108
+ getAriaLabel(element) {
109
+ return element.label;
110
+ }
111
+ getWidgetAriaLabel() {
112
+ return '';
113
+ }
114
+ }
115
+ class NotebookNavigationLabelProvider {
116
+ getKeyboardNavigationLabel(element) {
117
+ return element.label;
118
+ }
119
+ }
120
+ class NotebookOutlineVirtualDelegate {
121
+ getHeight(_element) {
122
+ return 22;
123
+ }
124
+ getTemplateId(_element) {
125
+ return NotebookOutlineTemplate.templateId;
126
+ }
127
+ }
128
+ let NotebookQuickPickProvider = class NotebookQuickPickProvider {
129
+ constructor(_getEntries, _themeService) {
130
+ this._getEntries = _getEntries;
131
+ this._themeService = _themeService;
132
+ }
133
+ getQuickPickElements() {
134
+ const bucket = [];
135
+ for (const entry of this._getEntries()) {
136
+ entry.asFlatList(bucket);
137
+ }
138
+ const result = [];
139
+ const { hasFileIcons } = this._themeService.getFileIconTheme();
140
+ for (const element of bucket) {
141
+ const useFileIcon = hasFileIcons && !element.symbolKind;
142
+ result.push({
143
+ element,
144
+ label: useFileIcon ? element.label : `$(${element.icon.id}) ${element.label}`,
145
+ ariaLabel: element.label,
146
+ iconClasses: useFileIcon ? getIconClassesForLanguageId(element.cell.language ?? '') : undefined,
147
+ });
148
+ }
149
+ return result;
150
+ }
151
+ };
152
+ NotebookQuickPickProvider = ( __decorate([
153
+ ( __param(1, IThemeService))
154
+ ], NotebookQuickPickProvider));
155
+ class NotebookComparator {
156
+ constructor() {
157
+ this._collator = ( new WindowIdleValue(mainWindow, () => new Intl.Collator(undefined, { numeric: true })));
158
+ }
159
+ compareByPosition(a, b) {
160
+ return a.index - b.index;
161
+ }
162
+ compareByType(a, b) {
163
+ return a.cell.cellKind - b.cell.cellKind || this._collator.value.compare(a.label, b.label);
164
+ }
165
+ compareByName(a, b) {
166
+ return this._collator.value.compare(a.label, b.label);
167
+ }
168
+ }
169
+ let NotebookCellOutline = NotebookCellOutline_1 = class NotebookCellOutline {
170
+ get entries() {
171
+ return this._outlineProvider?.entries ?? [];
172
+ }
173
+ get activeElement() {
174
+ return this._outlineProvider?.activeElement;
175
+ }
176
+ constructor(_editor, _target, instantiationService, _editorService, _configurationService) {
177
+ this._editor = _editor;
178
+ this._editorService = _editorService;
179
+ this._dispoables = ( new DisposableStore());
180
+ this._onDidChange = ( new Emitter());
181
+ this.onDidChange = this._onDidChange.event;
182
+ this._entriesDisposables = ( new DisposableStore());
183
+ this.outlineKind = 'notebookCells';
184
+ this._localDisposables = ( new DisposableStore());
185
+ const installSelectionListener = () => {
186
+ const notebookEditor = _editor.getControl();
187
+ if (!notebookEditor?.hasModel()) {
188
+ this._outlineProvider?.dispose();
189
+ this._outlineProvider = undefined;
190
+ this._localDisposables.clear();
191
+ }
192
+ else {
193
+ this._outlineProvider?.dispose();
194
+ this._localDisposables.clear();
195
+ this._outlineProvider = instantiationService.createInstance(NotebookCellOutlineProvider, notebookEditor, _target);
196
+ this._localDisposables.add(this._outlineProvider.onDidChange(e => {
197
+ this._onDidChange.fire(e);
198
+ }));
199
+ }
200
+ };
201
+ this._dispoables.add(_editor.onDidChangeModel(() => {
202
+ installSelectionListener();
203
+ }));
204
+ installSelectionListener();
205
+ const treeDataSource = { getChildren: parent => parent instanceof NotebookCellOutline_1 ? (this._outlineProvider?.entries ?? []) : parent.children };
206
+ const delegate = ( new NotebookOutlineVirtualDelegate());
207
+ const renderers = [instantiationService.createInstance(NotebookOutlineRenderer)];
208
+ const comparator = ( new NotebookComparator());
209
+ const options = {
210
+ collapseByDefault: _target === 2 || ((_target === 1 && _configurationService.getValue("outline.collapseItems" ) === "alwaysCollapse") ),
211
+ expandOnlyOnTwistieClick: true,
212
+ multipleSelectionSupport: false,
213
+ accessibilityProvider: ( new NotebookOutlineAccessibility()),
214
+ identityProvider: { getId: element => ( element.cell.uri.toString()) },
215
+ keyboardNavigationLabelProvider: ( new NotebookNavigationLabelProvider())
216
+ };
217
+ this.config = {
218
+ breadcrumbsDataSource: {
219
+ getBreadcrumbElements: () => {
220
+ const result = [];
221
+ let candidate = this.activeElement;
222
+ while (candidate) {
223
+ result.unshift(candidate);
224
+ candidate = candidate.parent;
225
+ }
226
+ return result;
227
+ }
228
+ },
229
+ quickPickDataSource: instantiationService.createInstance(NotebookQuickPickProvider, () => (this._outlineProvider?.entries ?? [])),
230
+ treeDataSource,
231
+ delegate,
232
+ renderers,
233
+ comparator,
234
+ options
235
+ };
236
+ }
237
+ async setFullSymbols(cancelToken) {
238
+ await this._outlineProvider?.setFullSymbols(cancelToken);
239
+ }
240
+ get uri() {
241
+ return this._outlineProvider?.uri;
242
+ }
243
+ get isEmpty() {
244
+ return this._outlineProvider?.isEmpty ?? true;
245
+ }
246
+ async reveal(entry, options, sideBySide) {
247
+ await this._editorService.openEditor({
248
+ resource: entry.cell.uri,
249
+ options: {
250
+ ...options,
251
+ override: this._editor.input?.editorId,
252
+ cellRevealType: 5 ,
253
+ selection: entry.position
254
+ },
255
+ }, sideBySide ? SIDE_GROUP : undefined);
256
+ }
257
+ preview(entry) {
258
+ const widget = this._editor.getControl();
259
+ if (!widget) {
260
+ return Disposable.None;
261
+ }
262
+ if (entry.range) {
263
+ const range = Range.lift(entry.range);
264
+ widget.revealRangeInCenterIfOutsideViewportAsync(entry.cell, range);
265
+ }
266
+ else {
267
+ widget.revealInCenterIfOutsideViewport(entry.cell);
268
+ }
269
+ const ids = widget.deltaCellDecorations([], [{
270
+ handle: entry.cell.handle,
271
+ options: { className: 'nb-symbolHighlight', outputClassName: 'nb-symbolHighlight' }
272
+ }]);
273
+ let editorDecorations;
274
+ widget.changeModelDecorations(accessor => {
275
+ if (entry.range) {
276
+ const decorations = [
277
+ {
278
+ range: entry.range, options: {
279
+ description: 'document-symbols-outline-range-highlight',
280
+ className: 'rangeHighlight',
281
+ isWholeLine: true
282
+ }
283
+ }
284
+ ];
285
+ const deltaDecoration = {
286
+ ownerId: entry.cell.handle,
287
+ decorations: decorations
288
+ };
289
+ editorDecorations = accessor.deltaDecorations([], [deltaDecoration]);
290
+ }
291
+ });
292
+ return toDisposable(() => {
293
+ widget.deltaCellDecorations(ids, []);
294
+ if (editorDecorations?.length) {
295
+ widget.changeModelDecorations(accessor => {
296
+ accessor.deltaDecorations(editorDecorations, []);
297
+ });
298
+ }
299
+ });
300
+ }
301
+ captureViewState() {
302
+ const widget = this._editor.getControl();
303
+ const viewState = widget?.getEditorViewState();
304
+ return toDisposable(() => {
305
+ if (viewState) {
306
+ widget?.restoreListViewState(viewState);
307
+ }
308
+ });
309
+ }
310
+ dispose() {
311
+ this._onDidChange.dispose();
312
+ this._dispoables.dispose();
313
+ this._entriesDisposables.dispose();
314
+ this._outlineProvider?.dispose();
315
+ this._localDisposables.dispose();
316
+ }
317
+ };
318
+ NotebookCellOutline = NotebookCellOutline_1 = ( __decorate([
319
+ ( __param(2, IInstantiationService)),
320
+ ( __param(3, IEditorService)),
321
+ ( __param(4, IConfigurationService))
322
+ ], NotebookCellOutline));
323
+ let NotebookOutlineCreator = class NotebookOutlineCreator {
324
+ constructor(outlineService, _instantiationService, _configurationService) {
325
+ this._instantiationService = _instantiationService;
326
+ this._configurationService = _configurationService;
327
+ const reg = outlineService.registerOutlineCreator(this);
328
+ this.dispose = () => reg.dispose();
329
+ }
330
+ matches(candidate) {
331
+ return candidate.getId() === NotebookEditor.ID;
332
+ }
333
+ async createOutline(editor, target, cancelToken) {
334
+ const outline = this._instantiationService.createInstance(NotebookCellOutline, editor, target);
335
+ const showAllSymbols = this._configurationService.getValue(NotebookSetting.gotoSymbolsAllSymbols);
336
+ if (target === 4 && showAllSymbols) {
337
+ await outline.setFullSymbols(cancelToken);
338
+ }
339
+ return outline;
340
+ }
341
+ };
342
+ NotebookOutlineCreator = ( __decorate([
343
+ ( __param(0, IOutlineService)),
344
+ ( __param(1, IInstantiationService)),
345
+ ( __param(2, IConfigurationService))
346
+ ], NotebookOutlineCreator));
347
+ ( Registry.as(Extensions.Workbench)).registerWorkbenchContribution(NotebookOutlineCreator, 4 );
348
+ ( Registry.as(Extensions$1.Configuration)).registerConfiguration({
349
+ id: 'notebook',
350
+ order: 100,
351
+ type: 'object',
352
+ 'properties': {
353
+ 'notebook.outline.showCodeCells': {
354
+ type: 'boolean',
355
+ default: false,
356
+ markdownDescription: ( localizeWithPath(
357
+ 'vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline',
358
+ 'outline.showCodeCells',
359
+ "When enabled notebook outline shows code cells."
360
+ ))
361
+ },
362
+ 'notebook.breadcrumbs.showCodeCells': {
363
+ type: 'boolean',
364
+ default: true,
365
+ markdownDescription: ( localizeWithPath(
366
+ 'vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline',
367
+ 'breadcrumbs.showCodeCells',
368
+ "When enabled notebook breadcrumbs contain code cells."
369
+ ))
370
+ },
371
+ [NotebookSetting.gotoSymbolsAllSymbols]: {
372
+ type: 'boolean',
373
+ default: false,
374
+ markdownDescription: ( localizeWithPath(
375
+ 'vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline',
376
+ 'notebook.gotoSymbols.showAllSymbols',
377
+ "When enabled the Go to Symbol Quick Pick will display full code symbols from the notebook, as well as Markdown headers."
378
+ ))
379
+ },
380
+ }
381
+ });
382
+
383
+ export { NotebookCellOutline, NotebookOutlineCreator };
@@ -0,0 +1,117 @@
1
+ import { __decorate, __param } from '../../../../../../../../../external/tslib/tslib.es6.js';
2
+ import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
3
+ import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js';
4
+ import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
5
+ import { registerAction2, Action2 } from 'monaco-editor/esm/vs/platform/actions/common/actions.js';
6
+ import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
7
+ import { NotebookSetting } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
8
+ import { IWorkbenchAssignmentService } from 'vscode/vscode/vs/workbench/services/assignment/common/assignmentService';
9
+ import { Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
10
+
11
+ var NotebookProfileType;
12
+ ( (function(NotebookProfileType) {
13
+ NotebookProfileType["default"] = "default";
14
+ NotebookProfileType["jupyter"] = "jupyter";
15
+ NotebookProfileType["colab"] = "colab";
16
+ })(NotebookProfileType || (NotebookProfileType = {})));
17
+ const profiles = {
18
+ [NotebookProfileType.default]: {
19
+ [NotebookSetting.focusIndicator]: 'gutter',
20
+ [NotebookSetting.insertToolbarLocation]: 'both',
21
+ [NotebookSetting.globalToolbar]: true,
22
+ [NotebookSetting.cellToolbarLocation]: { default: 'right' },
23
+ [NotebookSetting.compactView]: true,
24
+ [NotebookSetting.showCellStatusBar]: 'visible',
25
+ [NotebookSetting.consolidatedRunButton]: true,
26
+ [NotebookSetting.undoRedoPerCell]: false
27
+ },
28
+ [NotebookProfileType.jupyter]: {
29
+ [NotebookSetting.focusIndicator]: 'gutter',
30
+ [NotebookSetting.insertToolbarLocation]: 'notebookToolbar',
31
+ [NotebookSetting.globalToolbar]: true,
32
+ [NotebookSetting.cellToolbarLocation]: { default: 'left' },
33
+ [NotebookSetting.compactView]: true,
34
+ [NotebookSetting.showCellStatusBar]: 'visible',
35
+ [NotebookSetting.consolidatedRunButton]: false,
36
+ [NotebookSetting.undoRedoPerCell]: true
37
+ },
38
+ [NotebookProfileType.colab]: {
39
+ [NotebookSetting.focusIndicator]: 'border',
40
+ [NotebookSetting.insertToolbarLocation]: 'betweenCells',
41
+ [NotebookSetting.globalToolbar]: false,
42
+ [NotebookSetting.cellToolbarLocation]: { default: 'right' },
43
+ [NotebookSetting.compactView]: false,
44
+ [NotebookSetting.showCellStatusBar]: 'hidden',
45
+ [NotebookSetting.consolidatedRunButton]: true,
46
+ [NotebookSetting.undoRedoPerCell]: false
47
+ }
48
+ };
49
+ async function applyProfile(configService, profile) {
50
+ const promises = [];
51
+ for (const settingKey in profile) {
52
+ promises.push(configService.updateValue(settingKey, profile[settingKey]));
53
+ }
54
+ await Promise.all(promises);
55
+ }
56
+ registerAction2(class extends Action2 {
57
+ constructor() {
58
+ super({
59
+ id: 'notebook.setProfile',
60
+ title: ( localizeWithPath(
61
+ 'vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile',
62
+ 'setProfileTitle',
63
+ "Set Profile"
64
+ ))
65
+ });
66
+ }
67
+ async run(accessor, args) {
68
+ if (!isSetProfileArgs(args)) {
69
+ return;
70
+ }
71
+ const configService = accessor.get(IConfigurationService);
72
+ return applyProfile(configService, profiles[args.profile]);
73
+ }
74
+ });
75
+ function isSetProfileArgs(args) {
76
+ const setProfileArgs = args;
77
+ return setProfileArgs.profile === NotebookProfileType.colab ||
78
+ setProfileArgs.profile === NotebookProfileType.default ||
79
+ setProfileArgs.profile === NotebookProfileType.jupyter;
80
+ }
81
+ let NotebookProfileContribution = class NotebookProfileContribution extends Disposable {
82
+ constructor(configService, experimentService) {
83
+ super();
84
+ this.experimentService = experimentService;
85
+ if (this.experimentService) {
86
+ this.experimentService.getTreatment('notebookprofile').then(treatment => {
87
+ if (treatment === undefined) {
88
+ return;
89
+ }
90
+ else {
91
+ const focusIndicator = configService.getValue(NotebookSetting.focusIndicator);
92
+ const insertToolbarPosition = configService.getValue(NotebookSetting.insertToolbarLocation);
93
+ const globalToolbar = configService.getValue(NotebookSetting.globalToolbar);
94
+ const compactView = configService.getValue(NotebookSetting.compactView);
95
+ const showCellStatusBar = configService.getValue(NotebookSetting.showCellStatusBar);
96
+ const consolidatedRunButton = configService.getValue(NotebookSetting.consolidatedRunButton);
97
+ if (focusIndicator === 'border'
98
+ && insertToolbarPosition === 'both'
99
+ && globalToolbar === false
100
+ && compactView === true
101
+ && showCellStatusBar === 'visible'
102
+ && consolidatedRunButton === true) {
103
+ applyProfile(configService, profiles[treatment] ?? profiles[NotebookProfileType.default]);
104
+ }
105
+ }
106
+ });
107
+ }
108
+ }
109
+ };
110
+ NotebookProfileContribution = ( __decorate([
111
+ ( __param(0, IConfigurationService)),
112
+ ( __param(1, IWorkbenchAssignmentService))
113
+ ], NotebookProfileContribution));
114
+ const workbenchContributionsRegistry = ( Registry.as(Extensions.Workbench));
115
+ workbenchContributionsRegistry.registerWorkbenchContribution(NotebookProfileContribution, 2 );
116
+
117
+ export { NotebookProfileContribution, NotebookProfileType };