@codingame/monaco-vscode-notebook-service-override 4.1.0 → 4.1.2

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 (77) 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/notebook.js +12 -12
  4. package/override/vs/platform/dialogs/common/dialogs.js +10 -0
  5. package/package.json +2 -2
  6. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.css.js +6 -0
  7. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +391 -0
  8. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.js +109 -0
  9. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +173 -0
  10. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +544 -0
  11. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.js +106 -0
  12. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookCellPausing.js +67 -0
  13. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +165 -0
  14. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.js +67 -0
  15. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +320 -0
  16. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/execute/executionEditorProgress.js +72 -0
  17. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/media/notebookFind.css.js +6 -0
  18. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +168 -0
  19. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +209 -0
  20. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +84 -0
  21. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/kernelDetection/notebookKernelDetection.js +82 -0
  22. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +67 -0
  23. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +101 -0
  24. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +393 -0
  25. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableContextKeys.js +5 -0
  26. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +97 -0
  27. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +120 -0
  28. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +60 -0
  29. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +150 -0
  30. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +656 -0
  31. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +77 -0
  32. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +517 -0
  33. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +159 -0
  34. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +56 -0
  35. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.js +94 -0
  36. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/apiActions.js +51 -0
  37. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +652 -0
  38. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +721 -0
  39. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +351 -0
  40. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +315 -0
  41. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.js +199 -0
  42. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.js +47 -0
  43. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +1297 -0
  44. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +284 -0
  45. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.js +563 -0
  46. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.js +115 -0
  47. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.js +39 -0
  48. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiff.css.js +6 -0
  49. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +313 -0
  50. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +911 -0
  51. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.js +13 -0
  52. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +395 -0
  53. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +185 -0
  54. package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +1187 -0
  55. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibility.js +159 -0
  56. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +451 -0
  57. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +192 -0
  58. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +106 -0
  59. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +510 -0
  60. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +130 -0
  61. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +341 -0
  62. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +111 -0
  63. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +28 -0
  64. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.js +65 -0
  65. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +641 -0
  66. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +200 -0
  67. package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.js +90 -0
  68. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +1002 -0
  69. package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +103 -0
  70. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +203 -0
  71. package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.js +80 -0
  72. package/vscode/src/vs/workbench/contrib/notebook/common/notebookProvider.js +98 -0
  73. package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.js +89 -0
  74. package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +386 -0
  75. package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +408 -0
  76. package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.js +144 -0
  77. package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopyManager.js +129 -0
