@codingame/monaco-vscode-api 2.1.3 → 2.2.0-next.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 (191) hide show
  1. package/README.md +10 -0
  2. package/contributions.js +1 -0
  3. package/extensions.d.ts +6 -3
  4. package/extensions.js +18 -7
  5. package/lifecycle.js +11 -3
  6. package/missing-services.js +55 -10
  7. package/monaco.js +7 -3
  8. package/package.json +8 -8
  9. package/service-override/tools/editor.js +3 -1
  10. package/service-override/tools/views.d.ts +98 -0
  11. package/service-override/tools/views.js +249 -0
  12. package/services.d.ts +4 -2
  13. package/services.js +11 -9
  14. package/vscode/src/vs/base/browser/deviceAccess.js +60 -0
  15. package/vscode/src/vs/base/browser/dom.js +18 -1
  16. package/vscode/src/vs/base/browser/ui/centered/centeredViewLayout.js +178 -0
  17. package/vscode/src/vs/base/browser/ui/grid/grid.js +492 -0
  18. package/vscode/src/vs/base/browser/ui/grid/gridview.css.js +4 -0
  19. package/vscode/src/vs/base/browser/ui/grid/gridview.d.ts +1 -0
  20. package/vscode/src/vs/base/browser/ui/grid/gridview.js +1109 -0
  21. package/vscode/src/vs/base/browser/ui/sash/sash.js +9 -1
  22. package/vscode/src/vs/base/browser/ui/splitview/splitview.d.ts +348 -1
  23. package/vscode/src/vs/base/common/async.js +46 -2
  24. package/vscode/src/vs/base/common/codicons.d.ts +579 -0
  25. package/vscode/src/vs/base/common/event.js +11 -2
  26. package/vscode/src/vs/base/common/keybindingParser.js +87 -0
  27. package/vscode/src/vs/base/common/network.js +1 -2
  28. package/vscode/src/vs/base/common/observableInternal/utils.js +1 -1
  29. package/vscode/src/vs/base/common/platform.js +2 -1
  30. package/vscode/src/vs/base/common/scrollable.d.ts +28 -0
  31. package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/colors.js +17 -0
  32. package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/diffEditorItemTemplate.js +214 -0
  33. package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/multiDiffEditorViewModel.js +84 -0
  34. package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/multiDiffEditorWidget.js +54 -0
  35. package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/multiDiffEditorWidgetImpl.js +324 -0
  36. package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/objectPool.js +46 -0
  37. package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/style.css.js +4 -0
  38. package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/utils.js +11 -0
  39. package/vscode/src/vs/platform/keyboardLayout/common/keyboardLayout.js +61 -1
  40. package/vscode/src/vs/platform/languagePacks/common/localizedStrings.js +10 -0
  41. package/vscode/src/vs/platform/log/browser/log.js +24 -0
  42. package/vscode/src/vs/platform/product/common/product.js +1 -2
  43. package/vscode/src/vs/platform/userDataSync/common/abstractSynchronizer.js +772 -0
  44. package/vscode/src/vs/platform/userDataSync/common/userDataSyncStoreService.js +551 -0
  45. package/vscode/src/vs/platform/webview/common/mimeTypes.js +22 -0
  46. package/vscode/src/vs/platform/webview/common/webviewPortMapping.js +62 -0
  47. package/vscode/src/vs/workbench/api/browser/viewsExtensionPoint.js +788 -0
  48. package/vscode/src/vs/workbench/browser/actions/listCommands.js +763 -0
  49. package/vscode/src/vs/workbench/browser/layout.d.ts +26 -0
  50. package/vscode/src/vs/workbench/browser/media/style.css.js +1 -1
  51. package/vscode/src/vs/workbench/browser/parts/activitybar/activitybarPart.js +610 -0
  52. package/vscode/src/vs/workbench/browser/parts/activitybar/media/activityaction.css.js +4 -0
  53. package/vscode/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css.js +4 -0
  54. package/vscode/src/vs/workbench/browser/parts/auxiliarybar/auxiliaryBarPart.js +148 -0
  55. package/vscode/src/vs/workbench/browser/parts/auxiliarybar/media/auxiliaryBarPart.css.js +4 -0
  56. package/vscode/src/vs/workbench/browser/parts/compositeBar.js +603 -0
  57. package/vscode/src/vs/workbench/browser/parts/compositePart.js +333 -0
  58. package/vscode/src/vs/workbench/browser/parts/editor/auxiliaryEditorPart.js +221 -0
  59. package/vscode/src/vs/workbench/browser/parts/editor/editor.contribution.js +1406 -0
  60. package/vscode/src/vs/workbench/browser/parts/editor/editorConfiguration.js +184 -0
  61. package/vscode/src/vs/workbench/browser/parts/editor/editorDropTarget.js +509 -0
  62. package/vscode/src/vs/workbench/browser/parts/editor/editorPane.d.ts +112 -0
  63. package/vscode/src/vs/workbench/browser/parts/editor/editorPart.js +1018 -0
  64. package/vscode/src/vs/workbench/browser/parts/editor/editorParts.js +389 -0
  65. package/vscode/src/vs/workbench/browser/parts/editor/media/editordroptarget.css.js +4 -0
  66. package/vscode/src/vs/workbench/browser/parts/media/compositepart.css.js +4 -0
  67. package/vscode/src/vs/workbench/browser/parts/media/paneCompositePart.css.js +4 -0
  68. package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsActions.css.js +4 -0
  69. package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsCenter.css.js +4 -0
  70. package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsList.css.js +4 -0
  71. package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsToasts.css.js +4 -0
  72. package/vscode/src/vs/workbench/browser/parts/notifications/notificationsActions.js +213 -0
  73. package/vscode/src/vs/workbench/browser/parts/notifications/notificationsAlerts.js +73 -0
  74. package/vscode/src/vs/workbench/browser/parts/notifications/notificationsCenter.js +307 -0
  75. package/vscode/src/vs/workbench/browser/parts/notifications/notificationsList.js +226 -0
  76. package/vscode/src/vs/workbench/browser/parts/notifications/notificationsStatus.js +218 -0
  77. package/vscode/src/vs/workbench/browser/parts/notifications/notificationsToasts.js +433 -0
  78. package/vscode/src/vs/workbench/browser/parts/notifications/notificationsViewer.js +436 -0
  79. package/vscode/src/vs/workbench/browser/parts/paneCompositeBar.js +643 -0
  80. package/vscode/src/vs/workbench/browser/parts/paneCompositePart.js +377 -0
  81. package/vscode/src/vs/workbench/browser/parts/paneCompositePartService.js +66 -0
  82. package/vscode/src/vs/workbench/browser/parts/panel/panelPart.js +144 -0
  83. package/vscode/src/vs/workbench/browser/parts/sidebar/media/sidebarpart.css.js +4 -0
  84. package/vscode/src/vs/workbench/browser/parts/sidebar/sidebarPart.js +220 -0
  85. package/vscode/src/vs/workbench/browser/window.js +239 -5
  86. package/vscode/src/vs/workbench/common/configuration.js +11 -1
  87. package/vscode/src/vs/workbench/common/theme.js +3 -3
  88. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.js +298 -0
  89. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.js +363 -0
  90. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyTree.js +133 -0
  91. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/media/callHierarchy.css.js +4 -0
  92. package/vscode/src/vs/workbench/contrib/comments/browser/commentGlyphWidget.js +90 -0
  93. package/vscode/src/vs/workbench/contrib/comments/browser/commentMenus.js +43 -0
  94. package/vscode/src/vs/workbench/contrib/comments/browser/commentService.js +317 -2
  95. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadRangeDecorator.js +107 -0
  96. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.js +395 -0
  97. package/vscode/src/vs/workbench/contrib/comments/browser/comments.js +3 -0
  98. package/vscode/src/vs/workbench/contrib/comments/browser/commentsController.js +1277 -0
  99. package/vscode/src/vs/workbench/contrib/comments/browser/commentsFilterOptions.js +17 -0
  100. package/vscode/src/vs/workbench/contrib/comments/browser/commentsModel.js +123 -0
  101. package/vscode/src/vs/workbench/contrib/comments/browser/commentsTreeViewer.js +342 -0
  102. package/vscode/src/vs/workbench/contrib/comments/browser/commentsView.js +451 -0
  103. package/vscode/src/vs/workbench/contrib/comments/browser/commentsViewActions.js +176 -0
  104. package/vscode/src/vs/workbench/contrib/comments/browser/media/panel.css.js +4 -0
  105. package/vscode/src/vs/workbench/contrib/comments/common/commentModel.js +35 -0
  106. package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditor.contribution.js +16 -0
  107. package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditorInputFactory.js +143 -0
  108. package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditors.js +212 -0
  109. package/vscode/src/vs/workbench/contrib/customEditor/browser/media/customEditor.css.js +4 -0
  110. package/vscode/src/vs/workbench/contrib/customEditor/common/contributedCustomEditors.js +76 -0
  111. package/vscode/src/vs/workbench/contrib/customEditor/common/customEditorModelManager.js +61 -0
  112. package/vscode/src/vs/workbench/contrib/customEditor/common/extensionPoint.js +117 -0
  113. package/vscode/src/vs/workbench/contrib/editSessions/common/editSessions.js +62 -0
  114. package/vscode/src/vs/workbench/contrib/externalUriOpener/common/externalUriOpener.contribution.js +5 -0
  115. package/vscode/src/vs/workbench/contrib/files/browser/editors/binaryFileEditor.js +77 -0
  116. package/vscode/src/vs/workbench/contrib/files/browser/editors/fileEditorHandler.js +72 -0
  117. package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditor.js +254 -0
  118. package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditorTracker.js +97 -0
  119. package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.js +442 -0
  120. package/vscode/src/vs/workbench/contrib/files/browser/explorerService.js +430 -0
  121. package/vscode/src/vs/workbench/contrib/files/browser/fileActions.contribution.js +784 -0
  122. package/vscode/src/vs/workbench/contrib/files/browser/fileCommands.js +487 -0
  123. package/vscode/src/vs/workbench/contrib/files/browser/files.contribution.js +521 -0
  124. package/vscode/src/vs/workbench/contrib/files/browser/workspaceWatcher.js +150 -0
  125. package/vscode/src/vs/workbench/contrib/files/common/dirtyFilesIndicator.js +61 -0
  126. package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveDocumentService.js +25 -1
  127. package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveEditorInput.js +178 -0
  128. package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveHistoryService.js +49 -0
  129. package/vscode/src/vs/workbench/contrib/languageStatus/browser/languageStatus.contribution.js +408 -0
  130. package/vscode/src/vs/workbench/contrib/languageStatus/browser/media/languageStatus.css.js +4 -0
  131. package/vscode/src/vs/workbench/contrib/limitIndicator/browser/limitIndicator.contribution.js +145 -0
  132. package/vscode/src/vs/workbench/contrib/mappedEdits/common/mappedEdits.contribution.js +22 -0
  133. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/commands.js +691 -0
  134. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/devCommands.js +238 -0
  135. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditor.contribution.js +76 -0
  136. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorSerializer.js +40 -0
  137. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/colors.js +69 -0
  138. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/conflictActions.js +346 -0
  139. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editorGutter.js +96 -0
  140. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/baseCodeEditorView.js +144 -0
  141. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/codeEditorView.js +103 -0
  142. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/inputCodeEditorView.js +399 -0
  143. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/resultCodeEditorView.js +195 -0
  144. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/fixedZoneWidget.js +39 -0
  145. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/lineAlignment.js +126 -0
  146. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/media/mergeEditor.css.js +4 -0
  147. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/mergeEditor.js +611 -0
  148. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/scrollSynchronizer.js +156 -0
  149. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewModel.js +262 -0
  150. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewZones.js +171 -0
  151. package/vscode/src/vs/workbench/contrib/multiDiffEditor/browser/multiDiffSourceResolverService.js +41 -0
  152. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController.js +317 -0
  153. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/notebookVisibleCellObserver.js +56 -0
  154. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget.js +315 -0
  155. package/vscode/src/vs/workbench/contrib/preferences/browser/keyboardLayoutPicker.js +193 -0
  156. package/vscode/src/vs/workbench/contrib/preferences/common/preferences.js +2 -1
  157. package/vscode/src/vs/workbench/contrib/sash/browser/sash.contribution.js +37 -0
  158. package/vscode/src/vs/workbench/contrib/sash/browser/sash.js +39 -0
  159. package/vscode/src/vs/workbench/contrib/speech/common/speechService.js +138 -2
  160. package/vscode/src/vs/workbench/contrib/tags/browser/workspaceTagsService.js +12 -0
  161. package/vscode/src/vs/workbench/contrib/tags/common/workspaceTags.js +3 -0
  162. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/media/typeHierarchy.css.js +4 -0
  163. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchy.contribution.js +281 -0
  164. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyPeek.js +358 -0
  165. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyTree.js +131 -0
  166. package/vscode/src/vs/workbench/contrib/update/common/update.js +2 -0
  167. package/vscode/src/vs/workbench/contrib/webview/browser/overlayWebview.js +288 -0
  168. package/vscode/src/vs/workbench/contrib/webview/browser/resourceLoading.js +94 -0
  169. package/vscode/src/vs/workbench/contrib/webview/browser/themeing.js +86 -0
  170. package/vscode/src/vs/workbench/contrib/webview/browser/webview.contribution.js +77 -0
  171. package/vscode/src/vs/workbench/contrib/webview/browser/webviewElement.js +646 -0
  172. package/vscode/src/vs/workbench/contrib/webview/browser/webviewFindWidget.js +63 -0
  173. package/vscode/src/vs/workbench/contrib/webview/browser/webviewService.js +57 -0
  174. package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewCommands.js +140 -0
  175. package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewEditorInputSerializer.js +119 -0
  176. package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewPanel.contribution.js +67 -0
  177. package/vscode/src/vs/workbench/contrib/webviewView/browser/webviewViewPane.js +233 -0
  178. package/vscode/src/vs/workbench/services/activity/browser/activityService.js +143 -0
  179. package/vscode/src/vs/workbench/services/auxiliaryWindow/browser/auxiliaryWindowService.js +0 -3
  180. package/vscode/src/vs/workbench/services/driver/browser/driver.js +184 -0
  181. package/vscode/src/vs/workbench/services/editor/browser/editorResolverService.js +668 -0
  182. package/vscode/src/vs/workbench/services/history/browser/historyService.js +1482 -0
  183. package/vscode/src/vs/workbench/services/layout/browser/layoutService.js +17 -1
  184. package/vscode/src/vs/workbench/services/lifecycle/common/lifecycle.js +8 -1
  185. package/vscode/src/vs/workbench/services/progress/browser/media/progressService.css.js +4 -0
  186. package/vscode/src/vs/workbench/services/progress/browser/progressService.js +521 -0
  187. package/vscode/src/vs/workbench/services/textMate/common/TMGrammars.js +102 -0
  188. package/vscode/src/vs/workbench/services/themes/common/tokenClassificationExtensionPoint.js +296 -0
  189. package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorHandler.js +99 -0
  190. package/vscode/src/vs/workbench/services/views/browser/viewDescriptorService.js +711 -0
  191. package/vscode/src/vs/workbench/services/views/common/viewContainerModel.js +596 -0
