@codingame/monaco-vscode-api 1.85.0 → 1.85.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 (298) hide show
  1. package/README.md +31 -13
  2. package/contributions.js +1 -0
  3. package/missing-services.js +396 -68
  4. package/monaco-editor-treemending.patch +957 -950
  5. package/package.json +8 -7
  6. package/service-override/tools/editor.js +1 -1
  7. package/services.js +10 -6
  8. package/vscode/src/vs/base/browser/ui/tree/treeDefaults.js +14 -0
  9. package/vscode/src/vs/base/common/jsonFormatter.js +8 -1
  10. package/vscode/src/vs/platform/actions/browser/buttonbar.js +128 -0
  11. package/vscode/src/vs/platform/extensionManagement/common/extensionEnablementService.js +140 -0
  12. package/vscode/src/vs/platform/extensionManagement/common/extensionManagement.js +2 -1
  13. package/vscode/src/vs/platform/extensions/common/extensions.d.ts +1062 -93
  14. package/vscode/src/vs/platform/files/common/inMemoryFilesystemProvider.js +220 -0
  15. package/vscode/src/vs/platform/layout/browser/zIndexRegistry.js +58 -0
  16. package/vscode/src/vs/platform/quickinput/browser/quickPickPin.js +102 -0
  17. package/vscode/src/vs/platform/terminal/common/capabilities/commandDetectionCapability.js +56 -1
  18. package/vscode/src/vs/platform/userDataSync/common/content.js +9 -0
  19. package/vscode/src/vs/platform/userDataSync/common/settingsMerge.js +514 -0
  20. package/vscode/src/vs/platform/userDataSync/common/userDataSync.js +154 -2
  21. package/vscode/src/vs/platform/userDataSync/common/userDataSyncAccount.js +43 -1
  22. package/vscode/src/vs/platform/userDataSync/common/userDataSyncMachines.js +177 -0
  23. package/vscode/src/vs/workbench/api/common/extHostApiCommands.js +1 -1
  24. package/vscode/src/vs/workbench/api/common/extHostTypeConverters.js +1 -1
  25. package/vscode/src/vs/workbench/api/common/extHostWebview.js +2 -2
  26. package/vscode/src/vs/workbench/browser/actions/layoutActions.js +186 -4
  27. package/vscode/src/vs/workbench/browser/parts/views/checkbox.js +105 -0
  28. package/vscode/src/vs/workbench/browser/parts/views/media/views.css.js +4 -0
  29. package/vscode/src/vs/workbench/browser/parts/views/treeView.js +1614 -0
  30. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +191 -0
  31. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatActions.js +238 -2
  32. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.js +75 -0
  33. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +205 -1
  34. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditorInput.js +168 -0
  35. package/vscode/src/vs/workbench/contrib/chat/browser/chatFollowups.js +35 -0
  36. package/vscode/src/vs/workbench/contrib/chat/browser/chatInputPart.js +340 -0
  37. package/vscode/src/vs/workbench/contrib/chat/browser/chatListRenderer.js +1195 -0
  38. package/vscode/src/vs/workbench/contrib/chat/browser/chatMarkdownDecorationsRenderer.js +115 -0
  39. package/vscode/src/vs/workbench/contrib/chat/browser/chatOptions.js +81 -0
  40. package/vscode/src/vs/workbench/contrib/chat/browser/chatSlashCommandContentWidget.css.js +4 -0
  41. package/vscode/src/vs/workbench/contrib/chat/browser/chatSlashCommandContentWidget.js +62 -0
  42. package/vscode/src/vs/workbench/contrib/chat/browser/chatWidget.js +583 -0
  43. package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.css.js +4 -0
  44. package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.js +290 -0
  45. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatDynamicVariables.js +167 -0
  46. package/vscode/src/vs/workbench/contrib/chat/browser/media/chat.css.js +4 -0
  47. package/vscode/src/vs/workbench/contrib/chat/common/chatContextKeys.js +6 -1
  48. package/vscode/src/vs/workbench/contrib/chat/common/chatModel.js +562 -0
  49. package/vscode/src/vs/workbench/contrib/chat/common/chatParserTypes.js +31 -1
  50. package/vscode/src/vs/workbench/contrib/chat/common/chatProvider.js +24 -1
  51. package/vscode/src/vs/workbench/contrib/chat/common/chatRequestParser.js +193 -0
  52. package/vscode/src/vs/workbench/contrib/chat/common/chatService.js +22 -1
  53. package/vscode/src/vs/workbench/contrib/chat/common/chatSlashCommands.js +52 -1
  54. package/vscode/src/vs/workbench/contrib/chat/common/chatViewModel.js +258 -0
  55. package/vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.js +37 -0
  56. package/vscode/src/vs/workbench/contrib/chat/common/chatWordCounter.js +25 -0
  57. package/vscode/src/vs/workbench/contrib/codeEditor/browser/find/simpleFindWidget.css.js +4 -0
  58. package/vscode/src/vs/workbench/contrib/codeEditor/browser/find/simpleFindWidget.js +388 -0
  59. package/vscode/src/vs/workbench/contrib/codeEditor/browser/languageConfigurationExtensionPoint.js +7 -7
  60. package/vscode/src/vs/workbench/contrib/comments/browser/commentColors.js +61 -0
  61. package/vscode/src/vs/workbench/contrib/comments/browser/commentFormActions.js +49 -0
  62. package/vscode/src/vs/workbench/contrib/comments/browser/commentNode.js +647 -0
  63. package/vscode/src/vs/workbench/contrib/comments/browser/commentReply.js +300 -0
  64. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadAdditionalActions.js +60 -0
  65. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadBody.js +249 -0
  66. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadHeader.js +107 -0
  67. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadWidget.js +333 -0
  68. package/vscode/src/vs/workbench/contrib/comments/browser/media/review.css.js +4 -0
  69. package/vscode/src/vs/workbench/contrib/comments/browser/reactionsAction.js +99 -0
  70. package/vscode/src/vs/workbench/contrib/comments/browser/timestamp.js +55 -0
  71. package/vscode/src/vs/workbench/contrib/comments/common/commentsConfiguration.js +2 -0
  72. package/vscode/src/vs/workbench/contrib/contextmenu/browser/contextmenu.contribution.js +20 -0
  73. package/vscode/src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.js +855 -0
  74. package/vscode/src/vs/workbench/contrib/debug/browser/breakpointWidget.js +410 -0
  75. package/vscode/src/vs/workbench/contrib/debug/browser/breakpointsView.js +1591 -0
  76. package/vscode/src/vs/workbench/contrib/debug/browser/callStackEditorContribution.js +178 -0
  77. package/vscode/src/vs/workbench/contrib/debug/browser/media/breakpointWidget.css.js +4 -0
  78. package/vscode/src/vs/workbench/contrib/debug/browser/media/callStackEditorContribution.css.js +4 -0
  79. package/vscode/src/vs/workbench/contrib/debug/common/debugModel.js +1485 -0
  80. package/vscode/src/vs/workbench/contrib/debug/common/debugSource.js +125 -0
  81. package/vscode/src/vs/workbench/contrib/debug/common/disassemblyViewInput.js +29 -0
  82. package/vscode/src/vs/workbench/contrib/extensions/common/extensionsInput.js +41 -0
  83. package/vscode/src/vs/workbench/contrib/extensions/common/extensionsUtils.js +102 -0
  84. package/vscode/src/vs/workbench/contrib/files/browser/explorerViewlet.js +73 -2
  85. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.css.js +4 -0
  86. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.js +988 -0
  87. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatLivePreviewWidget.js +431 -0
  88. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSession.js +417 -0
  89. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatStrategies.js +806 -0
  90. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.js +915 -0
  91. package/vscode/src/vs/workbench/contrib/inlineChat/browser/utils.js +19 -0
  92. package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.js +129 -10
  93. package/vscode/src/vs/workbench/contrib/markdown/browser/markdownDocumentRenderer.js +205 -0
  94. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorInput.js +150 -0
  95. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel.js +480 -0
  96. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeMarkers/mergeMarkersController.js +5 -0
  97. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/diffComputer.js +90 -0
  98. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/editing.js +54 -0
  99. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/lineRange.js +108 -0
  100. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/mapping.js +258 -0
  101. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/mergeEditorModel.js +614 -0
  102. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/modifiedBaseRange.js +307 -0
  103. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/rangeUtils.js +44 -0
  104. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/textModelDiffs.js +165 -0
  105. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/telemetry.js +78 -0
  106. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/utils.js +169 -0
  107. package/vscode/src/vs/workbench/contrib/mergeEditor/common/mergeEditor.js +64 -0
  108. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/cellOutputClipboard.js +49 -0
  109. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/findFilters.js +70 -0
  110. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/findMatchDecorationModel.js +120 -0
  111. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/findModel.js +416 -0
  112. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindReplaceWidget.css.js +4 -0
  113. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindReplaceWidget.js +663 -0
  114. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOperations.js +593 -0
  115. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOutputActions.js +72 -0
  116. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/coreActions.js +326 -0
  117. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/editActions.js +539 -0
  118. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/foldingController.js +265 -0
  119. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +348 -0
  120. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebook.css.js +4 -0
  121. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellChat.css.js +4 -0
  122. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellEditorHint.css.js +4 -0
  123. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellInsertToolbar.css.js +4 -0
  124. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellOutput.css.js +4 -0
  125. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellStatusBar.css.js +4 -0
  126. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellTitleToolbar.css.js +4 -0
  127. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookDnd.css.js +4 -0
  128. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookEditorStickyScroll.css.js +4 -0
  129. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookFocusIndicator.css.js +4 -0
  130. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookFolding.css.js +4 -0
  131. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookKernelActionViewItem.css.js +4 -0
  132. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookOutline.css.js +4 -0
  133. package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookToolbar.css.js +4 -0
  134. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookBrowser.js +95 -3
  135. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookEditor.js +437 -0
  136. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookEditorExtensions.js +29 -0
  137. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.js +2730 -0
  138. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookIcons.js +139 -0
  139. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookLogger.js +17 -0
  140. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookOptions.js +564 -0
  141. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookViewEvents.js +27 -0
  142. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellPart.js +119 -0
  143. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellActionView.js +27 -0
  144. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellComments.js +135 -0
  145. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellContextKeys.js +178 -0
  146. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellDecorations.js +35 -0
  147. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellDnd.js +377 -0
  148. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellDragRenderer.js +97 -0
  149. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellEditorOptions.js +194 -0
  150. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellExecution.js +71 -0
  151. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellFocus.js +20 -0
  152. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellFocusIndicator.js +85 -0
  153. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellOutput.js +652 -0
  154. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellProgressBar.js +59 -0
  155. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellStatusPart.js +303 -0
  156. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellToolbarStickyScroll.js +24 -0
  157. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellToolbars.js +228 -0
  158. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/chat/cellChatActions.js +302 -0
  159. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/chat/cellChatController.js +438 -0
  160. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/chat/cellChatPart.js +45 -0
  161. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCell.js +435 -0
  162. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCellExecutionIcon.js +95 -0
  163. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCellRunToolbar.js +107 -0
  164. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/collapsedCellInput.js +29 -0
  165. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/collapsedCellOutput.js +59 -0
  166. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/foldedCellHint.js +67 -0
  167. package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/markupCell.js +430 -0
  168. package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookCellAnchor.js +54 -0
  169. package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookCellList.js +1131 -0
  170. package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookCellListView.js +21 -0
  171. package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.js +1591 -0
  172. package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.js +341 -0
  173. package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.js +2155 -0
  174. package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewThemeMapping.js +65 -0
  175. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/OutlineEntry.js +95 -0
  176. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/baseCellViewModel.js +507 -0
  177. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/cellEditorOptions.js +85 -0
  178. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/cellOutputViewModel.js +47 -0
  179. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/cellSelectionCollection.js +40 -0
  180. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel.js +435 -0
  181. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/eventDispatcher.js +31 -0
  182. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/foldingModel.js +257 -0
  183. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/markupCellViewModel.js +239 -0
  184. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.js +103 -0
  185. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineProvider.js +211 -0
  186. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookViewModelImpl.js +808 -0
  187. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/viewContext.js +8 -0
  188. package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorStickyScroll.js +381 -0
  189. package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorToolbar.js +527 -0
  190. package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorWidgetContextKeys.js +163 -0
  191. package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookKernelQuickPickStrategy.js +651 -0
  192. package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookKernelView.js +173 -0
  193. package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookOverviewRuler.js +98 -0
  194. package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookTopCellToolbar.js +62 -0
  195. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookCellOutputTextModel.js +101 -0
  196. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookCellTextModel.js +346 -0
  197. package/vscode/src/vs/workbench/contrib/notebook/common/notebookCommon.js +152 -1
  198. package/vscode/src/vs/workbench/contrib/notebook/common/notebookContextKeys.js +39 -0
  199. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorInput.js +296 -0
  200. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModel.js +261 -0
  201. package/vscode/src/vs/workbench/contrib/notebook/common/notebookExecutionService.js +3 -1
  202. package/vscode/src/vs/workbench/contrib/notebook/common/notebookKernelService.js +2 -1
  203. package/vscode/src/vs/workbench/contrib/notebook/common/notebookKeymapService.js +3 -0
  204. package/vscode/src/vs/workbench/contrib/notebook/common/notebookLoggingService.js +3 -0
  205. package/vscode/src/vs/workbench/contrib/notebook/common/notebookPerformance.js +16 -0
  206. package/vscode/src/vs/workbench/contrib/notebook/common/notebookRange.js +66 -0
  207. package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookWorkerService.js +4 -0
  208. package/vscode/src/vs/workbench/contrib/preferences/common/settingsEditorColorRegistry.js +130 -0
  209. package/vscode/src/vs/workbench/contrib/remote/browser/media/tunnelView.css.js +4 -0
  210. package/vscode/src/vs/workbench/contrib/remote/browser/remoteExplorer.js +847 -0
  211. package/vscode/src/vs/workbench/contrib/remote/browser/remoteIcons.js +89 -0
  212. package/vscode/src/vs/workbench/contrib/remote/browser/tunnelView.js +1942 -0
  213. package/vscode/src/vs/workbench/contrib/remote/browser/urlFinder.js +107 -0
  214. package/vscode/src/vs/workbench/contrib/search/browser/searchActionsBase.js +49 -0
  215. package/vscode/src/vs/workbench/contrib/search/browser/searchActionsFind.js +387 -0
  216. package/vscode/src/vs/workbench/contrib/search/browser/searchModel.js +2 -2
  217. package/vscode/src/vs/workbench/contrib/search/common/constants.js +66 -0
  218. package/vscode/src/vs/workbench/contrib/searchEditor/browser/constants.js +11 -0
  219. package/vscode/src/vs/workbench/contrib/snippets/browser/commands/abstractSnippetsActions.js +24 -0
  220. package/vscode/src/vs/workbench/contrib/snippets/browser/commands/fileTemplateSnippets.js +95 -0
  221. package/vscode/src/vs/workbench/contrib/tasks/common/taskDefinitionRegistry.js +6 -6
  222. package/vscode/src/vs/workbench/contrib/tasks/common/taskService.js +12 -2
  223. package/vscode/src/vs/workbench/contrib/tasks/common/tasks.js +712 -0
  224. package/vscode/src/vs/workbench/contrib/terminal/browser/terminal.js +4 -1
  225. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalProcessExtHostProxy.js +130 -0
  226. package/vscode/src/vs/workbench/contrib/terminal/common/terminal.js +2 -1
  227. package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/featuredExtensionService.js +159 -0
  228. package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedExtensionPoint.js +375 -0
  229. package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedService.js +563 -0
  230. package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/common/gettingStartedContent.js +932 -0
  231. package/vscode/src/vs/workbench/services/authentication/browser/authenticationService.js +20 -1
  232. package/vscode/src/vs/workbench/services/configurationResolver/common/configurationResolverSchema.js +205 -0
  233. package/vscode/src/vs/workbench/services/configurationResolver/common/configurationResolverUtils.js +11 -0
  234. package/vscode/src/vs/workbench/services/configurationResolver/common/variableResolver.js +9 -9
  235. package/vscode/src/vs/workbench/services/extensionManagement/browser/extensionBisect.js +1 -1
  236. package/vscode/src/vs/workbench/services/keybinding/common/keybindingEditing.js +2 -2
  237. package/vscode/src/vs/workbench/services/languageStatus/common/languageStatusService.js +24 -1
  238. package/vscode/src/vs/workbench/services/layout/browser/layoutService.js +15 -1
  239. package/vscode/src/vs/workbench/services/preferences/browser/keybindingsEditorInput.js +41 -0
  240. package/vscode/src/vs/workbench/services/preferences/browser/keybindingsEditorModel.js +588 -0
  241. package/vscode/src/vs/workbench/services/preferences/common/preferencesEditorInput.js +43 -0
  242. package/vscode/src/vs/workbench/services/remote/common/remoteExplorerService.d.ts +2 -2
  243. package/vscode/src/vs/workbench/services/remote/common/remoteExplorerService.js +190 -2
  244. package/vscode/src/vs/workbench/services/search/common/search.js +3 -3
  245. package/vscode/src/vs/workbench/services/terminal/common/embedderTerminalService.js +75 -1
  246. package/vscode/src/vs/workbench/services/timer/browser/timerService.js +240 -1
  247. package/vscode/src/vs/workbench/services/userData/browser/userDataInit.js +31 -1
  248. package/vscode/src/vs/workbench/services/userDataProfile/common/userDataProfile.js +25 -1
  249. package/vscode/src/vs/workbench/services/userDataProfile/common/userDataProfileIcons.js +75 -1
  250. package/vscode/src/vs/workbench/services/userDataSync/common/userDataSync.js +74 -4
  251. package/vscode/src/vs/workbench/services/workingCopy/common/resourceWorkingCopy.js +77 -0
  252. package/assets/break.mp3 +0 -0
  253. package/assets/chatRequestSent.mp3 +0 -0
  254. package/assets/chatResponsePending.mp3 +0 -0
  255. package/assets/chatResponseReceived1.mp3 +0 -0
  256. package/assets/chatResponseReceived2.mp3 +0 -0
  257. package/assets/chatResponseReceived3.mp3 +0 -0
  258. package/assets/chatResponseReceived4.mp3 +0 -0
  259. package/assets/clear.mp3 +0 -0
  260. package/assets/defaultIcon.png +0 -0
  261. package/assets/diffLineDeleted.mp3 +0 -0
  262. package/assets/diffLineInserted.mp3 +0 -0
  263. package/assets/diffLineModified.mp3 +0 -0
  264. package/assets/error.mp3 +0 -0
  265. package/assets/fake.html +0 -10
  266. package/assets/foldedAreas.mp3 +0 -0
  267. package/assets/format.mp3 +0 -0
  268. package/assets/index-no-csp.html +0 -1226
  269. package/assets/index.html +0 -1227
  270. package/assets/quickFixes.mp3 +0 -0
  271. package/assets/save.mp3 +0 -0
  272. package/assets/service-worker.js +0 -457
  273. package/assets/taskCompleted.mp3 +0 -0
  274. package/assets/taskFailed.mp3 +0 -0
  275. package/assets/terminalBell.mp3 +0 -0
  276. package/assets/warning.mp3 +0 -0
  277. package/assets/webWorkerExtensionHostIframe.html +0 -123
  278. package/override/vs/workbench/contrib/notebook/browser/contrib/find/findMatchDecorationModel.js +0 -2
  279. package/override/vs/workbench/contrib/notebook/browser/notebookEditorWidget.js +0 -2
  280. package/override/vs/workbench/contrib/notebook/common/notebookEditorInput.js +0 -5
  281. package/vscode/src/vs/base/parts/request/browser/request.js +0 -60
  282. package/vscode/src/vs/platform/request/browser/requestService.js +0 -28
  283. package/vscode/src/vs/platform/request/common/requestIpc.js +0 -17
  284. package/vscode/src/vs/platform/url/common/urlService.js +0 -17
  285. package/vscode/src/vs/workbench/services/configuration/common/jsonEditingService.js +0 -120
  286. package/vscode/src/vs/workbench/services/decorations/browser/decorationsService.js +0 -319
  287. package/vscode/src/vs/workbench/services/files/browser/elevatedFileService.js +0 -9
  288. package/vscode/src/vs/workbench/services/host/browser/browserHostService.js +0 -408
  289. package/vscode/src/vs/workbench/services/request/browser/requestService.js +0 -48
  290. package/vscode/src/vs/workbench/services/textfile/browser/browserTextFileService.js +0 -56
  291. package/vscode/src/vs/workbench/services/textfile/browser/textFileService.js +0 -639
  292. package/vscode/src/vs/workbench/services/textfile/common/textFileEditorModelManager.js +0 -402
  293. package/vscode/src/vs/workbench/services/textfile/common/textFileSaveParticipant.js +0 -62
  294. package/vscode/src/vs/workbench/services/themes/browser/browserHostColorSchemeService.js +0 -38
  295. package/vscode/src/vs/workbench/services/themes/common/tokenClassificationExtensionPoint.js +0 -295
  296. package/vscode/src/vs/workbench/services/url/browser/urlService.js +0 -47
  297. package/vscode/src/vs/workbench/services/views/common/treeViewsService.js +0 -20
  298. package/vscode/src/vs/workbench/services/workspaces/common/canonicalUriService.js +0 -19