@@ -0,0 +1,656 @@
1
+ import { __decorate, __param } from '../../../../../../../../../external/tslib/tslib.es6.js';
2
+ import { localizeWithPath } from 'vscode/vscode/vs/nls';
3
+ import { clearNode, WindowIdleValue } from 'vscode/vscode/vs/base/browser/dom';
4
+ import { ToolBar } from 'vscode/vscode/vs/base/browser/ui/toolbar/toolbar';
5
+ import { IconLabel } from 'vscode/vscode/vs/base/browser/ui/iconLabel/iconLabel';
6
+ import { Emitter } from 'vscode/vscode/vs/base/common/event';
7
+ import { createMatches } from 'vscode/vscode/vs/base/common/filters';
8
+ import { DisposableStore, Disposable, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
9
+ import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
10
+ import { getIconClassesForLanguageId } from 'vscode/vscode/vs/editor/common/services/getIconClasses';
11
+ import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
12
+ import { Extensions as Extensions$1 } from 'vscode/vscode/vs/platform/configuration/common/configurationRegistry';
13
+ import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
14
+ import { MarkerSeverity } from 'vscode/vscode/vs/platform/markers/common/markers';
15
+ import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
16
+ import 'vscode/vscode/vs/platform/theme/common/colorUtils';
17
+ import 'vscode/vscode/vs/platform/theme/common/colors/baseColors';
18
+ import 'vscode/vscode/vs/platform/theme/common/colors/chartsColors';
19
+ import 'vscode/vscode/vs/platform/theme/common/colors/editorColors';
20
+ import 'vscode/vscode/vs/platform/theme/common/colors/inputColors';
21
+ import { listErrorForeground, listWarningForeground } from 'vscode/vscode/vs/platform/theme/common/colors/listColors';
22
+ import 'vscode/vscode/vs/platform/theme/common/colors/menuColors';
23
+ import 'vscode/vscode/vs/platform/theme/common/colors/minimapColors';
24
+ import 'vscode/vscode/vs/platform/theme/common/colors/miscColors';
25
+ import 'vscode/vscode/vs/platform/theme/common/colors/quickpickColors';
26
+ import 'vscode/vscode/vs/platform/theme/common/colors/searchColors';
27
+ import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService';
28
+ import { Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
29
+ import { NotebookEditor } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookEditor';
30
+ import { NotebookCellOutlineProvider } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineProvider';
31
+ import { NotebookSetting, CellKind } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
32
+ import { SIDE_GROUP, IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
33
+ import { IOutlineService } from 'vscode/vscode/vs/workbench/services/outline/browser/outline';
34
+ import { Range } from 'vscode/vscode/vs/editor/common/core/range';
35
+ import { mainWindow } from 'vscode/vscode/vs/base/browser/window';
36
+ import { IContextMenuService } from 'vscode/vscode/vs/platform/contextview/browser/contextView';
37
+ import { MenuRegistry, MenuId, registerAction2, Action2, MenuItemAction, IMenuService } from 'vscode/vscode/vs/platform/actions/common/actions';
38
+ import { RawContextKey, ContextKeyExpr, IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
39
+ import { MenuEntryActionViewItem, createAndFillInActionBarActions } from 'vscode/vscode/vs/platform/actions/browser/menuEntryActionViewItem';
40
+ import { disposableTimeout } from 'vscode/vscode/vs/base/common/async';
41
+ import { IOutlinePane } from 'vscode/vscode/vs/workbench/contrib/outline/browser/outline';
42
+ import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
43
+ import { NOTEBOOK_IS_ACTIVE_EDITOR } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookContextKeys';
44
+
45
+ var NotebookCellOutline_1;
46
+ class NotebookOutlineTemplate {
47
+ static { this.templateId = 'NotebookOutlineRenderer'; }
48
+ constructor(container, iconClass, iconLabel, decoration, actionMenu, elementDisposables) {
49
+ this.container = container;
50
+ this.iconClass = iconClass;
51
+ this.iconLabel = iconLabel;
52
+ this.decoration = decoration;
53
+ this.actionMenu = actionMenu;
54
+ this.elementDisposables = elementDisposables;
55
+ }
56
+ }
57
+ let NotebookOutlineRenderer = class NotebookOutlineRenderer {
58
+ constructor(_editor, _target, _themeService, _configurationService, _contextMenuService, _contextKeyService, _menuService, _instantiationService) {
59
+ this._editor = _editor;
60
+ this._target = _target;
61
+ this._themeService = _themeService;
62
+ this._configurationService = _configurationService;
63
+ this._contextMenuService = _contextMenuService;
64
+ this._contextKeyService = _contextKeyService;
65
+ this._menuService = _menuService;
66
+ this._instantiationService = _instantiationService;
67
+ this.templateId = NotebookOutlineTemplate.templateId;
68
+ }
69
+ renderTemplate(container) {
70
+ const elementDisposables = ( new DisposableStore());
71
+ container.classList.add('notebook-outline-element', 'show-file-icons');
72
+ const iconClass = document.createElement('div');
73
+ container.append(iconClass);
74
+ const iconLabel = ( new IconLabel(container, { supportHighlights: true }));
75
+ const decoration = document.createElement('div');
76
+ decoration.className = 'element-decoration';
77
+ container.append(decoration);
78
+ const actionMenu = document.createElement('div');
79
+ actionMenu.className = 'action-menu';
80
+ container.append(actionMenu);
81
+ return ( new NotebookOutlineTemplate(
82
+ container,
83
+ iconClass,
84
+ iconLabel,
85
+ decoration,
86
+ actionMenu,
87
+ elementDisposables
88
+ ));
89
+ }
90
+ renderElement(node, _index, template, _height) {
91
+ const extraClasses = [];
92
+ const options = {
93
+ matches: createMatches(node.filterData),
94
+ labelEscapeNewLines: true,
95
+ extraClasses,
96
+ };
97
+ const isCodeCell = node.element.cell.cellKind === CellKind.Code;
98
+ if (node.element.level >= 8) {
99
+ template.iconClass.className = 'element-icon ' + ThemeIcon.asClassNameArray(node.element.icon).join(' ');
100
+ }
101
+ else if (isCodeCell && this._themeService.getFileIconTheme().hasFileIcons && !node.element.isExecuting) {
102
+ template.iconClass.className = '';
103
+ extraClasses.push(...getIconClassesForLanguageId(node.element.cell.language ?? ''));
104
+ }
105
+ else {
106
+ template.iconClass.className = 'element-icon ' + ThemeIcon.asClassNameArray(node.element.icon).join(' ');
107
+ }
108
+ template.iconLabel.setLabel(' ' + node.element.label, undefined, options);
109
+ const { markerInfo } = node.element;
110
+ template.container.style.removeProperty('--outline-element-color');
111
+ template.decoration.innerText = '';
112
+ if (markerInfo) {
113
+ const problem = this._configurationService.getValue('problems.visibility');
114
+ const useBadges = this._configurationService.getValue("outline.problems.badges" );
115
+ if (!useBadges || !problem) {
116
+ template.decoration.classList.remove('bubble');
117
+ template.decoration.innerText = '';
118
+ }
119
+ else if (markerInfo.count === 0) {
120
+ template.decoration.classList.add('bubble');
121
+ template.decoration.innerText = '\uea71';
122
+ }
123
+ else {
124
+ template.decoration.classList.remove('bubble');
125
+ template.decoration.innerText = markerInfo.count > 9 ? '9+' : String(markerInfo.count);
126
+ }
127
+ const color = this._themeService.getColorTheme().getColor(markerInfo.topSev === MarkerSeverity.Error ? listErrorForeground : listWarningForeground);
128
+ if (problem === undefined) {
129
+ return;
130
+ }
131
+ const useColors = this._configurationService.getValue("outline.problems.colors" );
132
+ if (!useColors || !problem) {
133
+ template.container.style.removeProperty('--outline-element-color');
134
+ template.decoration.style.setProperty('--outline-element-color', color?.toString() ?? 'inherit');
135
+ }
136
+ else {
137
+ template.container.style.setProperty('--outline-element-color', color?.toString() ?? 'inherit');
138
+ }
139
+ }
140
+ if (this._target === 1 ) {
141
+ const nbCell = node.element.cell;
142
+ const nbViewModel = this._editor?.getViewModel();
143
+ if (!nbViewModel) {
144
+ return;
145
+ }
146
+ const idx = nbViewModel.getCellIndex(nbCell);
147
+ const length = isCodeCell ? 0 : nbViewModel.getFoldedLength(idx);
148
+ const scopedContextKeyService = template.elementDisposables.add(this._contextKeyService.createScoped(template.container));
149
+ NotebookOutlineContext.CellKind.bindTo(scopedContextKeyService).set(isCodeCell ? CellKind.Code : CellKind.Markup);
150
+ NotebookOutlineContext.CellHasChildren.bindTo(scopedContextKeyService).set(length > 0);
151
+ NotebookOutlineContext.CellHasHeader.bindTo(scopedContextKeyService).set(node.element.level !== 7);
152
+ NotebookOutlineContext.OutlineElementTarget.bindTo(scopedContextKeyService).set(this._target);
153
+ this.setupFolding(isCodeCell, nbViewModel, scopedContextKeyService, template, nbCell);
154
+ const outlineEntryToolbar = template.elementDisposables.add(( new ToolBar(template.actionMenu, this._contextMenuService, {
155
+ actionViewItemProvider: action => {
156
+ if (action instanceof MenuItemAction) {
157
+ return this._instantiationService.createInstance(MenuEntryActionViewItem, action, undefined);
158
+ }
159
+ return undefined;
160
+ },
161
+ })));
162
+ const menu = template.elementDisposables.add(this._menuService.createMenu(MenuId.NotebookOutlineActionMenu, scopedContextKeyService));
163
+ const actions = getOutlineToolbarActions(menu, { notebookEditor: this._editor, outlineEntry: node.element });
164
+ outlineEntryToolbar.setActions(actions.primary, actions.secondary);
165
+ this.setupToolbarListeners(outlineEntryToolbar, menu, actions, node.element, template);
166
+ template.actionMenu.style.padding = '0 0.8em 0 0.4em';
167
+ }
168
+ }
169
+ disposeTemplate(templateData) {
170
+ templateData.iconLabel.dispose();
171
+ templateData.elementDisposables.clear();
172
+ }
173
+ disposeElement(element, index, templateData, height) {
174
+ templateData.elementDisposables.clear();
175
+ clearNode(templateData.actionMenu);
176
+ }
177
+ setupFolding(isCodeCell, nbViewModel, scopedContextKeyService, template, nbCell) {
178
+ const foldingState = isCodeCell ? 0 : (nbCell.foldingState);
179
+ const foldingStateCtx = NotebookOutlineContext.CellFoldingState.bindTo(scopedContextKeyService);
180
+ foldingStateCtx.set(foldingState);
181
+ if (!isCodeCell) {
182
+ template.elementDisposables.add(nbViewModel.onDidFoldingStateChanged(() => {
183
+ const foldingState = nbCell.foldingState;
184
+ NotebookOutlineContext.CellFoldingState.bindTo(scopedContextKeyService).set(foldingState);
185
+ foldingStateCtx.set(foldingState);
186
+ }));
187
+ }
188
+ }
189
+ setupToolbarListeners(toolbar, menu, initActions, entry, templateData) {
190
+ let dropdownIsVisible = false;
191
+ let deferredUpdate;
192
+ toolbar.setActions(initActions.primary, initActions.secondary);
193
+ templateData.elementDisposables.add(menu.onDidChange(() => {
194
+ if (dropdownIsVisible) {
195
+ const actions = getOutlineToolbarActions(menu, { notebookEditor: this._editor, outlineEntry: entry });
196
+ deferredUpdate = () => toolbar.setActions(actions.primary, actions.secondary);
197
+ return;
198
+ }
199
+ const actions = getOutlineToolbarActions(menu, { notebookEditor: this._editor, outlineEntry: entry });
200
+ toolbar.setActions(actions.primary, actions.secondary);
201
+ }));
202
+ templateData.container.classList.remove('notebook-outline-toolbar-dropdown-active');
203
+ templateData.elementDisposables.add(toolbar.onDidChangeDropdownVisibility(visible => {
204
+ dropdownIsVisible = visible;
205
+ if (visible) {
206
+ templateData.container.classList.add('notebook-outline-toolbar-dropdown-active');
207
+ }
208
+ else {
209
+ templateData.container.classList.remove('notebook-outline-toolbar-dropdown-active');
210
+ }
211
+ if (deferredUpdate && !visible) {
212
+ disposableTimeout(() => {
213
+ deferredUpdate?.();
214
+ }, 0, templateData.elementDisposables);
215
+ deferredUpdate = undefined;
216
+ }
217
+ }));
218
+ }
219
+ };
220
+ NotebookOutlineRenderer = ( __decorate([
221
+ ( __param(2, IThemeService)),
222
+ ( __param(3, IConfigurationService)),
223
+ ( __param(4, IContextMenuService)),
224
+ ( __param(5, IContextKeyService)),
225
+ ( __param(6, IMenuService)),
226
+ ( __param(7, IInstantiationService))
227
+ ], NotebookOutlineRenderer));
228
+ function getOutlineToolbarActions(menu, args) {
229
+ const primary = [];
230
+ const secondary = [];
231
+ const result = { primary, secondary };
232
+ createAndFillInActionBarActions(menu, { shouldForwardArgs: true, arg: args }, result);
233
+ return result;
234
+ }
235
+ class NotebookOutlineAccessibility {
236
+ getAriaLabel(element) {
237
+ return element.label;
238
+ }
239
+ getWidgetAriaLabel() {
240
+ return '';
241
+ }
242
+ }
243
+ class NotebookNavigationLabelProvider {
244
+ getKeyboardNavigationLabel(element) {
245
+ return element.label;
246
+ }
247
+ }
248
+ class NotebookOutlineVirtualDelegate {
249
+ getHeight(_element) {
250
+ return 22;
251
+ }
252
+ getTemplateId(_element) {
253
+ return NotebookOutlineTemplate.templateId;
254
+ }
255
+ }
256
+ let NotebookQuickPickProvider = class NotebookQuickPickProvider {
257
+ constructor(_getEntries, _themeService) {
258
+ this._getEntries = _getEntries;
259
+ this._themeService = _themeService;
260
+ }
261
+ getQuickPickElements() {
262
+ const bucket = [];
263
+ for (const entry of this._getEntries()) {
264
+ entry.asFlatList(bucket);
265
+ }
266
+ const result = [];
267
+ const { hasFileIcons } = this._themeService.getFileIconTheme();
268
+ for (const element of bucket) {
269
+ const useFileIcon = hasFileIcons && !element.symbolKind;
270
+ result.push({
271
+ element,
272
+ label: useFileIcon ? element.label : `$(${element.icon.id}) ${element.label}`,
273
+ ariaLabel: element.label,
274
+ iconClasses: useFileIcon ? getIconClassesForLanguageId(element.cell.language ?? '') : undefined,
275
+ });
276
+ }
277
+ return result;
278
+ }
279
+ };
280
+ NotebookQuickPickProvider = ( __decorate([
281
+ ( __param(1, IThemeService))
282
+ ], NotebookQuickPickProvider));
283
+ class NotebookComparator {
284
+ constructor() {
285
+ this._collator = new WindowIdleValue(mainWindow, () => new Intl.Collator(undefined, { numeric: true }));
286
+ }
287
+ compareByPosition(a, b) {
288
+ return a.index - b.index;
289
+ }
290
+ compareByType(a, b) {
291
+ return a.cell.cellKind - b.cell.cellKind || this._collator.value.compare(a.label, b.label);
292
+ }
293
+ compareByName(a, b) {
294
+ return this._collator.value.compare(a.label, b.label);
295
+ }
296
+ }
297
+ let NotebookCellOutline = NotebookCellOutline_1 = class NotebookCellOutline {
298
+ get entries() {
299
+ return this._outlineProvider?.entries ?? [];
300
+ }
301
+ get activeElement() {
302
+ return this._outlineProvider?.activeElement;
303
+ }
304
+ constructor(_editor, _target, instantiationService, _editorService, _configurationService) {
305
+ this._editor = _editor;
306
+ this._editorService = _editorService;
307
+ this._dispoables = ( new DisposableStore());
308
+ this._onDidChange = ( new Emitter());
309
+ this.onDidChange = this._onDidChange.event;
310
+ this._entriesDisposables = ( new DisposableStore());
311
+ this.outlineKind = 'notebookCells';
312
+ this._localDisposables = ( new DisposableStore());
313
+ const installSelectionListener = () => {
314
+ const notebookEditor = _editor.getControl();
315
+ if (!notebookEditor?.hasModel()) {
316
+ this._outlineProvider?.dispose();
317
+ this._outlineProvider = undefined;
318
+ this._localDisposables.clear();
319
+ }
320
+ else {
321
+ this._outlineProvider?.dispose();
322
+ this._localDisposables.clear();
323
+ this._outlineProvider = instantiationService.createInstance(NotebookCellOutlineProvider, notebookEditor, _target);
324
+ this._localDisposables.add(this._outlineProvider.onDidChange(e => {
325
+ this._onDidChange.fire(e);
326
+ }));
327
+ }
328
+ };
329
+ this._dispoables.add(_editor.onDidChangeModel(() => {
330
+ installSelectionListener();
331
+ }));
332
+ installSelectionListener();
333
+ const treeDataSource = {
334
+ getChildren: parent => {
335
+ return this.getChildren(parent, _configurationService);
336
+ }
337
+ };
338
+ const delegate = ( new NotebookOutlineVirtualDelegate());
339
+ const renderers = [instantiationService.createInstance(NotebookOutlineRenderer, this._editor.getControl(), _target)];
340
+ const comparator = ( new NotebookComparator());
341
+ const options = {
342
+ collapseByDefault: _target === 2 || ((_target === 1 && _configurationService.getValue("outline.collapseItems" ) === "alwaysCollapse") ),
343
+ expandOnlyOnTwistieClick: true,
344
+ multipleSelectionSupport: false,
345
+ accessibilityProvider: ( new NotebookOutlineAccessibility()),
346
+ identityProvider: { getId: element => ( element.cell.uri.toString()) },
347
+ keyboardNavigationLabelProvider: ( new NotebookNavigationLabelProvider())
348
+ };
349
+ this.config = {
350
+ breadcrumbsDataSource: {
351
+ getBreadcrumbElements: () => {
352
+ const result = [];
353
+ let candidate = this.activeElement;
354
+ while (candidate) {
355
+ result.unshift(candidate);
356
+ candidate = candidate.parent;
357
+ }
358
+ return result;
359
+ }
360
+ },
361
+ quickPickDataSource: instantiationService.createInstance(NotebookQuickPickProvider, () => (this._outlineProvider?.entries ?? [])),
362
+ treeDataSource,
363
+ delegate,
364
+ renderers,
365
+ comparator,
366
+ options
367
+ };
368
+ }
369
+ *getChildren(parent, configurationService) {
370
+ const showCodeCells = configurationService.getValue(NotebookSetting.outlineShowCodeCells);
371
+ const showCodeCellSymbols = configurationService.getValue(NotebookSetting.outlineShowCodeCellSymbols);
372
+ const showMarkdownHeadersOnly = configurationService.getValue(NotebookSetting.outlineShowMarkdownHeadersOnly);
373
+ for (const entry of parent instanceof NotebookCellOutline_1 ? (this._outlineProvider?.entries ?? []) : parent.children) {
374
+ if (entry.cell.cellKind === CellKind.Markup) {
375
+ if (!showMarkdownHeadersOnly) {
376
+ yield entry;
377
+ }
378
+ else if (entry.level < 7) {
379
+ yield entry;
380
+ }
381
+ }
382
+ else if (showCodeCells && entry.cell.cellKind === CellKind.Code) {
383
+ if (showCodeCellSymbols) {
384
+ yield entry;
385
+ }
386
+ else if (entry.level === 7) {
387
+ yield entry;
388
+ }
389
+ }
390
+ }
391
+ }
392
+ async setFullSymbols(cancelToken) {
393
+ await this._outlineProvider?.setFullSymbols(cancelToken);
394
+ }
395
+ get uri() {
396
+ return this._outlineProvider?.uri;
397
+ }
398
+ get isEmpty() {
399
+ return this._outlineProvider?.isEmpty ?? true;
400
+ }
401
+ async reveal(entry, options, sideBySide) {
402
+ await this._editorService.openEditor({
403
+ resource: entry.cell.uri,
404
+ options: {
405
+ ...options,
406
+ override: this._editor.input?.editorId,
407
+ cellRevealType: 5 ,
408
+ selection: entry.position
409
+ },
410
+ }, sideBySide ? SIDE_GROUP : undefined);
411
+ }
412
+ preview(entry) {
413
+ const widget = this._editor.getControl();
414
+ if (!widget) {
415
+ return Disposable.None;
416
+ }
417
+ if (entry.range) {
418
+ const range = Range.lift(entry.range);
419
+ widget.revealRangeInCenterIfOutsideViewportAsync(entry.cell, range);
420
+ }
421
+ else {
422
+ widget.revealInCenterIfOutsideViewport(entry.cell);
423
+ }
424
+ const ids = widget.deltaCellDecorations([], [{
425
+ handle: entry.cell.handle,
426
+ options: { className: 'nb-symbolHighlight', outputClassName: 'nb-symbolHighlight' }
427
+ }]);
428
+ let editorDecorations;
429
+ widget.changeModelDecorations(accessor => {
430
+ if (entry.range) {
431
+ const decorations = [
432
+ {
433
+ range: entry.range, options: {
434
+ description: 'document-symbols-outline-range-highlight',
435
+ className: 'rangeHighlight',
436
+ isWholeLine: true
437
+ }
438
+ }
439
+ ];
440
+ const deltaDecoration = {
441
+ ownerId: entry.cell.handle,
442
+ decorations: decorations
443
+ };
444
+ editorDecorations = accessor.deltaDecorations([], [deltaDecoration]);
445
+ }
446
+ });
447
+ return toDisposable(() => {
448
+ widget.deltaCellDecorations(ids, []);
449
+ if (editorDecorations?.length) {
450
+ widget.changeModelDecorations(accessor => {
451
+ accessor.deltaDecorations(editorDecorations, []);
452
+ });
453
+ }
454
+ });
455
+ }
456
+ captureViewState() {
457
+ const widget = this._editor.getControl();
458
+ const viewState = widget?.getEditorViewState();
459
+ return toDisposable(() => {
460
+ if (viewState) {
461
+ widget?.restoreListViewState(viewState);
462
+ }
463
+ });
464
+ }
465
+ dispose() {
466
+ this._onDidChange.dispose();
467
+ this._dispoables.dispose();
468
+ this._entriesDisposables.dispose();
469
+ this._outlineProvider?.dispose();
470
+ this._localDisposables.dispose();
471
+ }
472
+ };
473
+ NotebookCellOutline = NotebookCellOutline_1 = ( __decorate([
474
+ ( __param(2, IInstantiationService)),
475
+ ( __param(3, IEditorService)),
476
+ ( __param(4, IConfigurationService))
477
+ ], NotebookCellOutline));
478
+ let NotebookOutlineCreator = class NotebookOutlineCreator {
479
+ constructor(outlineService, _instantiationService, _configurationService) {
480
+ this._instantiationService = _instantiationService;
481
+ this._configurationService = _configurationService;
482
+ const reg = outlineService.registerOutlineCreator(this);
483
+ this.dispose = () => reg.dispose();
484
+ }
485
+ matches(candidate) {
486
+ return candidate.getId() === NotebookEditor.ID;
487
+ }
488
+ async createOutline(editor, target, cancelToken) {
489
+ const outline = this._instantiationService.createInstance(NotebookCellOutline, editor, target);
490
+ const showAllGotoSymbols = this._configurationService.getValue(NotebookSetting.gotoSymbolsAllSymbols);
491
+ const showAllOutlineSymbols = this._configurationService.getValue(NotebookSetting.outlineShowCodeCellSymbols);
492
+ if (target === 4 && showAllGotoSymbols) {
493
+ await outline.setFullSymbols(cancelToken);
494
+ }
495
+ else if (target === 1 && showAllOutlineSymbols) {
496
+ await outline.setFullSymbols(cancelToken);
497
+ }
498
+ return outline;
499
+ }
500
+ };
501
+ NotebookOutlineCreator = ( __decorate([
502
+ ( __param(0, IOutlineService)),
503
+ ( __param(1, IInstantiationService)),
504
+ ( __param(2, IConfigurationService))
505
+ ], NotebookOutlineCreator));
506
+ const NotebookOutlineContext = {
507
+ CellKind: ( new RawContextKey('notebookCellKind', undefined)),
508
+ CellHasChildren: ( new RawContextKey('notebookCellHasChildren', false)),
509
+ CellHasHeader: ( new RawContextKey('notebookCellHasHeader', false)),
510
+ CellFoldingState: ( new RawContextKey('notebookCellFoldingState', 0 )),
511
+ OutlineElementTarget: ( new RawContextKey('notebookOutlineElementTarget', undefined)),
512
+ };
513
+ ( Registry.as(Extensions.Workbench)).registerWorkbenchContribution(NotebookOutlineCreator, 4 );
514
+ ( Registry.as(Extensions$1.Configuration)).registerConfiguration({
515
+ id: 'notebook',
516
+ order: 100,
517
+ type: 'object',
518
+ 'properties': {
519
+ [NotebookSetting.outlineShowMarkdownHeadersOnly]: {
520
+ type: 'boolean',
521
+ default: true,
522
+ markdownDescription: ( localizeWithPath(
523
+ 'vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline',
524
+ 'outline.showMarkdownHeadersOnly',
525
+ "When enabled, notebook outline will show only markdown cells containing a header."
526
+ ))
527
+ },
528
+ [NotebookSetting.outlineShowCodeCells]: {
529
+ type: 'boolean',
530
+ default: false,
531
+ markdownDescription: ( localizeWithPath(
532
+ 'vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline',
533
+ 'outline.showCodeCells',
534
+ "When enabled, notebook outline shows code cells."
535
+ ))
536
+ },
537
+ [NotebookSetting.outlineShowCodeCellSymbols]: {
538
+ type: 'boolean',
539
+ default: true,
540
+ markdownDescription: ( localizeWithPath(
541
+ 'vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline',
542
+ 'outline.showCodeCellSymbols',
543
+ "When enabled, notebook outline shows code cell symbols. Relies on `notebook.outline.showCodeCells` being enabled."
544
+ ))
545
+ },
546
+ [NotebookSetting.breadcrumbsShowCodeCells]: {
547
+ type: 'boolean',
548
+ default: true,
549
+ markdownDescription: ( localizeWithPath(
550
+ 'vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline',
551
+ 'breadcrumbs.showCodeCells',
552
+ "When enabled, notebook breadcrumbs contain code cells."
553
+ ))
554
+ },
555
+ [NotebookSetting.gotoSymbolsAllSymbols]: {
556
+ type: 'boolean',
557
+ default: true,
558
+ markdownDescription: ( localizeWithPath(
559
+ 'vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline',
560
+ 'notebook.gotoSymbols.showAllSymbols',
561
+ "When enabled, the Go to Symbol Quick Pick will display full code symbols from the notebook, as well as Markdown headers."
562
+ ))
563
+ },
564
+ }
565
+ });
566
+ MenuRegistry.appendMenuItem(MenuId.ViewTitle, {
567
+ submenu: MenuId.NotebookOutlineFilter,
568
+ title: ( localizeWithPath(
569
+ 'vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline',
570
+ 'filter',
571
+ "Filter Entries"
572
+ )),
573
+ icon: Codicon.filter,
574
+ group: 'navigation',
575
+ order: -1,
576
+ when: ( ContextKeyExpr.and(( ContextKeyExpr.equals('view', IOutlinePane.Id)), NOTEBOOK_IS_ACTIVE_EDITOR)),
577
+ });
578
+ registerAction2(class ToggleShowMarkdownHeadersOnly extends Action2 {
579
+ constructor() {
580
+ super({
581
+ id: 'notebook.outline.toggleShowMarkdownHeadersOnly',
582
+ title: ( localizeWithPath(
583
+ 'vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline',
584
+ 'toggleShowMarkdownHeadersOnly',
585
+ "Markdown Headers Only"
586
+ )),
587
+ f1: false,
588
+ toggled: {
589
+ condition: ( ContextKeyExpr.equals('config.notebook.outline.showMarkdownHeadersOnly', true))
590
+ },
591
+ menu: {
592
+ id: MenuId.NotebookOutlineFilter,
593
+ group: '0_markdown_cells',
594
+ }
595
+ });
596
+ }
597
+ run(accessor, ...args) {
598
+ const configurationService = accessor.get(IConfigurationService);
599
+ const showMarkdownHeadersOnly = configurationService.getValue(NotebookSetting.outlineShowMarkdownHeadersOnly);
600
+ configurationService.updateValue(NotebookSetting.outlineShowMarkdownHeadersOnly, !showMarkdownHeadersOnly);
601
+ }
602
+ });
603
+ registerAction2(class ToggleCodeCellEntries extends Action2 {
604
+ constructor() {
605
+ super({
606
+ id: 'notebook.outline.toggleCodeCells',
607
+ title: ( localizeWithPath(
608
+ 'vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline',
609
+ 'toggleCodeCells',
610
+ "Code Cells"
611
+ )),
612
+ f1: false,
613
+ toggled: {
614
+ condition: ( ContextKeyExpr.equals('config.notebook.outline.showCodeCells', true))
615
+ },
616
+ menu: {
617
+ id: MenuId.NotebookOutlineFilter,
618
+ order: 1,
619
+ group: '1_code_cells',
620
+ }
621
+ });
622
+ }
623
+ run(accessor, ...args) {
624
+ const configurationService = accessor.get(IConfigurationService);
625
+ const showCodeCells = configurationService.getValue(NotebookSetting.outlineShowCodeCells);
626
+ configurationService.updateValue(NotebookSetting.outlineShowCodeCells, !showCodeCells);
627
+ }
628
+ });
629
+ registerAction2(class ToggleCodeCellSymbolEntries extends Action2 {
630
+ constructor() {
631
+ super({
632
+ id: 'notebook.outline.toggleCodeCellSymbols',
633
+ title: ( localizeWithPath(
634
+ 'vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline',
635
+ 'toggleCodeCellSymbols',
636
+ "Code Cell Symbols"
637
+ )),
638
+ f1: false,
639
+ toggled: {
640
+ condition: ( ContextKeyExpr.equals('config.notebook.outline.showCodeCellSymbols', true))
641
+ },
642
+ menu: {
643
+ id: MenuId.NotebookOutlineFilter,
644
+ order: 2,
645
+ group: '1_code_cells',
646
+ }
647
+ });
648
+ }
649
+ run(accessor, ...args) {
650
+ const configurationService = accessor.get(IConfigurationService);
651
+ const showCodeCellSymbols = configurationService.getValue(NotebookSetting.outlineShowCodeCellSymbols);
652
+ configurationService.updateValue(NotebookSetting.outlineShowCodeCellSymbols, !showCodeCellSymbols);
653
+ }
654
+ });
655
+
656
+ export { NotebookCellOutline, NotebookOutlineContext, NotebookOutlineCreator };