@@ -0,0 +1,317 @@
1
+ import { __decorate, __param } from '../../../../../../../../../external/tslib/tslib.es6.js';
2
+ import { disposableTimeout, RunOnceScheduler } from '../../../../../../base/common/async.js';
3
+ import { Disposable, MutableDisposable, dispose } from '../../../../../../base/common/lifecycle.js';
4
+ import { language } from '../../../../../../base/common/platform.js';
5
+ import { localizeWithPath } from '../../../../../../nls.js';
6
+ import { IInstantiationService } from '../../../../../../platform/instantiation/common/instantiation.js';
7
+ import { themeColorFromId } from '../../../../../../platform/theme/common/themeService.js';
8
+ import { ThemeIcon } from '../../../../../../base/common/themables.js';
9
+ import { NotebookVisibleCellObserver } from './notebookVisibleCellObserver.js';
10
+ import { registerNotebookContribution } from '../../notebookEditorExtensions.js';
11
+ import { cellStatusIconSuccess, cellStatusIconError } from '../../notebookEditorWidget.js';
12
+ import { successStateIcon, errorStateIcon, pendingStateIcon, executingStateIcon } from '../../notebookIcons.js';
13
+ import { NotebookCellExecutionState } from '../../../common/notebookCommon.js';
14
+ import { NotebookExecutionType, INotebookExecutionStateService } from '../../../common/notebookExecutionStateService.js';
15
+ import { INotebookService } from '../../../common/notebookService.js';
16
+ var ExecutionStateCellStatusBarItem_1, TimerCellStatusBarItem_1;
17
+ function formatCellDuration(duration, showMilliseconds = true) {
18
+ if (showMilliseconds && duration < 1000) {
19
+ return `${duration}ms`;
20
+ }
21
+ const minutes = Math.floor(duration / 1000 / 60);
22
+ const seconds = Math.floor(duration / 1000) % 60;
23
+ const tenths = Math.floor((duration % 1000) / 100);
24
+ if (minutes > 0) {
25
+ return `${minutes}m ${seconds}.${tenths}s`;
26
+ }
27
+ else {
28
+ return `${seconds}.${tenths}s`;
29
+ }
30
+ }
31
+ class NotebookStatusBarController extends Disposable {
32
+ constructor(_notebookEditor, _itemFactory) {
33
+ super();
34
+ this._notebookEditor = _notebookEditor;
35
+ this._itemFactory = _itemFactory;
36
+ this._visibleCells = ( new Map());
37
+ this._observer = this._register(( new NotebookVisibleCellObserver(this._notebookEditor)));
38
+ this._register(this._observer.onDidChangeVisibleCells(this._updateVisibleCells, this));
39
+ this._updateEverything();
40
+ }
41
+ _updateEverything() {
42
+ this._visibleCells.forEach(dispose);
43
+ this._visibleCells.clear();
44
+ this._updateVisibleCells({ added: this._observer.visibleCells, removed: [] });
45
+ }
46
+ _updateVisibleCells(e) {
47
+ const vm = this._notebookEditor.getViewModel();
48
+ if (!vm) {
49
+ return;
50
+ }
51
+ for (const oldCell of e.removed) {
52
+ this._visibleCells.get(oldCell.handle)?.dispose();
53
+ this._visibleCells.delete(oldCell.handle);
54
+ }
55
+ for (const newCell of e.added) {
56
+ this._visibleCells.set(newCell.handle, this._itemFactory(vm, newCell));
57
+ }
58
+ }
59
+ dispose() {
60
+ super.dispose();
61
+ this._visibleCells.forEach(dispose);
62
+ this._visibleCells.clear();
63
+ }
64
+ }
65
+ let ExecutionStateCellStatusBarContrib = class ExecutionStateCellStatusBarContrib extends Disposable {
66
+ static { this.id = 'workbench.notebook.statusBar.execState'; }
67
+ constructor(notebookEditor, instantiationService) {
68
+ super();
69
+ this._register(( new NotebookStatusBarController(
70
+ notebookEditor,
71
+ (vm, cell) => instantiationService.createInstance(ExecutionStateCellStatusBarItem, vm, cell)
72
+ )));
73
+ }
74
+ };
75
+ ExecutionStateCellStatusBarContrib = ( __decorate([
76
+ ( __param(1, IInstantiationService))
77
+ ], ExecutionStateCellStatusBarContrib));
78
+ registerNotebookContribution(ExecutionStateCellStatusBarContrib.id, ExecutionStateCellStatusBarContrib);
79
+ let ExecutionStateCellStatusBarItem = class ExecutionStateCellStatusBarItem extends Disposable {
80
+ static { ExecutionStateCellStatusBarItem_1 = this; }
81
+ static { this.MIN_SPINNER_TIME = 500; }
82
+ constructor(_notebookViewModel, _cell, _executionStateService) {
83
+ super();
84
+ this._notebookViewModel = _notebookViewModel;
85
+ this._cell = _cell;
86
+ this._executionStateService = _executionStateService;
87
+ this._currentItemIds = [];
88
+ this._clearExecutingStateTimer = this._register(( new MutableDisposable()));
89
+ this._update();
90
+ this._register(this._executionStateService.onDidChangeExecution(e => {
91
+ if (e.type === NotebookExecutionType.cell && e.affectsCell(this._cell.uri)) {
92
+ this._update();
93
+ }
94
+ }));
95
+ this._register(this._cell.model.onDidChangeInternalMetadata(() => this._update()));
96
+ }
97
+ async _update() {
98
+ const items = this._getItemsForCell();
99
+ if (Array.isArray(items)) {
100
+ this._currentItemIds = this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds, [{ handle: this._cell.handle, items }]);
101
+ }
102
+ }
103
+ _getItemsForCell() {
104
+ const runState = this._executionStateService.getCellExecution(this._cell.uri);
105
+ if (runState?.state === NotebookCellExecutionState.Executing && typeof this._showedExecutingStateTime !== 'number') {
106
+ this._showedExecutingStateTime = Date.now();
107
+ }
108
+ else if (runState?.state !== NotebookCellExecutionState.Executing && typeof this._showedExecutingStateTime === 'number') {
109
+ const timeUntilMin = ExecutionStateCellStatusBarItem_1.MIN_SPINNER_TIME - (Date.now() - this._showedExecutingStateTime);
110
+ if (timeUntilMin > 0) {
111
+ if (!this._clearExecutingStateTimer.value) {
112
+ this._clearExecutingStateTimer.value = disposableTimeout(() => {
113
+ this._showedExecutingStateTime = undefined;
114
+ this._clearExecutingStateTimer.clear();
115
+ this._update();
116
+ }, timeUntilMin);
117
+ }
118
+ return undefined;
119
+ }
120
+ else {
121
+ this._showedExecutingStateTime = undefined;
122
+ }
123
+ }
124
+ const items = this._getItemForState(runState, this._cell.internalMetadata);
125
+ return items;
126
+ }
127
+ _getItemForState(runState, internalMetadata) {
128
+ const state = runState?.state;
129
+ const { lastRunSuccess } = internalMetadata;
130
+ if (!state && lastRunSuccess) {
131
+ return [{
132
+ text: `$(${successStateIcon.id})`,
133
+ color: themeColorFromId(cellStatusIconSuccess),
134
+ tooltip: ( localizeWithPath(
135
+ 'vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController',
136
+ 'notebook.cell.status.success',
137
+ "Success"
138
+ )),
139
+ alignment: 1 ,
140
+ priority: Number.MAX_SAFE_INTEGER
141
+ }];
142
+ }
143
+ else if (!state && lastRunSuccess === false) {
144
+ return [{
145
+ text: `$(${errorStateIcon.id})`,
146
+ color: themeColorFromId(cellStatusIconError),
147
+ tooltip: ( localizeWithPath(
148
+ 'vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController',
149
+ 'notebook.cell.status.failed',
150
+ "Failed"
151
+ )),
152
+ alignment: 1 ,
153
+ priority: Number.MAX_SAFE_INTEGER
154
+ }];
155
+ }
156
+ else if (state === NotebookCellExecutionState.Pending || state === NotebookCellExecutionState.Unconfirmed) {
157
+ return [{
158
+ text: `$(${pendingStateIcon.id})`,
159
+ tooltip: ( localizeWithPath(
160
+ 'vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController',
161
+ 'notebook.cell.status.pending',
162
+ "Pending"
163
+ )),
164
+ alignment: 1 ,
165
+ priority: Number.MAX_SAFE_INTEGER
166
+ }];
167
+ }
168
+ else if (state === NotebookCellExecutionState.Executing) {
169
+ const icon = runState?.didPause ?
170
+ executingStateIcon :
171
+ ThemeIcon.modify(executingStateIcon, 'spin');
172
+ return [{
173
+ text: `$(${icon.id})`,
174
+ tooltip: ( localizeWithPath(
175
+ 'vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController',
176
+ 'notebook.cell.status.executing',
177
+ "Executing"
178
+ )),
179
+ alignment: 1 ,
180
+ priority: Number.MAX_SAFE_INTEGER
181
+ }];
182
+ }
183
+ return [];
184
+ }
185
+ dispose() {
186
+ super.dispose();
187
+ this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds, [{ handle: this._cell.handle, items: [] }]);
188
+ }
189
+ };
190
+ ExecutionStateCellStatusBarItem = ExecutionStateCellStatusBarItem_1 = ( __decorate([
191
+ ( __param(2, INotebookExecutionStateService))
192
+ ], ExecutionStateCellStatusBarItem));
193
+ let TimerCellStatusBarContrib = class TimerCellStatusBarContrib extends Disposable {
194
+ static { this.id = 'workbench.notebook.statusBar.execTimer'; }
195
+ constructor(notebookEditor, instantiationService) {
196
+ super();
197
+ this._register(( new NotebookStatusBarController(
198
+ notebookEditor,
199
+ (vm, cell) => instantiationService.createInstance(TimerCellStatusBarItem, vm, cell)
200
+ )));
201
+ }
202
+ };
203
+ TimerCellStatusBarContrib = ( __decorate([
204
+ ( __param(1, IInstantiationService))
205
+ ], TimerCellStatusBarContrib));
206
+ registerNotebookContribution(TimerCellStatusBarContrib.id, TimerCellStatusBarContrib);
207
+ const UPDATE_TIMER_GRACE_PERIOD = 200;
208
+ let TimerCellStatusBarItem = class TimerCellStatusBarItem extends Disposable {
209
+ static { TimerCellStatusBarItem_1 = this; }
210
+ static { this.UPDATE_INTERVAL = 100; }
211
+ constructor(_notebookViewModel, _cell, _executionStateService, _notebookService) {
212
+ super();
213
+ this._notebookViewModel = _notebookViewModel;
214
+ this._cell = _cell;
215
+ this._executionStateService = _executionStateService;
216
+ this._notebookService = _notebookService;
217
+ this._currentItemIds = [];
218
+ this._scheduler = this._register(( new RunOnceScheduler(() => this._update(), TimerCellStatusBarItem_1.UPDATE_INTERVAL)));
219
+ this._update();
220
+ this._register(this._cell.model.onDidChangeInternalMetadata(() => this._update()));
221
+ }
222
+ async _update() {
223
+ let timerItem;
224
+ const runState = this._executionStateService.getCellExecution(this._cell.uri);
225
+ const state = runState?.state;
226
+ const startTime = this._cell.internalMetadata.runStartTime;
227
+ const adjustment = this._cell.internalMetadata.runStartTimeAdjustment ?? 0;
228
+ const endTime = this._cell.internalMetadata.runEndTime;
229
+ if (runState?.didPause) {
230
+ timerItem = undefined;
231
+ }
232
+ else if (state === NotebookCellExecutionState.Executing) {
233
+ if (typeof startTime === 'number') {
234
+ timerItem = this._getTimeItem(startTime, Date.now(), adjustment);
235
+ this._scheduler.schedule();
236
+ }
237
+ }
238
+ else if (!state) {
239
+ if (typeof startTime === 'number' && typeof endTime === 'number') {
240
+ const timerDuration = Date.now() - startTime + adjustment;
241
+ const executionDuration = endTime - startTime;
242
+ const renderDuration = this._cell.internalMetadata.renderDuration ?? {};
243
+ timerItem = this._getTimeItem(startTime, endTime, undefined, {
244
+ timerDuration,
245
+ executionDuration,
246
+ renderDuration
247
+ });
248
+ }
249
+ }
250
+ const items = timerItem ? [timerItem] : [];
251
+ if (!items.length && !!runState) {
252
+ if (!this._deferredUpdate) {
253
+ this._deferredUpdate = disposableTimeout(() => {
254
+ this._deferredUpdate = undefined;
255
+ this._currentItemIds = this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds, [{ handle: this._cell.handle, items }]);
256
+ }, UPDATE_TIMER_GRACE_PERIOD);
257
+ }
258
+ }
259
+ else {
260
+ this._deferredUpdate?.dispose();
261
+ this._deferredUpdate = undefined;
262
+ this._currentItemIds = this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds, [{ handle: this._cell.handle, items }]);
263
+ }
264
+ }
265
+ _getTimeItem(startTime, endTime, adjustment = 0, runtimeInformation) {
266
+ const duration = endTime - startTime + adjustment;
267
+ let tooltip;
268
+ if (runtimeInformation) {
269
+ const lastExecution = ( new Date(endTime)).toLocaleTimeString(language);
270
+ const { renderDuration, executionDuration, timerDuration } = runtimeInformation;
271
+ let renderTimes = '';
272
+ for (const key in renderDuration) {
273
+ const rendererInfo = this._notebookService.getRendererInfo(key);
274
+ const args = encodeURIComponent(JSON.stringify({
275
+ extensionId: rendererInfo?.extensionId.value ?? '',
276
+ issueBody: `Auto-generated text from notebook cell performance. The duration for the renderer, ${rendererInfo?.displayName ?? key}, is slower than expected.\n` +
277
+ `Execution Time: ${formatCellDuration(executionDuration)}\n` +
278
+ `Renderer Duration: ${formatCellDuration(renderDuration[key])}\n`
279
+ }));
280
+ renderTimes += `- [${rendererInfo?.displayName ?? key}](command:workbench.action.openIssueReporter?${args}) ${formatCellDuration(renderDuration[key])}\n`;
281
+ }
282
+ renderTimes += `\n*${( localizeWithPath(
283
+ 'vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController',
284
+ 'notebook.cell.statusBar.timerTooltip.reportIssueFootnote',
285
+ "Use the links above to file an issue using the issue reporter."
286
+ ))}*\n`;
287
+ tooltip = {
288
+ value: ( localizeWithPath(
289
+ 'vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController',
290
+ 'notebook.cell.statusBar.timerTooltip',
291
+ "**Last Execution** {0}\n\n**Execution Time** {1}\n\n**Overhead Time** {2}\n\n**Render Times**\n\n{3}",
292
+ lastExecution,
293
+ formatCellDuration(executionDuration),
294
+ formatCellDuration(timerDuration - executionDuration),
295
+ renderTimes
296
+ )),
297
+ isTrusted: true
298
+ };
299
+ }
300
+ return {
301
+ text: formatCellDuration(duration, false),
302
+ alignment: 1 ,
303
+ priority: Number.MAX_SAFE_INTEGER - 5,
304
+ tooltip
305
+ };
306
+ }
307
+ dispose() {
308
+ super.dispose();
309
+ this._deferredUpdate?.dispose();
310
+ this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds, [{ handle: this._cell.handle, items: [] }]);
311
+ }
312
+ };
313
+ TimerCellStatusBarItem = TimerCellStatusBarItem_1 = ( __decorate([
314
+ ( __param(2, INotebookExecutionStateService)),
315
+ ( __param(3, INotebookService))
316
+ ], TimerCellStatusBarItem));
317
+ export { ExecutionStateCellStatusBarContrib, NotebookStatusBarController, TimerCellStatusBarContrib, formatCellDuration };
@@ -0,0 +1,56 @@
1
+ import { diffSets } from '../../../../../../base/common/collections.js';
2
+ import { Emitter } from '../../../../../../base/common/event.js';
3
+ import { Disposable, DisposableStore } from '../../../../../../base/common/lifecycle.js';
4
+ import { isDefined } from '../../../../../../base/common/types.js';
5
+ import { cellRangesToIndexes } from '../../../common/notebookRange.js';
6
+ class NotebookVisibleCellObserver extends Disposable {
7
+ get visibleCells() {
8
+ return this._visibleCells;
9
+ }
10
+ constructor(_notebookEditor) {
11
+ super();
12
+ this._notebookEditor = _notebookEditor;
13
+ this._onDidChangeVisibleCells = this._register(( new Emitter()));
14
+ this.onDidChangeVisibleCells = this._onDidChangeVisibleCells.event;
15
+ this._viewModelDisposables = this._register(( new DisposableStore()));
16
+ this._visibleCells = [];
17
+ this._register(this._notebookEditor.onDidChangeVisibleRanges(this._updateVisibleCells, this));
18
+ this._register(this._notebookEditor.onDidChangeModel(this._onModelChange, this));
19
+ this._updateVisibleCells();
20
+ }
21
+ _onModelChange() {
22
+ this._viewModelDisposables.clear();
23
+ if (this._notebookEditor.hasModel()) {
24
+ this._viewModelDisposables.add(this._notebookEditor.onDidChangeViewCells(() => this.updateEverything()));
25
+ }
26
+ this.updateEverything();
27
+ }
28
+ updateEverything() {
29
+ this._onDidChangeVisibleCells.fire({ added: [], removed: Array.from(this._visibleCells) });
30
+ this._visibleCells = [];
31
+ this._updateVisibleCells();
32
+ }
33
+ _updateVisibleCells() {
34
+ if (!this._notebookEditor.hasModel()) {
35
+ return;
36
+ }
37
+ const newVisibleCells = ( cellRangesToIndexes(this._notebookEditor.visibleRanges)
38
+ .map(index => this._notebookEditor.cellAt(index)))
39
+ .filter(isDefined);
40
+ const newVisibleHandles = ( new Set(( newVisibleCells.map(cell => cell.handle))));
41
+ const oldVisibleHandles = ( new Set(( this._visibleCells.map(cell => cell.handle))));
42
+ const diff = diffSets(oldVisibleHandles, newVisibleHandles);
43
+ const added = ( diff.added
44
+ .map(handle => this._notebookEditor.getCellByHandle(handle)))
45
+ .filter(isDefined);
46
+ const removed = ( diff.removed
47
+ .map(handle => this._notebookEditor.getCellByHandle(handle)))
48
+ .filter(isDefined);
49
+ this._visibleCells = newVisibleCells;
50
+ this._onDidChangeVisibleCells.fire({
51
+ added,
52
+ removed
53
+ });
54
+ }
55
+ }
56
+ export { NotebookVisibleCellObserver };