@@ -0,0 +1,1131 @@
1
+ import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
2
+ import * as dom from 'monaco-editor/esm/vs/base/browser/dom.js';
3
+ import { ListError } from 'monaco-editor/esm/vs/base/browser/ui/list/list.js';
4
+ import { Emitter, Event } from 'monaco-editor/esm/vs/base/common/event.js';
5
+ import { DisposableStore, MutableDisposable, Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
6
+ import { isMacintosh } from 'monaco-editor/esm/vs/base/common/platform.js';
7
+ import { PrefixSumComputer } from 'monaco-editor/esm/vs/editor/common/model/prefixSumComputer.js';
8
+ import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
9
+ import { WorkbenchList, IListService } from 'monaco-editor/esm/vs/platform/list/browser/listService.js';
10
+ import { CellEditState, CellFocusMode, CellRevealRangeType, CursorAtBoundary, CursorAtLineBoundary } from '../notebookBrowser.js';
11
+ import { NOTEBOOK_EDITOR_CURSOR_BOUNDARY, NOTEBOOK_EDITOR_CURSOR_LINE_BOUNDARY, CellKind, diff, SelectionStateType } from '../../common/notebookCommon.js';
12
+ import { cellRangesEqual, reduceCellRanges, cellRangesToIndexes } from '../../common/notebookRange.js';
13
+ import { NOTEBOOK_CELL_LIST_FOCUSED } from '../../common/notebookContextKeys.js';
14
+ import { clamp } from 'monaco-editor/esm/vs/base/common/numbers.js';
15
+ import { FastDomNode } from 'monaco-editor/esm/vs/base/browser/fastDomNode.js';
16
+ import { MarkupCellViewModel } from '../viewModel/markupCellViewModel.js';
17
+ import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
18
+ import { NotebookCellListView } from './notebookCellListView.js';
19
+ import { INotebookExecutionStateService } from '../../common/notebookExecutionStateService.js';
20
+ import { NotebookCellAnchor } from './notebookCellAnchor.js';
21
+ function getVisibleCells(cells, hiddenRanges) {
22
+ if (!hiddenRanges.length) {
23
+ return cells;
24
+ }
25
+ let start = 0;
26
+ let hiddenRangeIndex = 0;
27
+ const result = [];
28
+ while (start < cells.length && hiddenRangeIndex < hiddenRanges.length) {
29
+ if (start < hiddenRanges[hiddenRangeIndex].start) {
30
+ result.push(...cells.slice(start, hiddenRanges[hiddenRangeIndex].start));
31
+ }
32
+ start = hiddenRanges[hiddenRangeIndex].end + 1;
33
+ hiddenRangeIndex++;
34
+ }
35
+ if (start < cells.length) {
36
+ result.push(...cells.slice(start));
37
+ }
38
+ return result;
39
+ }
40
+ const NOTEBOOK_WEBVIEW_BOUNDARY = 5000;
41
+ function validateWebviewBoundary(element) {
42
+ const webviewTop = 0 - (parseInt(element.style.top, 10) || 0);
43
+ return webviewTop >= 0 && webviewTop <= NOTEBOOK_WEBVIEW_BOUNDARY * 2;
44
+ }
45
+ let NotebookCellList = class NotebookCellList extends WorkbenchList {
46
+ get onWillScroll() { return this.view.onWillScroll; }
47
+ get rowsContainer() {
48
+ return this.view.containerDomNode;
49
+ }
50
+ get scrollableElement() {
51
+ return this.view.scrollableElementDomNode;
52
+ }
53
+ get viewModel() {
54
+ return this._viewModel;
55
+ }
56
+ get visibleRanges() {
57
+ return this._visibleRanges;
58
+ }
59
+ set visibleRanges(ranges) {
60
+ if (cellRangesEqual(this._visibleRanges, ranges)) {
61
+ return;
62
+ }
63
+ this._visibleRanges = ranges;
64
+ this._onDidChangeVisibleRanges.fire();
65
+ }
66
+ get isDisposed() {
67
+ return this._isDisposed;
68
+ }
69
+ get webviewElement() {
70
+ return this._webviewElement;
71
+ }
72
+ get inRenderingTransaction() {
73
+ return this.view.inRenderingTransaction;
74
+ }
75
+ constructor(listUser, container, notebookOptions, delegate, renderers, contextKeyService, options, listService, configurationService, instantiationService, notebookExecutionStateService) {
76
+ super(listUser, container, delegate, renderers, options, contextKeyService, listService, configurationService, instantiationService);
77
+ this.listUser = listUser;
78
+ this.notebookOptions = notebookOptions;
79
+ this._previousFocusedElements = [];
80
+ this._localDisposableStore = ( new DisposableStore());
81
+ this._viewModelStore = ( new DisposableStore());
82
+ this._onDidRemoveOutputs = this._localDisposableStore.add(( new Emitter()));
83
+ this.onDidRemoveOutputs = this._onDidRemoveOutputs.event;
84
+ this._onDidHideOutputs = this._localDisposableStore.add(( new Emitter()));
85
+ this.onDidHideOutputs = this._onDidHideOutputs.event;
86
+ this._onDidRemoveCellsFromView = this._localDisposableStore.add(( new Emitter()));
87
+ this.onDidRemoveCellsFromView = this._onDidRemoveCellsFromView.event;
88
+ this._viewModel = null;
89
+ this._hiddenRangeIds = [];
90
+ this.hiddenRangesPrefixSum = null;
91
+ this._onDidChangeVisibleRanges = this._localDisposableStore.add(( new Emitter()));
92
+ this.onDidChangeVisibleRanges = this._onDidChangeVisibleRanges.event;
93
+ this._visibleRanges = [];
94
+ this._isDisposed = false;
95
+ this._isInLayout = false;
96
+ this._webviewElement = null;
97
+ NOTEBOOK_CELL_LIST_FOCUSED.bindTo(this.contextKeyService).set(true);
98
+ this._previousFocusedElements = this.getFocusedElements();
99
+ this._localDisposableStore.add(this.onDidChangeFocus((e) => {
100
+ this._previousFocusedElements.forEach(element => {
101
+ if (e.elements.indexOf(element) < 0) {
102
+ element.onDeselect();
103
+ }
104
+ });
105
+ this._previousFocusedElements = e.elements;
106
+ }));
107
+ const notebookEditorCursorAtBoundaryContext = NOTEBOOK_EDITOR_CURSOR_BOUNDARY.bindTo(contextKeyService);
108
+ notebookEditorCursorAtBoundaryContext.set('none');
109
+ const notebookEditorCursorAtLineBoundaryContext = NOTEBOOK_EDITOR_CURSOR_LINE_BOUNDARY.bindTo(contextKeyService);
110
+ notebookEditorCursorAtLineBoundaryContext.set('none');
111
+ const cursorSelectionListener = this._localDisposableStore.add(( new MutableDisposable()));
112
+ const textEditorAttachListener = this._localDisposableStore.add(( new MutableDisposable()));
113
+ this._notebookCellAnchor = ( new NotebookCellAnchor(notebookExecutionStateService, configurationService, this.onDidScroll));
114
+ const recomputeContext = (element) => {
115
+ switch (element.cursorAtBoundary()) {
116
+ case CursorAtBoundary.Both:
117
+ notebookEditorCursorAtBoundaryContext.set('both');
118
+ break;
119
+ case CursorAtBoundary.Top:
120
+ notebookEditorCursorAtBoundaryContext.set('top');
121
+ break;
122
+ case CursorAtBoundary.Bottom:
123
+ notebookEditorCursorAtBoundaryContext.set('bottom');
124
+ break;
125
+ default:
126
+ notebookEditorCursorAtBoundaryContext.set('none');
127
+ break;
128
+ }
129
+ switch (element.cursorAtLineBoundary()) {
130
+ case CursorAtLineBoundary.Both:
131
+ notebookEditorCursorAtLineBoundaryContext.set('both');
132
+ break;
133
+ case CursorAtLineBoundary.Start:
134
+ notebookEditorCursorAtLineBoundaryContext.set('start');
135
+ break;
136
+ case CursorAtLineBoundary.End:
137
+ notebookEditorCursorAtLineBoundaryContext.set('end');
138
+ break;
139
+ default:
140
+ notebookEditorCursorAtLineBoundaryContext.set('none');
141
+ break;
142
+ }
143
+ return;
144
+ };
145
+ this._localDisposableStore.add(this.onDidChangeFocus((e) => {
146
+ if (e.elements.length) {
147
+ const focusedElement = e.elements[0];
148
+ cursorSelectionListener.value = focusedElement.onDidChangeState((e) => {
149
+ if (e.selectionChanged) {
150
+ recomputeContext(focusedElement);
151
+ }
152
+ });
153
+ textEditorAttachListener.value = focusedElement.onDidChangeEditorAttachState(() => {
154
+ if (focusedElement.editorAttached) {
155
+ recomputeContext(focusedElement);
156
+ }
157
+ });
158
+ recomputeContext(focusedElement);
159
+ return;
160
+ }
161
+ notebookEditorCursorAtBoundaryContext.set('none');
162
+ }));
163
+ this._localDisposableStore.add(this.view.onMouseDblClick(() => {
164
+ const focus = this.getFocusedElements()[0];
165
+ if (focus && focus.cellKind === CellKind.Markup && !focus.isInputCollapsed && !this._viewModel?.options.isReadOnly) {
166
+ const focusedCellIndex = this._getViewIndexUpperBound(focus);
167
+ if (focusedCellIndex >= 0) {
168
+ this._revealInViewWithMinimalScrolling(focusedCellIndex);
169
+ }
170
+ focus.updateEditState(CellEditState.Editing, 'dbclick');
171
+ focus.focusMode = CellFocusMode.Editor;
172
+ }
173
+ }));
174
+ const updateVisibleRanges = () => {
175
+ if (!this.view.length) {
176
+ return;
177
+ }
178
+ const top = this.getViewScrollTop();
179
+ const bottom = this.getViewScrollBottom();
180
+ if (top >= bottom) {
181
+ return;
182
+ }
183
+ const topViewIndex = clamp(this.view.indexAt(top), 0, this.view.length - 1);
184
+ const topElement = this.view.element(topViewIndex);
185
+ const topModelIndex = this._viewModel.getCellIndex(topElement);
186
+ const bottomViewIndex = clamp(this.view.indexAt(bottom), 0, this.view.length - 1);
187
+ const bottomElement = this.view.element(bottomViewIndex);
188
+ const bottomModelIndex = this._viewModel.getCellIndex(bottomElement);
189
+ if (bottomModelIndex - topModelIndex === bottomViewIndex - topViewIndex) {
190
+ this.visibleRanges = [{ start: topModelIndex, end: bottomModelIndex + 1 }];
191
+ }
192
+ else {
193
+ this.visibleRanges = this._getVisibleRangesFromIndex(topViewIndex, topModelIndex, bottomViewIndex, bottomModelIndex);
194
+ }
195
+ };
196
+ this._localDisposableStore.add(this.view.onDidChangeContentHeight(() => {
197
+ if (this._isInLayout) {
198
+ dom.scheduleAtNextAnimationFrame(dom.getWindow(container), () => {
199
+ updateVisibleRanges();
200
+ });
201
+ }
202
+ updateVisibleRanges();
203
+ }));
204
+ this._localDisposableStore.add(this.view.onDidScroll(() => {
205
+ if (this._isInLayout) {
206
+ dom.scheduleAtNextAnimationFrame(dom.getWindow(container), () => {
207
+ updateVisibleRanges();
208
+ });
209
+ }
210
+ updateVisibleRanges();
211
+ }));
212
+ }
213
+ createListView(container, virtualDelegate, renderers, viewOptions) {
214
+ return ( new NotebookCellListView(container, virtualDelegate, renderers, viewOptions));
215
+ }
216
+ attachWebview(element) {
217
+ element.style.top = `-${NOTEBOOK_WEBVIEW_BOUNDARY}px`;
218
+ this.rowsContainer.insertAdjacentElement('afterbegin', element);
219
+ this._webviewElement = ( new FastDomNode(element));
220
+ }
221
+ elementAt(position) {
222
+ if (!this.view.length) {
223
+ return undefined;
224
+ }
225
+ const idx = this.view.indexAt(position);
226
+ const clamped = clamp(idx, 0, this.view.length - 1);
227
+ return this.element(clamped);
228
+ }
229
+ elementHeight(element) {
230
+ const index = this._getViewIndexUpperBound(element);
231
+ if (index === undefined || index < 0 || index >= this.length) {
232
+ this._getViewIndexUpperBound(element);
233
+ throw new ListError(this.listUser, `Invalid index ${index}`);
234
+ }
235
+ return this.view.elementHeight(index);
236
+ }
237
+ detachViewModel() {
238
+ this._viewModelStore.clear();
239
+ this._viewModel = null;
240
+ this.hiddenRangesPrefixSum = null;
241
+ }
242
+ attachViewModel(model) {
243
+ this._viewModel = model;
244
+ this._viewModelStore.add(model.onDidChangeViewCells((e) => {
245
+ if (this._isDisposed) {
246
+ return;
247
+ }
248
+ const currentRanges = ( this._hiddenRangeIds.map(id => this._viewModel.getTrackedRange(id))).filter(range => range !== null);
249
+ const newVisibleViewCells = getVisibleCells(this._viewModel.viewCells, currentRanges);
250
+ const oldVisibleViewCells = [];
251
+ const oldViewCellMapping = ( new Set());
252
+ for (let i = 0; i < this.length; i++) {
253
+ oldVisibleViewCells.push(this.element(i));
254
+ oldViewCellMapping.add(( this.element(i).uri.toString()));
255
+ }
256
+ const viewDiffs = diff(oldVisibleViewCells, newVisibleViewCells, a => {
257
+ return ( oldViewCellMapping.has(( a.uri.toString())));
258
+ });
259
+ if (e.synchronous) {
260
+ this._updateElementsInWebview(viewDiffs);
261
+ }
262
+ else {
263
+ this._viewModelStore.add(dom.scheduleAtNextAnimationFrame(dom.getWindow(this.rowsContainer), () => {
264
+ if (this._isDisposed) {
265
+ return;
266
+ }
267
+ this._updateElementsInWebview(viewDiffs);
268
+ }));
269
+ }
270
+ }));
271
+ this._viewModelStore.add(model.onDidChangeSelection((e) => {
272
+ if (e === 'view') {
273
+ return;
274
+ }
275
+ const viewSelections = ( ( cellRangesToIndexes(model.getSelections()).map(index => model.cellAt(index))).filter(cell => !!cell).map(cell => this._getViewIndexUpperBound(cell)));
276
+ this.setSelection(viewSelections, undefined, true);
277
+ const primary = ( ( cellRangesToIndexes([model.getFocus()]).map(index => model.cellAt(index))).filter(cell => !!cell).map(cell => this._getViewIndexUpperBound(cell)));
278
+ if (primary.length) {
279
+ this.setFocus(primary, undefined, true);
280
+ }
281
+ }));
282
+ const hiddenRanges = model.getHiddenRanges();
283
+ this.setHiddenAreas(hiddenRanges, false);
284
+ const newRanges = reduceCellRanges(hiddenRanges);
285
+ const viewCells = model.viewCells.slice(0);
286
+ newRanges.reverse().forEach(range => {
287
+ const removedCells = viewCells.splice(range.start, range.end - range.start + 1);
288
+ this._onDidRemoveCellsFromView.fire(removedCells);
289
+ });
290
+ this.splice2(0, 0, viewCells);
291
+ }
292
+ _updateElementsInWebview(viewDiffs) {
293
+ viewDiffs.reverse().forEach((diff) => {
294
+ const hiddenOutputs = [];
295
+ const deletedOutputs = [];
296
+ const removedMarkdownCells = [];
297
+ for (let i = diff.start; i < diff.start + diff.deleteCount; i++) {
298
+ const cell = this.element(i);
299
+ if (cell.cellKind === CellKind.Code) {
300
+ if (this._viewModel.hasCell(cell)) {
301
+ hiddenOutputs.push(...cell?.outputsViewModels);
302
+ }
303
+ else {
304
+ deletedOutputs.push(...cell?.outputsViewModels);
305
+ }
306
+ }
307
+ else {
308
+ removedMarkdownCells.push(cell);
309
+ }
310
+ }
311
+ this.splice2(diff.start, diff.deleteCount, diff.toInsert);
312
+ this._onDidHideOutputs.fire(hiddenOutputs);
313
+ this._onDidRemoveOutputs.fire(deletedOutputs);
314
+ this._onDidRemoveCellsFromView.fire(removedMarkdownCells);
315
+ });
316
+ }
317
+ clear() {
318
+ super.splice(0, this.length);
319
+ }
320
+ setHiddenAreas(_ranges, triggerViewUpdate) {
321
+ if (!this._viewModel) {
322
+ return false;
323
+ }
324
+ const newRanges = reduceCellRanges(_ranges);
325
+ const oldRanges = ( this._hiddenRangeIds.map(id => this._viewModel.getTrackedRange(id))).filter(range => range !== null);
326
+ if (newRanges.length === oldRanges.length) {
327
+ let hasDifference = false;
328
+ for (let i = 0; i < newRanges.length; i++) {
329
+ if (!(newRanges[i].start === oldRanges[i].start && newRanges[i].end === oldRanges[i].end)) {
330
+ hasDifference = true;
331
+ break;
332
+ }
333
+ }
334
+ if (!hasDifference) {
335
+ this._updateHiddenRangePrefixSum(newRanges);
336
+ return false;
337
+ }
338
+ }
339
+ this._hiddenRangeIds.forEach(id => this._viewModel.setTrackedRange(id, null, 3 ));
340
+ const hiddenAreaIds = ( newRanges.map(
341
+ range => this._viewModel.setTrackedRange(null, range, 3 )
342
+ )).filter(id => id !== null);
343
+ this._hiddenRangeIds = hiddenAreaIds;
344
+ this._updateHiddenRangePrefixSum(newRanges);
345
+ if (triggerViewUpdate) {
346
+ this.updateHiddenAreasInView(oldRanges, newRanges);
347
+ }
348
+ return true;
349
+ }
350
+ _updateHiddenRangePrefixSum(newRanges) {
351
+ let start = 0;
352
+ let index = 0;
353
+ const ret = [];
354
+ while (index < newRanges.length) {
355
+ for (let j = start; j < newRanges[index].start - 1; j++) {
356
+ ret.push(1);
357
+ }
358
+ ret.push(newRanges[index].end - newRanges[index].start + 1 + 1);
359
+ start = newRanges[index].end + 1;
360
+ index++;
361
+ }
362
+ for (let i = start; i < this._viewModel.length; i++) {
363
+ ret.push(1);
364
+ }
365
+ const values = ( new Uint32Array(ret.length));
366
+ for (let i = 0; i < ret.length; i++) {
367
+ values[i] = ret[i];
368
+ }
369
+ this.hiddenRangesPrefixSum = ( new PrefixSumComputer(values));
370
+ }
371
+ updateHiddenAreasInView(oldRanges, newRanges) {
372
+ const oldViewCellEntries = getVisibleCells(this._viewModel.viewCells, oldRanges);
373
+ const oldViewCellMapping = ( new Set());
374
+ oldViewCellEntries.forEach(cell => {
375
+ oldViewCellMapping.add(( cell.uri.toString()));
376
+ });
377
+ const newViewCellEntries = getVisibleCells(this._viewModel.viewCells, newRanges);
378
+ const viewDiffs = diff(oldViewCellEntries, newViewCellEntries, a => {
379
+ return ( oldViewCellMapping.has(( a.uri.toString())));
380
+ });
381
+ this._updateElementsInWebview(viewDiffs);
382
+ }
383
+ splice2(start, deleteCount, elements = []) {
384
+ if (start < 0 || start > this.view.length) {
385
+ return;
386
+ }
387
+ const focusInside = dom.isAncestorOfActiveElement(this.rowsContainer);
388
+ super.splice(start, deleteCount, elements);
389
+ if (focusInside) {
390
+ this.domFocus();
391
+ }
392
+ const selectionsLeft = [];
393
+ this.getSelectedElements().forEach(el => {
394
+ if (this._viewModel.hasCell(el)) {
395
+ selectionsLeft.push(el.handle);
396
+ }
397
+ });
398
+ if (!selectionsLeft.length && this._viewModel.viewCells.length) {
399
+ this._viewModel.updateSelectionsState({ kind: SelectionStateType.Index, focus: { start: 0, end: 1 }, selections: [{ start: 0, end: 1 }] });
400
+ }
401
+ }
402
+ getModelIndex(cell) {
403
+ const viewIndex = this.indexOf(cell);
404
+ return this.getModelIndex2(viewIndex);
405
+ }
406
+ getModelIndex2(viewIndex) {
407
+ if (!this.hiddenRangesPrefixSum) {
408
+ return viewIndex;
409
+ }
410
+ const modelIndex = this.hiddenRangesPrefixSum.getPrefixSum(viewIndex - 1);
411
+ return modelIndex;
412
+ }
413
+ getViewIndex(cell) {
414
+ const modelIndex = this._viewModel.getCellIndex(cell);
415
+ return this.getViewIndex2(modelIndex);
416
+ }
417
+ getViewIndex2(modelIndex) {
418
+ if (!this.hiddenRangesPrefixSum) {
419
+ return modelIndex;
420
+ }
421
+ const viewIndexInfo = this.hiddenRangesPrefixSum.getIndexOf(modelIndex);
422
+ if (viewIndexInfo.remainder !== 0) {
423
+ if (modelIndex >= this.hiddenRangesPrefixSum.getTotalSum()) {
424
+ return modelIndex - (this.hiddenRangesPrefixSum.getTotalSum() - this.hiddenRangesPrefixSum.getCount());
425
+ }
426
+ return undefined;
427
+ }
428
+ else {
429
+ return viewIndexInfo.index;
430
+ }
431
+ }
432
+ _getVisibleRangesFromIndex(topViewIndex, topModelIndex, bottomViewIndex, bottomModelIndex) {
433
+ const stack = [];
434
+ const ranges = [];
435
+ let index = topViewIndex;
436
+ let modelIndex = topModelIndex;
437
+ while (index <= bottomViewIndex) {
438
+ const accu = this.hiddenRangesPrefixSum.getPrefixSum(index);
439
+ if (accu === modelIndex + 1) {
440
+ if (stack.length) {
441
+ if (stack[stack.length - 1] === modelIndex - 1) {
442
+ ranges.push({ start: stack[stack.length - 1], end: modelIndex + 1 });
443
+ }
444
+ else {
445
+ ranges.push({ start: stack[stack.length - 1], end: stack[stack.length - 1] + 1 });
446
+ }
447
+ }
448
+ stack.push(modelIndex);
449
+ index++;
450
+ modelIndex++;
451
+ }
452
+ else {
453
+ if (stack.length) {
454
+ if (stack[stack.length - 1] === modelIndex - 1) {
455
+ ranges.push({ start: stack[stack.length - 1], end: modelIndex + 1 });
456
+ }
457
+ else {
458
+ ranges.push({ start: stack[stack.length - 1], end: stack[stack.length - 1] + 1 });
459
+ }
460
+ }
461
+ stack.push(modelIndex);
462
+ index++;
463
+ modelIndex = accu;
464
+ }
465
+ }
466
+ if (stack.length) {
467
+ ranges.push({ start: stack[stack.length - 1], end: stack[stack.length - 1] + 1 });
468
+ }
469
+ return reduceCellRanges(ranges);
470
+ }
471
+ getVisibleRangesPlusViewportAboveAndBelow() {
472
+ if (this.view.length <= 0) {
473
+ return [];
474
+ }
475
+ const top = Math.max(this.getViewScrollTop() - this.renderHeight, 0);
476
+ const topViewIndex = this.view.indexAt(top);
477
+ const topElement = this.view.element(topViewIndex);
478
+ const topModelIndex = this._viewModel.getCellIndex(topElement);
479
+ const bottom = clamp(this.getViewScrollBottom() + this.renderHeight, 0, this.scrollHeight);
480
+ const bottomViewIndex = clamp(this.view.indexAt(bottom), 0, this.view.length - 1);
481
+ const bottomElement = this.view.element(bottomViewIndex);
482
+ const bottomModelIndex = this._viewModel.getCellIndex(bottomElement);
483
+ if (bottomModelIndex - topModelIndex === bottomViewIndex - topViewIndex) {
484
+ return [{ start: topModelIndex, end: bottomModelIndex }];
485
+ }
486
+ else {
487
+ return this._getVisibleRangesFromIndex(topViewIndex, topModelIndex, bottomViewIndex, bottomModelIndex);
488
+ }
489
+ }
490
+ _getViewIndexUpperBound(cell) {
491
+ if (!this._viewModel) {
492
+ return -1;
493
+ }
494
+ const modelIndex = this._viewModel.getCellIndex(cell);
495
+ if (modelIndex === -1) {
496
+ return -1;
497
+ }
498
+ if (!this.hiddenRangesPrefixSum) {
499
+ return modelIndex;
500
+ }
501
+ const viewIndexInfo = this.hiddenRangesPrefixSum.getIndexOf(modelIndex);
502
+ if (viewIndexInfo.remainder !== 0) {
503
+ if (modelIndex >= this.hiddenRangesPrefixSum.getTotalSum()) {
504
+ return modelIndex - (this.hiddenRangesPrefixSum.getTotalSum() - this.hiddenRangesPrefixSum.getCount());
505
+ }
506
+ }
507
+ return viewIndexInfo.index;
508
+ }
509
+ _getViewIndexUpperBound2(modelIndex) {
510
+ if (!this.hiddenRangesPrefixSum) {
511
+ return modelIndex;
512
+ }
513
+ const viewIndexInfo = this.hiddenRangesPrefixSum.getIndexOf(modelIndex);
514
+ if (viewIndexInfo.remainder !== 0) {
515
+ if (modelIndex >= this.hiddenRangesPrefixSum.getTotalSum()) {
516
+ return modelIndex - (this.hiddenRangesPrefixSum.getTotalSum() - this.hiddenRangesPrefixSum.getCount());
517
+ }
518
+ }
519
+ return viewIndexInfo.index;
520
+ }
521
+ focusElement(cell) {
522
+ const index = this._getViewIndexUpperBound(cell);
523
+ if (index >= 0 && this._viewModel) {
524
+ const focusedElementHandle = this.element(index).handle;
525
+ this._viewModel.updateSelectionsState({
526
+ kind: SelectionStateType.Handle,
527
+ primary: focusedElementHandle,
528
+ selections: [focusedElementHandle]
529
+ }, 'view');
530
+ this.setFocus([index], undefined, false);
531
+ }
532
+ }
533
+ selectElements(elements) {
534
+ const indices = ( elements.map(cell => this._getViewIndexUpperBound(cell))).filter(index => index >= 0);
535
+ this.setSelection(indices);
536
+ }
537
+ getCellViewScrollTop(cell) {
538
+ const index = this._getViewIndexUpperBound(cell);
539
+ if (index === undefined || index < 0 || index >= this.length) {
540
+ throw new ListError(this.listUser, `Invalid index ${index}`);
541
+ }
542
+ return this.view.elementTop(index);
543
+ }
544
+ getCellViewScrollBottom(cell) {
545
+ const index = this._getViewIndexUpperBound(cell);
546
+ if (index === undefined || index < 0 || index >= this.length) {
547
+ throw new ListError(this.listUser, `Invalid index ${index}`);
548
+ }
549
+ const top = this.view.elementTop(index);
550
+ const height = this.view.elementHeight(index);
551
+ return top + height;
552
+ }
553
+ setFocus(indexes, browserEvent, ignoreTextModelUpdate) {
554
+ if (ignoreTextModelUpdate) {
555
+ super.setFocus(indexes, browserEvent);
556
+ return;
557
+ }
558
+ if (!indexes.length) {
559
+ if (this._viewModel) {
560
+ if (this.length) {
561
+ return;
562
+ }
563
+ this._viewModel.updateSelectionsState({
564
+ kind: SelectionStateType.Handle,
565
+ primary: null,
566
+ selections: []
567
+ }, 'view');
568
+ }
569
+ }
570
+ else {
571
+ if (this._viewModel) {
572
+ const focusedElementHandle = this.element(indexes[0]).handle;
573
+ this._viewModel.updateSelectionsState({
574
+ kind: SelectionStateType.Handle,
575
+ primary: focusedElementHandle,
576
+ selections: ( this.getSelection().map(selection => this.element(selection).handle))
577
+ }, 'view');
578
+ }
579
+ }
580
+ super.setFocus(indexes, browserEvent);
581
+ }
582
+ setSelection(indexes, browserEvent, ignoreTextModelUpdate) {
583
+ if (ignoreTextModelUpdate) {
584
+ super.setSelection(indexes, browserEvent);
585
+ return;
586
+ }
587
+ if (!indexes.length) {
588
+ if (this._viewModel) {
589
+ this._viewModel.updateSelectionsState({
590
+ kind: SelectionStateType.Handle,
591
+ primary: this.getFocusedElements()[0]?.handle ?? null,
592
+ selections: []
593
+ }, 'view');
594
+ }
595
+ }
596
+ else {
597
+ if (this._viewModel) {
598
+ this._viewModel.updateSelectionsState({
599
+ kind: SelectionStateType.Handle,
600
+ primary: this.getFocusedElements()[0]?.handle ?? null,
601
+ selections: ( ( indexes.map(index => this.element(index))).map(cell => cell.handle))
602
+ }, 'view');
603
+ }
604
+ }
605
+ super.setSelection(indexes, browserEvent);
606
+ }
607
+ revealCells(range) {
608
+ const startIndex = this._getViewIndexUpperBound2(range.start);
609
+ if (startIndex < 0) {
610
+ return;
611
+ }
612
+ const endIndex = this._getViewIndexUpperBound2(range.end - 1);
613
+ const scrollTop = this.getViewScrollTop();
614
+ const wrapperBottom = this.getViewScrollBottom();
615
+ const elementTop = this.view.elementTop(startIndex);
616
+ if (elementTop >= scrollTop
617
+ && elementTop < wrapperBottom) {
618
+ const endElementTop = this.view.elementTop(endIndex);
619
+ const endElementHeight = this.view.elementHeight(endIndex);
620
+ if (endElementTop + endElementHeight <= wrapperBottom) {
621
+ return;
622
+ }
623
+ if (endElementTop >= wrapperBottom) {
624
+ return this._revealInternal(endIndex, false, 2 );
625
+ }
626
+ if (endElementTop < wrapperBottom) {
627
+ if (endElementTop + endElementHeight - wrapperBottom < elementTop - scrollTop) {
628
+ return this.view.setScrollTop(scrollTop + endElementTop + endElementHeight - wrapperBottom);
629
+ }
630
+ else {
631
+ return this._revealInternal(startIndex, false, 0 );
632
+ }
633
+ }
634
+ }
635
+ this._revealInViewWithMinimalScrolling(startIndex);
636
+ }
637
+ _revealInViewWithMinimalScrolling(viewIndex, firstLine) {
638
+ const firstIndex = this.view.firstMostlyVisibleIndex;
639
+ const elementHeight = this.view.elementHeight(viewIndex);
640
+ if (viewIndex <= firstIndex || (!firstLine && elementHeight >= this.view.renderHeight)) {
641
+ this._revealInternal(viewIndex, true, 0 );
642
+ }
643
+ else {
644
+ this._revealInternal(viewIndex, true, 2 , firstLine);
645
+ }
646
+ }
647
+ scrollToBottom() {
648
+ const scrollHeight = this.view.scrollHeight;
649
+ const scrollTop = this.getViewScrollTop();
650
+ const wrapperBottom = this.getViewScrollBottom();
651
+ this.view.setScrollTop(scrollHeight - (wrapperBottom - scrollTop));
652
+ }
653
+ async revealCell(cell, revealType) {
654
+ const index = this._getViewIndexUpperBound(cell);
655
+ if (index < 0) {
656
+ return;
657
+ }
658
+ switch (revealType) {
659
+ case 2 :
660
+ this._revealInternal(index, false, 0 );
661
+ break;
662
+ case 3 :
663
+ this._revealInternal(index, false, 1 );
664
+ break;
665
+ case 4 :
666
+ this._revealInternal(index, true, 1 );
667
+ break;
668
+ case 5 :
669
+ this._revealInternal(index, true, 3 );
670
+ break;
671
+ case 6 :
672
+ this._revealInViewWithMinimalScrolling(index, true);
673
+ break;
674
+ case 1 :
675
+ this._revealInViewWithMinimalScrolling(index);
676
+ break;
677
+ }
678
+ if (cell.getEditState() === CellEditState.Editing && !cell.editorAttached) {
679
+ return getEditorAttachedPromise(cell);
680
+ }
681
+ return;
682
+ }
683
+ _revealInternal(viewIndex, ignoreIfInsideViewport, revealPosition, firstLine) {
684
+ if (viewIndex >= this.view.length) {
685
+ return;
686
+ }
687
+ const scrollTop = this.getViewScrollTop();
688
+ const wrapperBottom = this.getViewScrollBottom();
689
+ const elementTop = this.view.elementTop(viewIndex);
690
+ const elementBottom = this.view.elementHeight(viewIndex) + elementTop;
691
+ if (ignoreIfInsideViewport) {
692
+ if (elementTop >= scrollTop && elementBottom < wrapperBottom) {
693
+ return;
694
+ }
695
+ }
696
+ switch (revealPosition) {
697
+ case 0 :
698
+ this.view.setScrollTop(elementTop);
699
+ this.view.setScrollTop(this.view.elementTop(viewIndex));
700
+ break;
701
+ case 1 :
702
+ case 3 :
703
+ {
704
+ this.view.setScrollTop(elementTop - this.view.renderHeight / 2);
705
+ const newElementTop = this.view.elementTop(viewIndex);
706
+ const newElementHeight = this.view.elementHeight(viewIndex);
707
+ const renderHeight = this.getViewScrollBottom() - this.getViewScrollTop();
708
+ if (newElementHeight >= renderHeight) {
709
+ this.view.setScrollTop(newElementTop);
710
+ }
711
+ else if (revealPosition === 1 ) {
712
+ this.view.setScrollTop(newElementTop + (newElementHeight / 2) - (renderHeight / 2));
713
+ }
714
+ else if (revealPosition === 3 ) {
715
+ this.view.setScrollTop(newElementTop - (renderHeight / 5));
716
+ }
717
+ }
718
+ break;
719
+ case 2 :
720
+ if (firstLine) {
721
+ const lineHeight = this.viewModel?.layoutInfo?.fontInfo.lineHeight ?? 15;
722
+ const padding = this.notebookOptions.getLayoutConfiguration().cellTopMargin + this.notebookOptions.getLayoutConfiguration().editorTopPadding;
723
+ const firstLineLocation = elementTop + lineHeight + padding;
724
+ if (firstLineLocation < wrapperBottom) {
725
+ return;
726
+ }
727
+ this.view.setScrollTop(this.scrollTop + (firstLineLocation - wrapperBottom));
728
+ break;
729
+ }
730
+ this.view.setScrollTop(this.scrollTop + (elementBottom - wrapperBottom));
731
+ this.view.setScrollTop(this.scrollTop + (this.view.elementTop(viewIndex) + this.view.elementHeight(viewIndex) - this.getViewScrollBottom()));
732
+ break;
733
+ }
734
+ }
735
+ async revealRangeInCell(cell, range, revealType) {
736
+ const index = this._getViewIndexUpperBound(cell);
737
+ if (index < 0) {
738
+ return;
739
+ }
740
+ switch (revealType) {
741
+ case CellRevealRangeType.Default:
742
+ return this._revealRangeInternalAsync(index, range);
743
+ case CellRevealRangeType.Center:
744
+ return this._revealRangeInCenterInternalAsync(index, range);
745
+ case CellRevealRangeType.CenterIfOutsideViewport:
746
+ return this._revealRangeInCenterIfOutsideViewportInternalAsync(index, range);
747
+ }
748
+ }
749
+ async _revealRangeInternalAsync(viewIndex, range) {
750
+ const scrollTop = this.getViewScrollTop();
751
+ const wrapperBottom = this.getViewScrollBottom();
752
+ const elementTop = this.view.elementTop(viewIndex);
753
+ const element = this.view.element(viewIndex);
754
+ if (element.editorAttached) {
755
+ this._revealRangeCommon(viewIndex, range, false, false);
756
+ }
757
+ else {
758
+ const elementHeight = this.view.elementHeight(viewIndex);
759
+ let upwards = false;
760
+ if (elementTop + elementHeight <= scrollTop) {
761
+ this.view.setScrollTop(elementTop);
762
+ upwards = false;
763
+ }
764
+ else if (elementTop >= wrapperBottom) {
765
+ this.view.setScrollTop(elementTop - this.view.renderHeight / 2);
766
+ upwards = true;
767
+ }
768
+ const editorAttachedPromise = ( new Promise((resolve, reject) => {
769
+ element.onDidChangeEditorAttachState(() => {
770
+ element.editorAttached ? resolve() : reject();
771
+ });
772
+ }));
773
+ return editorAttachedPromise.then(() => {
774
+ this._revealRangeCommon(viewIndex, range, true, upwards);
775
+ });
776
+ }
777
+ }
778
+ async _revealRangeInCenterInternalAsync(viewIndex, range) {
779
+ const reveal = (viewIndex, range) => {
780
+ const element = this.view.element(viewIndex);
781
+ const positionOffset = element.getPositionScrollTopOffset(range);
782
+ const positionOffsetInView = this.view.elementTop(viewIndex) + positionOffset;
783
+ this.view.setScrollTop(positionOffsetInView - this.view.renderHeight / 2);
784
+ element.revealRangeInCenter(range);
785
+ };
786
+ const elementTop = this.view.elementTop(viewIndex);
787
+ const viewItemOffset = elementTop;
788
+ this.view.setScrollTop(viewItemOffset - this.view.renderHeight / 2);
789
+ const element = this.view.element(viewIndex);
790
+ if (!element.editorAttached) {
791
+ return getEditorAttachedPromise(element).then(() => reveal(viewIndex, range));
792
+ }
793
+ else {
794
+ reveal(viewIndex, range);
795
+ }
796
+ }
797
+ async _revealRangeInCenterIfOutsideViewportInternalAsync(viewIndex, range) {
798
+ const reveal = (viewIndex, range) => {
799
+ const element = this.view.element(viewIndex);
800
+ const positionOffset = element.getPositionScrollTopOffset(range);
801
+ const positionOffsetInView = this.view.elementTop(viewIndex) + positionOffset;
802
+ this.view.setScrollTop(positionOffsetInView - this.view.renderHeight / 2);
803
+ element.revealRangeInCenter(range);
804
+ };
805
+ const scrollTop = this.getViewScrollTop();
806
+ const wrapperBottom = this.getViewScrollBottom();
807
+ const elementTop = this.view.elementTop(viewIndex);
808
+ const viewItemOffset = elementTop;
809
+ const element = this.view.element(viewIndex);
810
+ const positionOffset = viewItemOffset + element.getPositionScrollTopOffset(range);
811
+ if (positionOffset < scrollTop || positionOffset > wrapperBottom) {
812
+ this.view.setScrollTop(positionOffset - this.view.renderHeight / 2);
813
+ const newPositionOffset = this.view.elementTop(viewIndex) + element.getPositionScrollTopOffset(range);
814
+ this.view.setScrollTop(newPositionOffset - this.view.renderHeight / 2);
815
+ if (!element.editorAttached) {
816
+ return getEditorAttachedPromise(element).then(() => reveal(viewIndex, range));
817
+ }
818
+ }
819
+ else {
820
+ if (element.editorAttached) {
821
+ element.revealRangeInCenter(range);
822
+ }
823
+ else {
824
+ return getEditorAttachedPromise(element).then(() => reveal(viewIndex, range));
825
+ }
826
+ }
827
+ }
828
+ _revealRangeCommon(viewIndex, range, newlyCreated, alignToBottom) {
829
+ const element = this.view.element(viewIndex);
830
+ const scrollTop = this.getViewScrollTop();
831
+ const wrapperBottom = this.getViewScrollBottom();
832
+ const positionOffset = element.getPositionScrollTopOffset(range);
833
+ const elementOriginalHeight = this.view.elementHeight(viewIndex);
834
+ if (positionOffset >= elementOriginalHeight) {
835
+ const newTotalHeight = element.layoutInfo.totalHeight;
836
+ this.updateElementHeight(viewIndex, newTotalHeight);
837
+ }
838
+ const elementTop = this.view.elementTop(viewIndex);
839
+ const positionTop = elementTop + positionOffset;
840
+ if (positionTop < scrollTop) {
841
+ this.view.setScrollTop(positionTop - 30);
842
+ }
843
+ else if (positionTop > wrapperBottom) {
844
+ this.view.setScrollTop(scrollTop + positionTop - wrapperBottom + 30);
845
+ }
846
+ else if (newlyCreated) {
847
+ if (alignToBottom) {
848
+ this.view.setScrollTop(scrollTop + positionTop - wrapperBottom + 30);
849
+ }
850
+ else {
851
+ this.view.setScrollTop(positionTop - 30);
852
+ }
853
+ }
854
+ element.revealRangeInCenter(range);
855
+ }
856
+ revealCellOffsetInCenter(cell, offset) {
857
+ const viewIndex = this._getViewIndexUpperBound(cell);
858
+ if (viewIndex >= 0) {
859
+ const element = this.view.element(viewIndex);
860
+ const elementTop = this.view.elementTop(viewIndex);
861
+ if (element instanceof MarkupCellViewModel) {
862
+ return this._revealInCenterIfOutsideViewport(viewIndex);
863
+ }
864
+ else {
865
+ const rangeOffset = element.layoutInfo.outputContainerOffset + Math.min(offset, element.layoutInfo.outputTotalHeight);
866
+ this.view.setScrollTop(elementTop - this.view.renderHeight / 2);
867
+ this.view.setScrollTop(elementTop + rangeOffset - this.view.renderHeight / 2);
868
+ }
869
+ }
870
+ }
871
+ _revealInCenterIfOutsideViewport(viewIndex) {
872
+ this._revealInternal(viewIndex, true, 1 );
873
+ }
874
+ domElementOfElement(element) {
875
+ const index = this._getViewIndexUpperBound(element);
876
+ if (index >= 0) {
877
+ return this.view.domElement(index);
878
+ }
879
+ return null;
880
+ }
881
+ focusView() {
882
+ this.view.domNode.focus();
883
+ }
884
+ triggerScrollFromMouseWheelEvent(browserEvent) {
885
+ this.view.delegateScrollFromMouseWheelEvent(browserEvent);
886
+ }
887
+ delegateVerticalScrollbarPointerDown(browserEvent) {
888
+ this.view.delegateVerticalScrollbarPointerDown(browserEvent);
889
+ }
890
+ isElementAboveViewport(index) {
891
+ const elementTop = this.view.elementTop(index);
892
+ const elementBottom = elementTop + this.view.elementHeight(index);
893
+ return elementBottom < this.scrollTop;
894
+ }
895
+ updateElementHeight2(element, size, anchorElementIndex = null) {
896
+ const index = this._getViewIndexUpperBound(element);
897
+ if (index === undefined || index < 0 || index >= this.length) {
898
+ return;
899
+ }
900
+ if (this.isElementAboveViewport(index)) {
901
+ const oldHeight = this.elementHeight(element);
902
+ const delta = oldHeight - size;
903
+ if (this._webviewElement) {
904
+ Event.once(this.view.onWillScroll)(() => {
905
+ const webviewTop = parseInt(this._webviewElement.domNode.style.top, 10);
906
+ if (validateWebviewBoundary(this._webviewElement.domNode)) {
907
+ this._webviewElement.setTop(webviewTop - delta);
908
+ }
909
+ else {
910
+ this._webviewElement.setTop(-NOTEBOOK_WEBVIEW_BOUNDARY);
911
+ }
912
+ });
913
+ }
914
+ this.view.updateElementHeight(index, size, anchorElementIndex);
915
+ return;
916
+ }
917
+ if (anchorElementIndex !== null) {
918
+ return this.view.updateElementHeight(index, size, anchorElementIndex);
919
+ }
920
+ const focused = this.getFocus();
921
+ const focus = focused.length ? focused[0] : null;
922
+ if (focus) {
923
+ const heightDelta = size - this.view.elementHeight(index);
924
+ if (this._notebookCellAnchor.shouldAnchor(this.view, focus, heightDelta, this.element(index))) {
925
+ return this.view.updateElementHeight(index, size, focus);
926
+ }
927
+ }
928
+ return this.view.updateElementHeight(index, size, null);
929
+ }
930
+ domFocus() {
931
+ const focused = this.getFocusedElements()[0];
932
+ const focusedDomElement = focused && this.domElementOfElement(focused);
933
+ if (this.view.domNode.ownerDocument.activeElement && focusedDomElement && focusedDomElement.contains(this.view.domNode.ownerDocument.activeElement)) {
934
+ return;
935
+ }
936
+ if (!isMacintosh && this.view.domNode.ownerDocument.activeElement && !!dom.findParentWithClass(this.view.domNode.ownerDocument.activeElement, 'context-view')) {
937
+ return;
938
+ }
939
+ super.domFocus();
940
+ }
941
+ focusContainer() {
942
+ super.domFocus();
943
+ }
944
+ getViewScrollTop() {
945
+ return this.view.getScrollTop();
946
+ }
947
+ getViewScrollBottom() {
948
+ return this.getViewScrollTop() + this.view.renderHeight;
949
+ }
950
+ setCellEditorSelection(cell, range) {
951
+ const element = cell;
952
+ if (element.editorAttached) {
953
+ element.setSelection(range);
954
+ }
955
+ else {
956
+ getEditorAttachedPromise(element).then(() => { element.setSelection(range); });
957
+ }
958
+ }
959
+ style(styles) {
960
+ const selectorSuffix = this.view.domId;
961
+ if (!this.styleElement) {
962
+ this.styleElement = dom.createStyleSheet(this.view.domNode);
963
+ }
964
+ const suffix = selectorSuffix && `.${selectorSuffix}`;
965
+ const content = [];
966
+ if (styles.listBackground) {
967
+ content.push(`.monaco-list${suffix} > div.monaco-scrollable-element > .monaco-list-rows { background: ${styles.listBackground}; }`);
968
+ }
969
+ if (styles.listFocusBackground) {
970
+ content.push(`.monaco-list${suffix}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { background-color: ${styles.listFocusBackground}; }`);
971
+ content.push(`.monaco-list${suffix}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused:hover { background-color: ${styles.listFocusBackground}; }`);
972
+ }
973
+ if (styles.listFocusForeground) {
974
+ content.push(`.monaco-list${suffix}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { color: ${styles.listFocusForeground}; }`);
975
+ }
976
+ if (styles.listActiveSelectionBackground) {
977
+ content.push(`.monaco-list${suffix}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { background-color: ${styles.listActiveSelectionBackground}; }`);
978
+ content.push(`.monaco-list${suffix}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected:hover { background-color: ${styles.listActiveSelectionBackground}; }`);
979
+ }
980
+ if (styles.listActiveSelectionForeground) {
981
+ content.push(`.monaco-list${suffix}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { color: ${styles.listActiveSelectionForeground}; }`);
982
+ }
983
+ if (styles.listFocusAndSelectionBackground) {
984
+ content.push(`
985
+ .monaco-drag-image,
986
+ .monaco-list${suffix}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected.focused { background-color: ${styles.listFocusAndSelectionBackground}; }
987
+ `);
988
+ }
989
+ if (styles.listFocusAndSelectionForeground) {
990
+ content.push(`
991
+ .monaco-drag-image,
992
+ .monaco-list${suffix}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected.focused { color: ${styles.listFocusAndSelectionForeground}; }
993
+ `);
994
+ }
995
+ if (styles.listInactiveFocusBackground) {
996
+ content.push(`.monaco-list${suffix} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { background-color: ${styles.listInactiveFocusBackground}; }`);
997
+ content.push(`.monaco-list${suffix} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused:hover { background-color: ${styles.listInactiveFocusBackground}; }`);
998
+ }
999
+ if (styles.listInactiveSelectionBackground) {
1000
+ content.push(`.monaco-list${suffix} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { background-color: ${styles.listInactiveSelectionBackground}; }`);
1001
+ content.push(`.monaco-list${suffix} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected:hover { background-color: ${styles.listInactiveSelectionBackground}; }`);
1002
+ }
1003
+ if (styles.listInactiveSelectionForeground) {
1004
+ content.push(`.monaco-list${suffix} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { color: ${styles.listInactiveSelectionForeground}; }`);
1005
+ }
1006
+ if (styles.listHoverBackground) {
1007
+ content.push(`.monaco-list${suffix}:not(.drop-target) > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row:hover:not(.selected):not(.focused) { background-color: ${styles.listHoverBackground}; }`);
1008
+ }
1009
+ if (styles.listHoverForeground) {
1010
+ content.push(`.monaco-list${suffix} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row:hover:not(.selected):not(.focused) { color: ${styles.listHoverForeground}; }`);
1011
+ }
1012
+ if (styles.listSelectionOutline) {
1013
+ content.push(`.monaco-list${suffix} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { outline: 1px dotted ${styles.listSelectionOutline}; outline-offset: -1px; }`);
1014
+ }
1015
+ if (styles.listFocusOutline) {
1016
+ content.push(`
1017
+ .monaco-drag-image,
1018
+ .monaco-list${suffix}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { outline: 1px solid ${styles.listFocusOutline}; outline-offset: -1px; }
1019
+ `);
1020
+ }
1021
+ if (styles.listInactiveFocusOutline) {
1022
+ content.push(`.monaco-list${suffix} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { outline: 1px dotted ${styles.listInactiveFocusOutline}; outline-offset: -1px; }`);
1023
+ }
1024
+ if (styles.listHoverOutline) {
1025
+ content.push(`.monaco-list${suffix} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row:hover { outline: 1px dashed ${styles.listHoverOutline}; outline-offset: -1px; }`);
1026
+ }
1027
+ if (styles.listDropBackground) {
1028
+ content.push(`
1029
+ .monaco-list${suffix}.drop-target,
1030
+ .monaco-list${suffix} > div.monaco-scrollable-element > .monaco-list-rows.drop-target,
1031
+ .monaco-list${suffix} > div.monaco-scrollable-element > .monaco-list-row.drop-target { background-color: ${styles.listDropBackground} !important; color: inherit !important; }
1032
+ `);
1033
+ }
1034
+ const newStyles = content.join('\n');
1035
+ if (newStyles !== this.styleElement.textContent) {
1036
+ this.styleElement.textContent = newStyles;
1037
+ }
1038
+ }
1039
+ getRenderHeight() {
1040
+ return this.view.renderHeight;
1041
+ }
1042
+ getScrollHeight() {
1043
+ return this.view.scrollHeight;
1044
+ }
1045
+ layout(height, width) {
1046
+ this._isInLayout = true;
1047
+ super.layout(height, width);
1048
+ if (this.renderHeight === 0) {
1049
+ this.view.domNode.style.visibility = 'hidden';
1050
+ }
1051
+ else {
1052
+ this.view.domNode.style.visibility = 'initial';
1053
+ }
1054
+ this._isInLayout = false;
1055
+ }
1056
+ dispose() {
1057
+ this._isDisposed = true;
1058
+ this._viewModelStore.dispose();
1059
+ this._localDisposableStore.dispose();
1060
+ this._notebookCellAnchor.dispose();
1061
+ super.dispose();
1062
+ this._previousFocusedElements = [];
1063
+ this._viewModel = null;
1064
+ this._hiddenRangeIds = [];
1065
+ this.hiddenRangesPrefixSum = null;
1066
+ this._visibleRanges = [];
1067
+ }
1068
+ };
1069
+ NotebookCellList = ( __decorate([
1070
+ ( __param(7, IListService)),
1071
+ ( __param(8, IConfigurationService)),
1072
+ ( __param(9, IInstantiationService)),
1073
+ ( __param(10, INotebookExecutionStateService))
1074
+ ], NotebookCellList));
1075
+ class ListViewInfoAccessor extends Disposable {
1076
+ constructor(list) {
1077
+ super();
1078
+ this.list = list;
1079
+ }
1080
+ getViewIndex(cell) {
1081
+ return this.list.getViewIndex(cell) ?? -1;
1082
+ }
1083
+ getViewHeight(cell) {
1084
+ if (!this.list.viewModel) {
1085
+ return -1;
1086
+ }
1087
+ return this.list.elementHeight(cell);
1088
+ }
1089
+ getCellRangeFromViewRange(startIndex, endIndex) {
1090
+ if (!this.list.viewModel) {
1091
+ return undefined;
1092
+ }
1093
+ const modelIndex = this.list.getModelIndex2(startIndex);
1094
+ if (modelIndex === undefined) {
1095
+ throw new Error(`startIndex ${startIndex} out of boundary`);
1096
+ }
1097
+ if (endIndex >= this.list.length) {
1098
+ const endModelIndex = this.list.viewModel.length;
1099
+ return { start: modelIndex, end: endModelIndex };
1100
+ }
1101
+ else {
1102
+ const endModelIndex = this.list.getModelIndex2(endIndex);
1103
+ if (endModelIndex === undefined) {
1104
+ throw new Error(`endIndex ${endIndex} out of boundary`);
1105
+ }
1106
+ return { start: modelIndex, end: endModelIndex };
1107
+ }
1108
+ }
1109
+ getCellsFromViewRange(startIndex, endIndex) {
1110
+ if (!this.list.viewModel) {
1111
+ return [];
1112
+ }
1113
+ const range = this.getCellRangeFromViewRange(startIndex, endIndex);
1114
+ if (!range) {
1115
+ return [];
1116
+ }
1117
+ return this.list.viewModel.getCellsInRange(range);
1118
+ }
1119
+ getCellsInRange(range) {
1120
+ return this.list.viewModel?.getCellsInRange(range) ?? [];
1121
+ }
1122
+ getVisibleRangesPlusViewportAboveAndBelow() {
1123
+ return this.list?.getVisibleRangesPlusViewportAboveAndBelow() ?? [];
1124
+ }
1125
+ }
1126
+ function getEditorAttachedPromise(element) {
1127
+ return ( new Promise((resolve, reject) => {
1128
+ Event.once(element.onDidChangeEditorAttachState)(() => element.editorAttached ? resolve() : reject());
1129
+ }));
1130
+ }
1131
+ export { ListViewInfoAccessor, NOTEBOOK_WEBVIEW_BOUNDARY, NotebookCellList };