@codingame/monaco-vscode-notebook-service-override 5.2.0 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/package.json +2 -2
  2. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +26 -22
  3. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +549 -0
  4. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticEditorContrib.js +133 -0
  5. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticsActions.js +58 -0
  6. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/diagnosticCellStatusBarContrib.js +65 -0
  7. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +6 -5
  8. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +29 -27
  9. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.js +2 -1
  10. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookCellPausing.js +2 -1
  11. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.js +6 -6
  12. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +10 -8
  13. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +27 -18
  14. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +32 -24
  15. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +5 -3
  16. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/kernelDetection/notebookKernelDetection.js +2 -1
  17. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +2 -2
  18. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +42 -40
  19. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +77 -57
  20. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +184 -99
  21. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +2 -1
  22. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +2 -2
  23. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.js +2 -2
  24. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +56 -112
  25. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.js +31 -0
  26. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +10 -14
  27. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +6 -4
  28. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +3 -2
  29. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.js +10 -8
  30. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +7 -6
  31. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +6 -4
  32. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.js +21 -15
  33. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +8 -6
  34. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +6 -5
  35. package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +88 -86
  36. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibilityHelp.js +94 -0
  37. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibleView.js +73 -0
  38. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +3 -2
  39. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +6 -6
  40. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +7 -6
  41. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +5 -3
  42. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +6 -3
  43. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +44 -17
  44. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.js +34 -0
  45. package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.js +5 -3
  46. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +67 -53
  47. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +11 -3
  48. package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.js +11 -10
  49. package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookSimpleWorker.js +3 -2
  50. package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +5 -3
  51. package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +15 -12
  52. package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.js +4 -2
  53. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibility.js +0 -156
@@ -26,10 +26,13 @@ import 'vscode/vscode/vs/platform/theme/common/colors/quickpickColors';
26
26
  import 'vscode/vscode/vs/platform/theme/common/colors/searchColors';
27
27
  import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService.service';
