monaco-editor-core 0.57.0 → 0.58.0-dev-20261104

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 (508) hide show
  1. package/esm/nls.keys.json +1 -1
  2. package/esm/nls.messages.cs.js +2 -2
  3. package/esm/nls.messages.de.js +2 -2
  4. package/esm/nls.messages.es.js +2 -2
  5. package/esm/nls.messages.fr.js +2 -2
  6. package/esm/nls.messages.it.js +2 -2
  7. package/esm/nls.messages.ja.js +2 -2
  8. package/esm/nls.messages.js +1 -1
  9. package/esm/nls.messages.json +1 -1
  10. package/esm/nls.messages.ko.js +2 -2
  11. package/esm/nls.messages.pl.js +2 -2
  12. package/esm/nls.messages.pt-br.js +2 -2
  13. package/esm/nls.messages.ru.js +2 -2
  14. package/esm/nls.messages.tr.js +2 -2
  15. package/esm/nls.messages.zh-cn.js +2 -2
  16. package/esm/nls.messages.zh-tw.js +2 -2
  17. package/esm/nls.metadata.json +38 -6
  18. package/esm/vs/base/browser/browser.js +8 -0
  19. package/esm/vs/base/browser/browser.js.map +1 -1
  20. package/esm/vs/base/browser/contextmenu.js +8 -1
  21. package/esm/vs/base/browser/contextmenu.js.map +1 -1
  22. package/esm/vs/base/browser/dom.js +34 -5
  23. package/esm/vs/base/browser/dom.js.map +1 -1
  24. package/esm/vs/base/browser/dompurify/dompurify.js +2457 -2640
  25. package/esm/vs/base/browser/markdownRenderer.js +48 -21
  26. package/esm/vs/base/browser/markdownRenderer.js.map +1 -1
  27. package/esm/vs/base/browser/pixelRatio.js +3 -2
  28. package/esm/vs/base/browser/pixelRatio.js.map +1 -1
  29. package/esm/vs/base/browser/ui/actionbar/actionViewItems.js +5 -2
  30. package/esm/vs/base/browser/ui/actionbar/actionViewItems.js.map +1 -1
  31. package/esm/vs/base/browser/ui/actionbar/actionbar.js +7 -2
  32. package/esm/vs/base/browser/ui/actionbar/actionbar.js.map +1 -1
  33. package/esm/vs/base/browser/ui/animations/animations.js +68 -40
  34. package/esm/vs/base/browser/ui/animations/animations.js.map +1 -1
  35. package/esm/vs/base/browser/ui/button/button.js +7 -0
  36. package/esm/vs/base/browser/ui/button/button.js.map +1 -1
  37. package/esm/vs/base/browser/ui/codicons/codicon/codicon.ttf +0 -0
  38. package/esm/vs/base/browser/ui/contextview/contextview.css +15 -0
  39. package/esm/vs/base/browser/ui/contextview/contextview.js +266 -40
  40. package/esm/vs/base/browser/ui/contextview/contextview.js.map +1 -1
  41. package/esm/vs/base/browser/ui/contextview/windowControlsOverlay.js +72 -0
  42. package/esm/vs/base/browser/ui/contextview/windowControlsOverlay.js.map +1 -0
  43. package/esm/vs/base/browser/ui/dialog/dialog.css +5 -0
  44. package/esm/vs/base/browser/ui/dropdown/dropdown.js +2 -1
  45. package/esm/vs/base/browser/ui/dropdown/dropdown.js.map +1 -1
  46. package/esm/vs/base/browser/ui/dropdown/dropdownActionViewItem.js +1 -0
  47. package/esm/vs/base/browser/ui/dropdown/dropdownActionViewItem.js.map +1 -1
  48. package/esm/vs/base/browser/ui/hover/hover.js.map +1 -1
  49. package/esm/vs/base/browser/ui/list/listView.js +87 -15
  50. package/esm/vs/base/browser/ui/list/listView.js.map +1 -1
  51. package/esm/vs/base/browser/ui/list/listWidget.js +37 -15
  52. package/esm/vs/base/browser/ui/list/listWidget.js.map +1 -1
  53. package/esm/vs/base/browser/ui/menu/menu.js +189 -52
  54. package/esm/vs/base/browser/ui/menu/menu.js.map +1 -1
  55. package/esm/vs/base/browser/ui/radio/radio.css +11 -0
  56. package/esm/vs/base/browser/ui/scrollbar/scrollableElement.js +2 -1
  57. package/esm/vs/base/browser/ui/scrollbar/scrollableElement.js.map +1 -1
  58. package/esm/vs/base/browser/ui/selectBox/selectBox.js.map +1 -1
  59. package/esm/vs/base/browser/ui/selectBox/selectBoxCustom.js +14 -8
  60. package/esm/vs/base/browser/ui/selectBox/selectBoxCustom.js.map +1 -1
  61. package/esm/vs/base/browser/ui/splitview/splitview.js +11 -7
  62. package/esm/vs/base/browser/ui/splitview/splitview.js.map +1 -1
  63. package/esm/vs/base/browser/ui/toggle/switch.css +16 -7
  64. package/esm/vs/base/browser/ui/toggle/switch.js +9 -6
  65. package/esm/vs/base/browser/ui/toggle/switch.js.map +1 -1
  66. package/esm/vs/base/browser/ui/toolbar/toolbar.css +1 -2
  67. package/esm/vs/base/browser/ui/toolbar/toolbar.js +85 -38
  68. package/esm/vs/base/browser/ui/toolbar/toolbar.js.map +1 -1
  69. package/esm/vs/base/browser/ui/tree/abstractTree.js +48 -9
  70. package/esm/vs/base/browser/ui/tree/abstractTree.js.map +1 -1
  71. package/esm/vs/base/browser/ui/tree/asyncDataTree.js +10 -1
  72. package/esm/vs/base/browser/ui/tree/asyncDataTree.js.map +1 -1
  73. package/esm/vs/base/browser/ui/tree/objectTree.js +3 -0
  74. package/esm/vs/base/browser/ui/tree/objectTree.js.map +1 -1
  75. package/esm/vs/base/browser/ui/tree/tree.js.map +1 -1
  76. package/esm/vs/base/common/actions.js +8 -2
  77. package/esm/vs/base/common/actions.js.map +1 -1
  78. package/esm/vs/base/common/arrays.js +4 -4
  79. package/esm/vs/base/common/arrays.js.map +1 -1
  80. package/esm/vs/base/common/async.js +12 -8
  81. package/esm/vs/base/common/async.js.map +1 -1
  82. package/esm/vs/base/common/cancellation.js +25 -0
  83. package/esm/vs/base/common/cancellation.js.map +1 -1
  84. package/esm/vs/base/common/codicons.js +2 -0
  85. package/esm/vs/base/common/codicons.js.map +1 -1
  86. package/esm/vs/base/common/codiconsLibrary.js +2 -0
  87. package/esm/vs/base/common/codiconsLibrary.js.map +1 -1
  88. package/esm/vs/base/common/color.js +1 -1
  89. package/esm/vs/base/common/color.js.map +1 -1
  90. package/esm/vs/base/common/diff/diff.js +60 -1
  91. package/esm/vs/base/common/diff/diff.js.map +1 -1
  92. package/esm/vs/base/common/event.js +1 -1
  93. package/esm/vs/base/common/event.js.map +1 -1
  94. package/esm/vs/base/common/glob.js +1 -0
  95. package/esm/vs/base/common/glob.js.map +1 -1
  96. package/esm/vs/base/common/htmlContent.js +74 -12
  97. package/esm/vs/base/common/htmlContent.js.map +1 -1
  98. package/esm/vs/base/common/json.js +19 -0
  99. package/esm/vs/base/common/json.js.map +1 -0
  100. package/esm/vs/base/common/network.js +16 -0
  101. package/esm/vs/base/common/network.js.map +1 -1
  102. package/esm/vs/base/common/resources.js +14 -2
  103. package/esm/vs/base/common/resources.js.map +1 -1
  104. package/esm/vs/base/common/strings.js +1 -1
  105. package/esm/vs/base/common/strings.js.map +1 -1
  106. package/esm/vs/base/common/uri.js +2 -2
  107. package/esm/vs/base/common/uri.js.map +1 -1
  108. package/esm/vs/editor/browser/config/editorConfiguration.js +1 -1
  109. package/esm/vs/editor/browser/config/fontMeasurements.js +19 -6
  110. package/esm/vs/editor/browser/config/fontMeasurements.js.map +1 -1
  111. package/esm/vs/editor/browser/controller/dragScrolling.js +3 -3
  112. package/esm/vs/editor/browser/controller/editContext/clipboardUtils.js +11 -5
  113. package/esm/vs/editor/browser/controller/editContext/clipboardUtils.js.map +1 -1
  114. package/esm/vs/editor/browser/controller/editContext/native/nativeEditContext.js +8 -38
  115. package/esm/vs/editor/browser/controller/editContext/native/nativeEditContext.js.map +1 -1
  116. package/esm/vs/editor/browser/controller/editContext/native/screenReaderContentRich.js +3 -3
  117. package/esm/vs/editor/browser/controller/editContext/native/screenReaderSupport.js +6 -6
  118. package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContext.js +12 -10
  119. package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContext.js.map +1 -1
  120. package/esm/vs/editor/browser/controller/mouseHandler.js +7 -7
  121. package/esm/vs/editor/browser/controller/mouseTarget.js +3 -3
  122. package/esm/vs/editor/browser/coreCommands.js +2 -2
  123. package/esm/vs/editor/browser/editorBrowser.js.map +1 -1
  124. package/esm/vs/editor/browser/editorMarkdownSanitizer.js +19 -0
  125. package/esm/vs/editor/browser/editorMarkdownSanitizer.js.map +1 -0
  126. package/esm/vs/editor/browser/gpu/rectangleRenderer.js +1 -1
  127. package/esm/vs/editor/browser/gpu/viewGpuContext.js +1 -1
  128. package/esm/vs/editor/browser/observableCodeEditor.js +1 -1
  129. package/esm/vs/editor/browser/services/editorWorkerService.js +3 -2
  130. package/esm/vs/editor/browser/services/editorWorkerService.js.map +1 -1
  131. package/esm/vs/editor/browser/services/openerService.js +6 -2
  132. package/esm/vs/editor/browser/services/openerService.js.map +1 -1
  133. package/esm/vs/editor/browser/view/domLineBreaksComputer.js +34 -11
  134. package/esm/vs/editor/browser/view/domLineBreaksComputer.js.map +1 -1
  135. package/esm/vs/editor/browser/view/viewController.js +7 -7
  136. package/esm/vs/editor/browser/view/viewController.js.map +1 -1
  137. package/esm/vs/editor/browser/view/viewLayer.js +1 -1
  138. package/esm/vs/editor/browser/view/viewOverlays.js +4 -4
  139. package/esm/vs/editor/browser/view.js +5 -5
  140. package/esm/vs/editor/browser/viewParts/blockDecorations/blockDecorations.js +1 -1
  141. package/esm/vs/editor/browser/viewParts/contentWidgets/contentWidgets.js +11 -3
  142. package/esm/vs/editor/browser/viewParts/contentWidgets/contentWidgets.js.map +1 -1
  143. package/esm/vs/editor/browser/viewParts/currentLineHighlight/currentLineHighlight.js +6 -6
  144. package/esm/vs/editor/browser/viewParts/editorScrollbar/editorScrollbar.js +12 -12
  145. package/esm/vs/editor/browser/viewParts/glyphMargin/glyphMargin.js +9 -2
  146. package/esm/vs/editor/browser/viewParts/glyphMargin/glyphMargin.js.map +1 -1
  147. package/esm/vs/editor/browser/viewParts/indentGuides/indentGuides.js +2 -2
  148. package/esm/vs/editor/browser/viewParts/lineNumbers/lineNumbers.js +2 -2
  149. package/esm/vs/editor/browser/viewParts/linesDecorations/linesDecorations.js +2 -2
  150. package/esm/vs/editor/browser/viewParts/margin/margin.js +2 -2
  151. package/esm/vs/editor/browser/viewParts/minimap/minimap.js +6 -6
  152. package/esm/vs/editor/browser/viewParts/overlayWidgets/overlayWidgets.js +9 -2
  153. package/esm/vs/editor/browser/viewParts/overlayWidgets/overlayWidgets.js.map +1 -1
  154. package/esm/vs/editor/browser/viewParts/overviewRuler/decorationsOverviewRuler.js +5 -5
  155. package/esm/vs/editor/browser/viewParts/overviewRuler/overviewRuler.js +3 -3
  156. package/esm/vs/editor/browser/viewParts/rulers/rulers.js +2 -2
  157. package/esm/vs/editor/browser/viewParts/rulersGpu/rulersGpu.js +1 -1
  158. package/esm/vs/editor/browser/viewParts/scrollDecoration/scrollDecoration.js +3 -3
  159. package/esm/vs/editor/browser/viewParts/selections/selections.js +2 -2
  160. package/esm/vs/editor/browser/viewParts/viewCursors/viewCursor.js +2 -2
  161. package/esm/vs/editor/browser/viewParts/viewCursors/viewCursors.js +6 -6
  162. package/esm/vs/editor/browser/viewParts/viewLines/viewLineOptions.js +5 -5
  163. package/esm/vs/editor/browser/viewParts/viewLines/viewLines.js +11 -11
  164. package/esm/vs/editor/browser/viewParts/viewLinesGpu/viewLinesGpu.js +1 -1
  165. package/esm/vs/editor/browser/viewParts/viewZones/viewZones.js +2 -2
  166. package/esm/vs/editor/browser/viewParts/whitespace/whitespace.js +4 -4
  167. package/esm/vs/editor/browser/viewParts/wordWrapIndicator/wordWrapIndicator.js +2 -2
  168. package/esm/vs/editor/browser/widget/codeEditor/codeEditorWidget.js +22 -21
  169. package/esm/vs/editor/browser/widget/codeEditor/codeEditorWidget.js.map +1 -1
  170. package/esm/vs/editor/browser/widget/diffEditor/commands.js +12 -12
  171. package/esm/vs/editor/browser/widget/diffEditor/components/accessibleDiffViewer.js +18 -18
  172. package/esm/vs/editor/browser/widget/diffEditor/components/diffEditorEditors.js +1 -1
  173. package/esm/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/diffEditorViewZones.js +3 -3
  174. package/esm/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/inlineDiffDeletedCodeMargin.js +10 -10
  175. package/esm/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/inlineDiffDeletedCodeMargin.js.map +1 -1
  176. package/esm/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/renderLines.js +2 -2
  177. package/esm/vs/editor/browser/widget/diffEditor/diffEditor.contribution.js +4 -4
  178. package/esm/vs/editor/browser/widget/diffEditor/diffProviderFactoryService.js +21 -3
  179. package/esm/vs/editor/browser/widget/diffEditor/diffProviderFactoryService.js.map +1 -1
  180. package/esm/vs/editor/browser/widget/diffEditor/features/gutterFeature.js +1 -1
  181. package/esm/vs/editor/browser/widget/diffEditor/features/hideUnchangedRegionsFeature.js +10 -10
  182. package/esm/vs/editor/browser/widget/diffEditor/features/movedBlocksLinesFeature.js +2 -2
  183. package/esm/vs/editor/browser/widget/diffEditor/features/overviewRulerFeature.js +1 -1
  184. package/esm/vs/editor/browser/widget/diffEditor/features/revertButtonsFeature.js +2 -2
  185. package/esm/vs/editor/browser/widget/diffEditor/registrations.contribution.js +5 -5
  186. package/esm/vs/editor/browser/widget/multiDiffEditor/colors.js +3 -3
  187. package/esm/vs/editor/browser/widget/multiDiffEditor/compressedVirtualizedScrollLayout.js +2 -2
  188. package/esm/vs/editor/browser/widget/multiDiffEditor/compressedVirtualizedScrollLayout.js.map +1 -1
  189. package/esm/vs/editor/browser/widget/multiDiffEditor/compressedVirtualizedScrollView.js +21 -2
  190. package/esm/vs/editor/browser/widget/multiDiffEditor/compressedVirtualizedScrollView.js.map +1 -1
  191. package/esm/vs/editor/browser/widget/multiDiffEditor/diffEditorItemTemplate.js +2 -2
  192. package/esm/vs/editor/browser/widget/multiDiffEditor/multiDiffEditorWidgetImpl.js +11 -3
  193. package/esm/vs/editor/browser/widget/multiDiffEditor/multiDiffEditorWidgetImpl.js.map +1 -1
  194. package/esm/vs/editor/browser/widget/multiDiffEditor/virtualizedItemManager.js +1 -0
  195. package/esm/vs/editor/browser/widget/multiDiffEditor/virtualizedItemManager.js.map +1 -1
  196. package/esm/vs/editor/common/commands/columnSelectionPasteCommand.js +64 -0
  197. package/esm/vs/editor/common/commands/columnSelectionPasteCommand.js.map +1 -0
  198. package/esm/vs/editor/common/config/editorConfigurationSchema.js +68 -58
  199. package/esm/vs/editor/common/config/editorConfigurationSchema.js.map +1 -1
  200. package/esm/vs/editor/common/config/editorOptions.js +560 -500
  201. package/esm/vs/editor/common/config/editorOptions.js.map +1 -1
  202. package/esm/vs/editor/common/core/editorColorRegistry.js +71 -71
  203. package/esm/vs/editor/common/core/edits/textEdit.js +16 -0
  204. package/esm/vs/editor/common/core/edits/textEdit.js.map +1 -1
  205. package/esm/vs/editor/common/cursor/cursor.js +20 -10
  206. package/esm/vs/editor/common/cursor/cursor.js.map +1 -1
  207. package/esm/vs/editor/common/cursor/cursorTypeEditOperations.js +67 -14
  208. package/esm/vs/editor/common/cursor/cursorTypeEditOperations.js.map +1 -1
  209. package/esm/vs/editor/common/cursor/cursorTypeOperations.js +2 -2
  210. package/esm/vs/editor/common/cursor/cursorTypeOperations.js.map +1 -1
  211. package/esm/vs/editor/common/cursorCommon.js +22 -21
  212. package/esm/vs/editor/common/cursorCommon.js.map +1 -1
  213. package/esm/vs/editor/common/diff/defaultLinesDiffComputer/defaultLinesDiffComputer.js +21 -8
  214. package/esm/vs/editor/common/diff/defaultLinesDiffComputer/defaultLinesDiffComputer.js.map +1 -1
  215. package/esm/vs/editor/common/diff/documentDiffProvider.js.map +1 -1
  216. package/esm/vs/editor/common/diff/externalLinesDiffComputer.js +38 -26
  217. package/esm/vs/editor/common/diff/externalLinesDiffComputer.js.map +1 -1
  218. package/esm/vs/editor/common/diff/rangeMapping.js +11 -1
  219. package/esm/vs/editor/common/diff/rangeMapping.js.map +1 -1
  220. package/esm/vs/editor/common/diff/verifyLinesDiff.js +28 -0
  221. package/esm/vs/editor/common/diff/verifyLinesDiff.js.map +1 -0
  222. package/esm/vs/editor/common/editorContextKeys.js +53 -53
  223. package/esm/vs/editor/common/languages/languageConfiguration.js +8 -0
  224. package/esm/vs/editor/common/languages/languageConfiguration.js.map +1 -1
  225. package/esm/vs/editor/common/languages/modesRegistry.js +1 -1
  226. package/esm/vs/editor/common/languages.js +56 -56
  227. package/esm/vs/editor/common/model/editStack.js +1 -1
  228. package/esm/vs/editor/common/services/editorWebWorker.js +27 -6
  229. package/esm/vs/editor/common/services/editorWebWorker.js.map +1 -1
  230. package/esm/vs/editor/common/services/editorWorker.js.map +1 -1
  231. package/esm/vs/editor/common/services/languageService.js +6 -4
  232. package/esm/vs/editor/common/services/languageService.js.map +1 -1
  233. package/esm/vs/editor/common/services/markerDecorationsService.js +21 -2
  234. package/esm/vs/editor/common/services/markerDecorationsService.js.map +1 -1
  235. package/esm/vs/editor/common/standalone/standaloneEnums.js +100 -97
  236. package/esm/vs/editor/common/standalone/standaloneEnums.js.map +1 -1
  237. package/esm/vs/editor/common/standaloneStrings.js +11 -11
  238. package/esm/vs/editor/common/textModelEditSource.js +9 -0
  239. package/esm/vs/editor/common/textModelEditSource.js.map +1 -1
  240. package/esm/vs/editor/common/viewLayout/viewLayout.js +16 -16
  241. package/esm/vs/editor/common/viewLayout/viewLineRenderer.js +2 -2
  242. package/esm/vs/editor/common/viewModel/monospaceLineBreaksComputer.js +1 -1
  243. package/esm/vs/editor/common/viewModel/viewModelImpl.js +19 -19
  244. package/esm/vs/editor/common/viewModel/viewModelImpl.js.map +1 -1
  245. package/esm/vs/editor/contrib/anchorSelect/browser/anchorSelect.js +6 -6
  246. package/esm/vs/editor/contrib/bracketMatching/browser/bracketMatching.js +9 -9
  247. package/esm/vs/editor/contrib/caretOperations/browser/caretOperations.js +2 -2
  248. package/esm/vs/editor/contrib/caretOperations/browser/transpose.js +1 -1
  249. package/esm/vs/editor/contrib/clipboard/browser/clipboard.js +23 -20
  250. package/esm/vs/editor/contrib/clipboard/browser/clipboard.js.map +1 -1
  251. package/esm/vs/editor/contrib/codeAction/browser/codeAction.js +1 -1
  252. package/esm/vs/editor/contrib/codeAction/browser/codeActionCommands.js +29 -29
  253. package/esm/vs/editor/contrib/codeAction/browser/codeActionContributions.js +3 -3
  254. package/esm/vs/editor/contrib/codeAction/browser/codeActionController.js +3 -3
  255. package/esm/vs/editor/contrib/codeAction/browser/codeActionMenu.js +8 -8
  256. package/esm/vs/editor/contrib/codeAction/browser/codeActionModel.js +1 -1
  257. package/esm/vs/editor/contrib/codeAction/browser/lightBulbWidget.js +9 -9
  258. package/esm/vs/editor/contrib/codelens/browser/codelensController.js +2 -2
  259. package/esm/vs/editor/contrib/colorPicker/browser/colorDetector.js +25 -10
  260. package/esm/vs/editor/contrib/colorPicker/browser/colorDetector.js.map +1 -1
  261. package/esm/vs/editor/contrib/colorPicker/browser/colorPickerParts/colorPickerCloseButton.js +1 -1
  262. package/esm/vs/editor/contrib/colorPicker/browser/colorPickerParts/colorPickerHeader.js +1 -1
  263. package/esm/vs/editor/contrib/colorPicker/browser/hoverColorPicker/hoverColorPickerContribution.js +1 -1
  264. package/esm/vs/editor/contrib/colorPicker/browser/hoverColorPicker/hoverColorPickerParticipant.js +3 -3
  265. package/esm/vs/editor/contrib/colorPicker/browser/standaloneColorPicker/standaloneColorPickerActions.js +7 -7
  266. package/esm/vs/editor/contrib/colorPicker/browser/standaloneColorPicker/standaloneColorPickerParticipant.js +1 -1
  267. package/esm/vs/editor/contrib/comment/browser/comment.js +6 -6
  268. package/esm/vs/editor/contrib/contextmenu/browser/contextmenu.js +17 -17
  269. package/esm/vs/editor/contrib/contextmenu/browser/contextmenu.js.map +1 -1
  270. package/esm/vs/editor/contrib/cursorUndo/browser/cursorUndo.js +2 -2
  271. package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteContribution.js +4 -4
  272. package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.js +39 -39
  273. package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.js.map +1 -1
  274. package/esm/vs/editor/contrib/dropOrPasteInto/browser/defaultProviders.js +8 -8
  275. package/esm/vs/editor/contrib/dropOrPasteInto/browser/dropIntoEditorController.js +3 -3
  276. package/esm/vs/editor/contrib/dropOrPasteInto/browser/pasteEditSession.js +19 -0
  277. package/esm/vs/editor/contrib/dropOrPasteInto/browser/pasteEditSession.js.map +1 -0
  278. package/esm/vs/editor/contrib/dropOrPasteInto/browser/postEditWidget.js +26 -18
  279. package/esm/vs/editor/contrib/dropOrPasteInto/browser/postEditWidget.js.map +1 -1
  280. package/esm/vs/editor/contrib/editorState/browser/keybindingCancellation.js +1 -1
  281. package/esm/vs/editor/contrib/editorState/browser/keybindingCancellation.js.map +1 -1
  282. package/esm/vs/editor/contrib/find/browser/findController.js +18 -18
  283. package/esm/vs/editor/contrib/find/browser/findController.js.map +1 -1
  284. package/esm/vs/editor/contrib/find/browser/findModel.js +6 -6
  285. package/esm/vs/editor/contrib/find/browser/findWidget.js +40 -40
  286. package/esm/vs/editor/contrib/find/browser/findWidget.js.map +1 -1
  287. package/esm/vs/editor/contrib/folding/browser/folding.js +23 -23
  288. package/esm/vs/editor/contrib/folding/browser/foldingDecorations.js +9 -9
  289. package/esm/vs/editor/contrib/fontZoom/browser/fontZoom.js +3 -3
  290. package/esm/vs/editor/contrib/format/browser/formatActions.js +2 -2
  291. package/esm/vs/editor/contrib/gotoError/browser/gotoError.js +8 -8
  292. package/esm/vs/editor/contrib/gotoError/browser/gotoErrorWidget.js +14 -14
  293. package/esm/vs/editor/contrib/gotoSymbol/browser/goToCommands.js +39 -39
  294. package/esm/vs/editor/contrib/gotoSymbol/browser/link/clickLinkGesture.js +3 -3
  295. package/esm/vs/editor/contrib/gotoSymbol/browser/link/goToDefinitionAtPosition.js +2 -2
  296. package/esm/vs/editor/contrib/gotoSymbol/browser/peek/referencesController.js +4 -4
  297. package/esm/vs/editor/contrib/gotoSymbol/browser/peek/referencesController.js.map +1 -1
  298. package/esm/vs/editor/contrib/gotoSymbol/browser/peek/referencesTree.js +3 -3
  299. package/esm/vs/editor/contrib/gotoSymbol/browser/peek/referencesWidget.js +3 -3
  300. package/esm/vs/editor/contrib/gotoSymbol/browser/referencesModel.js +8 -8
  301. package/esm/vs/editor/contrib/gotoSymbol/browser/symbolNavigation.js +3 -3
  302. package/esm/vs/editor/contrib/gpu/browser/gpuActions.js +4 -4
  303. package/esm/vs/editor/contrib/hover/browser/contentHoverController.js +9 -3
  304. package/esm/vs/editor/contrib/hover/browser/contentHoverController.js.map +1 -1
  305. package/esm/vs/editor/contrib/hover/browser/glyphHoverController.js +2 -2
  306. package/esm/vs/editor/contrib/hover/browser/glyphHoverWidget.js +2 -1
  307. package/esm/vs/editor/contrib/hover/browser/glyphHoverWidget.js.map +1 -1
  308. package/esm/vs/editor/contrib/hover/browser/hoverActionIds.js +2 -2
  309. package/esm/vs/editor/contrib/hover/browser/hoverActions.js +24 -24
  310. package/esm/vs/editor/contrib/hover/browser/hoverCopyButton.js +2 -2
  311. package/esm/vs/editor/contrib/hover/browser/markdownHoverParticipant.js +10 -8
  312. package/esm/vs/editor/contrib/hover/browser/markdownHoverParticipant.js.map +1 -1
  313. package/esm/vs/editor/contrib/hover/browser/markerHoverParticipant.js +6 -6
  314. package/esm/vs/editor/contrib/inPlaceReplace/browser/inPlaceReplace.js +2 -2
  315. package/esm/vs/editor/contrib/indentation/browser/indentation.js +20 -20
  316. package/esm/vs/editor/contrib/inlayHints/browser/inlayHintsController.js +5 -5
  317. package/esm/vs/editor/contrib/inlayHints/browser/inlayHintsHover.js +9 -9
  318. package/esm/vs/editor/contrib/inlayHints/browser/inlayHintsLocations.js +3 -3
  319. package/esm/vs/editor/contrib/inlayHints/browser/inlayHintsLocations.js.map +1 -1
  320. package/esm/vs/editor/contrib/inlineCompletions/browser/controller/commands.js +21 -21
  321. package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionContextKeys.js +13 -13
  322. package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionsController.js +7 -7
  323. package/esm/vs/editor/contrib/inlineCompletions/browser/hintsWidget/hoverParticipant.js +2 -2
  324. package/esm/vs/editor/contrib/inlineCompletions/browser/hintsWidget/inlineCompletionsHintsWidget.js +6 -5
  325. package/esm/vs/editor/contrib/inlineCompletions/browser/hintsWidget/inlineCompletionsHintsWidget.js.map +1 -1
  326. package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.js +1 -1
  327. package/esm/vs/editor/contrib/inlineCompletions/browser/model/renameSymbolProcessor.js +2 -2
  328. package/esm/vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.js +7 -7
  329. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorMenu.js +6 -6
  330. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorView.js +1 -1
  331. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsWordReplacementView.js +3 -3
  332. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/theme.js +20 -20
  333. package/esm/vs/editor/contrib/insertFinalNewLine/browser/insertFinalNewLine.js +1 -1
  334. package/esm/vs/editor/contrib/lineSelection/browser/lineSelection.js +1 -1
  335. package/esm/vs/editor/contrib/linesOperations/browser/linesOperations.js +32 -32
  336. package/esm/vs/editor/contrib/linkedEditing/browser/linkedEditing.js +5 -4
  337. package/esm/vs/editor/contrib/linkedEditing/browser/linkedEditing.js.map +1 -1
  338. package/esm/vs/editor/contrib/links/browser/links.js +16 -15
  339. package/esm/vs/editor/contrib/links/browser/links.js.map +1 -1
  340. package/esm/vs/editor/contrib/longLinesHelper/browser/longLinesHelper.js +1 -1
  341. package/esm/vs/editor/contrib/message/browser/messageController.js +16 -12
  342. package/esm/vs/editor/contrib/message/browser/messageController.js.map +1 -1
  343. package/esm/vs/editor/contrib/middleScroll/browser/middleScrollController.js +1 -1
  344. package/esm/vs/editor/contrib/multicursor/browser/multicursor.js +91 -55
  345. package/esm/vs/editor/contrib/multicursor/browser/multicursor.js.map +1 -1
  346. package/esm/vs/editor/contrib/parameterHints/browser/parameterHints.js +1 -1
  347. package/esm/vs/editor/contrib/parameterHints/browser/parameterHintsModel.js +3 -3
  348. package/esm/vs/editor/contrib/parameterHints/browser/parameterHintsModel.js.map +1 -1
  349. package/esm/vs/editor/contrib/parameterHints/browser/parameterHintsWidget.js +6 -4
  350. package/esm/vs/editor/contrib/parameterHints/browser/parameterHintsWidget.js.map +1 -1
  351. package/esm/vs/editor/contrib/peekView/browser/peekView.js +18 -18
  352. package/esm/vs/editor/contrib/placeholderText/browser/placeholderText.contribution.js +1 -1
  353. package/esm/vs/editor/contrib/placeholderText/browser/placeholderTextContribution.js +1 -1
  354. package/esm/vs/editor/contrib/quickAccess/browser/editorNavigationQuickAccess.js +1 -1
  355. package/esm/vs/editor/contrib/quickAccess/browser/gotoLineQuickAccess.js +12 -12
  356. package/esm/vs/editor/contrib/quickAccess/browser/gotoSymbolQuickAccess.js +32 -32
  357. package/esm/vs/editor/contrib/readOnlyMessage/browser/contribution.js +3 -3
  358. package/esm/vs/editor/contrib/rename/browser/rename.js +11 -11
  359. package/esm/vs/editor/contrib/rename/browser/renameWidget.js +7 -7
  360. package/esm/vs/editor/contrib/sectionHeaders/browser/sectionHeaders.js +6 -6
  361. package/esm/vs/editor/contrib/semanticTokens/browser/documentSemanticTokens.js +23 -13
  362. package/esm/vs/editor/contrib/semanticTokens/browser/documentSemanticTokens.js.map +1 -1
  363. package/esm/vs/editor/contrib/smartSelect/browser/smartSelect.js +5 -5
  364. package/esm/vs/editor/contrib/snippet/browser/snippetController2.js +5 -5
  365. package/esm/vs/editor/contrib/snippet/browser/snippetSession.js +2 -2
  366. package/esm/vs/editor/contrib/snippet/browser/snippetVariables.js +4 -4
  367. package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollActions.js +11 -11
  368. package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollController.js +10 -8
  369. package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollController.js.map +1 -1
  370. package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollModelProvider.js +1 -1
  371. package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollProvider.js +2 -2
  372. package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollWidget.js +6 -6
  373. package/esm/vs/editor/contrib/suggest/browser/suggest.js +9 -9
  374. package/esm/vs/editor/contrib/suggest/browser/suggestController.js +15 -15
  375. package/esm/vs/editor/contrib/suggest/browser/suggestInlineCompletions.js +2 -2
  376. package/esm/vs/editor/contrib/suggest/browser/suggestModel.js +11 -11
  377. package/esm/vs/editor/contrib/suggest/browser/suggestWidget.js +27 -27
  378. package/esm/vs/editor/contrib/suggest/browser/suggestWidgetDetails.js +8 -6
  379. package/esm/vs/editor/contrib/suggest/browser/suggestWidgetDetails.js.map +1 -1
  380. package/esm/vs/editor/contrib/suggest/browser/suggestWidgetRenderer.js +5 -5
  381. package/esm/vs/editor/contrib/suggest/browser/wordContextKey.js +3 -3
  382. package/esm/vs/editor/contrib/suggest/browser/wordDistance.js +1 -1
  383. package/esm/vs/editor/contrib/symbolIcons/browser/symbolIcons.js +33 -33
  384. package/esm/vs/editor/contrib/toggleTabFocusMode/browser/toggleTabFocusMode.js +4 -4
  385. package/esm/vs/editor/contrib/tokenization/browser/tokenization.js +1 -1
  386. package/esm/vs/editor/contrib/unicodeHighlighter/browser/bannerController.js +1 -1
  387. package/esm/vs/editor/contrib/unicodeHighlighter/browser/unicodeHighlighter.js +27 -27
  388. package/esm/vs/editor/contrib/unusualLineTerminators/browser/unusualLineTerminators.js +9 -9
  389. package/esm/vs/editor/contrib/wordHighlighter/browser/highlightDecorations.js +9 -9
  390. package/esm/vs/editor/contrib/wordHighlighter/browser/textualHighlightProvider.js +1 -1
  391. package/esm/vs/editor/contrib/wordHighlighter/browser/textualHighlightProvider.js.map +1 -1
  392. package/esm/vs/editor/contrib/wordHighlighter/browser/wordHighlighter.js +50 -14
  393. package/esm/vs/editor/contrib/wordHighlighter/browser/wordHighlighter.js.map +1 -1
  394. package/esm/vs/editor/contrib/wordOperations/browser/wordOperations.js +6 -6
  395. package/esm/vs/editor/editor.api.d.ts +133 -98
  396. package/esm/vs/editor/standalone/browser/iPadShowKeyboard/iPadShowKeyboard.js +1 -1
  397. package/esm/vs/editor/standalone/browser/quickInput/standaloneQuickInputService.js +5 -3
  398. package/esm/vs/editor/standalone/browser/quickInput/standaloneQuickInputService.js.map +1 -1
  399. package/esm/vs/editor/standalone/browser/standaloneCodeEditor.js +15 -1
  400. package/esm/vs/editor/standalone/browser/standaloneCodeEditor.js.map +1 -1
  401. package/esm/vs/nls.js.map +1 -1
  402. package/esm/vs/platform/accessibilitySignal/browser/accessibilitySignalService.js +72 -66
  403. package/esm/vs/platform/accessibilitySignal/browser/accessibilitySignalService.js.map +1 -1
  404. package/esm/vs/platform/action/common/actionCommonCategories.js +6 -6
  405. package/esm/vs/platform/actionWidget/browser/actionList.js +434 -136
  406. package/esm/vs/platform/actionWidget/browser/actionList.js.map +1 -1
  407. package/esm/vs/platform/actionWidget/browser/actionWidget.css +74 -4
  408. package/esm/vs/platform/actionWidget/browser/actionWidget.js +24 -26
  409. package/esm/vs/platform/actionWidget/browser/actionWidget.js.map +1 -1
  410. package/esm/vs/platform/actionWidget/browser/actionWidgetMotion.js +16 -0
  411. package/esm/vs/platform/actionWidget/browser/actionWidgetMotion.js.map +1 -0
  412. package/esm/vs/platform/actions/browser/menuEntryActionViewItem.js +15 -17
  413. package/esm/vs/platform/actions/browser/menuEntryActionViewItem.js.map +1 -1
  414. package/esm/vs/platform/actions/browser/toolbar.js +25 -12
  415. package/esm/vs/platform/actions/browser/toolbar.js.map +1 -1
  416. package/esm/vs/platform/actions/common/actions.js +4 -2
  417. package/esm/vs/platform/actions/common/actions.js.map +1 -1
  418. package/esm/vs/platform/actions/common/menuService.js +15 -8
  419. package/esm/vs/platform/actions/common/menuService.js.map +1 -1
  420. package/esm/vs/platform/configuration/common/configuration.js +3 -1
  421. package/esm/vs/platform/configuration/common/configuration.js.map +1 -1
  422. package/esm/vs/platform/configuration/common/configurationModels.js +16 -11
  423. package/esm/vs/platform/configuration/common/configurationModels.js.map +1 -1
  424. package/esm/vs/platform/configuration/common/configurationRegistry.js +29 -27
  425. package/esm/vs/platform/configuration/common/configurationRegistry.js.map +1 -1
  426. package/esm/vs/platform/configuration/common/configurations.js +13 -1
  427. package/esm/vs/platform/configuration/common/configurations.js.map +1 -1
  428. package/esm/vs/platform/contextkey/browser/contextKeyService.js +2 -2
  429. package/esm/vs/platform/contextkey/browser/contextKeyService.js.map +1 -1
  430. package/esm/vs/platform/contextkey/common/contextkey.js +28 -14
  431. package/esm/vs/platform/contextkey/common/contextkey.js.map +1 -1
  432. package/esm/vs/platform/contextkey/common/contextkeys.js +10 -10
  433. package/esm/vs/platform/contextkey/common/scanner.js +5 -5
  434. package/esm/vs/platform/contextview/browser/contextMenuHandler.js +17 -4
  435. package/esm/vs/platform/contextview/browser/contextMenuHandler.js.map +1 -1
  436. package/esm/vs/platform/contextview/browser/contextMenuService.js +1 -1
  437. package/esm/vs/platform/contextview/browser/contextMenuService.js.map +1 -1
  438. package/esm/vs/platform/contextview/browser/contextView.js.map +1 -1
  439. package/esm/vs/platform/contextview/browser/contextViewService.js +7 -2
  440. package/esm/vs/platform/contextview/browser/contextViewService.js.map +1 -1
  441. package/esm/vs/platform/editor/common/editor.js +17 -0
  442. package/esm/vs/platform/editor/common/editor.js.map +1 -1
  443. package/esm/vs/platform/history/browser/contextScopedHistoryWidget.js +1 -1
  444. package/esm/vs/platform/hover/browser/hoverService.js +6 -3
  445. package/esm/vs/platform/hover/browser/hoverService.js.map +1 -1
  446. package/esm/vs/platform/hover/browser/hoverWidget.js +38 -6
  447. package/esm/vs/platform/hover/browser/hoverWidget.js.map +1 -1
  448. package/esm/vs/platform/hover/browser/updatableHoverWidget.js +32 -5
  449. package/esm/vs/platform/hover/browser/updatableHoverWidget.js.map +1 -1
  450. package/esm/vs/platform/instantiation/common/instantiationService.js +1 -1
  451. package/esm/vs/platform/instantiation/common/instantiationService.js.map +1 -1
  452. package/esm/vs/platform/keybinding/common/abstractKeybindingService.js +5 -5
  453. package/esm/vs/platform/keybinding/common/keybindingResolver.js +1 -1
  454. package/esm/vs/platform/keybinding/common/keybindingResolver.js.map +1 -1
  455. package/esm/vs/platform/list/browser/listService.js +27 -27
  456. package/esm/vs/platform/markers/common/markerService.js +11 -8
  457. package/esm/vs/platform/markers/common/markerService.js.map +1 -1
  458. package/esm/vs/platform/markers/common/markers.js +6 -6
  459. package/esm/vs/platform/markers/common/markers.js.map +1 -1
  460. package/esm/vs/platform/notification/common/notification.js.map +1 -1
  461. package/esm/vs/platform/notification/common/notificationMessage.js +37 -0
  462. package/esm/vs/platform/notification/common/notificationMessage.js.map +1 -0
  463. package/esm/vs/platform/opener/common/opener.js.map +1 -1
  464. package/esm/vs/platform/progress/common/progress.js.map +1 -1
  465. package/esm/vs/platform/quickinput/browser/commandsQuickAccess.js +8 -8
  466. package/esm/vs/platform/quickinput/browser/helpQuickAccess.js +1 -1
  467. package/esm/vs/platform/quickinput/browser/media/quickInput.css +33 -2
  468. package/esm/vs/platform/quickinput/browser/quickAccess.js +7 -4
  469. package/esm/vs/platform/quickinput/browser/quickAccess.js.map +1 -1
  470. package/esm/vs/platform/quickinput/browser/quickInput.js +10 -10
  471. package/esm/vs/platform/quickinput/browser/quickInputActions.js +5 -5
  472. package/esm/vs/platform/quickinput/browser/quickInputController.js +65 -15
  473. package/esm/vs/platform/quickinput/browser/quickInputController.js.map +1 -1
  474. package/esm/vs/platform/quickinput/browser/quickInputList.js +96 -90
  475. package/esm/vs/platform/quickinput/browser/quickInputList.js.map +1 -1
  476. package/esm/vs/platform/quickinput/browser/quickInputService.js +5 -7
  477. package/esm/vs/platform/quickinput/browser/quickInputService.js.map +1 -1
  478. package/esm/vs/platform/quickinput/browser/quickInputUtils.js +1 -1
  479. package/esm/vs/platform/quickinput/browser/tree/quickInputTreeAccessibilityProvider.js +1 -1
  480. package/esm/vs/platform/quickinput/browser/tree/quickTree.js +1 -1
  481. package/esm/vs/platform/quickinput/common/quickAccess.js.map +1 -1
  482. package/esm/vs/platform/quickinput/common/quickInput.js.map +1 -1
  483. package/esm/vs/platform/storage/common/storage.js.map +1 -1
  484. package/esm/vs/platform/theme/common/colorRegistry.js +1 -0
  485. package/esm/vs/platform/theme/common/colorRegistry.js.map +1 -1
  486. package/esm/vs/platform/theme/common/colorUtils.js +11 -3
  487. package/esm/vs/platform/theme/common/colorUtils.js.map +1 -1
  488. package/esm/vs/platform/theme/common/colors/baseColors.js +19 -19
  489. package/esm/vs/platform/theme/common/colors/chartsColors.js +8 -9
  490. package/esm/vs/platform/theme/common/colors/chartsColors.js.map +1 -1
  491. package/esm/vs/platform/theme/common/colors/confettiColors.js +14 -0
  492. package/esm/vs/platform/theme/common/colors/confettiColors.js.map +1 -0
  493. package/esm/vs/platform/theme/common/colors/editorColors.js +95 -95
  494. package/esm/vs/platform/theme/common/colors/inputColors.js +48 -48
  495. package/esm/vs/platform/theme/common/colors/inputColors.js.map +1 -1
  496. package/esm/vs/platform/theme/common/colors/listColors.js +36 -36
  497. package/esm/vs/platform/theme/common/colors/menuColors.js +7 -7
  498. package/esm/vs/platform/theme/common/colors/minimapColors.js +13 -13
  499. package/esm/vs/platform/theme/common/colors/minimapColors.js.map +1 -1
  500. package/esm/vs/platform/theme/common/colors/miscColors.js +16 -16
  501. package/esm/vs/platform/theme/common/colors/quickpickColors.js +10 -10
  502. package/esm/vs/platform/theme/common/colors/searchColors.js +3 -3
  503. package/esm/vs/platform/theme/common/iconRegistry.js +6 -6
  504. package/esm/vs/platform/undoRedo/common/undoRedoService.js +20 -20
  505. package/esm/vs/platform/workspace/common/workspace.js +1 -1
  506. package/monaco.d.ts +133 -98
  507. package/package.json +3 -3
  508. package/version.txt +1 -1