28
28
  import { Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
29
+ import { CellFoldingState, CellRevealType } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
29
30
  import { NotebookEditor } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookEditor';
30
31
  import { CellKind, NotebookSetting } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
31
32
  import { SIDE_GROUP } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
32
33
  import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
34
+ import { LifecyclePhase } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle';
35
+ import { OutlineConfigKeys, OutlineTarget, OutlineConfigCollapseItemsValues } from 'vscode/vscode/vs/workbench/services/outline/browser/outline';
33
36
  import { IOutlineService } from 'vscode/vscode/vs/workbench/services/outline/browser/outline.service';
34
37
  import { Range } from 'vscode/vscode/vs/editor/common/core/range';
35
38
  import { mainWindow } from 'vscode/vscode/vs/base/browser/window';
@@ -43,9 +46,9 @@ import { disposableTimeout } from 'vscode/vscode/vs/base/common/async';
43
46
  import { IOutlinePane } from 'vscode/vscode/vs/workbench/contrib/outline/browser/outline';
44
47
  import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
45
48
  import { NOTEBOOK_IS_ACTIVE_EDITOR } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookContextKeys';
49
+ import { NotebookOutlineConstants } from '../../viewModel/notebookOutlineEntryFactory.js';
46
50
  import { INotebookCellOutlineProviderFactory } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineProviderFactory.service';
47
51
 
48
- var NotebookCellOutline_1;
49
52
  const _moduleId = "vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline";
50
53
  class NotebookOutlineTemplate {
51
54
  static { this.templateId = 'NotebookOutlineRenderer'; }
@@ -117,7 +120,7 @@ let NotebookOutlineRenderer = class NotebookOutlineRenderer {
117
120
  template.decoration.innerText = '';
118
121
  if (markerInfo) {
119
122
  const problem = this._configurationService.getValue('problems.visibility');
120
- const useBadges = this._configurationService.getValue("outline.problems.badges" );
123
+ const useBadges = this._configurationService.getValue(OutlineConfigKeys.problemsBadges);
121
124
  if (!useBadges || !problem) {
122
125
  template.decoration.classList.remove('bubble');
123
126
  template.decoration.innerText = '';
@@ -134,7 +137,7 @@ let NotebookOutlineRenderer = class NotebookOutlineRenderer {
134
137
  if (problem === undefined) {
135
138
  return;
136
139
  }
137
- const useColors = this._configurationService.getValue("outline.problems.colors" );
140
+ const useColors = this._configurationService.getValue(OutlineConfigKeys.problemsColors);
138
141
  if (!useColors || !problem) {
139
142
  template.container.style.removeProperty('--outline-element-color');
140
143
  template.decoration.style.setProperty('--outline-element-color', color?.toString() ?? 'inherit');
@@ -143,7 +146,7 @@ let NotebookOutlineRenderer = class NotebookOutlineRenderer {
143
146
  template.container.style.setProperty('--outline-element-color', color?.toString() ?? 'inherit');
144
147
  }
145
148
  }
146
- if (this._target === 1 ) {
149
+ if (this._target === OutlineTarget.OutlinePane) {
147
150
  const nbCell = node.element.cell;
148
151
  const nbViewModel = this._editor?.getViewModel();
149
152
  if (!nbViewModel) {
@@ -154,7 +157,7 @@ let NotebookOutlineRenderer = class NotebookOutlineRenderer {
154
157
  const scopedContextKeyService = template.elementDisposables.add(this._contextKeyService.createScoped(template.container));
155
158
  NotebookOutlineContext.CellKind.bindTo(scopedContextKeyService).set(isCodeCell ? CellKind.Code : CellKind.Markup);
156
159
  NotebookOutlineContext.CellHasChildren.bindTo(scopedContextKeyService).set(length > 0);
157
- NotebookOutlineContext.CellHasHeader.bindTo(scopedContextKeyService).set(node.element.level !== 7 );
160
+ NotebookOutlineContext.CellHasHeader.bindTo(scopedContextKeyService).set(node.element.level !== NotebookOutlineConstants.NonHeaderOutlineLevel);
158
161
  NotebookOutlineContext.OutlineElementTarget.bindTo(scopedContextKeyService).set(this._target);
159
162
  this.setupFolding(isCodeCell, nbViewModel, scopedContextKeyService, template, nbCell);
160
163
  const outlineEntryToolbar = template.elementDisposables.add(( (new ToolBar(template.actionMenu, this._contextMenuService, {
@@ -181,7 +184,7 @@ let NotebookOutlineRenderer = class NotebookOutlineRenderer {
181
184
  clearNode(templateData.actionMenu);
182
185
  }
183
186
  setupFolding(isCodeCell, nbViewModel, scopedContextKeyService, template, nbCell) {
184
- const foldingState = isCodeCell ? 0 : (nbCell.foldingState);
187
+ const foldingState = isCodeCell ? CellFoldingState.None : (nbCell.foldingState);
185
188
  const foldingStateCtx = NotebookOutlineContext.CellFoldingState.bindTo(scopedContextKeyService);
186
189
  foldingStateCtx.set(foldingState);
187
190
  if (!isCodeCell) {
@@ -274,7 +277,7 @@ let NotebookQuickPickProvider = class NotebookQuickPickProvider {
274
277
  const { hasFileIcons } = this._themeService.getFileIconTheme();
275
278
  const showSymbols = this._configurationService.getValue(NotebookSetting.gotoSymbolsAllSymbols);
276
279
  const isSymbol = (element) => !!element.symbolKind;
277
- const isCodeCell = (element) => ((element.cell.cellKind === CellKind.Code && element.level === 7) );
280
+ const isCodeCell = (element) => (element.cell.cellKind === CellKind.Code && element.level === NotebookOutlineConstants.NonHeaderOutlineLevel);
278
281
  for (let i = 0; i < bucket.length; i++) {
279
282
  const element = bucket[i];
280
283
  const nextElement = bucket[i + 1];
@@ -302,6 +305,61 @@ NotebookQuickPickProvider = ( (__decorate([
302
305
  ( (__param(1, IConfigurationService))),
303
306
  ( (__param(2, IThemeService)))
304
307
  ], NotebookQuickPickProvider)));
308
+ let NotebookOutlinePaneProvider = class NotebookOutlinePaneProvider {
309
+ constructor(_getEntries, _configurationService) {
310
+ this._getEntries = _getEntries;
311
+ this._configurationService = _configurationService;
312
+ }
313
+ *getChildren(element) {
314
+ const showCodeCells = this._configurationService.getValue(NotebookSetting.outlineShowCodeCells);
315
+ const showCodeCellSymbols = this._configurationService.getValue(NotebookSetting.outlineShowCodeCellSymbols);
316
+ const showMarkdownHeadersOnly = this._configurationService.getValue(NotebookSetting.outlineShowMarkdownHeadersOnly);
317
+ const isOutline = element instanceof NotebookCellOutline;
318
+ const entries = isOutline ? this._getEntries() : element.children;
319
+ for (const entry of entries) {
320
+ if (entry.cell.cellKind === CellKind.Markup) {
321
+ if (!showMarkdownHeadersOnly) {
322
+ yield entry;
323
+ }
324
+ else if (entry.level < NotebookOutlineConstants.NonHeaderOutlineLevel) {
325
+ yield entry;
326
+ }
327
+ }
328
+ else if (showCodeCells && entry.cell.cellKind === CellKind.Code) {
329
+ if (showCodeCellSymbols) {
330
+ yield entry;
331
+ }
332
+ else if (entry.level === NotebookOutlineConstants.NonHeaderOutlineLevel) {
333
+ yield entry;
334
+ }
335
+ }
336
+ }
337
+ }
338
+ };
339
+ NotebookOutlinePaneProvider = ( (__decorate([
340
+ ( (__param(1, IConfigurationService)))
341
+ ], NotebookOutlinePaneProvider)));
342
+ let NotebookBreadcrumbsProvider = class NotebookBreadcrumbsProvider {
343
+ constructor(_getActiveElement, _configurationService) {
344
+ this._getActiveElement = _getActiveElement;
345
+ this._configurationService = _configurationService;
346
+ }
347
+ getBreadcrumbElements() {
348
+ const result = [];
349
+ const showCodeCells = this._configurationService.getValue(NotebookSetting.breadcrumbsShowCodeCells);
350
+ let candidate = this._getActiveElement();
351
+ while (candidate) {
352
+ if (showCodeCells || candidate.cell.cellKind !== CellKind.Code) {
353
+ result.unshift(candidate);
354
+ }
355
+ candidate = candidate.parent;
356
+ }
357
+ return result;
358
+ }
359
+ };
360
+ NotebookBreadcrumbsProvider = ( (__decorate([
361
+ ( (__param(1, IConfigurationService)))
362
+ ], NotebookBreadcrumbsProvider)));
305
363
  class NotebookComparator {
306
364
  constructor() {
307
365
  this._collator = new WindowIdleValue(mainWindow, () => new Intl.Collator(undefined, { numeric: true }));
@@ -316,7 +374,7 @@ class NotebookComparator {
316
374
  return this._collator.value.compare(a.label, b.label);
317
375
  }
318
376
  }
319
- let NotebookCellOutline = NotebookCellOutline_1 = class NotebookCellOutline {
377
+ let NotebookCellOutline = class NotebookCellOutline {
320
378
  get entries() {
321
379
  return this._outlineProviderReference?.object?.entries ?? [];
322
380
  }
@@ -352,16 +410,11 @@ let NotebookCellOutline = NotebookCellOutline_1 = class NotebookCellOutline {
352
410
  installSelectionListener();
353
411
  }));
354
412
  installSelectionListener();
355
- const treeDataSource = {
356
- getChildren: parent => {
357
- return this.getChildren(parent, _configurationService);
358
- }
359
- };
360
413
  const delegate = ( (new NotebookOutlineVirtualDelegate()));
361
414
  const renderers = [instantiationService.createInstance(NotebookOutlineRenderer, this._editor.getControl(), _target)];
362
415
  const comparator = ( (new NotebookComparator()));
363
416
  const options = {
364
- collapseByDefault: _target === 2 || ((_target === 1 && _configurationService.getValue("outline.collapseItems" ) === "alwaysCollapse") ),
417
+ collapseByDefault: _target === OutlineTarget.Breadcrumbs || (_target === OutlineTarget.OutlinePane && _configurationService.getValue(OutlineConfigKeys.collapseItems) === OutlineConfigCollapseItemsValues.Collapsed),
365
418
  expandOnlyOnTwistieClick: true,
366
419
  multipleSelectionSupport: false,
367
420
  accessibilityProvider: ( (new NotebookOutlineAccessibility())),
@@ -369,48 +422,15 @@ let NotebookCellOutline = NotebookCellOutline_1 = class NotebookCellOutline {
369
422
  keyboardNavigationLabelProvider: ( (new NotebookNavigationLabelProvider()))
370
423
  };
371
424
  this.config = {
372
- breadcrumbsDataSource: {
373
- getBreadcrumbElements: () => {
374
- const result = [];
375
- let candidate = this.activeElement;
376
- while (candidate) {
377
- result.unshift(candidate);
378
- candidate = candidate.parent;
379
- }
380
- return result;
381
- }
382
- },
383
- quickPickDataSource: instantiationService.createInstance(NotebookQuickPickProvider, () => (this._outlineProviderReference?.object?.entries ?? [])),
384
- treeDataSource,
425
+ treeDataSource: instantiationService.createInstance(NotebookOutlinePaneProvider, () => (this.entries ?? [])),
426
+ quickPickDataSource: instantiationService.createInstance(NotebookQuickPickProvider, () => (this.entries ?? [])),
427
+ breadcrumbsDataSource: instantiationService.createInstance(NotebookBreadcrumbsProvider, () => (this.activeElement)),
385
428
  delegate,
386
429
  renderers,
387
430
  comparator,
388
431
  options
389
432
  };
390
433
  }
391
- *getChildren(parent, configurationService) {
392
- const showCodeCells = configurationService.getValue(NotebookSetting.outlineShowCodeCells);
393
- const showCodeCellSymbols = configurationService.getValue(NotebookSetting.outlineShowCodeCellSymbols);
394
- const showMarkdownHeadersOnly = configurationService.getValue(NotebookSetting.outlineShowMarkdownHeadersOnly);
395
- for (const entry of parent instanceof NotebookCellOutline_1 ? (this._outlineProviderReference?.object?.entries ?? []) : parent.children) {
396
- if (entry.cell.cellKind === CellKind.Markup) {
397
- if (!showMarkdownHeadersOnly) {
398
- yield entry;
399
- }
400
- else if (entry.level < 7 ) {
401
- yield entry;
402
- }
403
- }
404
- else if (showCodeCells && entry.cell.cellKind === CellKind.Code) {
405
- if (showCodeCellSymbols) {
406
- yield entry;
407
- }
408
- else if (entry.level === 7 ) {
409
- yield entry;
410
- }
411
- }
412
- }
413
- }
414
434
  async setFullSymbols(cancelToken) {
415
435
  await this._outlineProviderReference?.object?.setFullSymbols(cancelToken);
416
436
  }
@@ -426,7 +446,7 @@ let NotebookCellOutline = NotebookCellOutline_1 = class NotebookCellOutline {
426
446
  options: {
427
447
  ...options,
428
448
  override: this._editor.input?.editorId,
429
- cellRevealType: 5 ,
449
+ cellRevealType: CellRevealType.NearTopIfOutsideViewport,
430
450
  selection: entry.position
431
451
  },
432
452
  }, sideBySide ? SIDE_GROUP : undefined);
@@ -492,7 +512,7 @@ let NotebookCellOutline = NotebookCellOutline_1 = class NotebookCellOutline {
492
512
  this._localDisposables.dispose();
493
513
  }
494
514
  };
495
- NotebookCellOutline = NotebookCellOutline_1 = ( (__decorate([
515
+ NotebookCellOutline = ( (__decorate([
496
516
  ( (__param(2, IInstantiationService))),
497
517
  ( (__param(3, IEditorService))),
498
518
  ( (__param(4, IConfigurationService)))
@@ -511,10 +531,10 @@ let NotebookOutlineCreator = class NotebookOutlineCreator {
511
531
  const outline = this._instantiationService.createInstance(NotebookCellOutline, editor, target);
512
532
  const showAllGotoSymbols = this._configurationService.getValue(NotebookSetting.gotoSymbolsAllSymbols);
513
533
  const showAllOutlineSymbols = this._configurationService.getValue(NotebookSetting.outlineShowCodeCellSymbols);
514
- if (target === 4 && showAllGotoSymbols) {
534
+ if (target === OutlineTarget.QuickPick && showAllGotoSymbols) {
515
535
  await outline.setFullSymbols(cancelToken);
516
536
  }
517
- else if (target === 1 && showAllOutlineSymbols) {
537
+ else if (target === OutlineTarget.OutlinePane && showAllOutlineSymbols) {
518
538
  void outline.setFullSymbols(cancelToken);
519
539
  }
520
540
  return outline;
@@ -529,10 +549,10 @@ const NotebookOutlineContext = {
529
549
  CellKind: ( (new RawContextKey('notebookCellKind', undefined))),
530
550
  CellHasChildren: ( (new RawContextKey('notebookCellHasChildren', false))),
531
551
  CellHasHeader: ( (new RawContextKey('notebookCellHasHeader', false))),
532
- CellFoldingState: ( (new RawContextKey('notebookCellFoldingState', 0 ))),
552
+ CellFoldingState: ( (new RawContextKey('notebookCellFoldingState', CellFoldingState.None))),
533
553
  OutlineElementTarget: ( (new RawContextKey('notebookOutlineElementTarget', undefined))),
534
554
  };
535
- ( (Registry.as(Extensions.Workbench))).registerWorkbenchContribution(NotebookOutlineCreator, 4 );
555
+ ( (Registry.as(Extensions.Workbench))).registerWorkbenchContribution(NotebookOutlineCreator, LifecyclePhase.Eventually);
536
556
  ( (Registry.as(Extensions$1.Configuration))).registerConfiguration({
537
557
  id: 'notebook',
538
558
  order: 100,
@@ -654,4 +674,4 @@ registerAction2(class ToggleCodeCellSymbolEntries extends Action2 {
654
674
  }
655
675
  });
656
676
 
657
- export { NotebookCellOutline, NotebookOutlineContext, NotebookOutlineCreator };
677
+ export { NotebookBreadcrumbsProvider, NotebookCellOutline, NotebookOutlineContext, NotebookOutlineCreator, NotebookOutlinePaneProvider, NotebookQuickPickProvider };