@@ -67,7 +67,7 @@ let DiffEditorItemTemplate = class DiffEditorItemTemplate extends VirtualizedIte
67
67
  return { maxScroll: scroll2, width: this._originalWidth.read(reader) };
68
68
  }
69
69
  });
70
- const binaryFileChangedLabel = localize(164, "Binary file changed");
70
+ const binaryFileChangedLabel = localize(165, "Binary file changed");
71
71
  this._elements = h('div.multiDiffEntry', [
72
72
  h('div.header@header', [
73
73
  h('div.header-content', [
@@ -112,7 +112,7 @@ let DiffEditorItemTemplate = class DiffEditorItemTemplate extends VirtualizedIte
112
112
  this._elements.binaryFilePlaceholder.tabIndex = 0;
113
113
  if (this._workbenchUIElementFactory.openDiffEditor) {
114
114
  this._openBinaryDiffButton = this._register(new Button(this._elements.binaryFilePlaceholderActions, { ...defaultButtonStyles, secondary: true }));
115
- this._openBinaryDiffButton.label = localize(165, "Open Diff");
115
+ this._openBinaryDiffButton.label = localize(166, "Open Diff");
116
116
  this._register(this._openBinaryDiffButton.onDidClick(() => {
117
117
  const item = this._viewModel.get();
118
118
  if (item?.originalUri && item.modifiedUri) {
@@ -12,9 +12,10 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  return function (target, key) { decorator(target, key, paramIndex); }
13
13
  };
14
14
  import { h } from '../../../../base/browser/dom.js';
15
+ import { arrayEqualsC } from '../../../../base/common/equals.js';
15
16
  import { BugIndicatingError } from '../../../../base/common/errors.js';
16
17
  import { Disposable, toDisposable } from '../../../../base/common/lifecycle.js';
17
- import { autorun, autorunWithStore, constObservable, derived, mapObservableArrayCached, observableValue, transaction } from '../../../../base/common/observable.js';
18
+ import { autorun, autorunWithStore, constObservable, derived, derivedOpts, mapObservableArrayCached, observableValue, transaction } from '../../../../base/common/observable.js';
18
19
  import { localize } from '../../../../nls.js';
19
20
  import { IContextKeyService } from '../../../../platform/contextkey/common/contextkey.js';
20
21
  import { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';
@@ -158,6 +159,13 @@ let MultiDiffEditorWidgetImpl = class MultiDiffEditorWidgetImpl extends Disposab
158
159
  items: items.map((item, index) => item.getLayoutDebugState(reader, layout.items[index])),
159
160
  };
160
161
  });
162
+ this.visibleDiffItems = derivedOpts({ owner: this, equalsFn: arrayEqualsC() }, reader => {
163
+ const layout = this._scrollView.layout.read(reader);
164
+ // Layout items are index-aligned with the view items (the trailing padding item is not a view item).
165
+ return this._viewItems.read(reader)
166
+ .filter((_item, index) => layout.items[index]?.visibility === 'visible')
167
+ .map(item => item.viewModel);
168
+ });
161
169
  const variantClassNames = this._variantConfiguration.classNames.map(className => `.${className}`).join('');
162
170
  this._elements = h(`div.monaco-component.multiDiffEditor${variantClassNames}`, {}, [
163
171
  this._scrollView.domNode,
@@ -216,8 +224,8 @@ let MultiDiffEditorWidgetImpl = class MultiDiffEditorWidgetImpl extends Disposab
216
224
  }
217
225
  const vm = this._viewModel.read(reader);
218
226
  return (!vm || vm.isLoading.read(reader))
219
- ? localize(166, 'Loading...')
220
- : localize(167, 'No Changed Files');
227
+ ? localize(167, 'Loading...')
228
+ : localize(168, 'No Changed Files');
221
229
  });
222
230
  this._register(autorun((reader) => {
223
231
  const message = placeholderMessage.read(reader);
@@ -1 +1 @@
1
- {"version":3,"sources":["vs/editor/browser/widget/multiDiffEditor/multiDiffEditorWidgetImpl.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;AAEhG,OAAO,EAAa,CAAC,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAsC,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,OAAO,EAAE,wBAAwB,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACxM,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAmB,kBAAkB,EAAE,MAAM,sDAAsD,CAAC;AAC3G,OAAO,EAAE,qBAAqB,EAAE,MAAM,4DAA4D,CAAC;AACnG,OAAO,EAAE,iBAAiB,EAAE,MAAM,gEAAgE,CAAC;AACnG,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,mEAAmE,CAAC;AAInG,OAAO,EAAc,SAAS,EAAE,MAAM,m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AE,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC3E,CAAC;CACD","file":"multiDiffEditorWidgetImpl.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Dimension, h } from '../../../../base/browser/dom.js';\nimport { BugIndicatingError } from '../../../../base/common/errors.js';\nimport { Disposable, toDisposable } from '../../../../base/common/lifecycle.js';\nimport { IObservable, IReader, ITransaction, autorun, autorunWithStore, constObservable, derived, mapObservableArrayCached, observableValue, transaction } from '../../../../base/common/observable.js';\nimport { localize } from '../../../../nls.js';\nimport { ContextKeyValue, IContextKeyService } from '../../../../platform/contextkey/common/contextkey.js';\nimport { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';\nimport { ServiceCollection } from '../../../../platform/instantiation/common/serviceCollection.js';\nimport { ILogService } from '../../../../platform/log/common/log.js';\nimport { bindContextKey } from '../../../../platform/observable/common/platformObservableUtils.js';\nimport { OffsetRange } from '../../../common/core/ranges/offsetRange.js';\nimport { IDiffEditorOptions } from '../../../common/config/editorOptions.js';\nimport { IRange } from '../../../common/core/range.js';\nimport { ISelection, Selection } from '../../../common/core/selection.js';\nimport { IMultiDiffResourceId } from '../../../common/multiDiffEditor.js';\nimport { EditorContextKeys } from '../../../common/editorContextKeys.js';\nimport { ICodeEditor } from '../../editorBrowser.js';\nimport { CompressedVirtualizedScrollView, ICompressedVirtualizedScrollItem, ICompressedVirtualizedScrollItemContext } from './compressedVirtualizedScrollView.js';\nimport { ICompressedVirtualizedScrollLayout } from './compressedVirtualizedScrollLayout.js';\nimport { binaryFilePlaceholderContentHeight, DiffEditorItemBinding, DiffEditorItemTemplate } from './diffEditorItemTemplate.js';\nimport { formatDiffItemKey, formatUri, ILoggedDiffItem, MultiDiffEditorLogger } from './multiDiffEditorLogging.js';\nimport { IMultiDiffEditorVariantConfiguration } from './multiDiffEditorOptions.js';\nimport { DocumentDiffItemViewModel, MultiDiffEditorViewModel } from './multiDiffEditorViewModel.js';\nimport { RevealOptions } from './multiDiffEditorWidget.js';\nimport './style.css';\nimport { ManagedVirtualizedItem, VirtualizedItemManager } from './virtualizedItemManager.js';\nimport { IWorkbenchUIElementFactory } from './workbenchUIElementFactory.js';\n\nexport class MultiDiffEditorWidgetImpl extends Disposable {\n\tprivate readonly _scrollView;\n\n\tprivate readonly _elements;\n\n\tprivate readonly _optionsOverride: IObservable<IDiffEditorOptions>;\n\n\tpublic readonly scrollTop;\n\tpublic readonly scrollLeft;\n\tpublic readonly layoutDebugState: IObservable<IMultiDiffEditorLayoutDebugState>;\n\n\tprivate readonly _viewItemsInfo;\n\n\tprivate readonly _viewItems;\n\n\tprivate readonly _spaceBetweenPx;\n\tpublic readonly activeControl;\n\n\tprivate readonly _contextKeyService;\n\tprivate readonly _instantiationService;\n\n\tprivate readonly _logger: MultiDiffEditorLogger;\n\n\t/**\n\t * When `true`, the automatic \"select the first change\" initialization that\n\t * runs once the view model finishes loading does not move keyboard focus\n\t * into the editor. Driven by {@link setPreserveFocusOnLoad} so a\n\t * `preserveFocus` open (e.g. restored in the background or on a session\n\t * switch) does not steal focus, while a normal user-initiated open does.\n\t */\n\tprivate _preserveFocusOnLoad = false;\n\n\tconstructor(\n\t\tprivate readonly _element: HTMLElement,\n\t\tprivate readonly _dimension: IObservable<Dimension | undefined>,\n\t\tprivate readonly _viewModel: IObservable<MultiDiffEditorViewModel | undefined>,\n\t\tprivate readonly _workbenchUIElementFactory: IWorkbenchUIElementFactory,\n\t\tprivate readonly _variantConfiguration: IMultiDiffEditorVariantConfiguration,\n\t\tprivate readonly _diffLayoutOptions: IObservable<IDiffEditorOptions | undefined>,\n\t\tprivate readonly _diffEditorOptions: IDiffEditorOptions | undefined,\n\t\tprivate readonly _paddingBottomPx: IObservable<number>,\n\t\t@IContextKeyService private readonly _parentContextKeyService: IContextKeyService,\n\t\t@IInstantiationService private readonly _parentInstantiationService: IInstantiationService,\n\t\t@ILogService logService: ILogService,\n\t) {\n\t\tsuper();\n\t\tthis._logger = this._register(new MultiDiffEditorLogger(logService));\n\t\tthis._optionsOverride = derived(this, reader => {\n\t\t\treturn { ...this._diffEditorOptions, ...this._diffLayoutOptions.read(reader) };\n\t\t});\n\t\tthis._spaceBetweenPx = observableValue(this, 0);\n\t\tconst paddingBottomItem = this._paddingBottomPx.map<ICompressedVirtualizedScrollItem>(this, size => ({\n\t\t\tsize: constObservable(size),\n\t\t\tmaxScroll: constObservable({ maxScroll: 0 }),\n\t\t\trender() { },\n\t\t\thide() { },\n\t\t}));\n\n\t\tlet viewItemsInfo!: IObservable<{ items: readonly VirtualizedViewItem[]; getItem: (viewModel: DocumentDiffItemViewModel) => VirtualizedViewItem }>;\n\t\tlet viewItems!: IObservable<readonly VirtualizedViewItem[]>;\n\t\tthis._scrollView = this._register(new CompressedVirtualizedScrollView(\n\t\t\tthis._element,\n\t\t\tthis._dimension,\n\t\t\tthis._spaceBetweenPx,\n\t\t\tcontext => {\n\t\t\t\tconst sourceItems = derived(this, reader => this._viewModel.read(reader)?.items.read(reader) ?? []);\n\t\t\t\tconst manager = this._register(new VirtualizedItemManager<DocumentDiffItemViewModel, DiffEditorItemBinding, DiffEditorItemTemplate>(sourceItems, context, {\n\t\t\t\t\tgetId: item => item,\n\t\t\t\t\tgetTemplateId: () => 'diffEditor',\n\t\t\t\t\tgetUnboundSize: item => derived(item, reader => {\n\t\t\t\t\t\tconst headerHeight = this._variantConfiguration.headerHeight;\n\t\t\t\t\t\tif (item.collapsed.read(reader)) {\n\t\t\t\t\t\t\treturn headerHeight;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (item.isBinary) {\n\t\t\t\t\t\t\treturn headerHeight\n\t\t\t\t\t\t\t\t+ this._variantConfiguration.contentBottomPadding\n\t\t\t\t\t\t\t\t+ binaryFilePlaceholderContentHeight;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn item.lastTemplateData.read(reader).expandedContentHeight;\n\t\t\t\t\t}),\n\t\t\t\t\tcreateTemplate: () => this._instantiationService.createInstance(\n\t\t\t\t\t\tDiffEditorItemTemplate,\n\t\t\t\t\t\tcontext.contentDomNode,\n\t\t\t\t\t\tcontext.overflowWidgetsDomNode,\n\t\t\t\t\t\tthis._workbenchUIElementFactory,\n\t\t\t\t\t\tthis._variantConfiguration,\n\t\t\t\t\t\tthis._optionsOverride,\n\t\t\t\t\t),\n\t\t\t\t\tonDidBind: binding => {\n\t\t\t\t\t\tconst selections = binding.item.lastTemplateData.get().selections;\n\t\t\t\t\t\tthis._logger.log('acquired editor template', {\n\t\t\t\t\t\t\tfile: formatUri(binding.item.modifiedUri ?? binding.item.originalUri),\n\t\t\t\t\t\t\tcollapsed: binding.item.collapsed.get(),\n\t\t\t\t\t\t\texpectedExpandedContentHeight: binding.item.lastTemplateData.get().expandedContentHeight,\n\t\t\t\t\t\t\tselections: selections?.length ?? 0,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tif (selections) {\n\t\t\t\t\t\t\tbinding.editor.setSelections(selections);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tonWillUnbind: (binding, tx) => {\n\t\t\t\t\t\tthis._logger.log('releasing editor template', {\n\t\t\t\t\t\t\tfile: formatUri(binding.item.modifiedUri ?? binding.item.originalUri),\n\t\t\t\t\t\t\tcontentHeight: binding.size.get(),\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbinding.item.lastTemplateData.set({\n\t\t\t\t\t\t\texpandedContentHeight: binding.getExpandedContentHeight(),\n\t\t\t\t\t\t\tselections: binding.editor.getSelections() ?? undefined,\n\t\t\t\t\t\t}, tx);\n\t\t\t\t\t},\n\t\t\t\t}));\n\t\t\t\tconst adaptedItems = mapObservableArrayCached(this, manager.virtualizedItems, (item, store) => {\n\t\t\t\t\tconst adaptedItem = store.add(new VirtualizedViewItem(item, context.scrollLeft, this._logger));\n\t\t\t\t\tconst data = this._lastDocStates?.[adaptedItem.getKey()];\n\t\t\t\t\tif (data) {\n\t\t\t\t\t\ttransaction(tx => adaptedItem.setViewState(data, tx));\n\t\t\t\t\t}\n\t\t\t\t\treturn adaptedItem;\n\t\t\t\t}).recomputeInitiallyAndOnChange(this._store);\n\t\t\t\tviewItemsInfo = derived<{ items: readonly VirtualizedViewItem[]; getItem: (viewModel: DocumentDiffItemViewModel) => VirtualizedViewItem }>(this, reader => {\n\t\t\t\t\tconst items = adaptedItems.read(reader);\n\t\t\t\t\tconst map = new Map(items.map(item => [item.viewModel, item]));\n\t\t\t\t\tconst restoredDocStates = items.filter(item => this._lastDocStates?.[item.getKey()] !== undefined).length;\n\t\t\t\t\tthis._logger.log('view items updated', {\n\t\t\t\t\t\titems: items.length,\n\t\t\t\t\t\trestoredDocStates,\n\t\t\t\t\t});\n\t\t\t\t\treturn { items, getItem: d => map.get(d)! };\n\t\t\t\t});\n\t\t\t\tviewItems = viewItemsInfo.map(this, items => items.items);\n\t\t\t\treturn derived(this, reader => [...viewItems.read(reader), paddingBottomItem.read(reader)]);\n\t\t\t},\n\t\t));\n\t\tthis._viewItemsInfo = viewItemsInfo;\n\t\tthis._viewItems = viewItems;\n\t\tthis.scrollTop = this._scrollView.scrollTop;\n\t\tthis.scrollLeft = this._scrollView.scrollLeft;\n\t\tthis.layoutDebugState = derived(this, reader => {\n\t\t\tconst layout = this._scrollView.layout.read(reader);\n\t\t\tconst items = this._viewItems.read(reader);\n\t\t\tconst geometryEdit = this._scrollView.lastGeometryEdit.read(reader);\n\t\t\treturn {\n\t\t\t\tscrollLeft: this.scrollLeft.read(reader),\n\t\t\t\tscrollDimensions: this._scrollView.scrollDimensions.read(reader),\n\t\t\t\tlayout: {\n\t\t\t\t\trevision: layout.revision,\n\t\t\t\t\tscrollTop: layout.scrollTop,\n\t\t\t\t\tlogicalScrollHeight: layout.logicalScrollHeight,\n\t\t\t\t\tscrollHeight: layout.scrollHeight,\n\t\t\t\t\trenderedHeight: layout.renderedHeight,\n\t\t\t\t\tleadingScrollSlack: layout.leadingScrollSlack,\n\t\t\t\t\ttrailingScrollSlack: layout.trailingScrollSlack,\n\t\t\t\t\tcontentViewport: serializeOffsetRange(layout.contentViewport),\n\t\t\t\t\trenderedViewport: serializeOffsetRange(layout.renderedViewport),\n\t\t\t\t\thiddenContentHeightAboveViewport: layout.hiddenContentHeightAboveViewport,\n\t\t\t\t},\n\t\t\t\tgeometryEdit: geometryEdit ? {\n\t\t\t\t\t...geometryEdit,\n\t\t\t\t\tedits: geometryEdit.edits.map(edit => ({\n\t\t\t\t\t\toldRange: serializeOffsetRange(edit.oldRange),\n\t\t\t\t\t\tnewRange: serializeOffsetRange(edit.newRange),\n\t\t\t\t\t})),\n\t\t\t\t} : undefined,\n\t\t\t\titems: items.map((item, index) => item.getLayoutDebugState(reader, layout.items[index])),\n\t\t\t};\n\t\t});\n\t\tconst variantClassNames = this._variantConfiguration.classNames.map(className => `.${className}`).join('');\n\t\tthis._elements = h(`div.monaco-component.multiDiffEditor${variantClassNames}`, {}, [\n\t\t\tthis._scrollView.domNode,\n\t\t\th('div.placeholder@placeholder', {}, [h('div')]),\n\t\t]);\n\t\tthis.activeControl = derived(this, reader => {\n\t\t\tconst activeDiffItem = this._viewModel.read(reader)?.activeDiffItem.read(reader);\n\t\t\tif (!activeDiffItem) { return undefined; }\n\t\t\tconst viewItem = this._viewItemsInfo.read(reader).getItem(activeDiffItem);\n\t\t\treturn viewItem.template.read(reader)?.editor;\n\t\t});\n\t\tthis._contextKeyService = this._register(this._parentContextKeyService.createScoped(this._element));\n\t\tthis._instantiationService = this._register(this._parentInstantiationService.createChild(\n\t\t\tnew ServiceCollection([IContextKeyService, this._contextKeyService])\n\t\t));\n\n\t\tthis._contextKeyService.createKey(EditorContextKeys.inMultiDiffEditor.key, true);\n\t\tthis._register(bindContextKey(EditorContextKeys.diffEditorAutomaticRenderSideBySide, this._contextKeyService, reader =>\n\t\t\tthis.activeControl.read(reader)?.renderSideBySideInAutomaticMode.read(reader) ?? true));\n\t\tthis._register(bindContextKey(EditorContextKeys.diffEditorTemporaryInlineMode, this._contextKeyService, reader =>\n\t\t\tthis.activeControl.read(reader)?.temporaryInlineMode.read(reader) ?? false));\n\n\t\tthis._lastDocStates = {};\n\n\t\tthis._register(autorunWithStore((reader, store) => {\n\t\t\tconst viewModel = this._viewModel.read(reader);\n\t\t\tif (viewModel && viewModel.contextKeys) {\n\t\t\t\tfor (const [key, value] of Object.entries(viewModel.contextKeys)) {\n\t\t\t\t\tconst contextKey = this._contextKeyService.createKey<ContextKeyValue>(key, undefined);\n\t\t\t\t\tcontextKey.set(value);\n\t\t\t\t\tstore.add(toDisposable(() => contextKey.reset()));\n\t\t\t\t}\n\t\t\t}\n\t\t}));\n\n\t\tconst ctxAllCollapsed = this._parentContextKeyService.createKey<boolean>(EditorContextKeys.multiDiffEditorAllCollapsed.key, false);\n\t\tthis._register(autorun((reader) => {\n\t\t\tconst viewModel = this._viewModel.read(reader);\n\t\t\tif (viewModel) {\n\t\t\t\tconst allCollapsed = viewModel.items.read(reader).every(item => item.collapsed.read(reader));\n\t\t\t\tctxAllCollapsed.set(allCollapsed);\n\t\t\t}\n\t\t}));\n\n\t\tconst ctxRenderSideBySide = this._parentContextKeyService.createKey<boolean>(EditorContextKeys.multiDiffEditorRenderSideBySide.key, true);\n\t\tthis._register(autorun((reader) => {\n\t\t\tconst renderSideBySide = this._diffLayoutOptions.read(reader)?.renderSideBySide;\n\t\t\tif (renderSideBySide !== undefined) {\n\t\t\t\tctxRenderSideBySide.set(renderSideBySide);\n\t\t\t}\n\t\t}));\n\n\t\tthis._logger.logStateChanges({\n\t\t\tviewModel: this._viewModel,\n\t\t\titems: this._viewItems,\n\t\t\tspaceBetweenPx: this._spaceBetweenPx.get(),\n\t\t\tgetScrollTop: () => this._scrollView.getScrollPosition().scrollTop,\n\t\t\tisPreserveFocusOnLoad: () => this._preserveFocusOnLoad,\n\t\t});\n\n\t\tconst placeholderMessage = derived(reader => {\n\t\t\tconst items = this._viewItems.read(reader);\n\t\t\tif (items.length > 0) { return undefined; }\n\n\t\t\tconst vm = this._viewModel.read(reader);\n\t\t\treturn (!vm || vm.isLoading.read(reader))\n\t\t\t\t? localize('loading', 'Loading...')\n\t\t\t\t: localize('noChangedFiles', 'No Changed Files');\n\t\t});\n\n\t\tthis._register(autorun((reader) => {\n\t\t\tconst message = placeholderMessage.read(reader);\n\t\t\tthis._elements.placeholder.innerText = message ?? '';\n\t\t\tthis._elements.placeholder.classList.toggle('visible', !!message);\n\t\t}));\n\n\t\tthis._register(autorun(reader => {\n\t\t\tthis._scrollView.scrollDimensions.read(reader);\n\t\t\t// A restored scroll offset applied before the model updated these\n\t\t\t// dimensions would be clamped against a stale (often 0) scrollHeight, so\n\t\t\t// apply it here once the dimensions are known.\n\t\t\tthis._applyPendingScrollState();\n\t\t}));\n\n\t\t_element.replaceChildren(this._elements.root);\n\t\tthis._register(toDisposable(() => {\n\t\t\t_element.replaceChildren();\n\t\t}));\n\n\t\t// Automatically select the first change in the first file when items are loaded\n\t\tthis._register(autorun(reader => {\n\t\t\t/** @description Initialize first change */\n\t\t\tconst viewModel = this._viewModel.read(reader);\n\t\t\tif (!viewModel) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Only initialize when loading is complete\n\t\t\tif (!viewModel.isLoading.read(reader)) {\n\t\t\t\tconst items = viewModel.items.read(reader);\n\t\t\t\tif (items.length === 0) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Only initialize if there's no active item yet\n\t\t\t\tconst activeDiffItem = viewModel.activeDiffItem.read(reader);\n\t\t\t\tif (activeDiffItem) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Restore the persisted active item instead of selecting the first\n\t\t\t\t// change, so the restored scroll/collapsed state is preserved.\n\t\t\t\tif (this._restorePendingActiveDiffItem(viewModel, items)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tthis._logger.log('no active diff item after loading, selecting first change', { items: items.length });\n\n\t\t\t\t// Navigate to the first change using the existing navigation\n\t\t\t\t// logic. Whether this also moves keyboard focus into the editor\n\t\t\t\t// is driven by the last `setViewModel` call: an editor opened\n\t\t\t\t// with `preserveFocus` (e.g. restored in the background or on a\n\t\t\t\t// session switch) must not steal focus from wherever the user is\n\t\t\t\t// (such as the chat input), while a normal user-initiated open\n\t\t\t\t// focuses the first change so the editor is ready to use.\n\t\t\t\tthis._navigateToChange('next', !this._preserveFocusOnLoad);\n\t\t\t}\n\t\t}));\n\n\t}\n\n\tpublic setScrollState(scrollState: { top?: number; left?: number }): void {\n\t\tthis._pendingScrollState = scrollState;\n\t\tthis._hasAppliedPendingScrollState = false;\n\t\tthis._lastPendingScrollDimensions = undefined;\n\t\tthis._applyPendingScrollState();\n\t}\n\n\t/**\n\t * Retries a restored scroll offset as dimensions change until it lands.\n\t * Navigation away from the clamped offset with unchanged dimensions cancels restoration.\n\t */\n\tprivate _applyPendingScrollState(): void {\n\t\tconst pending = this._pendingScrollState;\n\t\tif (!pending) {\n\t\t\treturn;\n\t\t}\n\t\tconst dimensions = this._scrollView.scrollDimensions.get();\n\t\tconst current = this._scrollView.getScrollPosition();\n\t\tconst expectedTop = pending.top === undefined ? current.scrollTop : Math.min(Math.max(0, pending.top), Math.max(0, dimensions.scrollHeight - dimensions.height));\n\t\tconst expectedLeft = pending.left === undefined ? current.scrollLeft : Math.min(Math.max(0, pending.left), Math.max(0, dimensions.scrollWidth - dimensions.width));\n\t\tconst previousDimensions = this._lastPendingScrollDimensions;\n\t\tconst dimensionsChanged = !previousDimensions\n\t\t\t|| previousDimensions.width !== dimensions.width\n\t\t\t|| previousDimensions.height !== dimensions.height\n\t\t\t|| previousDimensions.scrollWidth !== dimensions.scrollWidth\n\t\t\t|| previousDimensions.scrollHeight !== dimensions.scrollHeight;\n\t\tif (this._hasAppliedPendingScrollState && !dimensionsChanged && (current.scrollTop !== expectedTop || current.scrollLeft !== expectedLeft)) {\n\t\t\tthis._pendingScrollState = undefined;\n\t\t\tthis._hasAppliedPendingScrollState = false;\n\t\t\tthis._lastPendingScrollDimensions = undefined;\n\t\t\treturn;\n\t\t}\n\t\tthis._scrollView.setScrollPosition({ scrollLeft: pending.left, scrollTop: pending.top });\n\t\tconst applied = this._scrollView.getScrollPosition();\n\t\tconst topLanded = pending.top === undefined || applied.scrollTop >= pending.top;\n\t\tconst leftLanded = pending.left === undefined || applied.scrollLeft >= pending.left;\n\t\tif (topLanded && leftLanded) {\n\t\t\tthis._pendingScrollState = undefined;\n\t\t\tthis._hasAppliedPendingScrollState = false;\n\t\t\tthis._lastPendingScrollDimensions = undefined;\n\t\t} else {\n\t\t\tthis._hasAppliedPendingScrollState = true;\n\t\t\tthis._lastPendingScrollDimensions = dimensions;\n\t\t}\n\t\tthis._logger.log('applied pending scroll state', {\n\t\t\trequested: pending,\n\t\t\tapplied: { top: applied.scrollTop, left: applied.scrollLeft },\n\t\t\tlanded: topLanded && leftLanded,\n\t\t});\n\t}\n\n\t/**\n\t * Controls whether the automatic first-change selection that runs once the\n\t * view model finishes loading preserves focus instead of moving it into the\n\t * editor. Set to `true` for `preserveFocus` opens so focus is not stolen\n\t * from elsewhere.\n\t */\n\tpublic setPreserveFocusOnLoad(preserveFocus: boolean): void {\n\t\tthis._preserveFocusOnLoad = preserveFocus;\n\t}\n\n\tpublic reveal(resource: IMultiDiffResourceId, options?: RevealOptions): void {\n\t\tconst viewItems = this._viewItems.get();\n\t\tconst index = viewItems.findIndex(\n\t\t\t(item) => item.viewModel.originalUri?.toString() === resource.original?.toString()\n\t\t\t\t&& item.viewModel.modifiedUri?.toString() === resource.modified?.toString()\n\t\t);\n\t\tif (index === -1) {\n\t\t\tthrow new BugIndicatingError('Resource not found in diff editor');\n\t\t}\n\t\tconst viewItem = viewItems[index];\n\t\tthis._viewModel.get()!.activeDiffItem.setCache(viewItem.viewModel, undefined);\n\n\t\tlet scrollTop = 0;\n\t\tfor (let i = 0; i < index; i++) {\n\t\t\tscrollTop += viewItems[i].contentHeight.get() + this._spaceBetweenPx.get();\n\t\t}\n\t\tthis._logger.log('reveal', {\n\t\t\tfile: viewItem.getLabel(),\n\t\t\tindex,\n\t\t\tscrollTop: `${this._scrollView.getScrollPosition().scrollTop} -> ${scrollTop}`,\n\t\t\trange: options?.range,\n\t\t});\n\t\tthis._scrollView.setLogicalScrollPosition(scrollTop);\n\n\t\tconst diffEditor = viewItem.template.get()?.editor;\n\t\tconst editor = 'original' in resource ? diffEditor?.getOriginalEditor() : diffEditor?.getModifiedEditor();\n\t\tif (editor && options?.range) {\n\t\t\teditor.revealRangeInCenter(options.range);\n\t\t\thighlightRange(editor, options.range);\n\t\t}\n\t}\n\n\tpublic getViewState(): IMultiDiffEditorViewState {\n\t\tconst viewState: IMultiDiffEditorViewState = {\n\t\t\tscrollState: {\n\t\t\t\ttop: this.scrollTop.get(),\n\t\t\t\tleft: this.scrollLeft.get(),\n\t\t\t},\n\t\t\tdocStates: Object.fromEntries(this._viewItems.get().map(i => [i.getKey(), i.getViewState()])),\n\t\t\tactiveDiffItemKey: this._viewModel.get()?.activeDiffItem.get()?.getKey(),\n\t\t};\n\t\tif (this._logger.isEnabled) {\n\t\t\tconst docStates = Object.values(viewState.docStates ?? {});\n\t\t\tthis._logger.log('get view state', {\n\t\t\t\tscrollTop: viewState.scrollState.top,\n\t\t\t\tscrollLeft: viewState.scrollState.left,\n\t\t\t\tdocStates: docStates.length,\n\t\t\t\tcollapsed: docStates.filter(s => s.collapsed).length,\n\t\t\t\tactiveDiffItem: formatDiffItemKey(viewState.activeDiffItemKey),\n\t\t\t});\n\t\t}\n\t\treturn viewState;\n\t}\n\n\t/** This accounts for documents that are not loaded yet. */\n\tprivate _lastDocStates: IMultiDiffEditorViewState['docStates'];\n\n\t/**\n\t * The active diff item to restore once the documents are loaded. Restoring it\n\t * suppresses the automatic first-change navigation (which would expand the\n\t * first file and reset scroll), so the restored state wins. Consumed once.\n\t */\n\tprivate _lastActiveDiffItemKey: string | undefined;\n\n\t/** A restored scroll offset waiting for the scrollable dimensions to be known. */\n\tprivate _pendingScrollState: { top?: number; left?: number } | undefined;\n\tprivate _hasAppliedPendingScrollState = false;\n\tprivate _lastPendingScrollDimensions: { readonly width: number; readonly height: number; readonly scrollWidth: number; readonly scrollHeight: number } | undefined;\n\n\tpublic setViewState(viewState: IMultiDiffEditorViewState, tx?: ITransaction): void {\n\t\tif (this._logger.isEnabled) {\n\t\t\tconst docStates = Object.values(viewState.docStates ?? {});\n\t\t\tthis._logger.log('set view state', {\n\t\t\t\tscrollTop: viewState.scrollState.top,\n\t\t\t\tscrollLeft: viewState.scrollState.left,\n\t\t\t\tdocStates: docStates.length,\n\t\t\t\tcollapsed: docStates.filter(s => s.collapsed).length,\n\t\t\t\tactiveDiffItem: formatDiffItemKey(viewState.activeDiffItemKey),\n\t\t\t\tviewItems: this._viewItems.get().length,\n\t\t\t});\n\t\t}\n\t\tthis.setScrollState(viewState.scrollState);\n\n\t\tthis._lastDocStates = viewState.docStates;\n\t\tthis._lastActiveDiffItemKey = viewState.activeDiffItemKey;\n\n\t\tconst applyDocStates = (tx: ITransaction) => {\n\t\t\tif (viewState.docStates) {\n\t\t\t\tfor (const i of this._viewItems.get()) {\n\t\t\t\t\tconst state = viewState.docStates[i.getKey()];\n\t\t\t\t\tif (state) {\n\t\t\t\t\t\ti.setViewState(state, tx);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tif (tx) {\n\t\t\tapplyDocStates(tx);\n\t\t} else {\n\t\t\ttransaction(applyDocStates);\n\t\t}\n\n\t\t// If the documents are already loaded, restore the active item now (this\n\t\t// overrides the first-change selection the init autorun may have made);\n\t\t// otherwise the init autorun restores it once loading completes.\n\t\tconst viewModel = this._viewModel.get();\n\t\tif (viewModel) {\n\t\t\tthis._restorePendingActiveDiffItem(viewModel, viewModel.items.get());\n\t\t}\n\t}\n\n\t/**\n\t * Restores the persisted active diff item (if any) onto the view model, so the\n\t * automatic first-change navigation is skipped. On an explicit (non-preserve-focus)\n\t * open it also moves focus into the restored item's editor, mirroring the\n\t * first-change navigation it replaces. Returns whether it was applied.\n\t */\n\tprivate _restorePendingActiveDiffItem(viewModel: MultiDiffEditorViewModel, items: readonly DocumentDiffItemViewModel[]): boolean {\n\t\tconst key = this._lastActiveDiffItemKey;\n\t\tif (key === undefined || items.length === 0) {\n\t\t\treturn false;\n\t\t}\n\t\tthis._lastActiveDiffItemKey = undefined;\n\t\tconst target = items.find(i => i.getKey() === key);\n\t\tif (!target) {\n\t\t\tif (this._logger.isEnabled) {\n\t\t\t\tthis._logger.log('persisted active diff item not found', {\n\t\t\t\t\tkey: formatDiffItemKey(key),\n\t\t\t\t\tavailableKeys: items.map(i => formatDiffItemKey(i.getKey())),\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t\tthis._logger.log('restored active diff item', { file: target.modifiedUri ?? target.originalUri, preserveFocus: this._preserveFocusOnLoad });\n\t\tviewModel.activeDiffItem.setCache(target, undefined);\n\n\t\tif (!this._preserveFocusOnLoad) {\n\t\t\tthis._viewItemsInfo.get().getItem(target).binding.get()?.focus();\n\t\t}\n\t\treturn true;\n\t}\n\n\tprivate _navigateToChange(direction: 'next' | 'previous', focusEditor: boolean = true): void {\n\t\tconst viewItems = this._viewItems.get();\n\t\tif (viewItems.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst activeViewModel = this._viewModel.get()?.activeDiffItem.get();\n\t\tconst currentIndex = activeViewModel ? viewItems.findIndex(v => v.viewModel === activeViewModel) : -1;\n\n\t\tthis._logger.log('navigate to change', { direction, focusEditor, currentIndex, items: viewItems.length });\n\n\t\t// Start with first file if no active item\n\t\tif (currentIndex === -1) {\n\t\t\tthis._goToFile(0, 'first', focusEditor);\n\t\t\treturn;\n\t\t}\n\n\t\t// Try current file first - expand if collapsed\n\t\tconst currentItem = viewItems[currentIndex];\n\t\tif (currentItem.viewModel.collapsed.get()) {\n\t\t\tthis._logger.log('expanding collapsed item to navigate within it', { file: currentItem.getLabel() });\n\t\t\tcurrentItem.viewModel.collapsed.set(false, undefined);\n\t\t}\n\n\t\tconst editor = currentItem.template.get()?.editor;\n\t\tif (editor?.getDiffComputationResult()?.changes2?.length) {\n\t\t\tconst pos = editor.getModifiedEditor().getPosition()?.lineNumber || 1;\n\t\t\tconst changes = editor.getDiffComputationResult()!.changes2!;\n\t\t\tconst hasNext = direction === 'next' ? changes.some(c => c.modified.startLineNumber > pos) : changes.some(c => c.modified.endLineNumberExclusive <= pos);\n\n\t\t\tif (hasNext) {\n\t\t\t\teditor.goToDiff(direction);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// Move to next/previous file\n\t\tconst nextIndex = (currentIndex + (direction === 'next' ? 1 : -1) + viewItems.length) % viewItems.length;\n\t\tthis._goToFile(nextIndex, direction === 'next' ? 'first' : 'last', focusEditor);\n\t}\n\n\tprivate _goToFile(index: number, position: 'first' | 'last', focusEditor: boolean = true): void {\n\t\tconst item = this._viewItems.get()[index];\n\t\tconst wasCollapsed = item.viewModel.collapsed.get();\n\t\tthis._logger.log('go to file', { file: item.getLabel(), index, position, focusEditor, wasCollapsed });\n\t\tif (wasCollapsed) {\n\t\t\titem.viewModel.collapsed.set(false, undefined);\n\t\t}\n\n\t\tthis.reveal({ original: item.viewModel.originalUri, modified: item.viewModel.modifiedUri });\n\n\t\tconst editor = item.template.get()?.editor;\n\t\tif (editor?.getDiffComputationResult()?.changes2?.length) {\n\t\t\tif (position === 'first') {\n\t\t\t\teditor.revealFirstDiff();\n\t\t\t} else {\n\t\t\t\tconst lastChange = editor.getDiffComputationResult()!.changes2!.at(-1)!;\n\t\t\t\tconst modifiedEditor = editor.getModifiedEditor();\n\t\t\t\tmodifiedEditor.setPosition({ lineNumber: lastChange.modified.startLineNumber, column: 1 });\n\t\t\t\tmodifiedEditor.revealLineInCenter(lastChange.modified.startLineNumber);\n\t\t\t}\n\t\t}\n\t\tif (focusEditor) {\n\t\t\titem.binding.get()?.focus();\n\t\t}\n\t}\n\n}\n\nfunction highlightRange(targetEditor: ICodeEditor, range: IRange) {\n\tconst modelNow = targetEditor.getModel();\n\tconst decorations = targetEditor.createDecorationsCollection([{ range, options: { description: 'symbol-navigate-action-highlight', className: 'symbolHighlight' } }]);\n\tsetTimeout(() => {\n\t\tif (targetEditor.getModel() === modelNow) {\n\t\t\tdecorations.clear();\n\t\t}\n\t}, 350);\n}\n\nexport interface IMultiDiffEditorViewState {\n\tscrollState: { top: number; left: number };\n\tdocStates?: Record<string, IMultiDiffDocState>;\n\t/** Key ({@link DocumentDiffItemViewModel.getKey}) of the active diff item, if any. */\n\tactiveDiffItemKey?: string;\n}\n\ninterface IMultiDiffDocState {\n\tcollapsed: boolean;\n\tselections?: ISelection[];\n}\n\nexport interface IMultiDiffEditorLayoutDebugState {\n}\n\ninterface IMultiDiffEditorItemLayoutDebugState {\n\treadonly key: string;\n\treadonly label: string;\n\treadonly originalUri: string | null;\n\treadonly modifiedUri: string | null;\n\treadonly collapsed: boolean;\n\treadonly hasTemplate: boolean;\n\treadonly verticalState: {\n\t\treadonly contentHeight: number;\n\t\treadonly itemViewportOffset: number;\n\t};\n\treadonly maxScroll: number;\n\treadonly layout: {\n\t\treadonly contentRange: ISerializedOffsetRange;\n\t\treadonly renderedRange: ISerializedOffsetRange;\n\t\treadonly maxScrollOffset: number;\n\t\treadonly scrollOffset: number;\n\t\treadonly visibility: 'before' | 'visible' | 'after';\n\t};\n}\n\ninterface ISerializedOffsetRange {\n\treadonly start: number;\n\treadonly endExclusive: number;\n}\n\nfunction serializeOffsetRange(range: OffsetRange): ISerializedOffsetRange {\n\treturn { start: range.start, endExclusive: range.endExclusive };\n}\n\nclass VirtualizedViewItem extends Disposable implements ILoggedDiffItem, ICompressedVirtualizedScrollItem {\n\tpublic readonly size;\n\tpublic readonly contentHeight;\n\tpublic readonly maxScroll;\n\tpublic readonly template;\n\tpublic readonly binding;\n\tpublic readonly viewModel;\n\n\tpublic get collapsed(): IObservable<boolean> { return this.viewModel.collapsed; }\n\n\tpublic getLayoutDebugState(reader: IReader, layout: ICompressedVirtualizedScrollLayout['items'][number]): IMultiDiffEditorItemLayoutDebugState {\n\t\tconst binding = this.binding.read(reader);\n\t\treturn {\n\t\t\tkey: this.getKey(),\n\t\t\tlabel: this.getLabel(),\n\t\t\toriginalUri: this.viewModel.originalUri?.toString() ?? null,\n\t\t\tmodifiedUri: this.viewModel.modifiedUri?.toString() ?? null,\n\t\t\tcollapsed: this.collapsed.read(reader),\n\t\t\thasTemplate: binding !== undefined,\n\t\t\tverticalState: {\n\t\t\t\tcontentHeight: this.size.read(reader),\n\t\t\t\titemViewportOffset: layout.scrollOffset,\n\t\t\t},\n\t\t\tmaxScroll: this.maxScroll.read(reader).maxScroll,\n\t\t\tlayout: {\n\t\t\t\tcontentRange: serializeOffsetRange(layout.contentRange),\n\t\t\t\trenderedRange: serializeOffsetRange(layout.renderedRange),\n\t\t\t\tmaxScrollOffset: layout.maxScrollOffset,\n\t\t\t\tscrollOffset: layout.scrollOffset,\n\t\t\t\tvisibility: layout.visibility,\n\t\t\t},\n\t\t};\n\t}\n\n\tprivate readonly _isFocused;\n\n\tconstructor(\n\t\tprivate readonly _managedItem: ManagedVirtualizedItem<DocumentDiffItemViewModel, DiffEditorItemBinding, DiffEditorItemTemplate>,\n\t\tprivate readonly _scrollLeft: IObservable<number>,\n\t\tprivate readonly _logger: MultiDiffEditorLogger,\n\t) {\n\t\tsuper();\n\t\tthis.size = _managedItem.size;\n\t\tthis.contentHeight = this.size;\n\t\tthis.maxScroll = _managedItem.maxScroll;\n\t\tthis.template = _managedItem.template;\n\t\tthis.binding = _managedItem.binding;\n\t\tthis.viewModel = _managedItem.item;\n\t\tthis._isFocused = derived(this, reader => this.template.read(reader)?.isFocused.read(reader) ?? false);\n\n\t\tthis.viewModel.setIsFocused(this._isFocused, undefined);\n\n\t\tthis._register(autorun((reader) => {\n\t\t\tconst scrollLeft = this._scrollLeft.read(reader);\n\t\t\tthis.binding.read(reader)?.setScrollLeft(scrollLeft);\n\t\t}));\n\t}\n\n\tpublic override toString(): string {\n\t\treturn `VirtualViewItem(${this.viewModel.modifiedUri?.toString() ?? this.viewModel.originalUri?.toString()})`;\n\t}\n\n\tpublic getKey(): string {\n\t\treturn this.viewModel.getKey();\n\t}\n\n\t/** Short, log friendly name of this item. */\n\tpublic getLabel(): string {\n\t\treturn formatUri(this.viewModel.modifiedUri ?? this.viewModel.originalUri);\n\t}\n\n\tpublic getViewState(): IMultiDiffDocState {\n\t\ttransaction(tx => {\n\t\t\tthis._updateTemplateData(tx);\n\t\t});\n\t\treturn {\n\t\t\tcollapsed: this.viewModel.collapsed.get(),\n\t\t\tselections: this.viewModel.lastTemplateData.get().selections,\n\t\t};\n\t}\n\n\tpublic setViewState(viewState: IMultiDiffDocState, tx: ITransaction): void {\n\t\tthis._logger.log('item view state restored', { file: this.getLabel(), collapsed: viewState.collapsed, selections: viewState.selections?.length ?? 0 });\n\t\tthis.viewModel.collapsed.set(viewState.collapsed, tx);\n\n\t\tthis._updateTemplateData(tx);\n\t\tconst data = this.viewModel.lastTemplateData.get();\n\t\tconst selections = viewState.selections?.map(Selection.liftSelection);\n\t\tthis.viewModel.lastTemplateData.set({\n\t\t\t...data,\n\t\t\tselections,\n\t\t}, tx);\n\t\tconst binding = this.binding.get();\n\t\tif (binding && selections) {\n\t\t\tbinding.editor.setSelections(selections);\n\t\t}\n\t}\n\n\tprivate _updateTemplateData(tx: ITransaction): void {\n\t\tconst binding = this.binding.get();\n\t\tif (!binding) { return; }\n\t\tthis.viewModel.lastTemplateData.set({\n\t\t\texpandedContentHeight: binding.getExpandedContentHeight(),\n\t\t\tselections: binding.editor.getSelections() ?? undefined,\n\t\t}, tx);\n\t}\n\n\tpublic hide(): void {\n\t\tthis._managedItem.hide();\n\t}\n\n\tpublic render(verticalSpace: OffsetRange, offset: number, width: number, viewPort: OffsetRange, context: ICompressedVirtualizedScrollItemContext): void {\n\t\tthis._managedItem.render(verticalSpace, offset, width, viewPort, context);\n\t}\n}\n"]}
1
+ {"version":3,"sources":["vs/editor/browser/widget/multiDiffEditor/multiDiffEditorWidgetImpl.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;AAEhG,OAAO,EAAa,CAAC,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAsC,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,OAAO,EAAE,WAAW,EAAE,wBAAwB,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACrN,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAmB,kBAAkB,EAAE,MAAM,sDAAsD,CAAC;AAC3G,OAAO,EAAE,qBAAqB,EAAE,MAAM,4DAA4D,CAAC;AACnG,OAAO,EAAE,iBAAiB,EAAE,MAAM,gEAAgE,CAAC;AACnG,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,mEAAmE,CAAC;AAInG,OAAO,EAAc,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAE1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAEzE,OAAO,EAAE,+BAA+B,EAA6E,MAAM,sCAAsC,CAAC;AAElK,OAAO,EAAE,kCAAkC,EAAyB,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAChI,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAmB,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAInH,OAAO,aAAa,CAAC;AACrB,OAAO,EAA0B,sBAAsB,EAAE,MAAM,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AC,YAAY,CAAC,IAAI,EAAE,CAAC;IAC1B,CAAC;IAEM,MAAM,CAAC,aAA0B,EAAE,MAAc,EAAE,KAAa,EAAE,QAAqB,EAAE,OAAgD;QAC/I,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC3E,CAAC;CACD","file":"multiDiffEditorWidgetImpl.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Dimension, h } from '../../../../base/browser/dom.js';\nimport { arrayEqualsC } from '../../../../base/common/equals.js';\nimport { BugIndicatingError } from '../../../../base/common/errors.js';\nimport { Disposable, toDisposable } from '../../../../base/common/lifecycle.js';\nimport { IObservable, IReader, ITransaction, autorun, autorunWithStore, constObservable, derived, derivedOpts, mapObservableArrayCached, observableValue, transaction } from '../../../../base/common/observable.js';\nimport { localize } from '../../../../nls.js';\nimport { ContextKeyValue, IContextKeyService } from '../../../../platform/contextkey/common/contextkey.js';\nimport { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';\nimport { ServiceCollection } from '../../../../platform/instantiation/common/serviceCollection.js';\nimport { ILogService } from '../../../../platform/log/common/log.js';\nimport { bindContextKey } from '../../../../platform/observable/common/platformObservableUtils.js';\nimport { OffsetRange } from '../../../common/core/ranges/offsetRange.js';\nimport { IDiffEditorOptions } from '../../../common/config/editorOptions.js';\nimport { IRange } from '../../../common/core/range.js';\nimport { ISelection, Selection } from '../../../common/core/selection.js';\nimport { IMultiDiffResourceId } from '../../../common/multiDiffEditor.js';\nimport { EditorContextKeys } from '../../../common/editorContextKeys.js';\nimport { ICodeEditor } from '../../editorBrowser.js';\nimport { CompressedVirtualizedScrollView, ICompressedVirtualizedScrollItem, ICompressedVirtualizedScrollItemContext } from './compressedVirtualizedScrollView.js';\nimport { ICompressedVirtualizedScrollLayout } from './compressedVirtualizedScrollLayout.js';\nimport { binaryFilePlaceholderContentHeight, DiffEditorItemBinding, DiffEditorItemTemplate } from './diffEditorItemTemplate.js';\nimport { formatDiffItemKey, formatUri, ILoggedDiffItem, MultiDiffEditorLogger } from './multiDiffEditorLogging.js';\nimport { IMultiDiffEditorVariantConfiguration } from './multiDiffEditorOptions.js';\nimport { DocumentDiffItemViewModel, MultiDiffEditorViewModel } from './multiDiffEditorViewModel.js';\nimport { RevealOptions } from './multiDiffEditorWidget.js';\nimport './style.css';\nimport { ManagedVirtualizedItem, VirtualizedItemManager } from './virtualizedItemManager.js';\nimport { IWorkbenchUIElementFactory } from './workbenchUIElementFactory.js';\n\nexport class MultiDiffEditorWidgetImpl extends Disposable {\n\tprivate readonly _scrollView;\n\n\tprivate readonly _elements;\n\n\tprivate readonly _optionsOverride: IObservable<IDiffEditorOptions>;\n\n\tpublic readonly scrollTop;\n\tpublic readonly scrollLeft;\n\tpublic readonly layoutDebugState: IObservable<IMultiDiffEditorLayoutDebugState>;\n\n\t/** Diff items whose content intersects the viewport, in document order. */\n\tpublic readonly visibleDiffItems: IObservable<readonly DocumentDiffItemViewModel[]>;\n\n\tprivate readonly _viewItemsInfo;\n\n\tprivate readonly _viewItems;\n\n\tprivate readonly _spaceBetweenPx;\n\tpublic readonly activeControl;\n\n\tprivate readonly _contextKeyService;\n\tprivate readonly _instantiationService;\n\n\tprivate readonly _logger: MultiDiffEditorLogger;\n\n\t/**\n\t * When `true`, the automatic \"select the first change\" initialization that\n\t * runs once the view model finishes loading does not move keyboard focus\n\t * into the editor. Driven by {@link setPreserveFocusOnLoad} so a\n\t * `preserveFocus` open (e.g. restored in the background or on a session\n\t * switch) does not steal focus, while a normal user-initiated open does.\n\t */\n\tprivate _preserveFocusOnLoad = false;\n\n\tconstructor(\n\t\tprivate readonly _element: HTMLElement,\n\t\tprivate readonly _dimension: IObservable<Dimension | undefined>,\n\t\tprivate readonly _viewModel: IObservable<MultiDiffEditorViewModel | undefined>,\n\t\tprivate readonly _workbenchUIElementFactory: IWorkbenchUIElementFactory,\n\t\tprivate readonly _variantConfiguration: IMultiDiffEditorVariantConfiguration,\n\t\tprivate readonly _diffLayoutOptions: IObservable<IDiffEditorOptions | undefined>,\n\t\tprivate readonly _diffEditorOptions: IDiffEditorOptions | undefined,\n\t\tprivate readonly _paddingBottomPx: IObservable<number>,\n\t\t@IContextKeyService private readonly _parentContextKeyService: IContextKeyService,\n\t\t@IInstantiationService private readonly _parentInstantiationService: IInstantiationService,\n\t\t@ILogService logService: ILogService,\n\t) {\n\t\tsuper();\n\t\tthis._logger = this._register(new MultiDiffEditorLogger(logService));\n\t\tthis._optionsOverride = derived(this, reader => {\n\t\t\treturn { ...this._diffEditorOptions, ...this._diffLayoutOptions.read(reader) };\n\t\t});\n\t\tthis._spaceBetweenPx = observableValue(this, 0);\n\t\tconst paddingBottomItem = this._paddingBottomPx.map<ICompressedVirtualizedScrollItem>(this, size => ({\n\t\t\tsize: constObservable(size),\n\t\t\tmaxScroll: constObservable({ maxScroll: 0 }),\n\t\t\trender() { },\n\t\t\thide() { },\n\t\t}));\n\n\t\tlet viewItemsInfo!: IObservable<{ items: readonly VirtualizedViewItem[]; getItem: (viewModel: DocumentDiffItemViewModel) => VirtualizedViewItem }>;\n\t\tlet viewItems!: IObservable<readonly VirtualizedViewItem[]>;\n\t\tthis._scrollView = this._register(new CompressedVirtualizedScrollView(\n\t\t\tthis._element,\n\t\t\tthis._dimension,\n\t\t\tthis._spaceBetweenPx,\n\t\t\tcontext => {\n\t\t\t\tconst sourceItems = derived(this, reader => this._viewModel.read(reader)?.items.read(reader) ?? []);\n\t\t\t\tconst manager = this._register(new VirtualizedItemManager<DocumentDiffItemViewModel, DiffEditorItemBinding, DiffEditorItemTemplate>(sourceItems, context, {\n\t\t\t\t\tgetId: item => item,\n\t\t\t\t\tgetTemplateId: () => 'diffEditor',\n\t\t\t\t\tgetUnboundSize: item => derived(item, reader => {\n\t\t\t\t\t\tconst headerHeight = this._variantConfiguration.headerHeight;\n\t\t\t\t\t\tif (item.collapsed.read(reader)) {\n\t\t\t\t\t\t\treturn headerHeight;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (item.isBinary) {\n\t\t\t\t\t\t\treturn headerHeight\n\t\t\t\t\t\t\t\t+ this._variantConfiguration.contentBottomPadding\n\t\t\t\t\t\t\t\t+ binaryFilePlaceholderContentHeight;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn item.lastTemplateData.read(reader).expandedContentHeight;\n\t\t\t\t\t}),\n\t\t\t\t\tcreateTemplate: () => this._instantiationService.createInstance(\n\t\t\t\t\t\tDiffEditorItemTemplate,\n\t\t\t\t\t\tcontext.contentDomNode,\n\t\t\t\t\t\tcontext.overflowWidgetsDomNode,\n\t\t\t\t\t\tthis._workbenchUIElementFactory,\n\t\t\t\t\t\tthis._variantConfiguration,\n\t\t\t\t\t\tthis._optionsOverride,\n\t\t\t\t\t),\n\t\t\t\t\tonDidBind: binding => {\n\t\t\t\t\t\tconst selections = binding.item.lastTemplateData.get().selections;\n\t\t\t\t\t\tthis._logger.log('acquired editor template', {\n\t\t\t\t\t\t\tfile: formatUri(binding.item.modifiedUri ?? binding.item.originalUri),\n\t\t\t\t\t\t\tcollapsed: binding.item.collapsed.get(),\n\t\t\t\t\t\t\texpectedExpandedContentHeight: binding.item.lastTemplateData.get().expandedContentHeight,\n\t\t\t\t\t\t\tselections: selections?.length ?? 0,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tif (selections) {\n\t\t\t\t\t\t\tbinding.editor.setSelections(selections);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tonWillUnbind: (binding, tx) => {\n\t\t\t\t\t\tthis._logger.log('releasing editor template', {\n\t\t\t\t\t\t\tfile: formatUri(binding.item.modifiedUri ?? binding.item.originalUri),\n\t\t\t\t\t\t\tcontentHeight: binding.size.get(),\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbinding.item.lastTemplateData.set({\n\t\t\t\t\t\t\texpandedContentHeight: binding.getExpandedContentHeight(),\n\t\t\t\t\t\t\tselections: binding.editor.getSelections() ?? undefined,\n\t\t\t\t\t\t}, tx);\n\t\t\t\t\t},\n\t\t\t\t}));\n\t\t\t\tconst adaptedItems = mapObservableArrayCached(this, manager.virtualizedItems, (item, store) => {\n\t\t\t\t\tconst adaptedItem = store.add(new VirtualizedViewItem(item, context.scrollLeft, this._logger));\n\t\t\t\t\tconst data = this._lastDocStates?.[adaptedItem.getKey()];\n\t\t\t\t\tif (data) {\n\t\t\t\t\t\ttransaction(tx => adaptedItem.setViewState(data, tx));\n\t\t\t\t\t}\n\t\t\t\t\treturn adaptedItem;\n\t\t\t\t}).recomputeInitiallyAndOnChange(this._store);\n\t\t\t\tviewItemsInfo = derived<{ items: readonly VirtualizedViewItem[]; getItem: (viewModel: DocumentDiffItemViewModel) => VirtualizedViewItem }>(this, reader => {\n\t\t\t\t\tconst items = adaptedItems.read(reader);\n\t\t\t\t\tconst map = new Map(items.map(item => [item.viewModel, item]));\n\t\t\t\t\tconst restoredDocStates = items.filter(item => this._lastDocStates?.[item.getKey()] !== undefined).length;\n\t\t\t\t\tthis._logger.log('view items updated', {\n\t\t\t\t\t\titems: items.length,\n\t\t\t\t\t\trestoredDocStates,\n\t\t\t\t\t});\n\t\t\t\t\treturn { items, getItem: d => map.get(d)! };\n\t\t\t\t});\n\t\t\t\tviewItems = viewItemsInfo.map(this, items => items.items);\n\t\t\t\treturn derived(this, reader => [...viewItems.read(reader), paddingBottomItem.read(reader)]);\n\t\t\t},\n\t\t));\n\t\tthis._viewItemsInfo = viewItemsInfo;\n\t\tthis._viewItems = viewItems;\n\t\tthis.scrollTop = this._scrollView.scrollTop;\n\t\tthis.scrollLeft = this._scrollView.scrollLeft;\n\t\tthis.layoutDebugState = derived(this, reader => {\n\t\t\tconst layout = this._scrollView.layout.read(reader);\n\t\t\tconst items = this._viewItems.read(reader);\n\t\t\tconst geometryEdit = this._scrollView.lastGeometryEdit.read(reader);\n\t\t\treturn {\n\t\t\t\tscrollLeft: this.scrollLeft.read(reader),\n\t\t\t\tscrollDimensions: this._scrollView.scrollDimensions.read(reader),\n\t\t\t\tlayout: {\n\t\t\t\t\trevision: layout.revision,\n\t\t\t\t\tscrollTop: layout.scrollTop,\n\t\t\t\t\tlogicalScrollHeight: layout.logicalScrollHeight,\n\t\t\t\t\tscrollHeight: layout.scrollHeight,\n\t\t\t\t\trenderedHeight: layout.renderedHeight,\n\t\t\t\t\tleadingScrollSlack: layout.leadingScrollSlack,\n\t\t\t\t\ttrailingScrollSlack: layout.trailingScrollSlack,\n\t\t\t\t\tcontentViewport: serializeOffsetRange(layout.contentViewport),\n\t\t\t\t\trenderedViewport: serializeOffsetRange(layout.renderedViewport),\n\t\t\t\t\thiddenContentHeightAboveViewport: layout.hiddenContentHeightAboveViewport,\n\t\t\t\t},\n\t\t\t\tgeometryEdit: geometryEdit ? {\n\t\t\t\t\t...geometryEdit,\n\t\t\t\t\tedits: geometryEdit.edits.map(edit => ({\n\t\t\t\t\t\toldRange: serializeOffsetRange(edit.oldRange),\n\t\t\t\t\t\tnewRange: serializeOffsetRange(edit.newRange),\n\t\t\t\t\t})),\n\t\t\t\t} : undefined,\n\t\t\t\titems: items.map((item, index) => item.getLayoutDebugState(reader, layout.items[index])),\n\t\t\t};\n\t\t});\n\t\tthis.visibleDiffItems = derivedOpts<readonly DocumentDiffItemViewModel[]>({ owner: this, equalsFn: arrayEqualsC() }, reader => {\n\t\t\tconst layout = this._scrollView.layout.read(reader);\n\t\t\t// Layout items are index-aligned with the view items (the trailing padding item is not a view item).\n\t\t\treturn this._viewItems.read(reader)\n\t\t\t\t.filter((_item, index) => layout.items[index]?.visibility === 'visible')\n\t\t\t\t.map(item => item.viewModel);\n\t\t});\n\t\tconst variantClassNames = this._variantConfiguration.classNames.map(className => `.${className}`).join('');\n\t\tthis._elements = h(`div.monaco-component.multiDiffEditor${variantClassNames}`, {}, [\n\t\t\tthis._scrollView.domNode,\n\t\t\th('div.placeholder@placeholder', {}, [h('div')]),\n\t\t]);\n\t\tthis.activeControl = derived(this, reader => {\n\t\t\tconst activeDiffItem = this._viewModel.read(reader)?.activeDiffItem.read(reader);\n\t\t\tif (!activeDiffItem) { return undefined; }\n\t\t\tconst viewItem = this._viewItemsInfo.read(reader).getItem(activeDiffItem);\n\t\t\treturn viewItem.template.read(reader)?.editor;\n\t\t});\n\t\tthis._contextKeyService = this._register(this._parentContextKeyService.createScoped(this._element));\n\t\tthis._instantiationService = this._register(this._parentInstantiationService.createChild(\n\t\t\tnew ServiceCollection([IContextKeyService, this._contextKeyService])\n\t\t));\n\n\t\tthis._contextKeyService.createKey(EditorContextKeys.inMultiDiffEditor.key, true);\n\t\tthis._register(bindContextKey(EditorContextKeys.diffEditorAutomaticRenderSideBySide, this._contextKeyService, reader =>\n\t\t\tthis.activeControl.read(reader)?.renderSideBySideInAutomaticMode.read(reader) ?? true));\n\t\tthis._register(bindContextKey(EditorContextKeys.diffEditorTemporaryInlineMode, this._contextKeyService, reader =>\n\t\t\tthis.activeControl.read(reader)?.temporaryInlineMode.read(reader) ?? false));\n\n\t\tthis._lastDocStates = {};\n\n\t\tthis._register(autorunWithStore((reader, store) => {\n\t\t\tconst viewModel = this._viewModel.read(reader);\n\t\t\tif (viewModel && viewModel.contextKeys) {\n\t\t\t\tfor (const [key, value] of Object.entries(viewModel.contextKeys)) {\n\t\t\t\t\tconst contextKey = this._contextKeyService.createKey<ContextKeyValue>(key, undefined);\n\t\t\t\t\tcontextKey.set(value);\n\t\t\t\t\tstore.add(toDisposable(() => contextKey.reset()));\n\t\t\t\t}\n\t\t\t}\n\t\t}));\n\n\t\tconst ctxAllCollapsed = this._parentContextKeyService.createKey<boolean>(EditorContextKeys.multiDiffEditorAllCollapsed.key, false);\n\t\tthis._register(autorun((reader) => {\n\t\t\tconst viewModel = this._viewModel.read(reader);\n\t\t\tif (viewModel) {\n\t\t\t\tconst allCollapsed = viewModel.items.read(reader).every(item => item.collapsed.read(reader));\n\t\t\t\tctxAllCollapsed.set(allCollapsed);\n\t\t\t}\n\t\t}));\n\n\t\tconst ctxRenderSideBySide = this._parentContextKeyService.createKey<boolean>(EditorContextKeys.multiDiffEditorRenderSideBySide.key, true);\n\t\tthis._register(autorun((reader) => {\n\t\t\tconst renderSideBySide = this._diffLayoutOptions.read(reader)?.renderSideBySide;\n\t\t\tif (renderSideBySide !== undefined) {\n\t\t\t\tctxRenderSideBySide.set(renderSideBySide);\n\t\t\t}\n\t\t}));\n\n\t\tthis._logger.logStateChanges({\n\t\t\tviewModel: this._viewModel,\n\t\t\titems: this._viewItems,\n\t\t\tspaceBetweenPx: this._spaceBetweenPx.get(),\n\t\t\tgetScrollTop: () => this._scrollView.getScrollPosition().scrollTop,\n\t\t\tisPreserveFocusOnLoad: () => this._preserveFocusOnLoad,\n\t\t});\n\n\t\tconst placeholderMessage = derived(reader => {\n\t\t\tconst items = this._viewItems.read(reader);\n\t\t\tif (items.length > 0) { return undefined; }\n\n\t\t\tconst vm = this._viewModel.read(reader);\n\t\t\treturn (!vm || vm.isLoading.read(reader))\n\t\t\t\t? localize('loading', 'Loading...')\n\t\t\t\t: localize('noChangedFiles', 'No Changed Files');\n\t\t});\n\n\t\tthis._register(autorun((reader) => {\n\t\t\tconst message = placeholderMessage.read(reader);\n\t\t\tthis._elements.placeholder.innerText = message ?? '';\n\t\t\tthis._elements.placeholder.classList.toggle('visible', !!message);\n\t\t}));\n\n\t\tthis._register(autorun(reader => {\n\t\t\tthis._scrollView.scrollDimensions.read(reader);\n\t\t\t// A restored scroll offset applied before the model updated these\n\t\t\t// dimensions would be clamped against a stale (often 0) scrollHeight, so\n\t\t\t// apply it here once the dimensions are known.\n\t\t\tthis._applyPendingScrollState();\n\t\t}));\n\n\t\t_element.replaceChildren(this._elements.root);\n\t\tthis._register(toDisposable(() => {\n\t\t\t_element.replaceChildren();\n\t\t}));\n\n\t\t// Automatically select the first change in the first file when items are loaded\n\t\tthis._register(autorun(reader => {\n\t\t\t/** @description Initialize first change */\n\t\t\tconst viewModel = this._viewModel.read(reader);\n\t\t\tif (!viewModel) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Only initialize when loading is complete\n\t\t\tif (!viewModel.isLoading.read(reader)) {\n\t\t\t\tconst items = viewModel.items.read(reader);\n\t\t\t\tif (items.length === 0) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Only initialize if there's no active item yet\n\t\t\t\tconst activeDiffItem = viewModel.activeDiffItem.read(reader);\n\t\t\t\tif (activeDiffItem) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Restore the persisted active item instead of selecting the first\n\t\t\t\t// change, so the restored scroll/collapsed state is preserved.\n\t\t\t\tif (this._restorePendingActiveDiffItem(viewModel, items)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tthis._logger.log('no active diff item after loading, selecting first change', { items: items.length });\n\n\t\t\t\t// Navigate to the first change using the existing navigation\n\t\t\t\t// logic. Whether this also moves keyboard focus into the editor\n\t\t\t\t// is driven by the last `setViewModel` call: an editor opened\n\t\t\t\t// with `preserveFocus` (e.g. restored in the background or on a\n\t\t\t\t// session switch) must not steal focus from wherever the user is\n\t\t\t\t// (such as the chat input), while a normal user-initiated open\n\t\t\t\t// focuses the first change so the editor is ready to use.\n\t\t\t\tthis._navigateToChange('next', !this._preserveFocusOnLoad);\n\t\t\t}\n\t\t}));\n\n\t}\n\n\tpublic setScrollState(scrollState: { top?: number; left?: number }): void {\n\t\tthis._pendingScrollState = scrollState;\n\t\tthis._hasAppliedPendingScrollState = false;\n\t\tthis._lastPendingScrollDimensions = undefined;\n\t\tthis._applyPendingScrollState();\n\t}\n\n\t/**\n\t * Retries a restored scroll offset as dimensions change until it lands.\n\t * Navigation away from the clamped offset with unchanged dimensions cancels restoration.\n\t */\n\tprivate _applyPendingScrollState(): void {\n\t\tconst pending = this._pendingScrollState;\n\t\tif (!pending) {\n\t\t\treturn;\n\t\t}\n\t\tconst dimensions = this._scrollView.scrollDimensions.get();\n\t\tconst current = this._scrollView.getScrollPosition();\n\t\tconst expectedTop = pending.top === undefined ? current.scrollTop : Math.min(Math.max(0, pending.top), Math.max(0, dimensions.scrollHeight - dimensions.height));\n\t\tconst expectedLeft = pending.left === undefined ? current.scrollLeft : Math.min(Math.max(0, pending.left), Math.max(0, dimensions.scrollWidth - dimensions.width));\n\t\tconst previousDimensions = this._lastPendingScrollDimensions;\n\t\tconst dimensionsChanged = !previousDimensions\n\t\t\t|| previousDimensions.width !== dimensions.width\n\t\t\t|| previousDimensions.height !== dimensions.height\n\t\t\t|| previousDimensions.scrollWidth !== dimensions.scrollWidth\n\t\t\t|| previousDimensions.scrollHeight !== dimensions.scrollHeight;\n\t\tif (this._hasAppliedPendingScrollState && !dimensionsChanged && (current.scrollTop !== expectedTop || current.scrollLeft !== expectedLeft)) {\n\t\t\tthis._pendingScrollState = undefined;\n\t\t\tthis._hasAppliedPendingScrollState = false;\n\t\t\tthis._lastPendingScrollDimensions = undefined;\n\t\t\treturn;\n\t\t}\n\t\tthis._scrollView.setScrollPosition({ scrollLeft: pending.left, scrollTop: pending.top });\n\t\tconst applied = this._scrollView.getScrollPosition();\n\t\tconst topLanded = pending.top === undefined || applied.scrollTop >= pending.top;\n\t\tconst leftLanded = pending.left === undefined || applied.scrollLeft >= pending.left;\n\t\tif (topLanded && leftLanded) {\n\t\t\tthis._pendingScrollState = undefined;\n\t\t\tthis._hasAppliedPendingScrollState = false;\n\t\t\tthis._lastPendingScrollDimensions = undefined;\n\t\t} else {\n\t\t\tthis._hasAppliedPendingScrollState = true;\n\t\t\tthis._lastPendingScrollDimensions = dimensions;\n\t\t}\n\t\tthis._logger.log('applied pending scroll state', {\n\t\t\trequested: pending,\n\t\t\tapplied: { top: applied.scrollTop, left: applied.scrollLeft },\n\t\t\tlanded: topLanded && leftLanded,\n\t\t});\n\t}\n\n\t/**\n\t * Controls whether the automatic first-change selection that runs once the\n\t * view model finishes loading preserves focus instead of moving it into the\n\t * editor. Set to `true` for `preserveFocus` opens so focus is not stolen\n\t * from elsewhere.\n\t */\n\tpublic setPreserveFocusOnLoad(preserveFocus: boolean): void {\n\t\tthis._preserveFocusOnLoad = preserveFocus;\n\t}\n\n\tpublic reveal(resource: IMultiDiffResourceId, options?: RevealOptions): void {\n\t\tconst viewItems = this._viewItems.get();\n\t\tconst index = viewItems.findIndex(\n\t\t\t(item) => item.viewModel.originalUri?.toString() === resource.original?.toString()\n\t\t\t\t&& item.viewModel.modifiedUri?.toString() === resource.modified?.toString()\n\t\t);\n\t\tif (index === -1) {\n\t\t\tthrow new BugIndicatingError('Resource not found in diff editor');\n\t\t}\n\t\tconst viewItem = viewItems[index];\n\t\tthis._viewModel.get()!.activeDiffItem.setCache(viewItem.viewModel, undefined);\n\n\t\tlet scrollTop = 0;\n\t\tfor (let i = 0; i < index; i++) {\n\t\t\tscrollTop += viewItems[i].contentHeight.get() + this._spaceBetweenPx.get();\n\t\t}\n\t\tthis._logger.log('reveal', {\n\t\t\tfile: viewItem.getLabel(),\n\t\t\tindex,\n\t\t\tscrollTop: `${this._scrollView.getScrollPosition().scrollTop} -> ${scrollTop}`,\n\t\t\trange: options?.range,\n\t\t});\n\t\tthis._scrollView.setLogicalScrollPosition(scrollTop);\n\n\t\tconst diffEditor = viewItem.template.get()?.editor;\n\t\tconst editor = 'original' in resource ? diffEditor?.getOriginalEditor() : diffEditor?.getModifiedEditor();\n\t\tif (editor && options?.range) {\n\t\t\teditor.revealRangeInCenter(options.range);\n\t\t\thighlightRange(editor, options.range);\n\t\t}\n\t}\n\n\tpublic getViewState(): IMultiDiffEditorViewState {\n\t\tconst viewState: IMultiDiffEditorViewState = {\n\t\t\tscrollState: {\n\t\t\t\ttop: this.scrollTop.get(),\n\t\t\t\tleft: this.scrollLeft.get(),\n\t\t\t},\n\t\t\tdocStates: Object.fromEntries(this._viewItems.get().map(i => [i.getKey(), i.getViewState()])),\n\t\t\tactiveDiffItemKey: this._viewModel.get()?.activeDiffItem.get()?.getKey(),\n\t\t};\n\t\tif (this._logger.isEnabled) {\n\t\t\tconst docStates = Object.values(viewState.docStates ?? {});\n\t\t\tthis._logger.log('get view state', {\n\t\t\t\tscrollTop: viewState.scrollState.top,\n\t\t\t\tscrollLeft: viewState.scrollState.left,\n\t\t\t\tdocStates: docStates.length,\n\t\t\t\tcollapsed: docStates.filter(s => s.collapsed).length,\n\t\t\t\tactiveDiffItem: formatDiffItemKey(viewState.activeDiffItemKey),\n\t\t\t});\n\t\t}\n\t\treturn viewState;\n\t}\n\n\t/** This accounts for documents that are not loaded yet. */\n\tprivate _lastDocStates: IMultiDiffEditorViewState['docStates'];\n\n\t/**\n\t * The active diff item to restore once the documents are loaded. Restoring it\n\t * suppresses the automatic first-change navigation (which would expand the\n\t * first file and reset scroll), so the restored state wins. Consumed once.\n\t */\n\tprivate _lastActiveDiffItemKey: string | undefined;\n\n\t/** A restored scroll offset waiting for the scrollable dimensions to be known. */\n\tprivate _pendingScrollState: { top?: number; left?: number } | undefined;\n\tprivate _hasAppliedPendingScrollState = false;\n\tprivate _lastPendingScrollDimensions: { readonly width: number; readonly height: number; readonly scrollWidth: number; readonly scrollHeight: number } | undefined;\n\n\tpublic setViewState(viewState: IMultiDiffEditorViewState, tx?: ITransaction): void {\n\t\tif (this._logger.isEnabled) {\n\t\t\tconst docStates = Object.values(viewState.docStates ?? {});\n\t\t\tthis._logger.log('set view state', {\n\t\t\t\tscrollTop: viewState.scrollState.top,\n\t\t\t\tscrollLeft: viewState.scrollState.left,\n\t\t\t\tdocStates: docStates.length,\n\t\t\t\tcollapsed: docStates.filter(s => s.collapsed).length,\n\t\t\t\tactiveDiffItem: formatDiffItemKey(viewState.activeDiffItemKey),\n\t\t\t\tviewItems: this._viewItems.get().length,\n\t\t\t});\n\t\t}\n\t\tthis.setScrollState(viewState.scrollState);\n\n\t\tthis._lastDocStates = viewState.docStates;\n\t\tthis._lastActiveDiffItemKey = viewState.activeDiffItemKey;\n\n\t\tconst applyDocStates = (tx: ITransaction) => {\n\t\t\tif (viewState.docStates) {\n\t\t\t\tfor (const i of this._viewItems.get()) {\n\t\t\t\t\tconst state = viewState.docStates[i.getKey()];\n\t\t\t\t\tif (state) {\n\t\t\t\t\t\ti.setViewState(state, tx);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tif (tx) {\n\t\t\tapplyDocStates(tx);\n\t\t} else {\n\t\t\ttransaction(applyDocStates);\n\t\t}\n\n\t\t// If the documents are already loaded, restore the active item now (this\n\t\t// overrides the first-change selection the init autorun may have made);\n\t\t// otherwise the init autorun restores it once loading completes.\n\t\tconst viewModel = this._viewModel.get();\n\t\tif (viewModel) {\n\t\t\tthis._restorePendingActiveDiffItem(viewModel, viewModel.items.get());\n\t\t}\n\t}\n\n\t/**\n\t * Restores the persisted active diff item (if any) onto the view model, so the\n\t * automatic first-change navigation is skipped. On an explicit (non-preserve-focus)\n\t * open it also moves focus into the restored item's editor, mirroring the\n\t * first-change navigation it replaces. Returns whether it was applied.\n\t */\n\tprivate _restorePendingActiveDiffItem(viewModel: MultiDiffEditorViewModel, items: readonly DocumentDiffItemViewModel[]): boolean {\n\t\tconst key = this._lastActiveDiffItemKey;\n\t\tif (key === undefined || items.length === 0) {\n\t\t\treturn false;\n\t\t}\n\t\tthis._lastActiveDiffItemKey = undefined;\n\t\tconst target = items.find(i => i.getKey() === key);\n\t\tif (!target) {\n\t\t\tif (this._logger.isEnabled) {\n\t\t\t\tthis._logger.log('persisted active diff item not found', {\n\t\t\t\t\tkey: formatDiffItemKey(key),\n\t\t\t\t\tavailableKeys: items.map(i => formatDiffItemKey(i.getKey())),\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t\tthis._logger.log('restored active diff item', { file: target.modifiedUri ?? target.originalUri, preserveFocus: this._preserveFocusOnLoad });\n\t\tviewModel.activeDiffItem.setCache(target, undefined);\n\n\t\tif (!this._preserveFocusOnLoad) {\n\t\t\tthis._viewItemsInfo.get().getItem(target).binding.get()?.focus();\n\t\t}\n\t\treturn true;\n\t}\n\n\tprivate _navigateToChange(direction: 'next' | 'previous', focusEditor: boolean = true): void {\n\t\tconst viewItems = this._viewItems.get();\n\t\tif (viewItems.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst activeViewModel = this._viewModel.get()?.activeDiffItem.get();\n\t\tconst currentIndex = activeViewModel ? viewItems.findIndex(v => v.viewModel === activeViewModel) : -1;\n\n\t\tthis._logger.log('navigate to change', { direction, focusEditor, currentIndex, items: viewItems.length });\n\n\t\t// Start with first file if no active item\n\t\tif (currentIndex === -1) {\n\t\t\tthis._goToFile(0, 'first', focusEditor);\n\t\t\treturn;\n\t\t}\n\n\t\t// Try current file first - expand if collapsed\n\t\tconst currentItem = viewItems[currentIndex];\n\t\tif (currentItem.viewModel.collapsed.get()) {\n\t\t\tthis._logger.log('expanding collapsed item to navigate within it', { file: currentItem.getLabel() });\n\t\t\tcurrentItem.viewModel.collapsed.set(false, undefined);\n\t\t}\n\n\t\tconst editor = currentItem.template.get()?.editor;\n\t\tif (editor?.getDiffComputationResult()?.changes2?.length) {\n\t\t\tconst pos = editor.getModifiedEditor().getPosition()?.lineNumber || 1;\n\t\t\tconst changes = editor.getDiffComputationResult()!.changes2!;\n\t\t\tconst hasNext = direction === 'next' ? changes.some(c => c.modified.startLineNumber > pos) : changes.some(c => c.modified.endLineNumberExclusive <= pos);\n\n\t\t\tif (hasNext) {\n\t\t\t\teditor.goToDiff(direction);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// Move to next/previous file\n\t\tconst nextIndex = (currentIndex + (direction === 'next' ? 1 : -1) + viewItems.length) % viewItems.length;\n\t\tthis._goToFile(nextIndex, direction === 'next' ? 'first' : 'last', focusEditor);\n\t}\n\n\tprivate _goToFile(index: number, position: 'first' | 'last', focusEditor: boolean = true): void {\n\t\tconst item = this._viewItems.get()[index];\n\t\tconst wasCollapsed = item.viewModel.collapsed.get();\n\t\tthis._logger.log('go to file', { file: item.getLabel(), index, position, focusEditor, wasCollapsed });\n\t\tif (wasCollapsed) {\n\t\t\titem.viewModel.collapsed.set(false, undefined);\n\t\t}\n\n\t\tthis.reveal({ original: item.viewModel.originalUri, modified: item.viewModel.modifiedUri });\n\n\t\tconst editor = item.template.get()?.editor;\n\t\tif (editor?.getDiffComputationResult()?.changes2?.length) {\n\t\t\tif (position === 'first') {\n\t\t\t\teditor.revealFirstDiff();\n\t\t\t} else {\n\t\t\t\tconst lastChange = editor.getDiffComputationResult()!.changes2!.at(-1)!;\n\t\t\t\tconst modifiedEditor = editor.getModifiedEditor();\n\t\t\t\tmodifiedEditor.setPosition({ lineNumber: lastChange.modified.startLineNumber, column: 1 });\n\t\t\t\tmodifiedEditor.revealLineInCenter(lastChange.modified.startLineNumber);\n\t\t\t}\n\t\t}\n\t\tif (focusEditor) {\n\t\t\titem.binding.get()?.focus();\n\t\t}\n\t}\n\n}\n\nfunction highlightRange(targetEditor: ICodeEditor, range: IRange) {\n\tconst modelNow = targetEditor.getModel();\n\tconst decorations = targetEditor.createDecorationsCollection([{ range, options: { description: 'symbol-navigate-action-highlight', className: 'symbolHighlight' } }]);\n\tsetTimeout(() => {\n\t\tif (targetEditor.getModel() === modelNow) {\n\t\t\tdecorations.clear();\n\t\t}\n\t}, 350);\n}\n\nexport interface IMultiDiffEditorViewState {\n\tscrollState: { top: number; left: number };\n\tdocStates?: Record<string, IMultiDiffDocState>;\n\t/** Key ({@link DocumentDiffItemViewModel.getKey}) of the active diff item, if any. */\n\tactiveDiffItemKey?: string;\n}\n\ninterface IMultiDiffDocState {\n\tcollapsed: boolean;\n\tselections?: ISelection[];\n}\n\nexport interface IMultiDiffEditorLayoutDebugState {\n}\n\ninterface IMultiDiffEditorItemLayoutDebugState {\n\treadonly key: string;\n\treadonly label: string;\n\treadonly originalUri: string | null;\n\treadonly modifiedUri: string | null;\n\treadonly collapsed: boolean;\n\treadonly hasTemplate: boolean;\n\treadonly verticalState: {\n\t\treadonly contentHeight: number;\n\t\treadonly itemViewportOffset: number;\n\t};\n\treadonly maxScroll: number;\n\treadonly layout: {\n\t\treadonly contentRange: ISerializedOffsetRange;\n\t\treadonly renderedRange: ISerializedOffsetRange;\n\t\treadonly maxScrollOffset: number;\n\t\treadonly scrollOffset: number;\n\t\treadonly visibility: 'before' | 'visible' | 'after';\n\t};\n}\n\ninterface ISerializedOffsetRange {\n\treadonly start: number;\n\treadonly endExclusive: number;\n}\n\nfunction serializeOffsetRange(range: OffsetRange): ISerializedOffsetRange {\n\treturn { start: range.start, endExclusive: range.endExclusive };\n}\n\nclass VirtualizedViewItem extends Disposable implements ILoggedDiffItem, ICompressedVirtualizedScrollItem {\n\tpublic readonly size;\n\tpublic readonly contentHeight;\n\tpublic readonly maxScroll;\n\tpublic readonly template;\n\tpublic readonly binding;\n\tpublic readonly viewModel;\n\n\tpublic get collapsed(): IObservable<boolean> { return this.viewModel.collapsed; }\n\n\tpublic getLayoutDebugState(reader: IReader, layout: ICompressedVirtualizedScrollLayout['items'][number]): IMultiDiffEditorItemLayoutDebugState {\n\t\tconst binding = this.binding.read(reader);\n\t\treturn {\n\t\t\tkey: this.getKey(),\n\t\t\tlabel: this.getLabel(),\n\t\t\toriginalUri: this.viewModel.originalUri?.toString() ?? null,\n\t\t\tmodifiedUri: this.viewModel.modifiedUri?.toString() ?? null,\n\t\t\tcollapsed: this.collapsed.read(reader),\n\t\t\thasTemplate: binding !== undefined,\n\t\t\tverticalState: {\n\t\t\t\tcontentHeight: this.size.read(reader),\n\t\t\t\titemViewportOffset: layout.scrollOffset,\n\t\t\t},\n\t\t\tmaxScroll: this.maxScroll.read(reader).maxScroll,\n\t\t\tlayout: {\n\t\t\t\tcontentRange: serializeOffsetRange(layout.contentRange),\n\t\t\t\trenderedRange: serializeOffsetRange(layout.renderedRange),\n\t\t\t\tmaxScrollOffset: layout.maxScrollOffset,\n\t\t\t\tscrollOffset: layout.scrollOffset,\n\t\t\t\tvisibility: layout.visibility,\n\t\t\t},\n\t\t};\n\t}\n\n\tprivate readonly _isFocused;\n\n\tconstructor(\n\t\tprivate readonly _managedItem: ManagedVirtualizedItem<DocumentDiffItemViewModel, DiffEditorItemBinding, DiffEditorItemTemplate>,\n\t\tprivate readonly _scrollLeft: IObservable<number>,\n\t\tprivate readonly _logger: MultiDiffEditorLogger,\n\t) {\n\t\tsuper();\n\t\tthis.size = _managedItem.size;\n\t\tthis.contentHeight = this.size;\n\t\tthis.maxScroll = _managedItem.maxScroll;\n\t\tthis.template = _managedItem.template;\n\t\tthis.binding = _managedItem.binding;\n\t\tthis.viewModel = _managedItem.item;\n\t\tthis._isFocused = derived(this, reader => this.template.read(reader)?.isFocused.read(reader) ?? false);\n\n\t\tthis.viewModel.setIsFocused(this._isFocused, undefined);\n\n\t\tthis._register(autorun((reader) => {\n\t\t\tconst scrollLeft = this._scrollLeft.read(reader);\n\t\t\tthis.binding.read(reader)?.setScrollLeft(scrollLeft);\n\t\t}));\n\t}\n\n\tpublic override toString(): string {\n\t\treturn `VirtualViewItem(${this.viewModel.modifiedUri?.toString() ?? this.viewModel.originalUri?.toString()})`;\n\t}\n\n\tpublic getKey(): string {\n\t\treturn this.viewModel.getKey();\n\t}\n\n\t/** Short, log friendly name of this item. */\n\tpublic getLabel(): string {\n\t\treturn formatUri(this.viewModel.modifiedUri ?? this.viewModel.originalUri);\n\t}\n\n\tpublic getViewState(): IMultiDiffDocState {\n\t\ttransaction(tx => {\n\t\t\tthis._updateTemplateData(tx);\n\t\t});\n\t\treturn {\n\t\t\tcollapsed: this.viewModel.collapsed.get(),\n\t\t\tselections: this.viewModel.lastTemplateData.get().selections,\n\t\t};\n\t}\n\n\tpublic setViewState(viewState: IMultiDiffDocState, tx: ITransaction): void {\n\t\tthis._logger.log('item view state restored', { file: this.getLabel(), collapsed: viewState.collapsed, selections: viewState.selections?.length ?? 0 });\n\t\tthis.viewModel.collapsed.set(viewState.collapsed, tx);\n\n\t\tthis._updateTemplateData(tx);\n\t\tconst data = this.viewModel.lastTemplateData.get();\n\t\tconst selections = viewState.selections?.map(Selection.liftSelection);\n\t\tthis.viewModel.lastTemplateData.set({\n\t\t\t...data,\n\t\t\tselections,\n\t\t}, tx);\n\t\tconst binding = this.binding.get();\n\t\tif (binding && selections) {\n\t\t\tbinding.editor.setSelections(selections);\n\t\t}\n\t}\n\n\tprivate _updateTemplateData(tx: ITransaction): void {\n\t\tconst binding = this.binding.get();\n\t\tif (!binding) { return; }\n\t\tthis.viewModel.lastTemplateData.set({\n\t\t\texpandedContentHeight: binding.getExpandedContentHeight(),\n\t\t\tselections: binding.editor.getSelections() ?? undefined,\n\t\t}, tx);\n\t}\n\n\tpublic hide(): void {\n\t\tthis._managedItem.hide();\n\t}\n\n\tpublic render(verticalSpace: OffsetRange, offset: number, width: number, viewPort: OffsetRange, context: ICompressedVirtualizedScrollItemContext): void {\n\t\tthis._managedItem.render(verticalSpace, offset, width, viewPort, context);\n\t}\n}\n"]}
@@ -38,6 +38,7 @@ export class VirtualizedItemTemplate extends Disposable {
38
38
  if (this._currentBinding.get() !== binding) {
39
39
  throw new BugIndicatingError('Disposed binding does not own its virtualized template');
40
40
  }
41
+ this._bindingStore.clear();
41
42
  this._currentBinding.set(undefined, undefined);
42
43
  }));
43
44
  this._currentBinding.set(binding, undefined);
@@ -1 +1 @@
1
- {"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/browser/widget/multiDiffEditor/virtualizedItemManager.ts","vs/editor/browser/widget/multiDiffEditor/virtualizedItemManager.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAC1F,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,eAAe,EAA2B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QAAQ,EAAE,CAAC;oBACd,OAAO;gBACR,CAAC;gBACD,QAAQ,GAAG,IAAI,CAAC;gBAChB,IAAI,QAAQ,CAAC,cAAc,CAAC,GAAG,EAAE,EAAE,CAAC;oBACnC,MAAM,IAAI,kBAAkB,CAAC,2DAA2D,CAAC,CAAC;gBAC3F,CAAC;gBACD,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;gBAC5B,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,EAAE,CAAC;oBAC5B,QAAQ,CAAC,OAAO,EAAE,CAAC;gBACpB,CAAC;qBAAM,CAAC;oBACP,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;gBAC5B,CAAC;YACF,CAAC;SACD,CAAC;IACH,CAAC;IAED,OAAO;QACN,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACnC,QAAQ,CAAC,OAAO,EAAE,CAAC;QACpB,CAAC;QACD,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACrC,QAAQ,CAAC,OAAO,EAAE,CAAC;QACpB,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACnB,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;CACD","file":"virtualizedItemManager.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { BugIndicatingError, onUnexpectedError } from '../../../../base/common/errors.js';\nimport { Emitter, Event } from '../../../../base/common/event.js';\nimport { Disposable, DisposableStore, IDisposable, IReference, toDisposable } from '../../../../base/common/lifecycle.js';\nimport { autorun, derived, IObservable, ITransaction, mapObservableArrayCached, observableValue, transaction } from '../../../../base/common/observable.js';\nimport { OffsetRange } from '../../../common/core/ranges/offsetRange.js';\nimport { ICompressedVirtualizedScrollItem, ICompressedVirtualizedScrollItemContext, ICompressedVirtualizedScrollViewContext } from './compressedVirtualizedScrollView.js';\n\nexport interface IVirtualizedItemBindingContext {\n\treadonly initialSize: number;\n\trunWithScrollAnchor(getItemOffset: () => number, update: (tx: ITransaction) => void): void;\n}\n\nexport interface IVirtualizedItemBinding<TItem> extends IDisposable {\n\treadonly item: TItem;\n\treadonly size: IObservable<number>;\n\treadonly maxScroll: IObservable<{ readonly maxScroll: number }>;\n\treadonly shouldKeepAlive: IObservable<boolean>;\n\treadonly onDidDispose: Event<void>;\n\trender(renderedRange: OffsetRange, scrollOffset: number, width: number, renderedViewport: OffsetRange): void;\n\thide(): void;\n}\n\nexport abstract class VirtualizedItemBinding<TItem> extends Disposable implements IVirtualizedItemBinding<TItem> {\n\tprivate readonly _onDidDispose = this._register(new Emitter<void>());\n\treadonly onDidDispose = this._onDidDispose.event;\n\tabstract readonly size: IObservable<number>;\n\tabstract readonly maxScroll: IObservable<{ readonly maxScroll: number }>;\n\tabstract readonly shouldKeepAlive: IObservable<boolean>;\n\n\tconstructor(readonly item: TItem) {\n\t\tsuper();\n\t}\n\n\tabstract render(renderedRange: OffsetRange, scrollOffset: number, width: number, renderedViewport: OffsetRange): void;\n\tabstract hide(): void;\n\n\toverride dispose(): void {\n\t\tif (this._store.isDisposed) {\n\t\t\treturn;\n\t\t}\n\t\tthis._onDidDispose.fire();\n\t\tsuper.dispose();\n\t}\n}\n\nexport interface IVirtualizedItemTemplate<TItem, TBinding extends IVirtualizedItemBinding<TItem>> extends IDisposable {\n\treadonly currentBinding: IObservable<TBinding | undefined>;\n\tbind(item: TItem, context: IVirtualizedItemBindingContext): TBinding;\n}\n\nexport abstract class VirtualizedItemTemplate<TItem, TBinding extends IVirtualizedItemBinding<TItem>> extends Disposable implements IVirtualizedItemTemplate<TItem, TBinding> {\n\tprivate readonly _currentBinding = observableValue<TBinding | undefined>(this, undefined);\n\treadonly currentBinding: IObservable<TBinding | undefined> = this._currentBinding;\n\tprivate readonly _bindingStore = this._register(new DisposableStore());\n\n\tbind(item: TItem, context: IVirtualizedItemBindingContext): TBinding {\n\t\tif (this._currentBinding.get()) {\n\t\t\tthrow new BugIndicatingError('Cannot rebind a virtualized template before disposing its current binding');\n\t\t}\n\t\tconst binding = this.createBinding(item, context);\n\t\tthis._bindingStore.clear();\n\t\tthis._bindingStore.add(Event.once(binding.onDidDispose)(() => {\n\t\t\tif (this._currentBinding.get() !== binding) {\n\t\t\t\tthrow new BugIndicatingError('Disposed binding does not own its virtualized template');\n\t\t\t}\n\t\t\tthis._currentBinding.set(undefined, undefined);\n\t\t}));\n\t\tthis._currentBinding.set(binding, undefined);\n\t\treturn binding;\n\t}\n\n\tprotected abstract createBinding(item: TItem, context: IVirtualizedItemBindingContext): TBinding;\n\n\toverride dispose(): void {\n\t\tthis._currentBinding.get()?.dispose();\n\t\tsuper.dispose();\n\t}\n}\n\nexport interface IVirtualizedItemDelegate<TItem, TBinding extends IVirtualizedItemBinding<TItem>, TTemplate extends IVirtualizedItemTemplate<TItem, TBinding>> {\n\tgetId(item: TItem): unknown;\n\tgetTemplateId(item: TItem): string;\n\tgetUnboundSize(item: TItem): IObservable<number>;\n\tcreateTemplate(templateId: string, context: ICompressedVirtualizedScrollViewContext): TTemplate;\n\tonDidBind?(binding: TBinding, tx: ITransaction): void;\n\tonWillUnbind?(binding: TBinding, tx: ITransaction): void;\n}\n\nexport class VirtualizedItemManager<TItem, TBinding extends IVirtualizedItemBinding<TItem>, TTemplate extends IVirtualizedItemTemplate<TItem, TBinding>> extends Disposable {\n\tprivate readonly _pools = new Map<string, VirtualizedTemplatePool<TItem, TBinding, TTemplate>>();\n\treadonly virtualizedItems: IObservable<readonly ManagedVirtualizedItem<TItem, TBinding, TTemplate>[]>;\n\n\tconstructor(\n\t\titems: IObservable<readonly TItem[]>,\n\t\tprivate readonly _context: ICompressedVirtualizedScrollViewContext,\n\t\tprivate readonly _delegate: IVirtualizedItemDelegate<TItem, TBinding, TTemplate>,\n\t) {\n\t\tsuper();\n\t\tthis.virtualizedItems = mapObservableArrayCached(\n\t\t\tthis,\n\t\t\titems,\n\t\t\t(item, store) => store.add(new ManagedVirtualizedItem(item, this, _delegate)),\n\t\t\titem => _delegate.getId(item),\n\t\t).recomputeInitiallyAndOnChange(this._store);\n\t\tthis._register(toDisposable(() => {\n\t\t\tfor (const pool of this._pools.values()) {\n\t\t\t\tpool.dispose();\n\t\t\t}\n\t\t\tthis._pools.clear();\n\t\t}));\n\t}\n\n\tacquire(item: TItem): IReference<TTemplate> {\n\t\tconst templateId = this._delegate.getTemplateId(item);\n\t\tlet pool = this._pools.get(templateId);\n\t\tif (!pool) {\n\t\t\tpool = new VirtualizedTemplatePool(() => this._delegate.createTemplate(templateId, this._context));\n\t\t\tthis._pools.set(templateId, pool);\n\t\t}\n\t\treturn pool.acquire();\n\t}\n\n}\n\nexport class ManagedVirtualizedItem<TItem, TBinding extends IVirtualizedItemBinding<TItem>, TTemplate extends IVirtualizedItemTemplate<TItem, TBinding>> extends Disposable implements ICompressedVirtualizedScrollItem {\n\tprivate readonly _templateReference = observableValue<IReference<TTemplate> | undefined>(this, undefined);\n\tprivate readonly _isHidden = observableValue(this, false);\n\tprivate _lastRender: { renderedRange: OffsetRange; scrollOffset: number; width: number; renderedViewport: OffsetRange; context: ICompressedVirtualizedScrollItemContext | undefined } | undefined;\n\tprivate _didRenderFail = false;\n\treadonly template = derived(this, reader => this._templateReference.read(reader)?.object);\n\treadonly binding = derived(this, reader => this.template.read(reader)?.currentBinding.read(reader));\n\treadonly size;\n\treadonly maxScroll;\n\n\tconstructor(\n\t\treadonly item: TItem,\n\t\tprivate readonly _manager: VirtualizedItemManager<TItem, TBinding, TTemplate>,\n\t\tprivate readonly _delegate: IVirtualizedItemDelegate<TItem, TBinding, TTemplate>,\n\t) {\n\t\tsuper();\n\t\tconst unboundSize = _delegate.getUnboundSize(item);\n\t\tthis.size = derived(this, reader => this.binding.read(reader)?.size.read(reader) ?? unboundSize.read(reader));\n\t\tthis.maxScroll = derived(this, reader => this.binding.read(reader)?.maxScroll.read(reader) ?? { maxScroll: 0 });\n\t\tthis._register(autorun(reader => {\n\t\t\tconst binding = this.binding.read(reader);\n\t\t\tif (!binding || !this._isHidden.read(reader) || binding.shouldKeepAlive.read(reader)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis._clearBinding();\n\t\t}));\n\t}\n\n\trender(renderedRange: OffsetRange, scrollOffset: number, width: number, renderedViewport: OffsetRange, context?: ICompressedVirtualizedScrollItemContext): void {\n\t\tthis._lastRender = { renderedRange, scrollOffset, width, renderedViewport, context };\n\t\tthis._isHidden.set(false, undefined);\n\t\tif (this._didRenderFail) {\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\tthis._render(renderedRange, scrollOffset, width, renderedViewport, context);\n\t\t} catch (error) {\n\t\t\tthis._didRenderFail = true;\n\t\t\tonUnexpectedError(error);\n\t\t}\n\t}\n\n\tprivate _render(renderedRange: OffsetRange, scrollOffset: number, width: number, renderedViewport: OffsetRange, context?: ICompressedVirtualizedScrollItemContext): void {\n\t\tlet binding = this.binding.get();\n\t\tif (!binding) {\n\t\t\tconst templateReference = this._manager.acquire(this.item);\n\t\t\tconst template = templateReference.object;\n\t\t\tif (template.currentBinding.get()) {\n\t\t\t\ttemplateReference.dispose();\n\t\t\t\tthrow new BugIndicatingError('Virtualized template pool returned a bound template');\n\t\t\t}\n\t\t\tlet newBinding: TBinding | undefined;\n\t\t\ttry {\n\t\t\t\tnewBinding = template.bind(this.item, {\n\t\t\t\t\tinitialSize: this.size.get(),\n\t\t\t\t\trunWithScrollAnchor: (getItemOffset, update) => {\n\t\t\t\t\t\tif (!context) {\n\t\t\t\t\t\t\tthrow new BugIndicatingError('Cannot preserve a virtualized item scroll anchor without a render context');\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontext.runWithScrollAnchor(getItemOffset, update);\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t\tif (newBinding.item !== this.item || template.currentBinding.get() !== newBinding) {\n\t\t\t\t\tthrow new BugIndicatingError('Virtualized template returned a binding for a different item');\n\t\t\t\t}\n\t\t\t\tconst validatedBinding = newBinding;\n\t\t\t\ttransaction(tx => {\n\t\t\t\t\tthis._delegate.onDidBind?.(validatedBinding, tx);\n\t\t\t\t\tthis._templateReference.set(templateReference, tx);\n\t\t\t\t});\n\t\t\t} catch (error) {\n\t\t\t\t(template.currentBinding.get() ?? newBinding)?.dispose();\n\t\t\t\ttemplateReference.dispose();\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tbinding = newBinding;\n\t\t}\n\t\tbinding.render(renderedRange, scrollOffset, width, renderedViewport);\n\t}\n\n\thide(): void {\n\t\tthis._isHidden.set(true, undefined);\n\t\tthis.binding.get()?.hide();\n\t}\n\n\tprivate _clearBinding(): void {\n\t\tconst templateReference = this._templateReference.get();\n\t\tconst binding = templateReference?.object.currentBinding.get();\n\t\tif (!templateReference || !binding) {\n\t\t\treturn;\n\t\t}\n\t\ttransaction(tx => {\n\t\t\tthis._delegate.onWillUnbind?.(binding, tx);\n\t\t});\n\t\tbinding.hide();\n\t\tbinding.dispose();\n\t\tif (templateReference.object.currentBinding.get()) {\n\t\t\tthrow new BugIndicatingError('Virtualized binding did not release its template when disposed');\n\t\t}\n\t\ttransaction(tx => {\n\t\t\tthis._templateReference.set(undefined, tx);\n\t\t});\n\t\ttemplateReference.dispose();\n\t}\n\n\toverride dispose(): void {\n\t\tthis._clearBinding();\n\t\tsuper.dispose();\n\t}\n}\n\nclass VirtualizedTemplatePool<TItem, TBinding extends IVirtualizedItemBinding<TItem>, TTemplate extends IVirtualizedItemTemplate<TItem, TBinding>> implements IDisposable {\n\tprivate readonly _unused = new Set<TTemplate>();\n\tprivate readonly _used = new Set<TTemplate>();\n\n\tconstructor(private readonly _create: () => TTemplate) { }\n\n\tacquire(): IReference<TTemplate> {\n\t\tconst template = this._unused.values().next().value ?? this._create();\n\t\tthis._unused.delete(template);\n\t\tif (template.currentBinding.get()) {\n\t\t\tthrow new BugIndicatingError('Cannot acquire a bound virtualized template');\n\t\t}\n\t\tthis._used.add(template);\n\t\tlet disposed = false;\n\t\treturn {\n\t\t\tobject: template,\n\t\t\tdispose: () => {\n\t\t\t\tif (disposed) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tdisposed = true;\n\t\t\t\tif (template.currentBinding.get()) {\n\t\t\t\t\tthrow new BugIndicatingError('Cannot pool a virtualized template with a current binding');\n\t\t\t\t}\n\t\t\t\tthis._used.delete(template);\n\t\t\t\tif (this._unused.size >= 5) {\n\t\t\t\t\ttemplate.dispose();\n\t\t\t\t} else {\n\t\t\t\t\tthis._unused.add(template);\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t}\n\n\tdispose(): void {\n\t\tfor (const template of this._used) {\n\t\t\ttemplate.dispose();\n\t\t}\n\t\tfor (const template of this._unused) {\n\t\t\ttemplate.dispose();\n\t\t}\n\t\tthis._used.clear();\n\t\tthis._unused.clear();\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { BugIndicatingError, onUnexpectedError } from '../../../../base/common/errors.js';\nimport { Emitter, Event } from '../../../../base/common/event.js';\nimport { Disposable, DisposableStore, IDisposable, IReference, toDisposable } from '../../../../base/common/lifecycle.js';\nimport { autorun, derived, IObservable, ITransaction, mapObservableArrayCached, observableValue, transaction } from '../../../../base/common/observable.js';\nimport { OffsetRange } from '../../../common/core/ranges/offsetRange.js';\nimport { ICompressedVirtualizedScrollItem, ICompressedVirtualizedScrollItemContext, ICompressedVirtualizedScrollViewContext } from './compressedVirtualizedScrollView.js';\n\nexport interface IVirtualizedItemBindingContext {\n\treadonly initialSize: number;\n\trunWithScrollAnchor(getItemOffset: () => number, update: (tx: ITransaction) => void): void;\n}\n\nexport interface IVirtualizedItemBinding<TItem> extends IDisposable {\n\treadonly item: TItem;\n\treadonly size: IObservable<number>;\n\treadonly maxScroll: IObservable<{ readonly maxScroll: number }>;\n\treadonly shouldKeepAlive: IObservable<boolean>;\n\treadonly onDidDispose: Event<void>;\n\trender(renderedRange: OffsetRange, scrollOffset: number, width: number, renderedViewport: OffsetRange): void;\n\thide(): void;\n}\n\nexport abstract class VirtualizedItemBinding<TItem> extends Disposable implements IVirtualizedItemBinding<TItem> {\n\tprivate readonly _onDidDispose = this._register(new Emitter<void>());\n\treadonly onDidDispose = this._onDidDispose.event;\n\tabstract readonly size: IObservable<number>;\n\tabstract readonly maxScroll: IObservable<{ readonly maxScroll: number }>;\n\tabstract readonly shouldKeepAlive: IObservable<boolean>;\n\n\tconstructor(readonly item: TItem) {\n\t\tsuper();\n\t}\n\n\tabstract render(renderedRange: OffsetRange, scrollOffset: number, width: number, renderedViewport: OffsetRange): void;\n\tabstract hide(): void;\n\n\toverride dispose(): void {\n\t\tif (this._store.isDisposed) {\n\t\t\treturn;\n\t\t}\n\t\tthis._onDidDispose.fire();\n\t\tsuper.dispose();\n\t}\n}\n\nexport interface IVirtualizedItemTemplate<TItem, TBinding extends IVirtualizedItemBinding<TItem>> extends IDisposable {\n\treadonly currentBinding: IObservable<TBinding | undefined>;\n\tbind(item: TItem, context: IVirtualizedItemBindingContext): TBinding;\n}\n\nexport abstract class VirtualizedItemTemplate<TItem, TBinding extends IVirtualizedItemBinding<TItem>> extends Disposable implements IVirtualizedItemTemplate<TItem, TBinding> {\n\tprivate readonly _currentBinding = observableValue<TBinding | undefined>(this, undefined);\n\treadonly currentBinding: IObservable<TBinding | undefined> = this._currentBinding;\n\tprivate readonly _bindingStore = this._register(new DisposableStore());\n\n\tbind(item: TItem, context: IVirtualizedItemBindingContext): TBinding {\n\t\tif (this._currentBinding.get()) {\n\t\t\tthrow new BugIndicatingError('Cannot rebind a virtualized template before disposing its current binding');\n\t\t}\n\t\tconst binding = this.createBinding(item, context);\n\t\tthis._bindingStore.clear();\n\t\tthis._bindingStore.add(Event.once(binding.onDidDispose)(() => {\n\t\t\tif (this._currentBinding.get() !== binding) {\n\t\t\t\tthrow new BugIndicatingError('Disposed binding does not own its virtualized template');\n\t\t\t}\n\t\t\tthis._currentBinding.set(undefined, undefined);\n\t\t}));\n\t\tthis._currentBinding.set(binding, undefined);\n\t\treturn binding;\n\t}\n\n\tprotected abstract createBinding(item: TItem, context: IVirtualizedItemBindingContext): TBinding;\n\n\toverride dispose(): void {\n\t\tthis._currentBinding.get()?.dispose();\n\t\tsuper.dispose();\n\t}\n}\n\nexport interface IVirtualizedItemDelegate<TItem, TBinding extends IVirtualizedItemBinding<TItem>, TTemplate extends IVirtualizedItemTemplate<TItem, TBinding>> {\n\tgetId(item: TItem): unknown;\n\tgetTemplateId(item: TItem): string;\n\tgetUnboundSize(item: TItem): IObservable<number>;\n\tcreateTemplate(templateId: string, context: ICompressedVirtualizedScrollViewContext): TTemplate;\n\tonDidBind?(binding: TBinding, tx: ITransaction): void;\n\tonWillUnbind?(binding: TBinding, tx: ITransaction): void;\n}\n\nexport class VirtualizedItemManager<TItem, TBinding extends IVirtualizedItemBinding<TItem>, TTemplate extends IVirtualizedItemTemplate<TItem, TBinding>> extends Disposable {\n\tprivate readonly _pools = new Map<string, VirtualizedTemplatePool<TItem, TBinding, TTemplate>>();\n\treadonly virtualizedItems: IObservable<readonly ManagedVirtualizedItem<TItem, TBinding, TTemplate>[]>;\n\n\tconstructor(\n\t\titems: IObservable<readonly TItem[]>,\n\t\tprivate readonly _context: ICompressedVirtualizedScrollViewContext,\n\t\tprivate readonly _delegate: IVirtualizedItemDelegate<TItem, TBinding, TTemplate>,\n\t) {\n\t\tsuper();\n\t\tthis.virtualizedItems = mapObservableArrayCached(\n\t\t\tthis,\n\t\t\titems,\n\t\t\t(item, store) => store.add(new ManagedVirtualizedItem(item, this, _delegate)),\n\t\t\titem => _delegate.getId(item),\n\t\t).recomputeInitiallyAndOnChange(this._store);\n\t\tthis._register(toDisposable(() => {\n\t\t\tfor (const pool of this._pools.values()) {\n\t\t\t\tpool.dispose();\n\t\t\t}\n\t\t\tthis._pools.clear();\n\t\t}));\n\t}\n\n\tacquire(item: TItem): IReference<TTemplate> {\n\t\tconst templateId = this._delegate.getTemplateId(item);\n\t\tlet pool = this._pools.get(templateId);\n\t\tif (!pool) {\n\t\t\tpool = new VirtualizedTemplatePool(() => this._delegate.createTemplate(templateId, this._context));\n\t\t\tthis._pools.set(templateId, pool);\n\t\t}\n\t\treturn pool.acquire();\n\t}\n\n}\n\nexport class ManagedVirtualizedItem<TItem, TBinding extends IVirtualizedItemBinding<TItem>, TTemplate extends IVirtualizedItemTemplate<TItem, TBinding>> extends Disposable implements ICompressedVirtualizedScrollItem {\n\tprivate readonly _templateReference = observableValue<IReference<TTemplate> | undefined>(this, undefined);\n\tprivate readonly _isHidden = observableValue(this, false);\n\tprivate _lastRender: { renderedRange: OffsetRange; scrollOffset: number; width: number; renderedViewport: OffsetRange; context: ICompressedVirtualizedScrollItemContext | undefined } | undefined;\n\tprivate _didRenderFail = false;\n\treadonly template = derived(this, reader => this._templateReference.read(reader)?.object);\n\treadonly binding = derived(this, reader => this.template.read(reader)?.currentBinding.read(reader));\n\treadonly size;\n\treadonly maxScroll;\n\n\tconstructor(\n\t\treadonly item: TItem,\n\t\tprivate readonly _manager: VirtualizedItemManager<TItem, TBinding, TTemplate>,\n\t\tprivate readonly _delegate: IVirtualizedItemDelegate<TItem, TBinding, TTemplate>,\n\t) {\n\t\tsuper();\n\t\tconst unboundSize = _delegate.getUnboundSize(item);\n\t\tthis.size = derived(this, reader => this.binding.read(reader)?.size.read(reader) ?? unboundSize.read(reader));\n\t\tthis.maxScroll = derived(this, reader => this.binding.read(reader)?.maxScroll.read(reader) ?? { maxScroll: 0 });\n\t\tthis._register(autorun(reader => {\n\t\t\tconst binding = this.binding.read(reader);\n\t\t\tif (!binding || !this._isHidden.read(reader) || binding.shouldKeepAlive.read(reader)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis._clearBinding();\n\t\t}));\n\t}\n\n\trender(renderedRange: OffsetRange, scrollOffset: number, width: number, renderedViewport: OffsetRange, context?: ICompressedVirtualizedScrollItemContext): void {\n\t\tthis._lastRender = { renderedRange, scrollOffset, width, renderedViewport, context };\n\t\tthis._isHidden.set(false, undefined);\n\t\tif (this._didRenderFail) {\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\tthis._render(renderedRange, scrollOffset, width, renderedViewport, context);\n\t\t} catch (error) {\n\t\t\tthis._didRenderFail = true;\n\t\t\tonUnexpectedError(error);\n\t\t}\n\t}\n\n\tprivate _render(renderedRange: OffsetRange, scrollOffset: number, width: number, renderedViewport: OffsetRange, context?: ICompressedVirtualizedScrollItemContext): void {\n\t\tlet binding = this.binding.get();\n\t\tif (!binding) {\n\t\t\tconst templateReference = this._manager.acquire(this.item);\n\t\t\tconst template = templateReference.object;\n\t\t\tif (template.currentBinding.get()) {\n\t\t\t\ttemplateReference.dispose();\n\t\t\t\tthrow new BugIndicatingError('Virtualized template pool returned a bound template');\n\t\t\t}\n\t\t\tlet newBinding: TBinding | undefined;\n\t\t\ttry {\n\t\t\t\tnewBinding = template.bind(this.item, {\n\t\t\t\t\tinitialSize: this.size.get(),\n\t\t\t\t\trunWithScrollAnchor: (getItemOffset, update) => {\n\t\t\t\t\t\tif (!context) {\n\t\t\t\t\t\t\tthrow new BugIndicatingError('Cannot preserve a virtualized item scroll anchor without a render context');\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontext.runWithScrollAnchor(getItemOffset, update);\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t\tif (newBinding.item !== this.item || template.currentBinding.get() !== newBinding) {\n\t\t\t\t\tthrow new BugIndicatingError('Virtualized template returned a binding for a different item');\n\t\t\t\t}\n\t\t\t\tconst validatedBinding = newBinding;\n\t\t\t\ttransaction(tx => {\n\t\t\t\t\tthis._delegate.onDidBind?.(validatedBinding, tx);\n\t\t\t\t\tthis._templateReference.set(templateReference, tx);\n\t\t\t\t});\n\t\t\t} catch (error) {\n\t\t\t\t(template.currentBinding.get() ?? newBinding)?.dispose();\n\t\t\t\ttemplateReference.dispose();\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tbinding = newBinding;\n\t\t}\n\t\tbinding.render(renderedRange, scrollOffset, width, renderedViewport);\n\t}\n\n\thide(): void {\n\t\tthis._isHidden.set(true, undefined);\n\t\tthis.binding.get()?.hide();\n\t}\n\n\tprivate _clearBinding(): void {\n\t\tconst templateReference = this._templateReference.get();\n\t\tconst binding = templateReference?.object.currentBinding.get();\n\t\tif (!templateReference || !binding) {\n\t\t\treturn;\n\t\t}\n\t\ttransaction(tx => {\n\t\t\tthis._delegate.onWillUnbind?.(binding, tx);\n\t\t});\n\t\tbinding.hide();\n\t\tbinding.dispose();\n\t\tif (templateReference.object.currentBinding.get()) {\n\t\t\tthrow new BugIndicatingError('Virtualized binding did not release its template when disposed');\n\t\t}\n\t\ttransaction(tx => {\n\t\t\tthis._templateReference.set(undefined, tx);\n\t\t});\n\t\ttemplateReference.dispose();\n\t}\n\n\toverride dispose(): void {\n\t\tthis._clearBinding();\n\t\tsuper.dispose();\n\t}\n}\n\nclass VirtualizedTemplatePool<TItem, TBinding extends IVirtualizedItemBinding<TItem>, TTemplate extends IVirtualizedItemTemplate<TItem, TBinding>> implements IDisposable {\n\tprivate readonly _unused = new Set<TTemplate>();\n\tprivate readonly _used = new Set<TTemplate>();\n\n\tconstructor(private readonly _create: () => TTemplate) { }\n\n\tacquire(): IReference<TTemplate> {\n\t\tconst template = this._unused.values().next().value ?? this._create();\n\t\tthis._unused.delete(template);\n\t\tif (template.currentBinding.get()) {\n\t\t\tthrow new BugIndicatingError('Cannot acquire a bound virtualized template');\n\t\t}\n\t\tthis._used.add(template);\n\t\tlet disposed = false;\n\t\treturn {\n\t\t\tobject: template,\n\t\t\tdispose: () => {\n\t\t\t\tif (disposed) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tdisposed = true;\n\t\t\t\tif (template.currentBinding.get()) {\n\t\t\t\t\tthrow new BugIndicatingError('Cannot pool a virtualized template with a current binding');\n\t\t\t\t}\n\t\t\t\tthis._used.delete(template);\n\t\t\t\tif (this._unused.size >= 5) {\n\t\t\t\t\ttemplate.dispose();\n\t\t\t\t} else {\n\t\t\t\t\tthis._unused.add(template);\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t}\n\n\tdispose(): void {\n\t\tfor (const template of this._used) {\n\t\t\ttemplate.dispose();\n\t\t}\n\t\tfor (const template of this._unused) {\n\t\t\ttemplate.dispose();\n\t\t}\n\t\tthis._used.clear();\n\t\tthis._unused.clear();\n\t}\n}\n"]}
1
+ {"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/browser/widget/multiDiffEditor/virtualizedItemManager.ts","vs/editor/browser/widget/multiDiffEditor/virtualizedItemManager.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAC1F,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,eAAe,EAA2B,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAC1H,OAAO,EAAE,OAAO,EAAE,OAAO,EAA6B,wBAAwB,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAmB5J,MAAM,OAAgB,sBAA8B,SAAQ,UAAU;IAOrE,YAAqB,IAAW;QAC/B,KAAK,EAAE,CAAC;QADY,SAAI,GAAJ,IAAI,CAAO;QANf,kBAAa,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,OAAO,EAAQ,CAAC,CAAC;QAC5D,iBAAY,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;IAOjD,CAAC;IAKQ,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OAAO,EAAE,CAAC;gBACpB,CAAC;qBAAM,CAAC;oBACP,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;gBAC5B,CAAC;YACF,CAAC;SACD,CAAC;IACH,CAAC;IAED,OAAO;QACN,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACnC,QAAQ,CAAC,OAAO,EAAE,CAAC;QACpB,CAAC;QACD,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACrC,QAAQ,CAAC,OAAO,EAAE,CAAC;QACpB,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACnB,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;CACD","file":"virtualizedItemManager.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { BugIndicatingError, onUnexpectedError } from '../../../../base/common/errors.js';\nimport { Emitter, Event } from '../../../../base/common/event.js';\nimport { Disposable, DisposableStore, IDisposable, IReference, toDisposable } from '../../../../base/common/lifecycle.js';\nimport { autorun, derived, IObservable, ITransaction, mapObservableArrayCached, observableValue, transaction } from '../../../../base/common/observable.js';\nimport { OffsetRange } from '../../../common/core/ranges/offsetRange.js';\nimport { ICompressedVirtualizedScrollItem, ICompressedVirtualizedScrollItemContext, ICompressedVirtualizedScrollViewContext } from './compressedVirtualizedScrollView.js';\n\nexport interface IVirtualizedItemBindingContext {\n\treadonly initialSize: number;\n\trunWithScrollAnchor(getItemOffset: () => number, update: (tx: ITransaction) => void): void;\n}\n\nexport interface IVirtualizedItemBinding<TItem> extends IDisposable {\n\treadonly item: TItem;\n\treadonly size: IObservable<number>;\n\treadonly maxScroll: IObservable<{ readonly maxScroll: number }>;\n\treadonly shouldKeepAlive: IObservable<boolean>;\n\treadonly onDidDispose: Event<void>;\n\trender(renderedRange: OffsetRange, scrollOffset: number, width: number, renderedViewport: OffsetRange): void;\n\thide(): void;\n}\n\nexport abstract class VirtualizedItemBinding<TItem> extends Disposable implements IVirtualizedItemBinding<TItem> {\n\tprivate readonly _onDidDispose = this._register(new Emitter<void>());\n\treadonly onDidDispose = this._onDidDispose.event;\n\tabstract readonly size: IObservable<number>;\n\tabstract readonly maxScroll: IObservable<{ readonly maxScroll: number }>;\n\tabstract readonly shouldKeepAlive: IObservable<boolean>;\n\n\tconstructor(readonly item: TItem) {\n\t\tsuper();\n\t}\n\n\tabstract render(renderedRange: OffsetRange, scrollOffset: number, width: number, renderedViewport: OffsetRange): void;\n\tabstract hide(): void;\n\n\toverride dispose(): void {\n\t\tif (this._store.isDisposed) {\n\t\t\treturn;\n\t\t}\n\t\tthis._onDidDispose.fire();\n\t\tsuper.dispose();\n\t}\n}\n\nexport interface IVirtualizedItemTemplate<TItem, TBinding extends IVirtualizedItemBinding<TItem>> extends IDisposable {\n\treadonly currentBinding: IObservable<TBinding | undefined>;\n\tbind(item: TItem, context: IVirtualizedItemBindingContext): TBinding;\n}\n\nexport abstract class VirtualizedItemTemplate<TItem, TBinding extends IVirtualizedItemBinding<TItem>> extends Disposable implements IVirtualizedItemTemplate<TItem, TBinding> {\n\tprivate readonly _currentBinding = observableValue<TBinding | undefined>(this, undefined);\n\treadonly currentBinding: IObservable<TBinding | undefined> = this._currentBinding;\n\tprivate readonly _bindingStore = this._register(new DisposableStore());\n\n\tbind(item: TItem, context: IVirtualizedItemBindingContext): TBinding {\n\t\tif (this._currentBinding.get()) {\n\t\t\tthrow new BugIndicatingError('Cannot rebind a virtualized template before disposing its current binding');\n\t\t}\n\t\tconst binding = this.createBinding(item, context);\n\t\tthis._bindingStore.clear();\n\t\tthis._bindingStore.add(Event.once(binding.onDidDispose)(() => {\n\t\t\tif (this._currentBinding.get() !== binding) {\n\t\t\t\tthrow new BugIndicatingError('Disposed binding does not own its virtualized template');\n\t\t\t}\n\t\t\tthis._bindingStore.clear();\n\t\t\tthis._currentBinding.set(undefined, undefined);\n\t\t}));\n\t\tthis._currentBinding.set(binding, undefined);\n\t\treturn binding;\n\t}\n\n\tprotected abstract createBinding(item: TItem, context: IVirtualizedItemBindingContext): TBinding;\n\n\toverride dispose(): void {\n\t\tthis._currentBinding.get()?.dispose();\n\t\tsuper.dispose();\n\t}\n}\n\nexport interface IVirtualizedItemDelegate<TItem, TBinding extends IVirtualizedItemBinding<TItem>, TTemplate extends IVirtualizedItemTemplate<TItem, TBinding>> {\n\tgetId(item: TItem): unknown;\n\tgetTemplateId(item: TItem): string;\n\tgetUnboundSize(item: TItem): IObservable<number>;\n\tcreateTemplate(templateId: string, context: ICompressedVirtualizedScrollViewContext): TTemplate;\n\tonDidBind?(binding: TBinding, tx: ITransaction): void;\n\tonWillUnbind?(binding: TBinding, tx: ITransaction): void;\n}\n\nexport class VirtualizedItemManager<TItem, TBinding extends IVirtualizedItemBinding<TItem>, TTemplate extends IVirtualizedItemTemplate<TItem, TBinding>> extends Disposable {\n\tprivate readonly _pools = new Map<string, VirtualizedTemplatePool<TItem, TBinding, TTemplate>>();\n\treadonly virtualizedItems: IObservable<readonly ManagedVirtualizedItem<TItem, TBinding, TTemplate>[]>;\n\n\tconstructor(\n\t\titems: IObservable<readonly TItem[]>,\n\t\tprivate readonly _context: ICompressedVirtualizedScrollViewContext,\n\t\tprivate readonly _delegate: IVirtualizedItemDelegate<TItem, TBinding, TTemplate>,\n\t) {\n\t\tsuper();\n\t\tthis.virtualizedItems = mapObservableArrayCached(\n\t\t\tthis,\n\t\t\titems,\n\t\t\t(item, store) => store.add(new ManagedVirtualizedItem(item, this, _delegate)),\n\t\t\titem => _delegate.getId(item),\n\t\t).recomputeInitiallyAndOnChange(this._store);\n\t\tthis._register(toDisposable(() => {\n\t\t\tfor (const pool of this._pools.values()) {\n\t\t\t\tpool.dispose();\n\t\t\t}\n\t\t\tthis._pools.clear();\n\t\t}));\n\t}\n\n\tacquire(item: TItem): IReference<TTemplate> {\n\t\tconst templateId = this._delegate.getTemplateId(item);\n\t\tlet pool = this._pools.get(templateId);\n\t\tif (!pool) {\n\t\t\tpool = new VirtualizedTemplatePool(() => this._delegate.createTemplate(templateId, this._context));\n\t\t\tthis._pools.set(templateId, pool);\n\t\t}\n\t\treturn pool.acquire();\n\t}\n\n}\n\nexport class ManagedVirtualizedItem<TItem, TBinding extends IVirtualizedItemBinding<TItem>, TTemplate extends IVirtualizedItemTemplate<TItem, TBinding>> extends Disposable implements ICompressedVirtualizedScrollItem {\n\tprivate readonly _templateReference = observableValue<IReference<TTemplate> | undefined>(this, undefined);\n\tprivate readonly _isHidden = observableValue(this, false);\n\tprivate _lastRender: { renderedRange: OffsetRange; scrollOffset: number; width: number; renderedViewport: OffsetRange; context: ICompressedVirtualizedScrollItemContext | undefined } | undefined;\n\tprivate _didRenderFail = false;\n\treadonly template = derived(this, reader => this._templateReference.read(reader)?.object);\n\treadonly binding = derived(this, reader => this.template.read(reader)?.currentBinding.read(reader));\n\treadonly size;\n\treadonly maxScroll;\n\n\tconstructor(\n\t\treadonly item: TItem,\n\t\tprivate readonly _manager: VirtualizedItemManager<TItem, TBinding, TTemplate>,\n\t\tprivate readonly _delegate: IVirtualizedItemDelegate<TItem, TBinding, TTemplate>,\n\t) {\n\t\tsuper();\n\t\tconst unboundSize = _delegate.getUnboundSize(item);\n\t\tthis.size = derived(this, reader => this.binding.read(reader)?.size.read(reader) ?? unboundSize.read(reader));\n\t\tthis.maxScroll = derived(this, reader => this.binding.read(reader)?.maxScroll.read(reader) ?? { maxScroll: 0 });\n\t\tthis._register(autorun(reader => {\n\t\t\tconst binding = this.binding.read(reader);\n\t\t\tif (!binding || !this._isHidden.read(reader) || binding.shouldKeepAlive.read(reader)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis._clearBinding();\n\t\t}));\n\t}\n\n\trender(renderedRange: OffsetRange, scrollOffset: number, width: number, renderedViewport: OffsetRange, context?: ICompressedVirtualizedScrollItemContext): void {\n\t\tthis._lastRender = { renderedRange, scrollOffset, width, renderedViewport, context };\n\t\tthis._isHidden.set(false, undefined);\n\t\tif (this._didRenderFail) {\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\tthis._render(renderedRange, scrollOffset, width, renderedViewport, context);\n\t\t} catch (error) {\n\t\t\tthis._didRenderFail = true;\n\t\t\tonUnexpectedError(error);\n\t\t}\n\t}\n\n\tprivate _render(renderedRange: OffsetRange, scrollOffset: number, width: number, renderedViewport: OffsetRange, context?: ICompressedVirtualizedScrollItemContext): void {\n\t\tlet binding = this.binding.get();\n\t\tif (!binding) {\n\t\t\tconst templateReference = this._manager.acquire(this.item);\n\t\t\tconst template = templateReference.object;\n\t\t\tif (template.currentBinding.get()) {\n\t\t\t\ttemplateReference.dispose();\n\t\t\t\tthrow new BugIndicatingError('Virtualized template pool returned a bound template');\n\t\t\t}\n\t\t\tlet newBinding: TBinding | undefined;\n\t\t\ttry {\n\t\t\t\tnewBinding = template.bind(this.item, {\n\t\t\t\t\tinitialSize: this.size.get(),\n\t\t\t\t\trunWithScrollAnchor: (getItemOffset, update) => {\n\t\t\t\t\t\tif (!context) {\n\t\t\t\t\t\t\tthrow new BugIndicatingError('Cannot preserve a virtualized item scroll anchor without a render context');\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontext.runWithScrollAnchor(getItemOffset, update);\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t\tif (newBinding.item !== this.item || template.currentBinding.get() !== newBinding) {\n\t\t\t\t\tthrow new BugIndicatingError('Virtualized template returned a binding for a different item');\n\t\t\t\t}\n\t\t\t\tconst validatedBinding = newBinding;\n\t\t\t\ttransaction(tx => {\n\t\t\t\t\tthis._delegate.onDidBind?.(validatedBinding, tx);\n\t\t\t\t\tthis._templateReference.set(templateReference, tx);\n\t\t\t\t});\n\t\t\t} catch (error) {\n\t\t\t\t(template.currentBinding.get() ?? newBinding)?.dispose();\n\t\t\t\ttemplateReference.dispose();\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tbinding = newBinding;\n\t\t}\n\t\tbinding.render(renderedRange, scrollOffset, width, renderedViewport);\n\t}\n\n\thide(): void {\n\t\tthis._isHidden.set(true, undefined);\n\t\tthis.binding.get()?.hide();\n\t}\n\n\tprivate _clearBinding(): void {\n\t\tconst templateReference = this._templateReference.get();\n\t\tconst binding = templateReference?.object.currentBinding.get();\n\t\tif (!templateReference || !binding) {\n\t\t\treturn;\n\t\t}\n\t\ttransaction(tx => {\n\t\t\tthis._delegate.onWillUnbind?.(binding, tx);\n\t\t});\n\t\tbinding.hide();\n\t\tbinding.dispose();\n\t\tif (templateReference.object.currentBinding.get()) {\n\t\t\tthrow new BugIndicatingError('Virtualized binding did not release its template when disposed');\n\t\t}\n\t\ttransaction(tx => {\n\t\t\tthis._templateReference.set(undefined, tx);\n\t\t});\n\t\ttemplateReference.dispose();\n\t}\n\n\toverride dispose(): void {\n\t\tthis._clearBinding();\n\t\tsuper.dispose();\n\t}\n}\n\nclass VirtualizedTemplatePool<TItem, TBinding extends IVirtualizedItemBinding<TItem>, TTemplate extends IVirtualizedItemTemplate<TItem, TBinding>> implements IDisposable {\n\tprivate readonly _unused = new Set<TTemplate>();\n\tprivate readonly _used = new Set<TTemplate>();\n\n\tconstructor(private readonly _create: () => TTemplate) { }\n\n\tacquire(): IReference<TTemplate> {\n\t\tconst template = this._unused.values().next().value ?? this._create();\n\t\tthis._unused.delete(template);\n\t\tif (template.currentBinding.get()) {\n\t\t\tthrow new BugIndicatingError('Cannot acquire a bound virtualized template');\n\t\t}\n\t\tthis._used.add(template);\n\t\tlet disposed = false;\n\t\treturn {\n\t\t\tobject: template,\n\t\t\tdispose: () => {\n\t\t\t\tif (disposed) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tdisposed = true;\n\t\t\t\tif (template.currentBinding.get()) {\n\t\t\t\t\tthrow new BugIndicatingError('Cannot pool a virtualized template with a current binding');\n\t\t\t\t}\n\t\t\t\tthis._used.delete(template);\n\t\t\t\tif (this._unused.size >= 5) {\n\t\t\t\t\ttemplate.dispose();\n\t\t\t\t} else {\n\t\t\t\t\tthis._unused.add(template);\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t}\n\n\tdispose(): void {\n\t\tfor (const template of this._used) {\n\t\t\ttemplate.dispose();\n\t\t}\n\t\tfor (const template of this._unused) {\n\t\t\ttemplate.dispose();\n\t\t}\n\t\tthis._used.clear();\n\t\tthis._unused.clear();\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { BugIndicatingError, onUnexpectedError } from '../../../../base/common/errors.js';\nimport { Emitter, Event } from '../../../../base/common/event.js';\nimport { Disposable, DisposableStore, IDisposable, IReference, toDisposable } from '../../../../base/common/lifecycle.js';\nimport { autorun, derived, IObservable, ITransaction, mapObservableArrayCached, observableValue, transaction } from '../../../../base/common/observable.js';\nimport { OffsetRange } from '../../../common/core/ranges/offsetRange.js';\nimport { ICompressedVirtualizedScrollItem, ICompressedVirtualizedScrollItemContext, ICompressedVirtualizedScrollViewContext } from './compressedVirtualizedScrollView.js';\n\nexport interface IVirtualizedItemBindingContext {\n\treadonly initialSize: number;\n\trunWithScrollAnchor(getItemOffset: () => number, update: (tx: ITransaction) => void): void;\n}\n\nexport interface IVirtualizedItemBinding<TItem> extends IDisposable {\n\treadonly item: TItem;\n\treadonly size: IObservable<number>;\n\treadonly maxScroll: IObservable<{ readonly maxScroll: number }>;\n\treadonly shouldKeepAlive: IObservable<boolean>;\n\treadonly onDidDispose: Event<void>;\n\trender(renderedRange: OffsetRange, scrollOffset: number, width: number, renderedViewport: OffsetRange): void;\n\thide(): void;\n}\n\nexport abstract class VirtualizedItemBinding<TItem> extends Disposable implements IVirtualizedItemBinding<TItem> {\n\tprivate readonly _onDidDispose = this._register(new Emitter<void>());\n\treadonly onDidDispose = this._onDidDispose.event;\n\tabstract readonly size: IObservable<number>;\n\tabstract readonly maxScroll: IObservable<{ readonly maxScroll: number }>;\n\tabstract readonly shouldKeepAlive: IObservable<boolean>;\n\n\tconstructor(readonly item: TItem) {\n\t\tsuper();\n\t}\n\n\tabstract render(renderedRange: OffsetRange, scrollOffset: number, width: number, renderedViewport: OffsetRange): void;\n\tabstract hide(): void;\n\n\toverride dispose(): void {\n\t\tif (this._store.isDisposed) {\n\t\t\treturn;\n\t\t}\n\t\tthis._onDidDispose.fire();\n\t\tsuper.dispose();\n\t}\n}\n\nexport interface IVirtualizedItemTemplate<TItem, TBinding extends IVirtualizedItemBinding<TItem>> extends IDisposable {\n\treadonly currentBinding: IObservable<TBinding | undefined>;\n\tbind(item: TItem, context: IVirtualizedItemBindingContext): TBinding;\n}\n\nexport abstract class VirtualizedItemTemplate<TItem, TBinding extends IVirtualizedItemBinding<TItem>> extends Disposable implements IVirtualizedItemTemplate<TItem, TBinding> {\n\tprivate readonly _currentBinding = observableValue<TBinding | undefined>(this, undefined);\n\treadonly currentBinding: IObservable<TBinding | undefined> = this._currentBinding;\n\tprivate readonly _bindingStore = this._register(new DisposableStore());\n\n\tbind(item: TItem, context: IVirtualizedItemBindingContext): TBinding {\n\t\tif (this._currentBinding.get()) {\n\t\t\tthrow new BugIndicatingError('Cannot rebind a virtualized template before disposing its current binding');\n\t\t}\n\t\tconst binding = this.createBinding(item, context);\n\t\tthis._bindingStore.clear();\n\t\tthis._bindingStore.add(Event.once(binding.onDidDispose)(() => {\n\t\t\tif (this._currentBinding.get() !== binding) {\n\t\t\t\tthrow new BugIndicatingError('Disposed binding does not own its virtualized template');\n\t\t\t}\n\t\t\tthis._bindingStore.clear();\n\t\t\tthis._currentBinding.set(undefined, undefined);\n\t\t}));\n\t\tthis._currentBinding.set(binding, undefined);\n\t\treturn binding;\n\t}\n\n\tprotected abstract createBinding(item: TItem, context: IVirtualizedItemBindingContext): TBinding;\n\n\toverride dispose(): void {\n\t\tthis._currentBinding.get()?.dispose();\n\t\tsuper.dispose();\n\t}\n}\n\nexport interface IVirtualizedItemDelegate<TItem, TBinding extends IVirtualizedItemBinding<TItem>, TTemplate extends IVirtualizedItemTemplate<TItem, TBinding>> {\n\tgetId(item: TItem): unknown;\n\tgetTemplateId(item: TItem): string;\n\tgetUnboundSize(item: TItem): IObservable<number>;\n\tcreateTemplate(templateId: string, context: ICompressedVirtualizedScrollViewContext): TTemplate;\n\tonDidBind?(binding: TBinding, tx: ITransaction): void;\n\tonWillUnbind?(binding: TBinding, tx: ITransaction): void;\n}\n\nexport class VirtualizedItemManager<TItem, TBinding extends IVirtualizedItemBinding<TItem>, TTemplate extends IVirtualizedItemTemplate<TItem, TBinding>> extends Disposable {\n\tprivate readonly _pools = new Map<string, VirtualizedTemplatePool<TItem, TBinding, TTemplate>>();\n\treadonly virtualizedItems: IObservable<readonly ManagedVirtualizedItem<TItem, TBinding, TTemplate>[]>;\n\n\tconstructor(\n\t\titems: IObservable<readonly TItem[]>,\n\t\tprivate readonly _context: ICompressedVirtualizedScrollViewContext,\n\t\tprivate readonly _delegate: IVirtualizedItemDelegate<TItem, TBinding, TTemplate>,\n\t) {\n\t\tsuper();\n\t\tthis.virtualizedItems = mapObservableArrayCached(\n\t\t\tthis,\n\t\t\titems,\n\t\t\t(item, store) => store.add(new ManagedVirtualizedItem(item, this, _delegate)),\n\t\t\titem => _delegate.getId(item),\n\t\t).recomputeInitiallyAndOnChange(this._store);\n\t\tthis._register(toDisposable(() => {\n\t\t\tfor (const pool of this._pools.values()) {\n\t\t\t\tpool.dispose();\n\t\t\t}\n\t\t\tthis._pools.clear();\n\t\t}));\n\t}\n\n\tacquire(item: TItem): IReference<TTemplate> {\n\t\tconst templateId = this._delegate.getTemplateId(item);\n\t\tlet pool = this._pools.get(templateId);\n\t\tif (!pool) {\n\t\t\tpool = new VirtualizedTemplatePool(() => this._delegate.createTemplate(templateId, this._context));\n\t\t\tthis._pools.set(templateId, pool);\n\t\t}\n\t\treturn pool.acquire();\n\t}\n\n}\n\nexport class ManagedVirtualizedItem<TItem, TBinding extends IVirtualizedItemBinding<TItem>, TTemplate extends IVirtualizedItemTemplate<TItem, TBinding>> extends Disposable implements ICompressedVirtualizedScrollItem {\n\tprivate readonly _templateReference = observableValue<IReference<TTemplate> | undefined>(this, undefined);\n\tprivate readonly _isHidden = observableValue(this, false);\n\tprivate _lastRender: { renderedRange: OffsetRange; scrollOffset: number; width: number; renderedViewport: OffsetRange; context: ICompressedVirtualizedScrollItemContext | undefined } | undefined;\n\tprivate _didRenderFail = false;\n\treadonly template = derived(this, reader => this._templateReference.read(reader)?.object);\n\treadonly binding = derived(this, reader => this.template.read(reader)?.currentBinding.read(reader));\n\treadonly size;\n\treadonly maxScroll;\n\n\tconstructor(\n\t\treadonly item: TItem,\n\t\tprivate readonly _manager: VirtualizedItemManager<TItem, TBinding, TTemplate>,\n\t\tprivate readonly _delegate: IVirtualizedItemDelegate<TItem, TBinding, TTemplate>,\n\t) {\n\t\tsuper();\n\t\tconst unboundSize = _delegate.getUnboundSize(item);\n\t\tthis.size = derived(this, reader => this.binding.read(reader)?.size.read(reader) ?? unboundSize.read(reader));\n\t\tthis.maxScroll = derived(this, reader => this.binding.read(reader)?.maxScroll.read(reader) ?? { maxScroll: 0 });\n\t\tthis._register(autorun(reader => {\n\t\t\tconst binding = this.binding.read(reader);\n\t\t\tif (!binding || !this._isHidden.read(reader) || binding.shouldKeepAlive.read(reader)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis._clearBinding();\n\t\t}));\n\t}\n\n\trender(renderedRange: OffsetRange, scrollOffset: number, width: number, renderedViewport: OffsetRange, context?: ICompressedVirtualizedScrollItemContext): void {\n\t\tthis._lastRender = { renderedRange, scrollOffset, width, renderedViewport, context };\n\t\tthis._isHidden.set(false, undefined);\n\t\tif (this._didRenderFail) {\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\tthis._render(renderedRange, scrollOffset, width, renderedViewport, context);\n\t\t} catch (error) {\n\t\t\tthis._didRenderFail = true;\n\t\t\tonUnexpectedError(error);\n\t\t}\n\t}\n\n\tprivate _render(renderedRange: OffsetRange, scrollOffset: number, width: number, renderedViewport: OffsetRange, context?: ICompressedVirtualizedScrollItemContext): void {\n\t\tlet binding = this.binding.get();\n\t\tif (!binding) {\n\t\t\tconst templateReference = this._manager.acquire(this.item);\n\t\t\tconst template = templateReference.object;\n\t\t\tif (template.currentBinding.get()) {\n\t\t\t\ttemplateReference.dispose();\n\t\t\t\tthrow new BugIndicatingError('Virtualized template pool returned a bound template');\n\t\t\t}\n\t\t\tlet newBinding: TBinding | undefined;\n\t\t\ttry {\n\t\t\t\tnewBinding = template.bind(this.item, {\n\t\t\t\t\tinitialSize: this.size.get(),\n\t\t\t\t\trunWithScrollAnchor: (getItemOffset, update) => {\n\t\t\t\t\t\tif (!context) {\n\t\t\t\t\t\t\tthrow new BugIndicatingError('Cannot preserve a virtualized item scroll anchor without a render context');\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontext.runWithScrollAnchor(getItemOffset, update);\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t\tif (newBinding.item !== this.item || template.currentBinding.get() !== newBinding) {\n\t\t\t\t\tthrow new BugIndicatingError('Virtualized template returned a binding for a different item');\n\t\t\t\t}\n\t\t\t\tconst validatedBinding = newBinding;\n\t\t\t\ttransaction(tx => {\n\t\t\t\t\tthis._delegate.onDidBind?.(validatedBinding, tx);\n\t\t\t\t\tthis._templateReference.set(templateReference, tx);\n\t\t\t\t});\n\t\t\t} catch (error) {\n\t\t\t\t(template.currentBinding.get() ?? newBinding)?.dispose();\n\t\t\t\ttemplateReference.dispose();\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tbinding = newBinding;\n\t\t}\n\t\tbinding.render(renderedRange, scrollOffset, width, renderedViewport);\n\t}\n\n\thide(): void {\n\t\tthis._isHidden.set(true, undefined);\n\t\tthis.binding.get()?.hide();\n\t}\n\n\tprivate _clearBinding(): void {\n\t\tconst templateReference = this._templateReference.get();\n\t\tconst binding = templateReference?.object.currentBinding.get();\n\t\tif (!templateReference || !binding) {\n\t\t\treturn;\n\t\t}\n\t\ttransaction(tx => {\n\t\t\tthis._delegate.onWillUnbind?.(binding, tx);\n\t\t});\n\t\tbinding.hide();\n\t\tbinding.dispose();\n\t\tif (templateReference.object.currentBinding.get()) {\n\t\t\tthrow new BugIndicatingError('Virtualized binding did not release its template when disposed');\n\t\t}\n\t\ttransaction(tx => {\n\t\t\tthis._templateReference.set(undefined, tx);\n\t\t});\n\t\ttemplateReference.dispose();\n\t}\n\n\toverride dispose(): void {\n\t\tthis._clearBinding();\n\t\tsuper.dispose();\n\t}\n}\n\nclass VirtualizedTemplatePool<TItem, TBinding extends IVirtualizedItemBinding<TItem>, TTemplate extends IVirtualizedItemTemplate<TItem, TBinding>> implements IDisposable {\n\tprivate readonly _unused = new Set<TTemplate>();\n\tprivate readonly _used = new Set<TTemplate>();\n\n\tconstructor(private readonly _create: () => TTemplate) { }\n\n\tacquire(): IReference<TTemplate> {\n\t\tconst template = this._unused.values().next().value ?? this._create();\n\t\tthis._unused.delete(template);\n\t\tif (template.currentBinding.get()) {\n\t\t\tthrow new BugIndicatingError('Cannot acquire a bound virtualized template');\n\t\t}\n\t\tthis._used.add(template);\n\t\tlet disposed = false;\n\t\treturn {\n\t\t\tobject: template,\n\t\t\tdispose: () => {\n\t\t\t\tif (disposed) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tdisposed = true;\n\t\t\t\tif (template.currentBinding.get()) {\n\t\t\t\t\tthrow new BugIndicatingError('Cannot pool a virtualized template with a current binding');\n\t\t\t\t}\n\t\t\t\tthis._used.delete(template);\n\t\t\t\tif (this._unused.size >= 5) {\n\t\t\t\t\ttemplate.dispose();\n\t\t\t\t} else {\n\t\t\t\t\tthis._unused.add(template);\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t}\n\n\tdispose(): void {\n\t\tfor (const template of this._used) {\n\t\t\ttemplate.dispose();\n\t\t}\n\t\tfor (const template of this._unused) {\n\t\t\ttemplate.dispose();\n\t\t}\n\t\tthis._used.clear();\n\t\tthis._unused.clear();\n\t}\n}\n"]}
@@ -0,0 +1,64 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import { CursorColumns } from '../core/cursorColumns.js';
6
+ import { Range } from '../core/range.js';
7
+ import { Selection } from '../core/selection.js';
8
+ import { ReplaceCommand, ReplaceOvertypeCommand } from './replaceCommand.js';
9
+ export class ColumnSelectionPasteCommand {
10
+ constructor(_selection, _text, _tabSize, _overtype) {
11
+ this._selection = _selection;
12
+ this._text = _text;
13
+ this._tabSize = _tabSize;
14
+ this._overtype = _overtype;
15
+ }
16
+ getEditOperations(model, builder) {
17
+ const visibleColumn = CursorColumns.visibleColumnFromColumn(model.getLineContent(this._selection.startLineNumber), this._selection.startColumn, this._tabSize);
18
+ const text = this._padTextToBlockWidth(visibleColumn);
19
+ const lineCount = model.getLineCount();
20
+ const ChosenReplaceCommand = this._overtype ? ReplaceOvertypeCommand : ReplaceCommand;
21
+ for (let i = 0; i < text.length; i++) {
22
+ const lineNumber = this._selection.endLineNumber + i;
23
+ if (lineNumber > lineCount) {
24
+ const endColumn = model.getLineMaxColumn(lineCount);
25
+ const padding = ' '.repeat(visibleColumn);
26
+ const appendedText = '\n' + padding + text.slice(i).join('\n' + padding);
27
+ builder.addTrackedEditOperation(new Range(lineCount, endColumn, lineCount, endColumn), appendedText);
28
+ break;
29
+ }
30
+ let range;
31
+ let lineText = text[i];
32
+ if (i === 0) {
33
+ range = this._selection;
34
+ }
35
+ else {
36
+ const lineContent = model.getLineContent(lineNumber);
37
+ const column = CursorColumns.columnFromVisibleColumn(lineContent, visibleColumn, this._tabSize);
38
+ range = new Range(lineNumber, column, lineNumber, column);
39
+ if (column === model.getLineMaxColumn(lineNumber)) {
40
+ const endVisibleColumn = CursorColumns.visibleColumnFromColumn(lineContent, column, this._tabSize);
41
+ lineText = ' '.repeat(Math.max(0, visibleColumn - endVisibleColumn)) + lineText;
42
+ }
43
+ }
44
+ new ChosenReplaceCommand(range, lineText).getEditOperations(model, builder);
45
+ }
46
+ }
47
+ _padTextToBlockWidth(visibleColumn) {
48
+ const prefix = ' '.repeat(visibleColumn);
49
+ const endVisibleColumns = [];
50
+ let blockEndVisibleColumn = visibleColumn;
51
+ for (const text of this._text) {
52
+ const textWithPrefix = prefix + text;
53
+ const endVisibleColumn = CursorColumns.visibleColumnFromColumn(textWithPrefix, textWithPrefix.length + 1, this._tabSize);
54
+ endVisibleColumns.push(endVisibleColumn);
55
+ blockEndVisibleColumn = Math.max(blockEndVisibleColumn, endVisibleColumn);
56
+ }
57
+ return this._text.map((text, index) => text + ' '.repeat(blockEndVisibleColumn - endVisibleColumns[index]));
58
+ }
59
+ computeCursorState(model, helper) {
60
+ const operations = helper.getInverseEditOperations();
61
+ return Selection.fromPositions(operations[operations.length - 1].range.getEndPosition());
62
+ }
63
+ }
64
+ //# sourceMappingURL=columnSelectionPasteCommand.js.map