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.
- package/esm/nls.keys.json +1 -1
- package/esm/nls.messages.cs.js +2 -2
- package/esm/nls.messages.de.js +2 -2
- package/esm/nls.messages.es.js +2 -2
- package/esm/nls.messages.fr.js +2 -2
- package/esm/nls.messages.it.js +2 -2
- package/esm/nls.messages.ja.js +2 -2
- package/esm/nls.messages.js +1 -1
- package/esm/nls.messages.json +1 -1
- package/esm/nls.messages.ko.js +2 -2
- package/esm/nls.messages.pl.js +2 -2
- package/esm/nls.messages.pt-br.js +2 -2
- package/esm/nls.messages.ru.js +2 -2
- package/esm/nls.messages.tr.js +2 -2
- package/esm/nls.messages.zh-cn.js +2 -2
- package/esm/nls.messages.zh-tw.js +2 -2
- package/esm/nls.metadata.json +38 -6
- package/esm/vs/base/browser/browser.js +8 -0
- package/esm/vs/base/browser/browser.js.map +1 -1
- package/esm/vs/base/browser/contextmenu.js +8 -1
- package/esm/vs/base/browser/contextmenu.js.map +1 -1
- package/esm/vs/base/browser/dom.js +34 -5
- package/esm/vs/base/browser/dom.js.map +1 -1
- package/esm/vs/base/browser/dompurify/dompurify.js +2457 -2640
- package/esm/vs/base/browser/markdownRenderer.js +48 -21
- package/esm/vs/base/browser/markdownRenderer.js.map +1 -1
- package/esm/vs/base/browser/pixelRatio.js +3 -2
- package/esm/vs/base/browser/pixelRatio.js.map +1 -1
- package/esm/vs/base/browser/ui/actionbar/actionViewItems.js +5 -2
- package/esm/vs/base/browser/ui/actionbar/actionViewItems.js.map +1 -1
- package/esm/vs/base/browser/ui/actionbar/actionbar.js +7 -2
- package/esm/vs/base/browser/ui/actionbar/actionbar.js.map +1 -1
- package/esm/vs/base/browser/ui/animations/animations.js +68 -40
- package/esm/vs/base/browser/ui/animations/animations.js.map +1 -1
- package/esm/vs/base/browser/ui/button/button.js +7 -0
- package/esm/vs/base/browser/ui/button/button.js.map +1 -1
- package/esm/vs/base/browser/ui/codicons/codicon/codicon.ttf +0 -0
- package/esm/vs/base/browser/ui/contextview/contextview.css +15 -0
- package/esm/vs/base/browser/ui/contextview/contextview.js +266 -40
- package/esm/vs/base/browser/ui/contextview/contextview.js.map +1 -1
- package/esm/vs/base/browser/ui/contextview/windowControlsOverlay.js +72 -0
- package/esm/vs/base/browser/ui/contextview/windowControlsOverlay.js.map +1 -0
- package/esm/vs/base/browser/ui/dialog/dialog.css +5 -0
- package/esm/vs/base/browser/ui/dropdown/dropdown.js +2 -1
- package/esm/vs/base/browser/ui/dropdown/dropdown.js.map +1 -1
- package/esm/vs/base/browser/ui/dropdown/dropdownActionViewItem.js +1 -0
- package/esm/vs/base/browser/ui/dropdown/dropdownActionViewItem.js.map +1 -1
- package/esm/vs/base/browser/ui/hover/hover.js.map +1 -1
- package/esm/vs/base/browser/ui/list/listView.js +87 -15
- package/esm/vs/base/browser/ui/list/listView.js.map +1 -1
- package/esm/vs/base/browser/ui/list/listWidget.js +37 -15
- package/esm/vs/base/browser/ui/list/listWidget.js.map +1 -1
- package/esm/vs/base/browser/ui/menu/menu.js +189 -52
- package/esm/vs/base/browser/ui/menu/menu.js.map +1 -1
- package/esm/vs/base/browser/ui/radio/radio.css +11 -0
- package/esm/vs/base/browser/ui/scrollbar/scrollableElement.js +2 -1
- package/esm/vs/base/browser/ui/scrollbar/scrollableElement.js.map +1 -1
- package/esm/vs/base/browser/ui/selectBox/selectBox.js.map +1 -1
- package/esm/vs/base/browser/ui/selectBox/selectBoxCustom.js +14 -8
- package/esm/vs/base/browser/ui/selectBox/selectBoxCustom.js.map +1 -1
- package/esm/vs/base/browser/ui/splitview/splitview.js +11 -7
- package/esm/vs/base/browser/ui/splitview/splitview.js.map +1 -1
- package/esm/vs/base/browser/ui/toggle/switch.css +16 -7
- package/esm/vs/base/browser/ui/toggle/switch.js +9 -6
- package/esm/vs/base/browser/ui/toggle/switch.js.map +1 -1
- package/esm/vs/base/browser/ui/toolbar/toolbar.css +1 -2
- package/esm/vs/base/browser/ui/toolbar/toolbar.js +85 -38
- package/esm/vs/base/browser/ui/toolbar/toolbar.js.map +1 -1
- package/esm/vs/base/browser/ui/tree/abstractTree.js +48 -9
- package/esm/vs/base/browser/ui/tree/abstractTree.js.map +1 -1
- package/esm/vs/base/browser/ui/tree/asyncDataTree.js +10 -1
- package/esm/vs/base/browser/ui/tree/asyncDataTree.js.map +1 -1
- package/esm/vs/base/browser/ui/tree/objectTree.js +3 -0
- package/esm/vs/base/browser/ui/tree/objectTree.js.map +1 -1
- package/esm/vs/base/browser/ui/tree/tree.js.map +1 -1
- package/esm/vs/base/common/actions.js +8 -2
- package/esm/vs/base/common/actions.js.map +1 -1
- package/esm/vs/base/common/arrays.js +4 -4
- package/esm/vs/base/common/arrays.js.map +1 -1
- package/esm/vs/base/common/async.js +12 -8
- package/esm/vs/base/common/async.js.map +1 -1
- package/esm/vs/base/common/cancellation.js +25 -0
- package/esm/vs/base/common/cancellation.js.map +1 -1
- package/esm/vs/base/common/codicons.js +2 -0
- package/esm/vs/base/common/codicons.js.map +1 -1
- package/esm/vs/base/common/codiconsLibrary.js +2 -0
- package/esm/vs/base/common/codiconsLibrary.js.map +1 -1
- package/esm/vs/base/common/color.js +1 -1
- package/esm/vs/base/common/color.js.map +1 -1
- package/esm/vs/base/common/diff/diff.js +60 -1
- package/esm/vs/base/common/diff/diff.js.map +1 -1
- package/esm/vs/base/common/event.js +1 -1
- package/esm/vs/base/common/event.js.map +1 -1
- package/esm/vs/base/common/glob.js +1 -0
- package/esm/vs/base/common/glob.js.map +1 -1
- package/esm/vs/base/common/htmlContent.js +74 -12
- package/esm/vs/base/common/htmlContent.js.map +1 -1
- package/esm/vs/base/common/json.js +19 -0
- package/esm/vs/base/common/json.js.map +1 -0
- package/esm/vs/base/common/network.js +16 -0
- package/esm/vs/base/common/network.js.map +1 -1
- package/esm/vs/base/common/resources.js +14 -2
- package/esm/vs/base/common/resources.js.map +1 -1
- package/esm/vs/base/common/strings.js +1 -1
- package/esm/vs/base/common/strings.js.map +1 -1
- package/esm/vs/base/common/uri.js +2 -2
- package/esm/vs/base/common/uri.js.map +1 -1
- package/esm/vs/editor/browser/config/editorConfiguration.js +1 -1
- package/esm/vs/editor/browser/config/fontMeasurements.js +19 -6
- package/esm/vs/editor/browser/config/fontMeasurements.js.map +1 -1
- package/esm/vs/editor/browser/controller/dragScrolling.js +3 -3
- package/esm/vs/editor/browser/controller/editContext/clipboardUtils.js +11 -5
- package/esm/vs/editor/browser/controller/editContext/clipboardUtils.js.map +1 -1
- package/esm/vs/editor/browser/controller/editContext/native/nativeEditContext.js +8 -38
- package/esm/vs/editor/browser/controller/editContext/native/nativeEditContext.js.map +1 -1
- package/esm/vs/editor/browser/controller/editContext/native/screenReaderContentRich.js +3 -3
- package/esm/vs/editor/browser/controller/editContext/native/screenReaderSupport.js +6 -6
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContext.js +12 -10
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContext.js.map +1 -1
- package/esm/vs/editor/browser/controller/mouseHandler.js +7 -7
- package/esm/vs/editor/browser/controller/mouseTarget.js +3 -3
- package/esm/vs/editor/browser/coreCommands.js +2 -2
- package/esm/vs/editor/browser/editorBrowser.js.map +1 -1
- package/esm/vs/editor/browser/editorMarkdownSanitizer.js +19 -0
- package/esm/vs/editor/browser/editorMarkdownSanitizer.js.map +1 -0
- package/esm/vs/editor/browser/gpu/rectangleRenderer.js +1 -1
- package/esm/vs/editor/browser/gpu/viewGpuContext.js +1 -1
- package/esm/vs/editor/browser/observableCodeEditor.js +1 -1
- package/esm/vs/editor/browser/services/editorWorkerService.js +3 -2
- package/esm/vs/editor/browser/services/editorWorkerService.js.map +1 -1
- package/esm/vs/editor/browser/services/openerService.js +6 -2
- package/esm/vs/editor/browser/services/openerService.js.map +1 -1
- package/esm/vs/editor/browser/view/domLineBreaksComputer.js +34 -11
- package/esm/vs/editor/browser/view/domLineBreaksComputer.js.map +1 -1
- package/esm/vs/editor/browser/view/viewController.js +7 -7
- package/esm/vs/editor/browser/view/viewController.js.map +1 -1
- package/esm/vs/editor/browser/view/viewLayer.js +1 -1
- package/esm/vs/editor/browser/view/viewOverlays.js +4 -4
- package/esm/vs/editor/browser/view.js +5 -5
- package/esm/vs/editor/browser/viewParts/blockDecorations/blockDecorations.js +1 -1
- package/esm/vs/editor/browser/viewParts/contentWidgets/contentWidgets.js +11 -3
- package/esm/vs/editor/browser/viewParts/contentWidgets/contentWidgets.js.map +1 -1
- package/esm/vs/editor/browser/viewParts/currentLineHighlight/currentLineHighlight.js +6 -6
- package/esm/vs/editor/browser/viewParts/editorScrollbar/editorScrollbar.js +12 -12
- package/esm/vs/editor/browser/viewParts/glyphMargin/glyphMargin.js +9 -2
- package/esm/vs/editor/browser/viewParts/glyphMargin/glyphMargin.js.map +1 -1
- package/esm/vs/editor/browser/viewParts/indentGuides/indentGuides.js +2 -2
- package/esm/vs/editor/browser/viewParts/lineNumbers/lineNumbers.js +2 -2
- package/esm/vs/editor/browser/viewParts/linesDecorations/linesDecorations.js +2 -2
- package/esm/vs/editor/browser/viewParts/margin/margin.js +2 -2
- package/esm/vs/editor/browser/viewParts/minimap/minimap.js +6 -6
- package/esm/vs/editor/browser/viewParts/overlayWidgets/overlayWidgets.js +9 -2
- package/esm/vs/editor/browser/viewParts/overlayWidgets/overlayWidgets.js.map +1 -1
- package/esm/vs/editor/browser/viewParts/overviewRuler/decorationsOverviewRuler.js +5 -5
- package/esm/vs/editor/browser/viewParts/overviewRuler/overviewRuler.js +3 -3
- package/esm/vs/editor/browser/viewParts/rulers/rulers.js +2 -2
- package/esm/vs/editor/browser/viewParts/rulersGpu/rulersGpu.js +1 -1
- package/esm/vs/editor/browser/viewParts/scrollDecoration/scrollDecoration.js +3 -3
- package/esm/vs/editor/browser/viewParts/selections/selections.js +2 -2
- package/esm/vs/editor/browser/viewParts/viewCursors/viewCursor.js +2 -2
- package/esm/vs/editor/browser/viewParts/viewCursors/viewCursors.js +6 -6
- package/esm/vs/editor/browser/viewParts/viewLines/viewLineOptions.js +5 -5
- package/esm/vs/editor/browser/viewParts/viewLines/viewLines.js +11 -11
- package/esm/vs/editor/browser/viewParts/viewLinesGpu/viewLinesGpu.js +1 -1
- package/esm/vs/editor/browser/viewParts/viewZones/viewZones.js +2 -2
- package/esm/vs/editor/browser/viewParts/whitespace/whitespace.js +4 -4
- package/esm/vs/editor/browser/viewParts/wordWrapIndicator/wordWrapIndicator.js +2 -2
- package/esm/vs/editor/browser/widget/codeEditor/codeEditorWidget.js +22 -21
- package/esm/vs/editor/browser/widget/codeEditor/codeEditorWidget.js.map +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/commands.js +12 -12
- package/esm/vs/editor/browser/widget/diffEditor/components/accessibleDiffViewer.js +18 -18
- package/esm/vs/editor/browser/widget/diffEditor/components/diffEditorEditors.js +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/diffEditorViewZones.js +3 -3
- package/esm/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/inlineDiffDeletedCodeMargin.js +10 -10
- package/esm/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/inlineDiffDeletedCodeMargin.js.map +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/renderLines.js +2 -2
- package/esm/vs/editor/browser/widget/diffEditor/diffEditor.contribution.js +4 -4
- package/esm/vs/editor/browser/widget/diffEditor/diffProviderFactoryService.js +21 -3
- package/esm/vs/editor/browser/widget/diffEditor/diffProviderFactoryService.js.map +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/features/gutterFeature.js +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/features/hideUnchangedRegionsFeature.js +10 -10
- package/esm/vs/editor/browser/widget/diffEditor/features/movedBlocksLinesFeature.js +2 -2
- package/esm/vs/editor/browser/widget/diffEditor/features/overviewRulerFeature.js +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/features/revertButtonsFeature.js +2 -2
- package/esm/vs/editor/browser/widget/diffEditor/registrations.contribution.js +5 -5
- package/esm/vs/editor/browser/widget/multiDiffEditor/colors.js +3 -3
- package/esm/vs/editor/browser/widget/multiDiffEditor/compressedVirtualizedScrollLayout.js +2 -2
- package/esm/vs/editor/browser/widget/multiDiffEditor/compressedVirtualizedScrollLayout.js.map +1 -1
- package/esm/vs/editor/browser/widget/multiDiffEditor/compressedVirtualizedScrollView.js +21 -2
- package/esm/vs/editor/browser/widget/multiDiffEditor/compressedVirtualizedScrollView.js.map +1 -1
- package/esm/vs/editor/browser/widget/multiDiffEditor/diffEditorItemTemplate.js +2 -2
- package/esm/vs/editor/browser/widget/multiDiffEditor/multiDiffEditorWidgetImpl.js +11 -3
- package/esm/vs/editor/browser/widget/multiDiffEditor/multiDiffEditorWidgetImpl.js.map +1 -1
- package/esm/vs/editor/browser/widget/multiDiffEditor/virtualizedItemManager.js +1 -0
- package/esm/vs/editor/browser/widget/multiDiffEditor/virtualizedItemManager.js.map +1 -1
- package/esm/vs/editor/common/commands/columnSelectionPasteCommand.js +64 -0
- package/esm/vs/editor/common/commands/columnSelectionPasteCommand.js.map +1 -0
- package/esm/vs/editor/common/config/editorConfigurationSchema.js +68 -58
- package/esm/vs/editor/common/config/editorConfigurationSchema.js.map +1 -1
- package/esm/vs/editor/common/config/editorOptions.js +560 -500
- package/esm/vs/editor/common/config/editorOptions.js.map +1 -1
- package/esm/vs/editor/common/core/editorColorRegistry.js +71 -71
- package/esm/vs/editor/common/core/edits/textEdit.js +16 -0
- package/esm/vs/editor/common/core/edits/textEdit.js.map +1 -1
- package/esm/vs/editor/common/cursor/cursor.js +20 -10
- package/esm/vs/editor/common/cursor/cursor.js.map +1 -1
- package/esm/vs/editor/common/cursor/cursorTypeEditOperations.js +67 -14
- package/esm/vs/editor/common/cursor/cursorTypeEditOperations.js.map +1 -1
- package/esm/vs/editor/common/cursor/cursorTypeOperations.js +2 -2
- package/esm/vs/editor/common/cursor/cursorTypeOperations.js.map +1 -1
- package/esm/vs/editor/common/cursorCommon.js +22 -21
- package/esm/vs/editor/common/cursorCommon.js.map +1 -1
- package/esm/vs/editor/common/diff/defaultLinesDiffComputer/defaultLinesDiffComputer.js +21 -8
- package/esm/vs/editor/common/diff/defaultLinesDiffComputer/defaultLinesDiffComputer.js.map +1 -1
- package/esm/vs/editor/common/diff/documentDiffProvider.js.map +1 -1
- package/esm/vs/editor/common/diff/externalLinesDiffComputer.js +38 -26
- package/esm/vs/editor/common/diff/externalLinesDiffComputer.js.map +1 -1
- package/esm/vs/editor/common/diff/rangeMapping.js +11 -1
- package/esm/vs/editor/common/diff/rangeMapping.js.map +1 -1
- package/esm/vs/editor/common/diff/verifyLinesDiff.js +28 -0
- package/esm/vs/editor/common/diff/verifyLinesDiff.js.map +1 -0
- package/esm/vs/editor/common/editorContextKeys.js +53 -53
- package/esm/vs/editor/common/languages/languageConfiguration.js +8 -0
- package/esm/vs/editor/common/languages/languageConfiguration.js.map +1 -1
- package/esm/vs/editor/common/languages/modesRegistry.js +1 -1
- package/esm/vs/editor/common/languages.js +56 -56
- package/esm/vs/editor/common/model/editStack.js +1 -1
- package/esm/vs/editor/common/services/editorWebWorker.js +27 -6
- package/esm/vs/editor/common/services/editorWebWorker.js.map +1 -1
- package/esm/vs/editor/common/services/editorWorker.js.map +1 -1
- package/esm/vs/editor/common/services/languageService.js +6 -4
- package/esm/vs/editor/common/services/languageService.js.map +1 -1
- package/esm/vs/editor/common/services/markerDecorationsService.js +21 -2
- package/esm/vs/editor/common/services/markerDecorationsService.js.map +1 -1
- package/esm/vs/editor/common/standalone/standaloneEnums.js +100 -97
- package/esm/vs/editor/common/standalone/standaloneEnums.js.map +1 -1
- package/esm/vs/editor/common/standaloneStrings.js +11 -11
- package/esm/vs/editor/common/textModelEditSource.js +9 -0
- package/esm/vs/editor/common/textModelEditSource.js.map +1 -1
- package/esm/vs/editor/common/viewLayout/viewLayout.js +16 -16
- package/esm/vs/editor/common/viewLayout/viewLineRenderer.js +2 -2
- package/esm/vs/editor/common/viewModel/monospaceLineBreaksComputer.js +1 -1
- package/esm/vs/editor/common/viewModel/viewModelImpl.js +19 -19
- package/esm/vs/editor/common/viewModel/viewModelImpl.js.map +1 -1
- package/esm/vs/editor/contrib/anchorSelect/browser/anchorSelect.js +6 -6
- package/esm/vs/editor/contrib/bracketMatching/browser/bracketMatching.js +9 -9
- package/esm/vs/editor/contrib/caretOperations/browser/caretOperations.js +2 -2
- package/esm/vs/editor/contrib/caretOperations/browser/transpose.js +1 -1
- package/esm/vs/editor/contrib/clipboard/browser/clipboard.js +23 -20
- package/esm/vs/editor/contrib/clipboard/browser/clipboard.js.map +1 -1
- package/esm/vs/editor/contrib/codeAction/browser/codeAction.js +1 -1
- package/esm/vs/editor/contrib/codeAction/browser/codeActionCommands.js +29 -29
- package/esm/vs/editor/contrib/codeAction/browser/codeActionContributions.js +3 -3
- package/esm/vs/editor/contrib/codeAction/browser/codeActionController.js +3 -3
- package/esm/vs/editor/contrib/codeAction/browser/codeActionMenu.js +8 -8
- package/esm/vs/editor/contrib/codeAction/browser/codeActionModel.js +1 -1
- package/esm/vs/editor/contrib/codeAction/browser/lightBulbWidget.js +9 -9
- package/esm/vs/editor/contrib/codelens/browser/codelensController.js +2 -2
- package/esm/vs/editor/contrib/colorPicker/browser/colorDetector.js +25 -10
- package/esm/vs/editor/contrib/colorPicker/browser/colorDetector.js.map +1 -1
- package/esm/vs/editor/contrib/colorPicker/browser/colorPickerParts/colorPickerCloseButton.js +1 -1
- package/esm/vs/editor/contrib/colorPicker/browser/colorPickerParts/colorPickerHeader.js +1 -1
- package/esm/vs/editor/contrib/colorPicker/browser/hoverColorPicker/hoverColorPickerContribution.js +1 -1
- package/esm/vs/editor/contrib/colorPicker/browser/hoverColorPicker/hoverColorPickerParticipant.js +3 -3
- package/esm/vs/editor/contrib/colorPicker/browser/standaloneColorPicker/standaloneColorPickerActions.js +7 -7
- package/esm/vs/editor/contrib/colorPicker/browser/standaloneColorPicker/standaloneColorPickerParticipant.js +1 -1
- package/esm/vs/editor/contrib/comment/browser/comment.js +6 -6
- package/esm/vs/editor/contrib/contextmenu/browser/contextmenu.js +17 -17
- package/esm/vs/editor/contrib/contextmenu/browser/contextmenu.js.map +1 -1
- package/esm/vs/editor/contrib/cursorUndo/browser/cursorUndo.js +2 -2
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteContribution.js +4 -4
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.js +39 -39
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.js.map +1 -1
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/defaultProviders.js +8 -8
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/dropIntoEditorController.js +3 -3
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/pasteEditSession.js +19 -0
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/pasteEditSession.js.map +1 -0
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/postEditWidget.js +26 -18
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/postEditWidget.js.map +1 -1
- package/esm/vs/editor/contrib/editorState/browser/keybindingCancellation.js +1 -1
- package/esm/vs/editor/contrib/editorState/browser/keybindingCancellation.js.map +1 -1
- package/esm/vs/editor/contrib/find/browser/findController.js +18 -18
- package/esm/vs/editor/contrib/find/browser/findController.js.map +1 -1
- package/esm/vs/editor/contrib/find/browser/findModel.js +6 -6
- package/esm/vs/editor/contrib/find/browser/findWidget.js +40 -40
- package/esm/vs/editor/contrib/find/browser/findWidget.js.map +1 -1
- package/esm/vs/editor/contrib/folding/browser/folding.js +23 -23
- package/esm/vs/editor/contrib/folding/browser/foldingDecorations.js +9 -9
- package/esm/vs/editor/contrib/fontZoom/browser/fontZoom.js +3 -3
- package/esm/vs/editor/contrib/format/browser/formatActions.js +2 -2
- package/esm/vs/editor/contrib/gotoError/browser/gotoError.js +8 -8
- package/esm/vs/editor/contrib/gotoError/browser/gotoErrorWidget.js +14 -14
- package/esm/vs/editor/contrib/gotoSymbol/browser/goToCommands.js +39 -39
- package/esm/vs/editor/contrib/gotoSymbol/browser/link/clickLinkGesture.js +3 -3
- package/esm/vs/editor/contrib/gotoSymbol/browser/link/goToDefinitionAtPosition.js +2 -2
- package/esm/vs/editor/contrib/gotoSymbol/browser/peek/referencesController.js +4 -4
- package/esm/vs/editor/contrib/gotoSymbol/browser/peek/referencesController.js.map +1 -1
- package/esm/vs/editor/contrib/gotoSymbol/browser/peek/referencesTree.js +3 -3
- package/esm/vs/editor/contrib/gotoSymbol/browser/peek/referencesWidget.js +3 -3
- package/esm/vs/editor/contrib/gotoSymbol/browser/referencesModel.js +8 -8
- package/esm/vs/editor/contrib/gotoSymbol/browser/symbolNavigation.js +3 -3
- package/esm/vs/editor/contrib/gpu/browser/gpuActions.js +4 -4
- package/esm/vs/editor/contrib/hover/browser/contentHoverController.js +9 -3
- package/esm/vs/editor/contrib/hover/browser/contentHoverController.js.map +1 -1
- package/esm/vs/editor/contrib/hover/browser/glyphHoverController.js +2 -2
- package/esm/vs/editor/contrib/hover/browser/glyphHoverWidget.js +2 -1
- package/esm/vs/editor/contrib/hover/browser/glyphHoverWidget.js.map +1 -1
- package/esm/vs/editor/contrib/hover/browser/hoverActionIds.js +2 -2
- package/esm/vs/editor/contrib/hover/browser/hoverActions.js +24 -24
- package/esm/vs/editor/contrib/hover/browser/hoverCopyButton.js +2 -2
- package/esm/vs/editor/contrib/hover/browser/markdownHoverParticipant.js +10 -8
- package/esm/vs/editor/contrib/hover/browser/markdownHoverParticipant.js.map +1 -1
- package/esm/vs/editor/contrib/hover/browser/markerHoverParticipant.js +6 -6
- package/esm/vs/editor/contrib/inPlaceReplace/browser/inPlaceReplace.js +2 -2
- package/esm/vs/editor/contrib/indentation/browser/indentation.js +20 -20
- package/esm/vs/editor/contrib/inlayHints/browser/inlayHintsController.js +5 -5
- package/esm/vs/editor/contrib/inlayHints/browser/inlayHintsHover.js +9 -9
- package/esm/vs/editor/contrib/inlayHints/browser/inlayHintsLocations.js +3 -3
- package/esm/vs/editor/contrib/inlayHints/browser/inlayHintsLocations.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/commands.js +21 -21
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionContextKeys.js +13 -13
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionsController.js +7 -7
- package/esm/vs/editor/contrib/inlineCompletions/browser/hintsWidget/hoverParticipant.js +2 -2
- package/esm/vs/editor/contrib/inlineCompletions/browser/hintsWidget/inlineCompletionsHintsWidget.js +6 -5
- package/esm/vs/editor/contrib/inlineCompletions/browser/hintsWidget/inlineCompletionsHintsWidget.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.js +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/renameSymbolProcessor.js +2 -2
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.js +7 -7
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorMenu.js +6 -6
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorView.js +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsWordReplacementView.js +3 -3
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/theme.js +20 -20
- package/esm/vs/editor/contrib/insertFinalNewLine/browser/insertFinalNewLine.js +1 -1
- package/esm/vs/editor/contrib/lineSelection/browser/lineSelection.js +1 -1
- package/esm/vs/editor/contrib/linesOperations/browser/linesOperations.js +32 -32
- package/esm/vs/editor/contrib/linkedEditing/browser/linkedEditing.js +5 -4
- package/esm/vs/editor/contrib/linkedEditing/browser/linkedEditing.js.map +1 -1
- package/esm/vs/editor/contrib/links/browser/links.js +16 -15
- package/esm/vs/editor/contrib/links/browser/links.js.map +1 -1
- package/esm/vs/editor/contrib/longLinesHelper/browser/longLinesHelper.js +1 -1
- package/esm/vs/editor/contrib/message/browser/messageController.js +16 -12
- package/esm/vs/editor/contrib/message/browser/messageController.js.map +1 -1
- package/esm/vs/editor/contrib/middleScroll/browser/middleScrollController.js +1 -1
- package/esm/vs/editor/contrib/multicursor/browser/multicursor.js +91 -55
- package/esm/vs/editor/contrib/multicursor/browser/multicursor.js.map +1 -1
- package/esm/vs/editor/contrib/parameterHints/browser/parameterHints.js +1 -1
- package/esm/vs/editor/contrib/parameterHints/browser/parameterHintsModel.js +3 -3
- package/esm/vs/editor/contrib/parameterHints/browser/parameterHintsModel.js.map +1 -1
- package/esm/vs/editor/contrib/parameterHints/browser/parameterHintsWidget.js +6 -4
- package/esm/vs/editor/contrib/parameterHints/browser/parameterHintsWidget.js.map +1 -1
- package/esm/vs/editor/contrib/peekView/browser/peekView.js +18 -18
- package/esm/vs/editor/contrib/placeholderText/browser/placeholderText.contribution.js +1 -1
- package/esm/vs/editor/contrib/placeholderText/browser/placeholderTextContribution.js +1 -1
- package/esm/vs/editor/contrib/quickAccess/browser/editorNavigationQuickAccess.js +1 -1
- package/esm/vs/editor/contrib/quickAccess/browser/gotoLineQuickAccess.js +12 -12
- package/esm/vs/editor/contrib/quickAccess/browser/gotoSymbolQuickAccess.js +32 -32
- package/esm/vs/editor/contrib/readOnlyMessage/browser/contribution.js +3 -3
- package/esm/vs/editor/contrib/rename/browser/rename.js +11 -11
- package/esm/vs/editor/contrib/rename/browser/renameWidget.js +7 -7
- package/esm/vs/editor/contrib/sectionHeaders/browser/sectionHeaders.js +6 -6
- package/esm/vs/editor/contrib/semanticTokens/browser/documentSemanticTokens.js +23 -13
- package/esm/vs/editor/contrib/semanticTokens/browser/documentSemanticTokens.js.map +1 -1
- package/esm/vs/editor/contrib/smartSelect/browser/smartSelect.js +5 -5
- package/esm/vs/editor/contrib/snippet/browser/snippetController2.js +5 -5
- package/esm/vs/editor/contrib/snippet/browser/snippetSession.js +2 -2
- package/esm/vs/editor/contrib/snippet/browser/snippetVariables.js +4 -4
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollActions.js +11 -11
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollController.js +10 -8
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollController.js.map +1 -1
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollModelProvider.js +1 -1
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollProvider.js +2 -2
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollWidget.js +6 -6
- package/esm/vs/editor/contrib/suggest/browser/suggest.js +9 -9
- package/esm/vs/editor/contrib/suggest/browser/suggestController.js +15 -15
- package/esm/vs/editor/contrib/suggest/browser/suggestInlineCompletions.js +2 -2
- package/esm/vs/editor/contrib/suggest/browser/suggestModel.js +11 -11
- package/esm/vs/editor/contrib/suggest/browser/suggestWidget.js +27 -27
- package/esm/vs/editor/contrib/suggest/browser/suggestWidgetDetails.js +8 -6
- package/esm/vs/editor/contrib/suggest/browser/suggestWidgetDetails.js.map +1 -1
- package/esm/vs/editor/contrib/suggest/browser/suggestWidgetRenderer.js +5 -5
- package/esm/vs/editor/contrib/suggest/browser/wordContextKey.js +3 -3
- package/esm/vs/editor/contrib/suggest/browser/wordDistance.js +1 -1
- package/esm/vs/editor/contrib/symbolIcons/browser/symbolIcons.js +33 -33
- package/esm/vs/editor/contrib/toggleTabFocusMode/browser/toggleTabFocusMode.js +4 -4
- package/esm/vs/editor/contrib/tokenization/browser/tokenization.js +1 -1
- package/esm/vs/editor/contrib/unicodeHighlighter/browser/bannerController.js +1 -1
- package/esm/vs/editor/contrib/unicodeHighlighter/browser/unicodeHighlighter.js +27 -27
- package/esm/vs/editor/contrib/unusualLineTerminators/browser/unusualLineTerminators.js +9 -9
- package/esm/vs/editor/contrib/wordHighlighter/browser/highlightDecorations.js +9 -9
- package/esm/vs/editor/contrib/wordHighlighter/browser/textualHighlightProvider.js +1 -1
- package/esm/vs/editor/contrib/wordHighlighter/browser/textualHighlightProvider.js.map +1 -1
- package/esm/vs/editor/contrib/wordHighlighter/browser/wordHighlighter.js +50 -14
- package/esm/vs/editor/contrib/wordHighlighter/browser/wordHighlighter.js.map +1 -1
- package/esm/vs/editor/contrib/wordOperations/browser/wordOperations.js +6 -6
- package/esm/vs/editor/editor.api.d.ts +133 -98
- package/esm/vs/editor/standalone/browser/iPadShowKeyboard/iPadShowKeyboard.js +1 -1
- package/esm/vs/editor/standalone/browser/quickInput/standaloneQuickInputService.js +5 -3
- package/esm/vs/editor/standalone/browser/quickInput/standaloneQuickInputService.js.map +1 -1
- package/esm/vs/editor/standalone/browser/standaloneCodeEditor.js +15 -1
- package/esm/vs/editor/standalone/browser/standaloneCodeEditor.js.map +1 -1
- package/esm/vs/nls.js.map +1 -1
- package/esm/vs/platform/accessibilitySignal/browser/accessibilitySignalService.js +72 -66
- package/esm/vs/platform/accessibilitySignal/browser/accessibilitySignalService.js.map +1 -1
- package/esm/vs/platform/action/common/actionCommonCategories.js +6 -6
- package/esm/vs/platform/actionWidget/browser/actionList.js +434 -136
- package/esm/vs/platform/actionWidget/browser/actionList.js.map +1 -1
- package/esm/vs/platform/actionWidget/browser/actionWidget.css +74 -4
- package/esm/vs/platform/actionWidget/browser/actionWidget.js +24 -26
- package/esm/vs/platform/actionWidget/browser/actionWidget.js.map +1 -1
- package/esm/vs/platform/actionWidget/browser/actionWidgetMotion.js +16 -0
- package/esm/vs/platform/actionWidget/browser/actionWidgetMotion.js.map +1 -0
- package/esm/vs/platform/actions/browser/menuEntryActionViewItem.js +15 -17
- package/esm/vs/platform/actions/browser/menuEntryActionViewItem.js.map +1 -1
- package/esm/vs/platform/actions/browser/toolbar.js +25 -12
- package/esm/vs/platform/actions/browser/toolbar.js.map +1 -1
- package/esm/vs/platform/actions/common/actions.js +4 -2
- package/esm/vs/platform/actions/common/actions.js.map +1 -1
- package/esm/vs/platform/actions/common/menuService.js +15 -8
- package/esm/vs/platform/actions/common/menuService.js.map +1 -1
- package/esm/vs/platform/configuration/common/configuration.js +3 -1
- package/esm/vs/platform/configuration/common/configuration.js.map +1 -1
- package/esm/vs/platform/configuration/common/configurationModels.js +16 -11
- package/esm/vs/platform/configuration/common/configurationModels.js.map +1 -1
- package/esm/vs/platform/configuration/common/configurationRegistry.js +29 -27
- package/esm/vs/platform/configuration/common/configurationRegistry.js.map +1 -1
- package/esm/vs/platform/configuration/common/configurations.js +13 -1
- package/esm/vs/platform/configuration/common/configurations.js.map +1 -1
- package/esm/vs/platform/contextkey/browser/contextKeyService.js +2 -2
- package/esm/vs/platform/contextkey/browser/contextKeyService.js.map +1 -1
- package/esm/vs/platform/contextkey/common/contextkey.js +28 -14
- package/esm/vs/platform/contextkey/common/contextkey.js.map +1 -1
- package/esm/vs/platform/contextkey/common/contextkeys.js +10 -10
- package/esm/vs/platform/contextkey/common/scanner.js +5 -5
- package/esm/vs/platform/contextview/browser/contextMenuHandler.js +17 -4
- package/esm/vs/platform/contextview/browser/contextMenuHandler.js.map +1 -1
- package/esm/vs/platform/contextview/browser/contextMenuService.js +1 -1
- package/esm/vs/platform/contextview/browser/contextMenuService.js.map +1 -1
- package/esm/vs/platform/contextview/browser/contextView.js.map +1 -1
- package/esm/vs/platform/contextview/browser/contextViewService.js +7 -2
- package/esm/vs/platform/contextview/browser/contextViewService.js.map +1 -1
- package/esm/vs/platform/editor/common/editor.js +17 -0
- package/esm/vs/platform/editor/common/editor.js.map +1 -1
- package/esm/vs/platform/history/browser/contextScopedHistoryWidget.js +1 -1
- package/esm/vs/platform/hover/browser/hoverService.js +6 -3
- package/esm/vs/platform/hover/browser/hoverService.js.map +1 -1
- package/esm/vs/platform/hover/browser/hoverWidget.js +38 -6
- package/esm/vs/platform/hover/browser/hoverWidget.js.map +1 -1
- package/esm/vs/platform/hover/browser/updatableHoverWidget.js +32 -5
- package/esm/vs/platform/hover/browser/updatableHoverWidget.js.map +1 -1
- package/esm/vs/platform/instantiation/common/instantiationService.js +1 -1
- package/esm/vs/platform/instantiation/common/instantiationService.js.map +1 -1
- package/esm/vs/platform/keybinding/common/abstractKeybindingService.js +5 -5
- package/esm/vs/platform/keybinding/common/keybindingResolver.js +1 -1
- package/esm/vs/platform/keybinding/common/keybindingResolver.js.map +1 -1
- package/esm/vs/platform/list/browser/listService.js +27 -27
- package/esm/vs/platform/markers/common/markerService.js +11 -8
- package/esm/vs/platform/markers/common/markerService.js.map +1 -1
- package/esm/vs/platform/markers/common/markers.js +6 -6
- package/esm/vs/platform/markers/common/markers.js.map +1 -1
- package/esm/vs/platform/notification/common/notification.js.map +1 -1
- package/esm/vs/platform/notification/common/notificationMessage.js +37 -0
- package/esm/vs/platform/notification/common/notificationMessage.js.map +1 -0
- package/esm/vs/platform/opener/common/opener.js.map +1 -1
- package/esm/vs/platform/progress/common/progress.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/commandsQuickAccess.js +8 -8
- package/esm/vs/platform/quickinput/browser/helpQuickAccess.js +1 -1
- package/esm/vs/platform/quickinput/browser/media/quickInput.css +33 -2
- package/esm/vs/platform/quickinput/browser/quickAccess.js +7 -4
- package/esm/vs/platform/quickinput/browser/quickAccess.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/quickInput.js +10 -10
- package/esm/vs/platform/quickinput/browser/quickInputActions.js +5 -5
- package/esm/vs/platform/quickinput/browser/quickInputController.js +65 -15
- package/esm/vs/platform/quickinput/browser/quickInputController.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/quickInputList.js +96 -90
- package/esm/vs/platform/quickinput/browser/quickInputList.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/quickInputService.js +5 -7
- package/esm/vs/platform/quickinput/browser/quickInputService.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/quickInputUtils.js +1 -1
- package/esm/vs/platform/quickinput/browser/tree/quickInputTreeAccessibilityProvider.js +1 -1
- package/esm/vs/platform/quickinput/browser/tree/quickTree.js +1 -1
- package/esm/vs/platform/quickinput/common/quickAccess.js.map +1 -1
- package/esm/vs/platform/quickinput/common/quickInput.js.map +1 -1
- package/esm/vs/platform/storage/common/storage.js.map +1 -1
- package/esm/vs/platform/theme/common/colorRegistry.js +1 -0
- package/esm/vs/platform/theme/common/colorRegistry.js.map +1 -1
- package/esm/vs/platform/theme/common/colorUtils.js +11 -3
- package/esm/vs/platform/theme/common/colorUtils.js.map +1 -1
- package/esm/vs/platform/theme/common/colors/baseColors.js +19 -19
- package/esm/vs/platform/theme/common/colors/chartsColors.js +8 -9
- package/esm/vs/platform/theme/common/colors/chartsColors.js.map +1 -1
- package/esm/vs/platform/theme/common/colors/confettiColors.js +14 -0
- package/esm/vs/platform/theme/common/colors/confettiColors.js.map +1 -0
- package/esm/vs/platform/theme/common/colors/editorColors.js +95 -95
- package/esm/vs/platform/theme/common/colors/inputColors.js +48 -48
- package/esm/vs/platform/theme/common/colors/inputColors.js.map +1 -1
- package/esm/vs/platform/theme/common/colors/listColors.js +36 -36
- package/esm/vs/platform/theme/common/colors/menuColors.js +7 -7
- package/esm/vs/platform/theme/common/colors/minimapColors.js +13 -13
- package/esm/vs/platform/theme/common/colors/minimapColors.js.map +1 -1
- package/esm/vs/platform/theme/common/colors/miscColors.js +16 -16
- package/esm/vs/platform/theme/common/colors/quickpickColors.js +10 -10
- package/esm/vs/platform/theme/common/colors/searchColors.js +3 -3
- package/esm/vs/platform/theme/common/iconRegistry.js +6 -6
- package/esm/vs/platform/undoRedo/common/undoRedoService.js +20 -20
- package/esm/vs/platform/workspace/common/workspace.js +1 -1
- package/monaco.d.ts +133 -98
- package/package.json +3 -3
- package/version.txt +1 -1
|
@@ -151,7 +151,7 @@ let HideUnchangedRegionsFeature = class HideUnchangedRegionsFeature extends Disp
|
|
|
151
151
|
const unchangedLinesDecorationShow = {
|
|
152
152
|
description: 'Fold Unchanged',
|
|
153
153
|
glyphMarginHoverMessage: new MarkdownString(undefined, { isTrusted: true, supportThemeIcons: true })
|
|
154
|
-
.appendMarkdown(localize(
|
|
154
|
+
.appendMarkdown(localize(140, 'Fold Unchanged Region')),
|
|
155
155
|
glyphMarginClassName: 'fold-unchanged ' + ThemeIcon.asClassName(Codicon.fold),
|
|
156
156
|
zIndex: 10001,
|
|
157
157
|
};
|
|
@@ -258,7 +258,7 @@ class CompactCollapsedCodeOverlayWidget extends ViewZoneOverlayWidget {
|
|
|
258
258
|
/** @description update labels */
|
|
259
259
|
if (!this._hide) {
|
|
260
260
|
const lineCount = this._unchangedRegion.getHiddenModifiedRange(reader).length;
|
|
261
|
-
const linesHiddenText = localize(
|
|
261
|
+
const linesHiddenText = localize(141, '{0} hidden lines', lineCount);
|
|
262
262
|
this._nodes.text.innerText = linesHiddenText;
|
|
263
263
|
}
|
|
264
264
|
}));
|
|
@@ -279,16 +279,16 @@ let CollapsedCodeOverlayWidget = class CollapsedCodeOverlayWidget extends ViewZo
|
|
|
279
279
|
this._compactControl = _compactControl;
|
|
280
280
|
this._hoverService = _hoverService;
|
|
281
281
|
this._nodes = h('div.diff-hidden-lines', [
|
|
282
|
-
h('div.top@top', { title: localize(
|
|
282
|
+
h('div.top@top', { title: localize(142, 'Click or drag to show more above') }),
|
|
283
283
|
h('div.center@content', { style: { display: 'flex' } }, [
|
|
284
284
|
h('div.disclosure-toggle@toggle'),
|
|
285
285
|
h('div.first@first', { style: { display: 'flex', alignItems: 'center', flexShrink: '0' } }, [
|
|
286
286
|
h('span.line-number-control@lineNumberControl', { 'aria-hidden': 'true' }),
|
|
287
|
-
$('a.default-control', { title: localize(
|
|
287
|
+
$('a.default-control', { title: localize(143, 'Show Unchanged Region'), role: 'button', onclick: () => { this._unchangedRegion.showAll(undefined); } }, ...renderLabelWithIcons('$(unfold)'))
|
|
288
288
|
]),
|
|
289
289
|
h('div.content-row@others', { style: { display: 'flex', justifyContent: 'center', alignItems: 'center' } }),
|
|
290
290
|
]),
|
|
291
|
-
h('div.bottom@bottom', { title: localize(
|
|
291
|
+
h('div.bottom@bottom', { title: localize(144, 'Click or drag to show more below'), role: 'button' }),
|
|
292
292
|
]);
|
|
293
293
|
root.root.appendChild(this._nodes.root);
|
|
294
294
|
this._nodes.root.classList.toggle('diff-hidden-lines-disclosure', this._compactControl);
|
|
@@ -328,8 +328,8 @@ let CollapsedCodeOverlayWidget = class CollapsedCodeOverlayWidget extends ViewZo
|
|
|
328
328
|
const isFullyRevealed = this._unchangedRegion.visibleLineCountTop.read(reader) + this._unchangedRegion.visibleLineCountBottom.read(reader) === this._unchangedRegion.lineCount;
|
|
329
329
|
if (this._compactControl && !this._hide) {
|
|
330
330
|
const actionLabel = isFullyRevealed
|
|
331
|
-
? localize(
|
|
332
|
-
: localize(
|
|
331
|
+
? localize(145, 'Collapse unchanged lines')
|
|
332
|
+
: localize(146, 'Show {0} hidden lines', this._unchangedRegion.getHiddenModifiedRange(reader).length);
|
|
333
333
|
this._nodes.toggle.setAttribute('aria-expanded', String(isFullyRevealed));
|
|
334
334
|
this._nodes.toggle.setAttribute('aria-label', actionLabel);
|
|
335
335
|
reset(this._nodes.lineNumberControl, ...renderLabelWithIcons(isFullyRevealed ? '$(fold)' : '$(unfold)'));
|
|
@@ -438,8 +438,8 @@ let CollapsedCodeOverlayWidget = class CollapsedCodeOverlayWidget extends ViewZo
|
|
|
438
438
|
if (!this._hide) {
|
|
439
439
|
const isFullyRevealed = this._isFullyRevealed(reader);
|
|
440
440
|
const lineCount = _unchangedRegion.getHiddenModifiedRange(reader).length;
|
|
441
|
-
const linesHiddenText = localize(
|
|
442
|
-
const span = $('span', this._compactControl ? undefined : { title: localize(
|
|
441
|
+
const linesHiddenText = localize(147, '{0} hidden lines', lineCount);
|
|
442
|
+
const span = $('span', this._compactControl ? undefined : { title: localize(148, 'Double click to unfold') }, this._compactControl && isFullyRevealed ? localize(149, 'Collapse unchanged lines') : linesHiddenText);
|
|
443
443
|
if (!this._compactControl) {
|
|
444
444
|
reader.store.add(addDisposableListener(span, EventType.DBLCLICK, e => {
|
|
445
445
|
if (e.button !== 0) {
|
|
@@ -474,7 +474,7 @@ let CollapsedCodeOverlayWidget = class CollapsedCodeOverlayWidget extends ViewZo
|
|
|
474
474
|
};
|
|
475
475
|
reader.store.add(addDisposableListener(divItem, EventType.CLICK, revealBreadcrumb));
|
|
476
476
|
if (this._compactControl) {
|
|
477
|
-
const label = localize(
|
|
477
|
+
const label = localize(150, 'Go to {0}', item.name);
|
|
478
478
|
divItem.tabIndex = 0;
|
|
479
479
|
divItem.setAttribute('role', 'button');
|
|
480
480
|
divItem.setAttribute('aria-label', label);
|
|
@@ -244,10 +244,10 @@ class MovedBlockOverlayWidget extends ViewZoneOverlayWidget {
|
|
|
244
244
|
}));
|
|
245
245
|
let text;
|
|
246
246
|
if (_move.changes.length > 0) {
|
|
247
|
-
text = this._kind === 'original' ? localize(
|
|
247
|
+
text = this._kind === 'original' ? localize(151, 'Code moved with changes to line {0}-{1}', this._move.lineRangeMapping.modified.startLineNumber, this._move.lineRangeMapping.modified.endLineNumberExclusive - 1) : localize(152, 'Code moved with changes from line {0}-{1}', this._move.lineRangeMapping.original.startLineNumber, this._move.lineRangeMapping.original.endLineNumberExclusive - 1);
|
|
248
248
|
}
|
|
249
249
|
else {
|
|
250
|
-
text = this._kind === 'original' ? localize(
|
|
250
|
+
text = this._kind === 'original' ? localize(153, 'Code moved to line {0}-{1}', this._move.lineRangeMapping.modified.startLineNumber, this._move.lineRangeMapping.modified.endLineNumberExclusive - 1) : localize(154, 'Code moved from line {0}-{1}', this._move.lineRangeMapping.original.startLineNumber, this._move.lineRangeMapping.original.endLineNumberExclusive - 1);
|
|
251
251
|
}
|
|
252
252
|
const actionBar = this._register(new ActionBar(this._nodes.actionBar, {
|
|
253
253
|
highlightToggledItems: true,
|
|
@@ -132,7 +132,7 @@ let OverviewRulerFeature = class OverviewRulerFeature extends Disposable {
|
|
|
132
132
|
});
|
|
133
133
|
const scrollTop = this._editors.modifiedScrollTop.read(reader);
|
|
134
134
|
const scrollHeight = this._editors.modifiedScrollHeight.read(reader);
|
|
135
|
-
const scrollBarOptions = this._editors.modified.getOption(
|
|
135
|
+
const scrollBarOptions = this._editors.modified.getOption(119 /* EditorOption.scrollbar */);
|
|
136
136
|
const state = new ScrollbarState(scrollBarOptions.verticalHasArrows ? scrollBarOptions.arrowSize : 0, scrollBarOptions.verticalScrollbarSize, 0, layoutInfo.height, scrollHeight, scrollTop);
|
|
137
137
|
viewportDomElement.setTop(state.getSliderPosition());
|
|
138
138
|
viewportDomElement.setHeight(state.getSliderSize());
|
|
@@ -95,8 +95,8 @@ export class RevertButton extends Disposable {
|
|
|
95
95
|
this._id = `revertButton${RevertButton.counter++}`;
|
|
96
96
|
this._domNode = h('div.revertButton', {
|
|
97
97
|
title: this._revertSelection
|
|
98
|
-
? localize(
|
|
99
|
-
: localize(
|
|
98
|
+
? localize(155, 'Revert Selected Changes')
|
|
99
|
+
: localize(156, 'Revert Change')
|
|
100
100
|
}, [renderIcon(Codicon.arrowRight)]).root;
|
|
101
101
|
this._register(addDisposableListener(this._domNode, EventType.MOUSE_DOWN, e => {
|
|
102
102
|
// don't prevent context menu from showing up
|
|
@@ -8,11 +8,11 @@ import { ModelDecorationOptions } from '../../../common/model/textModel.js';
|
|
|
8
8
|
import { localize } from '../../../../nls.js';
|
|
9
9
|
import { registerColor } from '../../../../platform/theme/common/colorRegistry.js';
|
|
10
10
|
import { registerIcon } from '../../../../platform/theme/common/iconRegistry.js';
|
|
11
|
-
export const diffMoveBorder = registerColor('diffEditor.move.border', '#8b8b8b9c', localize(
|
|
12
|
-
export const diffMoveBorderActive = registerColor('diffEditor.moveActive.border', '#FFA500', localize(
|
|
13
|
-
export const diffEditorUnchangedRegionShadow = registerColor('diffEditor.unchangedRegionShadow', { dark: '#000000', light: '#737373BF', hcDark: '#000000', hcLight: '#737373BF', }, localize(
|
|
14
|
-
export const diffInsertIcon = registerIcon('diff-insert', Codicon.add, localize(
|
|
15
|
-
export const diffRemoveIcon = registerIcon('diff-remove', Codicon.remove, localize(
|
|
11
|
+
export const diffMoveBorder = registerColor('diffEditor.move.border', '#8b8b8b9c', localize(157, 'The border color for text that got moved in the diff editor.'));
|
|
12
|
+
export const diffMoveBorderActive = registerColor('diffEditor.moveActive.border', '#FFA500', localize(158, 'The active border color for text that got moved in the diff editor.'));
|
|
13
|
+
export const diffEditorUnchangedRegionShadow = registerColor('diffEditor.unchangedRegionShadow', { dark: '#000000', light: '#737373BF', hcDark: '#000000', hcLight: '#737373BF', }, localize(159, 'The color of the shadow around unchanged region widgets.'));
|
|
14
|
+
export const diffInsertIcon = registerIcon('diff-insert', Codicon.add, localize(160, 'Line decoration for inserts in the diff editor.'));
|
|
15
|
+
export const diffRemoveIcon = registerIcon('diff-remove', Codicon.remove, localize(161, 'Line decoration for removals in the diff editor.'));
|
|
16
16
|
export const diffLineAddDecorationBackgroundWithIndicator = ModelDecorationOptions.register({
|
|
17
17
|
className: 'line-insert',
|
|
18
18
|
description: 'line-insert',
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { localize } from '../../../../nls.js';
|
|
6
6
|
import { registerColor, editorBackground } from '../../../../platform/theme/common/colorRegistry.js';
|
|
7
|
-
export const multiDiffEditorHeaderBackground = registerColor('multiDiffEditor.headerBackground', { dark: '#262626', light: 'tab.inactiveBackground', hcDark: 'tab.inactiveBackground', hcLight: 'tab.inactiveBackground', }, localize(
|
|
8
|
-
export const multiDiffEditorBackground = registerColor('multiDiffEditor.background', editorBackground, localize(
|
|
9
|
-
export const multiDiffEditorBorder = registerColor('multiDiffEditor.border', { dark: 'sideBarSectionHeader.border', light: '#cccccc', hcDark: 'sideBarSectionHeader.border', hcLight: '#cccccc', }, localize(
|
|
7
|
+
export const multiDiffEditorHeaderBackground = registerColor('multiDiffEditor.headerBackground', { dark: '#262626', light: 'tab.inactiveBackground', hcDark: 'tab.inactiveBackground', hcLight: 'tab.inactiveBackground', }, localize(162, 'The background color of the diff editor\'s header'));
|
|
8
|
+
export const multiDiffEditorBackground = registerColor('multiDiffEditor.background', editorBackground, localize(163, 'The background color of the multi file diff editor'));
|
|
9
|
+
export const multiDiffEditorBorder = registerColor('multiDiffEditor.border', { dark: 'sideBarSectionHeader.border', light: '#cccccc', hcDark: 'sideBarSectionHeader.border', hcLight: '#cccccc', }, localize(164, 'The border color of the multi file diff editor'));
|
|
10
10
|
//# sourceMappingURL=colors.js.map
|
|
@@ -108,7 +108,7 @@ export function createAnchoredSizeEditBatch(fromRevision, toRevision, oldItemHei
|
|
|
108
108
|
anchor: { revision: fromRevision, offset: anchorOffset },
|
|
109
109
|
};
|
|
110
110
|
}
|
|
111
|
-
export function mapLogicalPosition(position, edit) {
|
|
111
|
+
export function mapLogicalPosition(position, edit, removedPositionAffinity = 'itemStart') {
|
|
112
112
|
if (position.revision !== edit.fromRevision) {
|
|
113
113
|
throw new BugIndicatingError(`Cannot map layout revision ${position.revision} through revision ${edit.fromRevision}`);
|
|
114
114
|
}
|
|
@@ -121,7 +121,7 @@ export function mapLogicalPosition(position, edit) {
|
|
|
121
121
|
const relativeOffset = position.offset - sizeEdit.oldRange.start;
|
|
122
122
|
mappedOffset = relativeOffset < sizeEdit.newRange.length
|
|
123
123
|
? sizeEdit.newRange.start + relativeOffset
|
|
124
|
-
: sizeEdit.newRange.start;
|
|
124
|
+
: removedPositionAffinity === 'itemEnd' ? sizeEdit.newRange.endExclusive : sizeEdit.newRange.start;
|
|
125
125
|
return { revision: edit.toRevision, offset: mappedOffset };
|
|
126
126
|
}
|
|
127
127
|
mappedOffset = position.offset + sizeEdit.newRange.endExclusive - sizeEdit.oldRange.endExclusive;
|
package/esm/vs/editor/browser/widget/multiDiffEditor/compressedVirtualizedScrollLayout.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/browser/widget/multiDiffEditor/compressedVirtualizedScrollLayout.ts","vs/editor/browser/widget/multiDiffEditor/compressedVirtualizedScrollLayout.ts"],"names":[],"mappings":"AAAA;;;gGA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ACD,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC,GAAG,OAAO,GAAG,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACxG,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAY,EAAE,KAAa;IACrD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QAC1C,MAAM,IAAI,kBAAkB,CAAC,GAAG,IAAI,8CAA8C,KAAK,EAAE,CAAC,CAAC;IAC5F,CAAC;AACF,CAAC","file":"compressedVirtualizedScrollLayout.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 } from '../../../../base/common/errors.js';\nimport { OffsetRange } from '../../../common/core/ranges/offsetRange.js';\n\nexport type CompressedVirtualizedItemVisibility = 'before' | 'visible' | 'after';\n\nexport interface ICompressedVirtualizedItemLayout {\n\t/** Complete item range in outer scroll coordinates. */\n\treadonly contentRange: OffsetRange;\n\t/** Item range in the compressed rendered coordinate system. */\n\treadonly renderedRange: OffsetRange;\n\t/** Height removed from the rendered row and represented by item-local scrolling. */\n\treadonly maxScrollOffset: number;\n\t/**\n\t * Item-local scroll coordinates:\n\t *\n\t * 0 ---------------------------- maxScrollOffset\n\t * item begins item end is aligned\n\t */\n\treadonly scrollOffset: number;\n\treadonly visibility: CompressedVirtualizedItemVisibility;\n}\n\nexport interface ICompressedVirtualizedScrollLayout {\n\treadonly revision: LayoutRevision;\n\t/** Clamped position in the complete outer scroll coordinates. */\n\treadonly scrollTop: number;\n\t/** Complete height of the logical item content, excluding transient scroll slack. */\n\treadonly logicalScrollHeight: number;\n\t/** Complete height of all items and inter-item gaps. */\n\treadonly scrollHeight: number;\n\treadonly leadingScrollSlack: number;\n\treadonly trailingScrollSlack: number;\n\t/** Height occupied by the compressed item rows and inter-item gaps. */\n\treadonly renderedHeight: number;\n\treadonly contentViewport: OffsetRange;\n\treadonly renderedViewport: OffsetRange;\n\t/** Full-content height above the viewport represented by item-local scrolling instead of DOM movement. */\n\treadonly hiddenContentHeightAboveViewport: number;\n\treadonly items: readonly ICompressedVirtualizedItemLayout[];\n}\n\nexport interface ICompressedVirtualizedScrollLayoutInput {\n\treadonly revision?: LayoutRevision;\n\treadonly scrollTop: number;\n\treadonly viewportHeight: number;\n\treadonly itemGap: number;\n\treadonly itemHeights: readonly number[];\n\treadonly leadingScrollSlack?: number;\n\treadonly trailingScrollSlack?: number;\n}\n\nexport type LayoutRevision = number & { readonly _brand: 'LayoutRevision' };\n\nexport interface ILogicalPosition {\n\treadonly revision: LayoutRevision;\n\treadonly offset: number;\n}\n\nexport interface ISizeEdit {\n\treadonly oldRange: OffsetRange;\n\treadonly newRange: OffsetRange;\n}\n\nexport interface IAnchoredSizeEditBatch {\n\treadonly fromRevision: LayoutRevision;\n\treadonly toRevision: LayoutRevision;\n\treadonly edits: readonly ISizeEdit[];\n\treadonly anchor: ILogicalPosition;\n}\n\nexport function asLayoutRevision(value: number): LayoutRevision {\n\treturn value as LayoutRevision;\n}\n\n/**\n * Computes the complete and compressed vertical layout of a virtualized list.\n */\nexport function computeCompressedVirtualizedScrollLayout(input: ICompressedVirtualizedScrollLayoutInput): ICompressedVirtualizedScrollLayout {\n\tassertNonNegative('viewportHeight', input.viewportHeight);\n\tconst leadingScrollSlack = input.leadingScrollSlack ?? 0;\n\tconst trailingScrollSlack = input.trailingScrollSlack ?? 0;\n\tassertNonNegative('leadingScrollSlack', leadingScrollSlack);\n\tassertNonNegative('trailingScrollSlack', trailingScrollSlack);\n\tconst logicalScrollHeight = computeCompressedVirtualizedScrollHeight(input.itemHeights, input.itemGap);\n\tconst scrollHeight = leadingScrollSlack + logicalScrollHeight + trailingScrollSlack;\n\tconst maxScrollTop = Math.max(0, scrollHeight - input.viewportHeight);\n\tconst scrollTop = Math.max(0, Math.min(input.scrollTop, maxScrollTop));\n\tconst contentViewport = OffsetRange.ofStartAndLength(scrollTop - leadingScrollSlack, input.viewportHeight);\n\n\tlet contentTop = 0;\n\tlet renderedTop = leadingScrollSlack;\n\tlet hiddenContentHeightAboveViewport = 0;\n\tconst items: ICompressedVirtualizedItemLayout[] = [];\n\n\tfor (let index = 0; index < input.itemHeights.length; index++) {\n\t\tconst fullHeight = input.itemHeights[index];\n\t\tconst renderedHeight = Math.min(fullHeight, input.viewportHeight);\n\t\tconst maxScrollOffset = fullHeight - renderedHeight;\n\t\tconst contentRange = OffsetRange.ofStartAndLength(contentTop, fullHeight);\n\t\tconst renderedRange = OffsetRange.ofStartAndLength(renderedTop, renderedHeight);\n\n\t\tlet visibility: CompressedVirtualizedItemVisibility;\n\t\tlet scrollOffset: number;\n\t\tif (contentRange.isBefore(contentViewport)) {\n\t\t\tvisibility = 'before';\n\t\t\tscrollOffset = maxScrollOffset;\n\t\t} else if (contentRange.isAfter(contentViewport)) {\n\t\t\tvisibility = 'after';\n\t\t\tscrollOffset = 0;\n\t\t} else {\n\t\t\tvisibility = 'visible';\n\t\t\tscrollOffset = Math.max(0, Math.min(contentViewport.start - contentRange.start, maxScrollOffset));\n\t\t}\n\n\t\thiddenContentHeightAboveViewport += scrollOffset;\n\t\titems.push({\n\t\t\tcontentRange,\n\t\t\trenderedRange,\n\t\t\tmaxScrollOffset,\n\t\t\tscrollOffset,\n\t\t\tvisibility,\n\t\t});\n\n\t\tif (index < input.itemHeights.length - 1) {\n\t\t\tcontentTop += fullHeight + input.itemGap;\n\t\t\trenderedTop += renderedHeight + input.itemGap;\n\t\t} else {\n\t\t\tcontentTop += fullHeight;\n\t\t\trenderedTop += renderedHeight;\n\t\t}\n\t}\n\n\tconst renderedScrollTop = scrollTop - hiddenContentHeightAboveViewport;\n\treturn {\n\t\trevision: input.revision ?? asLayoutRevision(0),\n\t\tscrollTop,\n\t\tlogicalScrollHeight,\n\t\tscrollHeight,\n\t\tleadingScrollSlack,\n\t\ttrailingScrollSlack,\n\t\trenderedHeight: renderedTop + trailingScrollSlack,\n\t\tcontentViewport,\n\t\trenderedViewport: OffsetRange.ofStartAndLength(renderedScrollTop, input.viewportHeight),\n\t\thiddenContentHeightAboveViewport,\n\t\titems,\n\t};\n}\n\nexport function computeItemRanges(itemHeights: readonly number[], itemGap: number): readonly OffsetRange[] {\n\tassertNonNegative('itemGap', itemGap);\n\tconst ranges: OffsetRange[] = [];\n\tlet offset = 0;\n\tfor (let index = 0; index < itemHeights.length; index++) {\n\t\tconst height = itemHeights[index];\n\t\tassertNonNegative(`itemHeights[${index}]`, height);\n\t\tranges.push(OffsetRange.ofStartAndLength(offset, height));\n\t\toffset += height + (index < itemHeights.length - 1 ? itemGap : 0);\n\t}\n\treturn ranges;\n}\n\nexport function createAnchoredSizeEditBatch(\n\tfromRevision: LayoutRevision,\n\ttoRevision: LayoutRevision,\n\toldItemHeights: readonly number[],\n\tnewItemHeights: readonly number[],\n\toldItemGap: number,\n\tnewItemGap: number,\n\tanchorOffset: number,\n): IAnchoredSizeEditBatch {\n\tif (oldItemHeights.length !== newItemHeights.length) {\n\t\tthrow new BugIndicatingError('Size edits require stable item identity and ordering');\n\t}\n\tconst oldRanges = computeItemRanges(oldItemHeights, oldItemGap);\n\tconst newRanges = computeItemRanges(newItemHeights, newItemGap);\n\tconst edits: ISizeEdit[] = [];\n\tfor (let index = 0; index < oldRanges.length; index++) {\n\t\tif (!oldRanges[index].equals(newRanges[index])) {\n\t\t\tedits.push({ oldRange: oldRanges[index], newRange: newRanges[index] });\n\t\t}\n\t}\n\treturn {\n\t\tfromRevision,\n\t\ttoRevision,\n\t\tedits,\n\t\tanchor: { revision: fromRevision, offset: anchorOffset },\n\t};\n}\n\nexport function mapLogicalPosition(position: ILogicalPosition, edit: IAnchoredSizeEditBatch): ILogicalPosition {\n\tif (position.revision !== edit.fromRevision) {\n\t\tthrow new BugIndicatingError(`Cannot map layout revision ${position.revision} through revision ${edit.fromRevision}`);\n\t}\n\tlet mappedOffset = position.offset;\n\tfor (const sizeEdit of edit.edits) {\n\t\tif (position.offset < sizeEdit.oldRange.start) {\n\t\t\tbreak;\n\t\t}\n\t\tif (sizeEdit.oldRange.contains(position.offset)) {\n\t\t\tconst relativeOffset = position.offset - sizeEdit.oldRange.start;\n\t\t\tmappedOffset = relativeOffset < sizeEdit.newRange.length\n\t\t\t\t? sizeEdit.newRange.start + relativeOffset\n\t\t\t\t: sizeEdit.newRange.start;\n\t\t\treturn { revision: edit.toRevision, offset: mappedOffset };\n\t\t}\n\t\tmappedOffset = position.offset + sizeEdit.newRange.endExclusive - sizeEdit.oldRange.endExclusive;\n\t}\n\treturn { revision: edit.toRevision, offset: mappedOffset };\n}\n\nexport function computeCompressedVirtualizedScrollHeight(itemHeights: readonly number[], itemGap: number): number {\n\tassertNonNegative('itemGap', itemGap);\n\tfor (let i = 0; i < itemHeights.length; i++) {\n\t\tassertNonNegative(`itemHeights[${i}]`, itemHeights[i]);\n\t}\n\tif (itemHeights.length === 0) {\n\t\treturn 0;\n\t}\n\treturn itemHeights.reduce((result, height) => result + height, 0) + itemGap * (itemHeights.length - 1);\n}\n\nfunction assertNonNegative(name: string, value: number): void {\n\tif (!Number.isFinite(value) || value < 0) {\n\t\tthrow new BugIndicatingError(`${name} must be a finite non-negative number, got ${value}`);\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 } from '../../../../base/common/errors.js';\nimport { OffsetRange } from '../../../common/core/ranges/offsetRange.js';\n\nexport type CompressedVirtualizedItemVisibility = 'before' | 'visible' | 'after';\n\nexport interface ICompressedVirtualizedItemLayout {\n\t/** Complete item range in outer scroll coordinates. */\n\treadonly contentRange: OffsetRange;\n\t/** Item range in the compressed rendered coordinate system. */\n\treadonly renderedRange: OffsetRange;\n\t/** Height removed from the rendered row and represented by item-local scrolling. */\n\treadonly maxScrollOffset: number;\n\t/**\n\t * Item-local scroll coordinates:\n\t *\n\t * 0 ---------------------------- maxScrollOffset\n\t * item begins item end is aligned\n\t */\n\treadonly scrollOffset: number;\n\treadonly visibility: CompressedVirtualizedItemVisibility;\n}\n\nexport interface ICompressedVirtualizedScrollLayout {\n\treadonly revision: LayoutRevision;\n\t/** Clamped position in the complete outer scroll coordinates. */\n\treadonly scrollTop: number;\n\t/** Complete height of the logical item content, excluding transient scroll slack. */\n\treadonly logicalScrollHeight: number;\n\t/** Complete height of all items and inter-item gaps. */\n\treadonly scrollHeight: number;\n\treadonly leadingScrollSlack: number;\n\treadonly trailingScrollSlack: number;\n\t/** Height occupied by the compressed item rows and inter-item gaps. */\n\treadonly renderedHeight: number;\n\treadonly contentViewport: OffsetRange;\n\treadonly renderedViewport: OffsetRange;\n\t/** Full-content height above the viewport represented by item-local scrolling instead of DOM movement. */\n\treadonly hiddenContentHeightAboveViewport: number;\n\treadonly items: readonly ICompressedVirtualizedItemLayout[];\n}\n\nexport interface ICompressedVirtualizedScrollLayoutInput {\n\treadonly revision?: LayoutRevision;\n\treadonly scrollTop: number;\n\treadonly viewportHeight: number;\n\treadonly itemGap: number;\n\treadonly itemHeights: readonly number[];\n\treadonly leadingScrollSlack?: number;\n\treadonly trailingScrollSlack?: number;\n}\n\nexport type LayoutRevision = number & { readonly _brand: 'LayoutRevision' };\n\nexport interface ILogicalPosition {\n\treadonly revision: LayoutRevision;\n\treadonly offset: number;\n}\n\nexport interface ISizeEdit {\n\treadonly oldRange: OffsetRange;\n\treadonly newRange: OffsetRange;\n}\n\nexport interface IAnchoredSizeEditBatch {\n\treadonly fromRevision: LayoutRevision;\n\treadonly toRevision: LayoutRevision;\n\treadonly edits: readonly ISizeEdit[];\n\treadonly anchor: ILogicalPosition;\n}\n\nexport function asLayoutRevision(value: number): LayoutRevision {\n\treturn value as LayoutRevision;\n}\n\n/**\n * Computes the complete and compressed vertical layout of a virtualized list.\n */\nexport function computeCompressedVirtualizedScrollLayout(input: ICompressedVirtualizedScrollLayoutInput): ICompressedVirtualizedScrollLayout {\n\tassertNonNegative('viewportHeight', input.viewportHeight);\n\tconst leadingScrollSlack = input.leadingScrollSlack ?? 0;\n\tconst trailingScrollSlack = input.trailingScrollSlack ?? 0;\n\tassertNonNegative('leadingScrollSlack', leadingScrollSlack);\n\tassertNonNegative('trailingScrollSlack', trailingScrollSlack);\n\tconst logicalScrollHeight = computeCompressedVirtualizedScrollHeight(input.itemHeights, input.itemGap);\n\tconst scrollHeight = leadingScrollSlack + logicalScrollHeight + trailingScrollSlack;\n\tconst maxScrollTop = Math.max(0, scrollHeight - input.viewportHeight);\n\tconst scrollTop = Math.max(0, Math.min(input.scrollTop, maxScrollTop));\n\tconst contentViewport = OffsetRange.ofStartAndLength(scrollTop - leadingScrollSlack, input.viewportHeight);\n\n\tlet contentTop = 0;\n\tlet renderedTop = leadingScrollSlack;\n\tlet hiddenContentHeightAboveViewport = 0;\n\tconst items: ICompressedVirtualizedItemLayout[] = [];\n\n\tfor (let index = 0; index < input.itemHeights.length; index++) {\n\t\tconst fullHeight = input.itemHeights[index];\n\t\tconst renderedHeight = Math.min(fullHeight, input.viewportHeight);\n\t\tconst maxScrollOffset = fullHeight - renderedHeight;\n\t\tconst contentRange = OffsetRange.ofStartAndLength(contentTop, fullHeight);\n\t\tconst renderedRange = OffsetRange.ofStartAndLength(renderedTop, renderedHeight);\n\n\t\tlet visibility: CompressedVirtualizedItemVisibility;\n\t\tlet scrollOffset: number;\n\t\tif (contentRange.isBefore(contentViewport)) {\n\t\t\tvisibility = 'before';\n\t\t\tscrollOffset = maxScrollOffset;\n\t\t} else if (contentRange.isAfter(contentViewport)) {\n\t\t\tvisibility = 'after';\n\t\t\tscrollOffset = 0;\n\t\t} else {\n\t\t\tvisibility = 'visible';\n\t\t\tscrollOffset = Math.max(0, Math.min(contentViewport.start - contentRange.start, maxScrollOffset));\n\t\t}\n\n\t\thiddenContentHeightAboveViewport += scrollOffset;\n\t\titems.push({\n\t\t\tcontentRange,\n\t\t\trenderedRange,\n\t\t\tmaxScrollOffset,\n\t\t\tscrollOffset,\n\t\t\tvisibility,\n\t\t});\n\n\t\tif (index < input.itemHeights.length - 1) {\n\t\t\tcontentTop += fullHeight + input.itemGap;\n\t\t\trenderedTop += renderedHeight + input.itemGap;\n\t\t} else {\n\t\t\tcontentTop += fullHeight;\n\t\t\trenderedTop += renderedHeight;\n\t\t}\n\t}\n\n\tconst renderedScrollTop = scrollTop - hiddenContentHeightAboveViewport;\n\treturn {\n\t\trevision: input.revision ?? asLayoutRevision(0),\n\t\tscrollTop,\n\t\tlogicalScrollHeight,\n\t\tscrollHeight,\n\t\tleadingScrollSlack,\n\t\ttrailingScrollSlack,\n\t\trenderedHeight: renderedTop + trailingScrollSlack,\n\t\tcontentViewport,\n\t\trenderedViewport: OffsetRange.ofStartAndLength(renderedScrollTop, input.viewportHeight),\n\t\thiddenContentHeightAboveViewport,\n\t\titems,\n\t};\n}\n\nexport function computeItemRanges(itemHeights: readonly number[], itemGap: number): readonly OffsetRange[] {\n\tassertNonNegative('itemGap', itemGap);\n\tconst ranges: OffsetRange[] = [];\n\tlet offset = 0;\n\tfor (let index = 0; index < itemHeights.length; index++) {\n\t\tconst height = itemHeights[index];\n\t\tassertNonNegative(`itemHeights[${index}]`, height);\n\t\tranges.push(OffsetRange.ofStartAndLength(offset, height));\n\t\toffset += height + (index < itemHeights.length - 1 ? itemGap : 0);\n\t}\n\treturn ranges;\n}\n\nexport function createAnchoredSizeEditBatch(\n\tfromRevision: LayoutRevision,\n\ttoRevision: LayoutRevision,\n\toldItemHeights: readonly number[],\n\tnewItemHeights: readonly number[],\n\toldItemGap: number,\n\tnewItemGap: number,\n\tanchorOffset: number,\n): IAnchoredSizeEditBatch {\n\tif (oldItemHeights.length !== newItemHeights.length) {\n\t\tthrow new BugIndicatingError('Size edits require stable item identity and ordering');\n\t}\n\tconst oldRanges = computeItemRanges(oldItemHeights, oldItemGap);\n\tconst newRanges = computeItemRanges(newItemHeights, newItemGap);\n\tconst edits: ISizeEdit[] = [];\n\tfor (let index = 0; index < oldRanges.length; index++) {\n\t\tif (!oldRanges[index].equals(newRanges[index])) {\n\t\t\tedits.push({ oldRange: oldRanges[index], newRange: newRanges[index] });\n\t\t}\n\t}\n\treturn {\n\t\tfromRevision,\n\t\ttoRevision,\n\t\tedits,\n\t\tanchor: { revision: fromRevision, offset: anchorOffset },\n\t};\n}\n\nexport function mapLogicalPosition(position: ILogicalPosition, edit: IAnchoredSizeEditBatch): ILogicalPosition {\n\tif (position.revision !== edit.fromRevision) {\n\t\tthrow new BugIndicatingError(`Cannot map layout revision ${position.revision} through revision ${edit.fromRevision}`);\n\t}\n\tlet mappedOffset = position.offset;\n\tfor (const sizeEdit of edit.edits) {\n\t\tif (position.offset < sizeEdit.oldRange.start) {\n\t\t\tbreak;\n\t\t}\n\t\tif (sizeEdit.oldRange.contains(position.offset)) {\n\t\t\tconst relativeOffset = position.offset - sizeEdit.oldRange.start;\n\t\t\tmappedOffset = relativeOffset < sizeEdit.newRange.length\n\t\t\t\t? sizeEdit.newRange.start + relativeOffset\n\t\t\t\t: sizeEdit.newRange.start;\n\t\t\treturn { revision: edit.toRevision, offset: mappedOffset };\n\t\t}\n\t\tmappedOffset = position.offset + sizeEdit.newRange.endExclusive - sizeEdit.oldRange.endExclusive;\n\t}\n\treturn { revision: edit.toRevision, offset: mappedOffset };\n}\n\nexport function computeCompressedVirtualizedScrollHeight(itemHeights: readonly number[], itemGap: number): number {\n\tassertNonNegative('itemGap', itemGap);\n\tfor (let i = 0; i < itemHeights.length; i++) {\n\t\tassertNonNegative(`itemHeights[${i}]`, itemHeights[i]);\n\t}\n\tif (itemHeights.length === 0) {\n\t\treturn 0;\n\t}\n\treturn itemHeights.reduce((result, height) => result + height, 0) + itemGap * (itemHeights.length - 1);\n}\n\nfunction assertNonNegative(name: string, value: number): void {\n\tif (!Number.isFinite(value) || value < 0) {\n\t\tthrow new BugIndicatingError(`${name} must be a finite non-negative number, got ${value}`);\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/browser/widget/multiDiffEditor/compressedVirtualizedScrollLayout.ts","vs/editor/browser/widget/multiDiffEditor/compressedVirtualizedScrollLayout.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,4CAA4C,CAAC;AAqEzE,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC7C,OAAO,KAAuB,CAAC;AAChC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,wCAAwC,CAAC,KAA8C;IACtG,iBAAiB,CAAC,gBAAgB,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;IAC1D,MAAM,kBAAkB,GAAG,KAAK,CAAC,kBAAkB,IAAI,CAAC,CAAC;IACzD,MAAM,mBAAmB,GAAG,KAAK,CAAC,mBAAmB,IAAI,CAAC,CAAC;IAC3D,iBAAiB,CAAC,oBAAoB,EAAE,kBAAkB,CAAC,CAAC;IAC5D,iBAAiB,CAAC,qBAAqB,EAAE,mBAAmB,CAAC,CAAC;IAC9D,MAAM,mBAAmB,GAAG,wCAAwC,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IACvG,MAAM,YAAY,GAAG,kBAAkB,GAAG,mBAAmB,GAAG,mBAAmB,CAAC;IACpF,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,YAAY,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC;IACtE,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAA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,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC;AAC5D,CAAC;AAED,MAAM,UAAU,wCAAwC,CAAC,WAA8B,EAAE,OAAe;IACvG,iBAAiB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACtC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC7C,iBAAiB,CAAC,eAAe,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IACxD,CAAC;IACD,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9B,OAAO,CAAC,CAAC;IACV,CAAC;IACD,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC,GAAG,OAAO,GAAG,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACxG,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAY,EAAE,KAAa;IACrD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QAC1C,MAAM,IAAI,kBAAkB,CAAC,GAAG,IAAI,8CAA8C,KAAK,EAAE,CAAC,CAAC;IAC5F,CAAC;AACF,CAAC","file":"compressedVirtualizedScrollLayout.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 } from '../../../../base/common/errors.js';\nimport { OffsetRange } from '../../../common/core/ranges/offsetRange.js';\n\nexport type CompressedVirtualizedItemVisibility = 'before' | 'visible' | 'after';\n\nexport interface ICompressedVirtualizedItemLayout {\n\t/** Complete item range in outer scroll coordinates. */\n\treadonly contentRange: OffsetRange;\n\t/** Item range in the compressed rendered coordinate system. */\n\treadonly renderedRange: OffsetRange;\n\t/** Height removed from the rendered row and represented by item-local scrolling. */\n\treadonly maxScrollOffset: number;\n\t/**\n\t * Item-local scroll coordinates:\n\t *\n\t * 0 ---------------------------- maxScrollOffset\n\t * item begins item end is aligned\n\t */\n\treadonly scrollOffset: number;\n\treadonly visibility: CompressedVirtualizedItemVisibility;\n}\n\nexport interface ICompressedVirtualizedScrollLayout {\n\treadonly revision: LayoutRevision;\n\t/** Clamped position in the complete outer scroll coordinates. */\n\treadonly scrollTop: number;\n\t/** Complete height of the logical item content, excluding transient scroll slack. */\n\treadonly logicalScrollHeight: number;\n\t/** Complete height of all items and inter-item gaps. */\n\treadonly scrollHeight: number;\n\treadonly leadingScrollSlack: number;\n\treadonly trailingScrollSlack: number;\n\t/** Height occupied by the compressed item rows and inter-item gaps. */\n\treadonly renderedHeight: number;\n\treadonly contentViewport: OffsetRange;\n\treadonly renderedViewport: OffsetRange;\n\t/** Full-content height above the viewport represented by item-local scrolling instead of DOM movement. */\n\treadonly hiddenContentHeightAboveViewport: number;\n\treadonly items: readonly ICompressedVirtualizedItemLayout[];\n}\n\nexport interface ICompressedVirtualizedScrollLayoutInput {\n\treadonly revision?: LayoutRevision;\n\treadonly scrollTop: number;\n\treadonly viewportHeight: number;\n\treadonly itemGap: number;\n\treadonly itemHeights: readonly number[];\n\treadonly leadingScrollSlack?: number;\n\treadonly trailingScrollSlack?: number;\n}\n\nexport type LayoutRevision = number & { readonly _brand: 'LayoutRevision' };\n\nexport interface ILogicalPosition {\n\treadonly revision: LayoutRevision;\n\treadonly offset: number;\n}\n\nexport interface ISizeEdit {\n\treadonly oldRange: OffsetRange;\n\treadonly newRange: OffsetRange;\n}\n\nexport interface IAnchoredSizeEditBatch {\n\treadonly fromRevision: LayoutRevision;\n\treadonly toRevision: LayoutRevision;\n\treadonly edits: readonly ISizeEdit[];\n\treadonly anchor: ILogicalPosition;\n}\n\nexport function asLayoutRevision(value: number): LayoutRevision {\n\treturn value as LayoutRevision;\n}\n\n/**\n * Computes the complete and compressed vertical layout of a virtualized list.\n */\nexport function computeCompressedVirtualizedScrollLayout(input: ICompressedVirtualizedScrollLayoutInput): ICompressedVirtualizedScrollLayout {\n\tassertNonNegative('viewportHeight', input.viewportHeight);\n\tconst leadingScrollSlack = input.leadingScrollSlack ?? 0;\n\tconst trailingScrollSlack = input.trailingScrollSlack ?? 0;\n\tassertNonNegative('leadingScrollSlack', leadingScrollSlack);\n\tassertNonNegative('trailingScrollSlack', trailingScrollSlack);\n\tconst logicalScrollHeight = computeCompressedVirtualizedScrollHeight(input.itemHeights, input.itemGap);\n\tconst scrollHeight = leadingScrollSlack + logicalScrollHeight + trailingScrollSlack;\n\tconst maxScrollTop = Math.max(0, scrollHeight - input.viewportHeight);\n\tconst scrollTop = Math.max(0, Math.min(input.scrollTop, maxScrollTop));\n\tconst contentViewport = OffsetRange.ofStartAndLength(scrollTop - leadingScrollSlack, input.viewportHeight);\n\n\tlet contentTop = 0;\n\tlet renderedTop = leadingScrollSlack;\n\tlet hiddenContentHeightAboveViewport = 0;\n\tconst items: ICompressedVirtualizedItemLayout[] = [];\n\n\tfor (let index = 0; index < input.itemHeights.length; index++) {\n\t\tconst fullHeight = input.itemHeights[index];\n\t\tconst renderedHeight = Math.min(fullHeight, input.viewportHeight);\n\t\tconst maxScrollOffset = fullHeight - renderedHeight;\n\t\tconst contentRange = OffsetRange.ofStartAndLength(contentTop, fullHeight);\n\t\tconst renderedRange = OffsetRange.ofStartAndLength(renderedTop, renderedHeight);\n\n\t\tlet visibility: CompressedVirtualizedItemVisibility;\n\t\tlet scrollOffset: number;\n\t\tif (contentRange.isBefore(contentViewport)) {\n\t\t\tvisibility = 'before';\n\t\t\tscrollOffset = maxScrollOffset;\n\t\t} else if (contentRange.isAfter(contentViewport)) {\n\t\t\tvisibility = 'after';\n\t\t\tscrollOffset = 0;\n\t\t} else {\n\t\t\tvisibility = 'visible';\n\t\t\tscrollOffset = Math.max(0, Math.min(contentViewport.start - contentRange.start, maxScrollOffset));\n\t\t}\n\n\t\thiddenContentHeightAboveViewport += scrollOffset;\n\t\titems.push({\n\t\t\tcontentRange,\n\t\t\trenderedRange,\n\t\t\tmaxScrollOffset,\n\t\t\tscrollOffset,\n\t\t\tvisibility,\n\t\t});\n\n\t\tif (index < input.itemHeights.length - 1) {\n\t\t\tcontentTop += fullHeight + input.itemGap;\n\t\t\trenderedTop += renderedHeight + input.itemGap;\n\t\t} else {\n\t\t\tcontentTop += fullHeight;\n\t\t\trenderedTop += renderedHeight;\n\t\t}\n\t}\n\n\tconst renderedScrollTop = scrollTop - hiddenContentHeightAboveViewport;\n\treturn {\n\t\trevision: input.revision ?? asLayoutRevision(0),\n\t\tscrollTop,\n\t\tlogicalScrollHeight,\n\t\tscrollHeight,\n\t\tleadingScrollSlack,\n\t\ttrailingScrollSlack,\n\t\trenderedHeight: renderedTop + trailingScrollSlack,\n\t\tcontentViewport,\n\t\trenderedViewport: OffsetRange.ofStartAndLength(renderedScrollTop, input.viewportHeight),\n\t\thiddenContentHeightAboveViewport,\n\t\titems,\n\t};\n}\n\nexport function computeItemRanges(itemHeights: readonly number[], itemGap: number): readonly OffsetRange[] {\n\tassertNonNegative('itemGap', itemGap);\n\tconst ranges: OffsetRange[] = [];\n\tlet offset = 0;\n\tfor (let index = 0; index < itemHeights.length; index++) {\n\t\tconst height = itemHeights[index];\n\t\tassertNonNegative(`itemHeights[${index}]`, height);\n\t\tranges.push(OffsetRange.ofStartAndLength(offset, height));\n\t\toffset += height + (index < itemHeights.length - 1 ? itemGap : 0);\n\t}\n\treturn ranges;\n}\n\nexport function createAnchoredSizeEditBatch(\n\tfromRevision: LayoutRevision,\n\ttoRevision: LayoutRevision,\n\toldItemHeights: readonly number[],\n\tnewItemHeights: readonly number[],\n\toldItemGap: number,\n\tnewItemGap: number,\n\tanchorOffset: number,\n): IAnchoredSizeEditBatch {\n\tif (oldItemHeights.length !== newItemHeights.length) {\n\t\tthrow new BugIndicatingError('Size edits require stable item identity and ordering');\n\t}\n\tconst oldRanges = computeItemRanges(oldItemHeights, oldItemGap);\n\tconst newRanges = computeItemRanges(newItemHeights, newItemGap);\n\tconst edits: ISizeEdit[] = [];\n\tfor (let index = 0; index < oldRanges.length; index++) {\n\t\tif (!oldRanges[index].equals(newRanges[index])) {\n\t\t\tedits.push({ oldRange: oldRanges[index], newRange: newRanges[index] });\n\t\t}\n\t}\n\treturn {\n\t\tfromRevision,\n\t\ttoRevision,\n\t\tedits,\n\t\tanchor: { revision: fromRevision, offset: anchorOffset },\n\t};\n}\n\n/**\n * Where a position inside the removed tail of a shrunk item is mapped to.\n * A viewport edge should keep the shrunk item on its viewport side: the top edge\n * keeps the item's new start, the bottom edge keeps the item's new end.\n */\nexport type RemovedPositionAffinity = 'itemStart' | 'itemEnd';\n\nexport function mapLogicalPosition(position: ILogicalPosition, edit: IAnchoredSizeEditBatch, removedPositionAffinity: RemovedPositionAffinity = 'itemStart'): ILogicalPosition {\n\tif (position.revision !== edit.fromRevision) {\n\t\tthrow new BugIndicatingError(`Cannot map layout revision ${position.revision} through revision ${edit.fromRevision}`);\n\t}\n\tlet mappedOffset = position.offset;\n\tfor (const sizeEdit of edit.edits) {\n\t\tif (position.offset < sizeEdit.oldRange.start) {\n\t\t\tbreak;\n\t\t}\n\t\tif (sizeEdit.oldRange.contains(position.offset)) {\n\t\t\tconst relativeOffset = position.offset - sizeEdit.oldRange.start;\n\t\t\tmappedOffset = relativeOffset < sizeEdit.newRange.length\n\t\t\t\t? sizeEdit.newRange.start + relativeOffset\n\t\t\t\t: removedPositionAffinity === 'itemEnd' ? sizeEdit.newRange.endExclusive : sizeEdit.newRange.start;\n\t\t\treturn { revision: edit.toRevision, offset: mappedOffset };\n\t\t}\n\t\tmappedOffset = position.offset + sizeEdit.newRange.endExclusive - sizeEdit.oldRange.endExclusive;\n\t}\n\treturn { revision: edit.toRevision, offset: mappedOffset };\n}\n\nexport function computeCompressedVirtualizedScrollHeight(itemHeights: readonly number[], itemGap: number): number {\n\tassertNonNegative('itemGap', itemGap);\n\tfor (let i = 0; i < itemHeights.length; i++) {\n\t\tassertNonNegative(`itemHeights[${i}]`, itemHeights[i]);\n\t}\n\tif (itemHeights.length === 0) {\n\t\treturn 0;\n\t}\n\treturn itemHeights.reduce((result, height) => result + height, 0) + itemGap * (itemHeights.length - 1);\n}\n\nfunction assertNonNegative(name: string, value: number): void {\n\tif (!Number.isFinite(value) || value < 0) {\n\t\tthrow new BugIndicatingError(`${name} must be a finite non-negative number, got ${value}`);\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 } from '../../../../base/common/errors.js';\nimport { OffsetRange } from '../../../common/core/ranges/offsetRange.js';\n\nexport type CompressedVirtualizedItemVisibility = 'before' | 'visible' | 'after';\n\nexport interface ICompressedVirtualizedItemLayout {\n\t/** Complete item range in outer scroll coordinates. */\n\treadonly contentRange: OffsetRange;\n\t/** Item range in the compressed rendered coordinate system. */\n\treadonly renderedRange: OffsetRange;\n\t/** Height removed from the rendered row and represented by item-local scrolling. */\n\treadonly maxScrollOffset: number;\n\t/**\n\t * Item-local scroll coordinates:\n\t *\n\t * 0 ---------------------------- maxScrollOffset\n\t * item begins item end is aligned\n\t */\n\treadonly scrollOffset: number;\n\treadonly visibility: CompressedVirtualizedItemVisibility;\n}\n\nexport interface ICompressedVirtualizedScrollLayout {\n\treadonly revision: LayoutRevision;\n\t/** Clamped position in the complete outer scroll coordinates. */\n\treadonly scrollTop: number;\n\t/** Complete height of the logical item content, excluding transient scroll slack. */\n\treadonly logicalScrollHeight: number;\n\t/** Complete height of all items and inter-item gaps. */\n\treadonly scrollHeight: number;\n\treadonly leadingScrollSlack: number;\n\treadonly trailingScrollSlack: number;\n\t/** Height occupied by the compressed item rows and inter-item gaps. */\n\treadonly renderedHeight: number;\n\treadonly contentViewport: OffsetRange;\n\treadonly renderedViewport: OffsetRange;\n\t/** Full-content height above the viewport represented by item-local scrolling instead of DOM movement. */\n\treadonly hiddenContentHeightAboveViewport: number;\n\treadonly items: readonly ICompressedVirtualizedItemLayout[];\n}\n\nexport interface ICompressedVirtualizedScrollLayoutInput {\n\treadonly revision?: LayoutRevision;\n\treadonly scrollTop: number;\n\treadonly viewportHeight: number;\n\treadonly itemGap: number;\n\treadonly itemHeights: readonly number[];\n\treadonly leadingScrollSlack?: number;\n\treadonly trailingScrollSlack?: number;\n}\n\nexport type LayoutRevision = number & { readonly _brand: 'LayoutRevision' };\n\nexport interface ILogicalPosition {\n\treadonly revision: LayoutRevision;\n\treadonly offset: number;\n}\n\nexport interface ISizeEdit {\n\treadonly oldRange: OffsetRange;\n\treadonly newRange: OffsetRange;\n}\n\nexport interface IAnchoredSizeEditBatch {\n\treadonly fromRevision: LayoutRevision;\n\treadonly toRevision: LayoutRevision;\n\treadonly edits: readonly ISizeEdit[];\n\treadonly anchor: ILogicalPosition;\n}\n\nexport function asLayoutRevision(value: number): LayoutRevision {\n\treturn value as LayoutRevision;\n}\n\n/**\n * Computes the complete and compressed vertical layout of a virtualized list.\n */\nexport function computeCompressedVirtualizedScrollLayout(input: ICompressedVirtualizedScrollLayoutInput): ICompressedVirtualizedScrollLayout {\n\tassertNonNegative('viewportHeight', input.viewportHeight);\n\tconst leadingScrollSlack = input.leadingScrollSlack ?? 0;\n\tconst trailingScrollSlack = input.trailingScrollSlack ?? 0;\n\tassertNonNegative('leadingScrollSlack', leadingScrollSlack);\n\tassertNonNegative('trailingScrollSlack', trailingScrollSlack);\n\tconst logicalScrollHeight = computeCompressedVirtualizedScrollHeight(input.itemHeights, input.itemGap);\n\tconst scrollHeight = leadingScrollSlack + logicalScrollHeight + trailingScrollSlack;\n\tconst maxScrollTop = Math.max(0, scrollHeight - input.viewportHeight);\n\tconst scrollTop = Math.max(0, Math.min(input.scrollTop, maxScrollTop));\n\tconst contentViewport = OffsetRange.ofStartAndLength(scrollTop - leadingScrollSlack, input.viewportHeight);\n\n\tlet contentTop = 0;\n\tlet renderedTop = leadingScrollSlack;\n\tlet hiddenContentHeightAboveViewport = 0;\n\tconst items: ICompressedVirtualizedItemLayout[] = [];\n\n\tfor (let index = 0; index < input.itemHeights.length; index++) {\n\t\tconst fullHeight = input.itemHeights[index];\n\t\tconst renderedHeight = Math.min(fullHeight, input.viewportHeight);\n\t\tconst maxScrollOffset = fullHeight - renderedHeight;\n\t\tconst contentRange = OffsetRange.ofStartAndLength(contentTop, fullHeight);\n\t\tconst renderedRange = OffsetRange.ofStartAndLength(renderedTop, renderedHeight);\n\n\t\tlet visibility: CompressedVirtualizedItemVisibility;\n\t\tlet scrollOffset: number;\n\t\tif (contentRange.isBefore(contentViewport)) {\n\t\t\tvisibility = 'before';\n\t\t\tscrollOffset = maxScrollOffset;\n\t\t} else if (contentRange.isAfter(contentViewport)) {\n\t\t\tvisibility = 'after';\n\t\t\tscrollOffset = 0;\n\t\t} else {\n\t\t\tvisibility = 'visible';\n\t\t\tscrollOffset = Math.max(0, Math.min(contentViewport.start - contentRange.start, maxScrollOffset));\n\t\t}\n\n\t\thiddenContentHeightAboveViewport += scrollOffset;\n\t\titems.push({\n\t\t\tcontentRange,\n\t\t\trenderedRange,\n\t\t\tmaxScrollOffset,\n\t\t\tscrollOffset,\n\t\t\tvisibility,\n\t\t});\n\n\t\tif (index < input.itemHeights.length - 1) {\n\t\t\tcontentTop += fullHeight + input.itemGap;\n\t\t\trenderedTop += renderedHeight + input.itemGap;\n\t\t} else {\n\t\t\tcontentTop += fullHeight;\n\t\t\trenderedTop += renderedHeight;\n\t\t}\n\t}\n\n\tconst renderedScrollTop = scrollTop - hiddenContentHeightAboveViewport;\n\treturn {\n\t\trevision: input.revision ?? asLayoutRevision(0),\n\t\tscrollTop,\n\t\tlogicalScrollHeight,\n\t\tscrollHeight,\n\t\tleadingScrollSlack,\n\t\ttrailingScrollSlack,\n\t\trenderedHeight: renderedTop + trailingScrollSlack,\n\t\tcontentViewport,\n\t\trenderedViewport: OffsetRange.ofStartAndLength(renderedScrollTop, input.viewportHeight),\n\t\thiddenContentHeightAboveViewport,\n\t\titems,\n\t};\n}\n\nexport function computeItemRanges(itemHeights: readonly number[], itemGap: number): readonly OffsetRange[] {\n\tassertNonNegative('itemGap', itemGap);\n\tconst ranges: OffsetRange[] = [];\n\tlet offset = 0;\n\tfor (let index = 0; index < itemHeights.length; index++) {\n\t\tconst height = itemHeights[index];\n\t\tassertNonNegative(`itemHeights[${index}]`, height);\n\t\tranges.push(OffsetRange.ofStartAndLength(offset, height));\n\t\toffset += height + (index < itemHeights.length - 1 ? itemGap : 0);\n\t}\n\treturn ranges;\n}\n\nexport function createAnchoredSizeEditBatch(\n\tfromRevision: LayoutRevision,\n\ttoRevision: LayoutRevision,\n\toldItemHeights: readonly number[],\n\tnewItemHeights: readonly number[],\n\toldItemGap: number,\n\tnewItemGap: number,\n\tanchorOffset: number,\n): IAnchoredSizeEditBatch {\n\tif (oldItemHeights.length !== newItemHeights.length) {\n\t\tthrow new BugIndicatingError('Size edits require stable item identity and ordering');\n\t}\n\tconst oldRanges = computeItemRanges(oldItemHeights, oldItemGap);\n\tconst newRanges = computeItemRanges(newItemHeights, newItemGap);\n\tconst edits: ISizeEdit[] = [];\n\tfor (let index = 0; index < oldRanges.length; index++) {\n\t\tif (!oldRanges[index].equals(newRanges[index])) {\n\t\t\tedits.push({ oldRange: oldRanges[index], newRange: newRanges[index] });\n\t\t}\n\t}\n\treturn {\n\t\tfromRevision,\n\t\ttoRevision,\n\t\tedits,\n\t\tanchor: { revision: fromRevision, offset: anchorOffset },\n\t};\n}\n\n/**\n * Where a position inside the removed tail of a shrunk item is mapped to.\n * A viewport edge should keep the shrunk item on its viewport side: the top edge\n * keeps the item's new start, the bottom edge keeps the item's new end.\n */\nexport type RemovedPositionAffinity = 'itemStart' | 'itemEnd';\n\nexport function mapLogicalPosition(position: ILogicalPosition, edit: IAnchoredSizeEditBatch, removedPositionAffinity: RemovedPositionAffinity = 'itemStart'): ILogicalPosition {\n\tif (position.revision !== edit.fromRevision) {\n\t\tthrow new BugIndicatingError(`Cannot map layout revision ${position.revision} through revision ${edit.fromRevision}`);\n\t}\n\tlet mappedOffset = position.offset;\n\tfor (const sizeEdit of edit.edits) {\n\t\tif (position.offset < sizeEdit.oldRange.start) {\n\t\t\tbreak;\n\t\t}\n\t\tif (sizeEdit.oldRange.contains(position.offset)) {\n\t\t\tconst relativeOffset = position.offset - sizeEdit.oldRange.start;\n\t\t\tmappedOffset = relativeOffset < sizeEdit.newRange.length\n\t\t\t\t? sizeEdit.newRange.start + relativeOffset\n\t\t\t\t: removedPositionAffinity === 'itemEnd' ? sizeEdit.newRange.endExclusive : sizeEdit.newRange.start;\n\t\t\treturn { revision: edit.toRevision, offset: mappedOffset };\n\t\t}\n\t\tmappedOffset = position.offset + sizeEdit.newRange.endExclusive - sizeEdit.oldRange.endExclusive;\n\t}\n\treturn { revision: edit.toRevision, offset: mappedOffset };\n}\n\nexport function computeCompressedVirtualizedScrollHeight(itemHeights: readonly number[], itemGap: number): number {\n\tassertNonNegative('itemGap', itemGap);\n\tfor (let i = 0; i < itemHeights.length; i++) {\n\t\tassertNonNegative(`itemHeights[${i}]`, itemHeights[i]);\n\t}\n\tif (itemHeights.length === 0) {\n\t\treturn 0;\n\t}\n\treturn itemHeights.reduce((result, height) => result + height, 0) + itemGap * (itemHeights.length - 1);\n}\n\nfunction assertNonNegative(name: string, value: number): void {\n\tif (!Number.isFinite(value) || value < 0) {\n\t\tthrow new BugIndicatingError(`${name} must be a finite non-negative number, got ${value}`);\n\t}\n}\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { getWindow, h, scheduleAtNextAnimationFrame } from '../../../../base/browser/dom.js';
|
|
5
|
+
import { addDisposableListener, getWindow, h, scheduleAtNextAnimationFrame } from '../../../../base/browser/dom.js';
|
|
6
6
|
import { SmoothScrollableElement } from '../../../../base/browser/ui/scrollbar/scrollableElement.js';
|
|
7
7
|
import { compareBy, numberComparator } from '../../../../base/common/arrays.js';
|
|
8
8
|
import { findFirstMax } from '../../../../base/common/arraysFind.js';
|
|
@@ -50,6 +50,24 @@ export class CompressedVirtualizedScrollView extends Disposable {
|
|
|
50
50
|
useShadows: false,
|
|
51
51
|
}, this._scrollable));
|
|
52
52
|
this.domNode = h('div', {}, [this._scrollableElement.getDomNode()]).root;
|
|
53
|
+
// The browser can natively scroll the `overflow: hidden` content (e.g. when focusing an element or
|
|
54
|
+
// calling `scrollIntoView`), which the virtualized layout does not account for. Undo that native
|
|
55
|
+
// scroll and apply it to the virtual scroll position instead, so the focused element stays visible.
|
|
56
|
+
this._register(addDisposableListener(this._scrollableElements.root, 'scroll', () => {
|
|
57
|
+
const element = this._scrollableElements.root;
|
|
58
|
+
const nativeScrollTop = element.scrollTop;
|
|
59
|
+
const nativeScrollLeft = element.scrollLeft;
|
|
60
|
+
if (nativeScrollTop === 0 && nativeScrollLeft === 0) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
element.scrollTop = 0;
|
|
64
|
+
element.scrollLeft = 0;
|
|
65
|
+
const position = this._scrollableElement.getScrollPosition();
|
|
66
|
+
this._scrollableElement.setScrollPosition({
|
|
67
|
+
scrollTop: position.scrollTop + nativeScrollTop,
|
|
68
|
+
scrollLeft: position.scrollLeft + nativeScrollLeft,
|
|
69
|
+
});
|
|
70
|
+
}));
|
|
53
71
|
this._sizeObserver = this._register(new ObservableElementSizeObserver(elementToObserve, undefined));
|
|
54
72
|
this.scrollTop = observableFromEvent(this, this._scrollableElement.onScroll, () => /** @description scrollTop */ this._scrollableElement.getScrollPosition().scrollTop);
|
|
55
73
|
this.scrollLeft = observableFromEvent(this, this._scrollableElement.onScroll, () => /** @description scrollLeft */ this._scrollableElement.getScrollPosition().scrollLeft);
|
|
@@ -171,7 +189,8 @@ export class CompressedVirtualizedScrollView extends Disposable {
|
|
|
171
189
|
const fromRevision = this._revision;
|
|
172
190
|
const toRevision = geometryChanged ? asLayoutRevision(fromRevision + 1) : fromRevision;
|
|
173
191
|
const edit = createAnchoredSizeEditBatch(fromRevision, toRevision, previousItemHeights, itemHeights, this._previousItemGap, itemGap, anchorOffset);
|
|
174
|
-
|
|
192
|
+
// Mapping a removed bottom anchor to the item start would place the whole item below the viewport.
|
|
193
|
+
let mappedAnchor = mapLogicalPosition(edit.anchor, edit, anchorKind === 'viewportBottom' ? 'itemEnd' : 'itemStart');
|
|
175
194
|
if (pendingAnchor?.item && pendingAnchor.getItemOffset) {
|
|
176
195
|
const itemIndex = items.findIndex(item => item === pendingAnchor.item);
|
|
177
196
|
if (itemIndex === -1) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/browser/widget/multiDiffEditor/compressedVirtualizedScrollView.ts","vs/editor/browser/widget/multiDiffEditor/compressedVirtualizedScrollView.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAa,SAAS,EAAE,CAAC,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AACxG,OAAO,EAAE,uBAAuB,EAAE,MAAM,4DAA4D,CAAC;AACrG,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAClE,OAAO,E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M,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;AAC/E,CAAC","file":"compressedVirtualizedScrollView.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, getWindow, h, scheduleAtNextAnimationFrame } from '../../../../base/browser/dom.js';\nimport { SmoothScrollableElement } from '../../../../base/browser/ui/scrollbar/scrollableElement.js';\nimport { compareBy, numberComparator } from '../../../../base/common/arrays.js';\nimport { findFirstMax } from '../../../../base/common/arraysFind.js';\nimport { RunOnceScheduler } from '../../../../base/common/async.js';\nimport { BugIndicatingError } from '../../../../base/common/errors.js';\nimport { Disposable } from '../../../../base/common/lifecycle.js';\nimport { autorun, globalTransaction, IObservable, ITransaction, observableFromEvent, observableSignal, observableValue } from '../../../../base/common/observable.js';\nimport { INewScrollPosition, IScrollPosition, Scrollable, ScrollbarVisibility } from '../../../../base/common/scrollable.js';\nimport { OffsetRange } from '../../../common/core/ranges/offsetRange.js';\nimport { ObservableElementSizeObserver } from '../diffEditor/utils.js';\nimport { asLayoutRevision, computeCompressedVirtualizedScrollHeight, computeCompressedVirtualizedScrollLayout, computeItemRanges, createAnchoredSizeEditBatch, ICompressedVirtualizedScrollLayout, ILogicalPosition, ISizeEdit, LayoutRevision, mapLogicalPosition } from './compressedVirtualizedScrollLayout.js';\n\nconst scrollDirectionRetentionDurationMs = 100;\n\nexport interface ICompressedVirtualizedScrollItem {\n\treadonly size: IObservable<number>;\n\treadonly maxScroll: IObservable<{ readonly maxScroll: number }>;\n\trender(renderedRange: OffsetRange, scrollOffset: number, width: number, renderedViewport: OffsetRange, context: ICompressedVirtualizedScrollItemContext): void;\n\thide(): void;\n}\n\nexport interface ICompressedVirtualizedScrollViewContext {\n\treadonly contentDomNode: HTMLElement;\n\treadonly overflowWidgetsDomNode: HTMLElement;\n\treadonly scrollLeft: IObservable<number>;\n}\n\nexport interface ICompressedVirtualizedScrollItemContext {\n\trunWithScrollAnchor(getItemOffset: () => number, update: (tx: ITransaction) => void): void;\n}\n\nexport interface ICompressedVirtualizedGeometryEdit {\n\treadonly fromRevision: LayoutRevision;\n\treadonly toRevision: LayoutRevision;\n\treadonly edits: readonly ISizeEdit[];\n\treadonly anchorKind: 'viewportTop' | 'viewportBottom' | 'logical' | 'item';\n\treadonly anchorOffset: number;\n\treadonly mappedAnchorOffset: number;\n\treadonly anchorViewportOffset: number;\n\treadonly desiredScrollTop: number;\n\treadonly appliedScrollTop: number;\n\treadonly leadingScrollSlack: number;\n\treadonly trailingScrollSlack: number;\n}\n\n/**\n * Virtualizes complete-height items into viewport-capped rows whose removed height is represented by item-local scrolling.\n */\nexport class CompressedVirtualizedScrollView<TItem extends ICompressedVirtualizedScrollItem> extends Disposable {\n\tprivate readonly _scrollableElements;\n\tprivate readonly _scrollable;\n\tprivate readonly _scrollableElement;\n\tprivate readonly _sizeObserver;\n\tprivate readonly _items;\n\tprivate readonly _layout;\n\tprivate readonly _scrollDimensions;\n\tprivate readonly _lastGeometryEdit = observableValue<ICompressedVirtualizedGeometryEdit | undefined>(this, undefined);\n\tprivate readonly _itemAnchorEditSignal = observableSignal(this);\n\tprivate _revision = asLayoutRevision(0);\n\tprivate _leadingScrollSlack = 0;\n\tprivate _trailingScrollSlack = 0;\n\tprivate _previousItems: readonly TItem[] | undefined;\n\tprivate _previousItemHeights: readonly number[] | undefined;\n\tprivate _previousItemGap = 0;\n\tprivate _lastScrollTop = 0;\n\tprivate _lastScrollDirection: 'up' | 'down' | undefined;\n\tprivate readonly _clearScrollDirection = this._register(new RunOnceScheduler(() => this._lastScrollDirection = undefined, scrollDirectionRetentionDurationMs));\n\tprivate _isUpdating = false;\n\tprivate _pendingAnchor: {\n\t\treadonly position: ILogicalPosition;\n\t\treadonly viewportOffset: number;\n\t\treadonly item?: ICompressedVirtualizedScrollItem;\n\t\treadonly getItemOffset?: () => number;\n\t} | undefined;\n\n\treadonly domNode: HTMLElement;\n\treadonly scrollTop: IObservable<number>;\n\treadonly scrollLeft: IObservable<number>;\n\treadonly layout: IObservable<ICompressedVirtualizedScrollLayout>;\n\treadonly scrollDimensions: IObservable<{ readonly width: number; readonly height: number; readonly scrollWidth: number; readonly scrollHeight: number }>;\n\treadonly lastGeometryEdit: IObservable<ICompressedVirtualizedGeometryEdit | undefined> = this._lastGeometryEdit;\n\n\tconstructor(\n\t\telementToObserve: HTMLElement,\n\t\tdimension: IObservable<Dimension | undefined>,\n\t\titemGap: IObservable<number>,\n\t\tcreateItems: (context: ICompressedVirtualizedScrollViewContext) => IObservable<readonly TItem[]>,\n\t) {\n\t\tsuper();\n\t\tthis._scrollableElements = h('div.scrollContent', [\n\t\t\th('div@content', {\n\t\t\t\tstyle: {\n\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\tposition: 'relative',\n\t\t\t\t}\n\t\t\t}),\n\t\t\th('div.monaco-editor@overflowWidgetsDomNode'),\n\t\t]);\n\t\tthis._scrollable = this._register(new Scrollable({\n\t\t\tforceIntegerValues: false,\n\t\t\tscheduleAtNextAnimationFrame: callback => scheduleAtNextAnimationFrame(getWindow(elementToObserve), callback),\n\t\t\tsmoothScrollDuration: 100,\n\t\t}));\n\t\tthis._scrollableElement = this._register(new SmoothScrollableElement(this._scrollableElements.root, {\n\t\t\tvertical: ScrollbarVisibility.Auto,\n\t\t\thorizontal: ScrollbarVisibility.Auto,\n\t\t\tuseShadows: false,\n\t\t}, this._scrollable));\n\t\tthis.domNode = h('div', {}, [this._scrollableElement.getDomNode()]).root;\n\t\tthis._sizeObserver = this._register(new ObservableElementSizeObserver(elementToObserve, undefined));\n\t\tthis.scrollTop = observableFromEvent(this, this._scrollableElement.onScroll, () => /** @description scrollTop */ this._scrollableElement.getScrollPosition().scrollTop);\n\t\tthis.scrollLeft = observableFromEvent(this, this._scrollableElement.onScroll, () => /** @description scrollLeft */ this._scrollableElement.getScrollPosition().scrollLeft);\n\t\tthis._items = createItems({\n\t\t\tcontentDomNode: this._scrollableElements.content,\n\t\t\toverflowWidgetsDomNode: this._scrollableElements.overflowWidgetsDomNode,\n\t\t\tscrollLeft: this.scrollLeft,\n\t\t});\n\t\tthis._layout = observableValue(this, computeCompressedVirtualizedScrollLayout({\n\t\t\trevision: this._revision,\n\t\t\tscrollTop: 0,\n\t\t\tviewportHeight: 0,\n\t\t\titemGap: 0,\n\t\t\titemHeights: [],\n\t\t}));\n\t\tthis.layout = this._layout;\n\t\tthis._scrollDimensions = observableValue(this, { width: 0, height: 0, scrollWidth: 0, scrollHeight: 0 });\n\t\tthis.scrollDimensions = this._scrollDimensions;\n\n\t\tthis._register(autorun(reader => {\n\t\t\tthis._sizeObserver.observe(dimension.read(reader));\n\t\t}));\n\t\tthis._register(autorun(reader => {\n\t\t\tthis._itemAnchorEditSignal.read(reader);\n\t\t\tconst width = this._sizeObserver.width.read(reader);\n\t\t\tconst height = this._sizeObserver.height.read(reader);\n\t\t\tconst items = this._items.read(reader);\n\t\t\tconst itemHeights = items.map(item => item.size.read(reader));\n\t\t\tconst max = findFirstMax(items, compareBy(item => item.maxScroll.read(reader).maxScroll, numberComparator));\n\t\t\tconst maxScroll = max?.maxScroll.read(reader).maxScroll ?? 0;\n\t\t\tconst gap = itemGap.read(reader);\n\t\t\tconst requestedScrollTop = this.scrollTop.read(reader);\n\t\t\tglobalTransaction(tx => this._update(items, itemHeights, gap, width, height, width + maxScroll, requestedScrollTop, tx));\n\t\t}));\n\t}\n\n\tsetScrollPosition(position: INewScrollPosition, smooth = false): void {\n\t\tthis._scrollableElement.setScrollPosition({\n\t\t\t...position,\n\t\t\treuseAnimation: smooth,\n\t\t});\n\t}\n\n\tsetLogicalScrollPosition(scrollTop: number, smooth = false): void {\n\t\tthis.setScrollPosition({ scrollTop: this._leadingScrollSlack + scrollTop }, smooth);\n\t}\n\n\tgetScrollPosition(): IScrollPosition {\n\t\treturn this._scrollableElement.getScrollPosition();\n\t}\n\n\tprivate _runWithItemScrollAnchor(item: ICompressedVirtualizedScrollItem, getItemOffset: () => number, update: (tx: ITransaction) => void): void {\n\t\tconst items = this._items.get();\n\t\tconst itemIndex = items.findIndex(candidate => candidate === item);\n\t\tif (itemIndex === -1) {\n\t\t\tthrow new BugIndicatingError('Cannot anchor an item that is not in the compacted virtualized scroll view');\n\t\t}\n\t\tconst itemRange = this._layout.get().items[itemIndex].contentRange;\n\t\tconst itemOffset = getItemOffset();\n\t\tif (!Number.isFinite(itemOffset) || itemOffset < 0 || itemOffset > itemRange.length) {\n\t\t\tthrow new BugIndicatingError(`Item anchor ${itemOffset} is outside item range ${itemRange}`);\n\t\t}\n\t\tconst position = {\n\t\t\trevision: this._revision,\n\t\t\toffset: itemRange.start + itemOffset,\n\t\t};\n\t\tconst logicalViewportTop = this.getScrollPosition().scrollTop - this._leadingScrollSlack;\n\t\tthis._runWithPendingAnchor({\n\t\t\tposition,\n\t\t\tviewportOffset: position.offset - logicalViewportTop,\n\t\t\titem,\n\t\t\tgetItemOffset,\n\t\t}, tx => {\n\t\t\tupdate(tx);\n\t\t\tif (getItemOffset() !== itemOffset) {\n\t\t\t\tthis._itemAnchorEditSignal.trigger(tx);\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate _runWithPendingAnchor(pendingAnchor: NonNullable<typeof this._pendingAnchor>, update: (tx: ITransaction) => void): void {\n\t\tif (this._pendingAnchor) {\n\t\t\tthrow new BugIndicatingError('Cannot nest compacted virtualized scroll anchors');\n\t\t}\n\t\tthis._pendingAnchor = pendingAnchor;\n\t\ttry {\n\t\t\tglobalTransaction(update);\n\t\t} finally {\n\t\t\tif (this._pendingAnchor === pendingAnchor) {\n\t\t\t\tthis._pendingAnchor = undefined;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate _update(\n\t\titems: readonly TItem[],\n\t\titemHeights: readonly number[],\n\t\titemGap: number,\n\t\twidth: number,\n\t\theight: number,\n\t\tscrollWidth: number,\n\t\trequestedScrollTop: number,\n\t\ttx: ITransaction,\n\t): void {\n\t\tif (this._isUpdating) {\n\t\t\treturn;\n\t\t}\n\t\tthis._isUpdating = true;\n\t\ttry {\n\t\t\tlet targetScrollTop = requestedScrollTop;\n\t\t\tconst scrollDelta = requestedScrollTop - this._lastScrollTop;\n\t\t\tif (scrollDelta !== 0) {\n\t\t\t\tthis._lastScrollDirection = scrollDelta < 0 ? 'up' : 'down';\n\t\t\t\tthis._clearScrollDirection.schedule();\n\t\t\t}\n\t\t\tconst previousItemHeights = this._previousItemHeights;\n\t\t\tconst geometryChanged = previousItemHeights !== undefined\n\t\t\t\t&& (itemGap !== this._previousItemGap || !arrayEquals(previousItemHeights, itemHeights));\n\t\t\tconst hasStableItems = this._previousItems !== undefined\n\t\t\t\t&& this._previousItems.length === items.length\n\t\t\t\t&& this._previousItems.every((item, index) => item === items[index]);\n\t\t\tconst itemsChanged = this._previousItems !== undefined && !hasStableItems;\n\t\t\tlet didApplyAnchor = false;\n\n\t\t\tconst appliesPendingAnchor = !!this._pendingAnchor && hasStableItems;\n\t\t\tif (previousItemHeights && (geometryChanged || appliesPendingAnchor) && hasStableItems) {\n\t\t\t\tconst oldLogicalScrollHeight = computeCompressedVirtualizedScrollHeight(previousItemHeights, this._previousItemGap);\n\t\t\t\tconst oldLogicalViewportTop = requestedScrollTop - this._leadingScrollSlack;\n\t\t\t\tconst pendingAnchor = this._pendingAnchor;\n\t\t\t\tconst isScrollingUp = this._lastScrollDirection === 'up';\n\t\t\t\tconst defaultAnchorViewportOffset = isScrollingUp ? height : 0;\n\t\t\t\tconst anchorKind = pendingAnchor?.item ? 'item' : pendingAnchor ? 'logical' : isScrollingUp ? 'viewportBottom' : 'viewportTop';\n\t\t\t\tconst anchorOffset = pendingAnchor?.position.offset ?? Math.max(0, Math.min(oldLogicalViewportTop + defaultAnchorViewportOffset, oldLogicalScrollHeight));\n\t\t\t\tconst anchorViewportOffset = pendingAnchor?.viewportOffset ?? anchorOffset - oldLogicalViewportTop;\n\t\t\t\tconst fromRevision = this._revision;\n\t\t\t\tconst toRevision = geometryChanged ? asLayoutRevision(fromRevision + 1) : fromRevision;\n\t\t\t\tconst edit = createAnchoredSizeEditBatch(fromRevision, toRevision, previousItemHeights, itemHeights, this._previousItemGap, itemGap, anchorOffset);\n\t\t\t\tlet mappedAnchor = mapLogicalPosition(edit.anchor, edit);\n\t\t\t\tif (pendingAnchor?.item && pendingAnchor.getItemOffset) {\n\t\t\t\t\tconst itemIndex = items.findIndex(item => item === pendingAnchor.item);\n\t\t\t\t\tif (itemIndex === -1) {\n\t\t\t\t\t\tthrow new BugIndicatingError('Compacted virtualized scroll anchor item was removed during its edit');\n\t\t\t\t\t}\n\t\t\t\t\tconst itemRange = computeItemRanges(itemHeights, itemGap)[itemIndex];\n\t\t\t\t\tconst itemOffset = pendingAnchor.getItemOffset();\n\t\t\t\t\tif (!Number.isFinite(itemOffset) || itemOffset < 0 || itemOffset > itemRange.length) {\n\t\t\t\t\t\tthrow new BugIndicatingError(`Mapped item anchor ${itemOffset} is outside item range ${itemRange}`);\n\t\t\t\t\t}\n\t\t\t\t\tmappedAnchor = {\n\t\t\t\t\t\trevision: toRevision,\n\t\t\t\t\t\toffset: itemRange.start + itemOffset,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tconst newLogicalScrollHeight = computeCompressedVirtualizedScrollHeight(itemHeights, itemGap);\n\t\t\t\tconst desiredLogicalScrollTop = mappedAnchor.offset - anchorViewportOffset;\n\t\t\t\tconst naturalMaxScrollTop = Math.max(0, newLogicalScrollHeight - height);\n\n\t\t\t\tthis._leadingScrollSlack = Math.max(0, -desiredLogicalScrollTop);\n\t\t\t\tthis._trailingScrollSlack = Math.max(0, desiredLogicalScrollTop - naturalMaxScrollTop);\n\t\t\t\ttargetScrollTop = this._leadingScrollSlack + desiredLogicalScrollTop;\n\t\t\t\tthis._revision = toRevision;\n\t\t\t\tthis._pendingAnchor = undefined;\n\t\t\t\tdidApplyAnchor = true;\n\t\t\t\tthis._lastGeometryEdit.set({\n\t\t\t\t\tfromRevision,\n\t\t\t\t\ttoRevision,\n\t\t\t\t\tedits: edit.edits,\n\t\t\t\t\tanchorKind,\n\t\t\t\t\tanchorOffset,\n\t\t\t\t\tmappedAnchorOffset: mappedAnchor.offset,\n\t\t\t\t\tanchorViewportOffset,\n\t\t\t\t\tdesiredScrollTop: targetScrollTop,\n\t\t\t\t\tappliedScrollTop: targetScrollTop,\n\t\t\t\t\tleadingScrollSlack: this._leadingScrollSlack,\n\t\t\t\t\ttrailingScrollSlack: this._trailingScrollSlack,\n\t\t\t\t}, tx);\n\t\t\t} else if (geometryChanged || itemsChanged) {\n\t\t\t\tif (geometryChanged) {\n\t\t\t\t\tthis._revision = asLayoutRevision(this._revision + 1);\n\t\t\t\t}\n\t\t\t\tthis._leadingScrollSlack = 0;\n\t\t\t\tthis._trailingScrollSlack = 0;\n\t\t\t\tthis._lastGeometryEdit.set(undefined, tx);\n\t\t\t} else {\n\t\t\t\tif (scrollDelta > 0 && this._leadingScrollSlack > 0) {\n\t\t\t\t\tconst consumedSlack = Math.min(scrollDelta, this._leadingScrollSlack);\n\t\t\t\t\tthis._leadingScrollSlack -= consumedSlack;\n\t\t\t\t\ttargetScrollTop -= consumedSlack;\n\t\t\t\t} else if (scrollDelta < 0 && this._trailingScrollSlack > 0) {\n\t\t\t\t\tconst logicalScrollHeight = computeCompressedVirtualizedScrollHeight(itemHeights, itemGap);\n\t\t\t\t\tconst naturalMaxScrollTop = this._leadingScrollSlack + Math.max(0, logicalScrollHeight - height);\n\t\t\t\t\tthis._trailingScrollSlack = Math.max(0, targetScrollTop - naturalMaxScrollTop);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet layout = computeCompressedVirtualizedScrollLayout({\n\t\t\t\trevision: this._revision,\n\t\t\t\tscrollTop: targetScrollTop,\n\t\t\t\tviewportHeight: height,\n\t\t\t\titemGap,\n\t\t\t\titemHeights,\n\t\t\t\tleadingScrollSlack: this._leadingScrollSlack,\n\t\t\t\ttrailingScrollSlack: this._trailingScrollSlack,\n\t\t\t});\n\t\t\tconst dimensions = { width, height, scrollWidth, scrollHeight: layout.scrollHeight };\n\t\t\tthis._scrollableElements.root.style.height = `${height}px`;\n\t\t\tthis._scrollableElements.content.style.height = `${layout.scrollHeight}px`;\n\t\t\tthis._scrollable.setScrollDimensions(dimensions, true);\n\t\t\tconst needsImmediateScrollCorrection = geometryChanged || targetScrollTop !== requestedScrollTop;\n\t\t\tif (needsImmediateScrollCorrection) {\n\t\t\t\tthis._scrollable.setScrollPositionNow({ scrollTop: layout.scrollTop });\n\t\t\t}\n\t\t\tconst appliedScrollTop = this._scrollableElement.getScrollPosition().scrollTop;\n\t\t\tif (appliedScrollTop !== layout.scrollTop) {\n\t\t\t\tlayout = computeCompressedVirtualizedScrollLayout({\n\t\t\t\t\trevision: this._revision,\n\t\t\t\t\tscrollTop: appliedScrollTop,\n\t\t\t\t\tviewportHeight: height,\n\t\t\t\t\titemGap,\n\t\t\t\t\titemHeights,\n\t\t\t\t\tleadingScrollSlack: this._leadingScrollSlack,\n\t\t\t\t\ttrailingScrollSlack: this._trailingScrollSlack,\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst geometryEdit = this._lastGeometryEdit.get();\n\t\t\tif (didApplyAnchor && geometryEdit) {\n\t\t\t\tthis._lastGeometryEdit.set({ ...geometryEdit, appliedScrollTop }, tx);\n\t\t\t}\n\t\t\tthis._layout.set(layout, tx);\n\t\t\tthis._scrollDimensions.set(dimensions, tx);\n\t\t\tthis._render(items, layout, width);\n\t\t\tthis._previousItems = items;\n\t\t\tthis._previousItemHeights = itemHeights;\n\t\t\tthis._previousItemGap = itemGap;\n\t\t\tthis._lastScrollTop = layout.scrollTop;\n\t\t} finally {\n\t\t\tthis._isUpdating = false;\n\t\t}\n\t}\n\n\tprivate _render(items: readonly TItem[], layout: ICompressedVirtualizedScrollLayout, width: number): void {\n\t\tfor (let index = 0; index < items.length; index++) {\n\t\t\tconst item = items[index];\n\t\t\tconst itemLayout = layout.items[index];\n\t\t\tif (itemLayout.visibility !== 'visible') {\n\t\t\t\titem.hide();\n\t\t\t} else {\n\t\t\t\titem.render(itemLayout.renderedRange, itemLayout.scrollOffset, width, layout.renderedViewport, {\n\t\t\t\t\trunWithScrollAnchor: (getItemOffset, update) => this._runWithItemScrollAnchor(item, getItemOffset, update),\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tthis._scrollableElements.content.style.transform = `translateY(${-layout.renderedViewport.start}px)`;\n\t}\n}\n\nfunction arrayEquals(a: readonly number[], b: readonly number[]): boolean {\n\treturn a.length === b.length && a.every((value, index) => value === b[index]);\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 { Dimension, getWindow, h, scheduleAtNextAnimationFrame } from '../../../../base/browser/dom.js';\nimport { SmoothScrollableElement } from '../../../../base/browser/ui/scrollbar/scrollableElement.js';\nimport { compareBy, numberComparator } from '../../../../base/common/arrays.js';\nimport { findFirstMax } from '../../../../base/common/arraysFind.js';\nimport { RunOnceScheduler } from '../../../../base/common/async.js';\nimport { BugIndicatingError } from '../../../../base/common/errors.js';\nimport { Disposable } from '../../../../base/common/lifecycle.js';\nimport { autorun, globalTransaction, IObservable, ITransaction, observableFromEvent, observableSignal, observableValue } from '../../../../base/common/observable.js';\nimport { INewScrollPosition, IScrollPosition, Scrollable, ScrollbarVisibility } from '../../../../base/common/scrollable.js';\nimport { OffsetRange } from '../../../common/core/ranges/offsetRange.js';\nimport { ObservableElementSizeObserver } from '../diffEditor/utils.js';\nimport { asLayoutRevision, computeCompressedVirtualizedScrollHeight, computeCompressedVirtualizedScrollLayout, computeItemRanges, createAnchoredSizeEditBatch, ICompressedVirtualizedScrollLayout, ILogicalPosition, ISizeEdit, LayoutRevision, mapLogicalPosition } from './compressedVirtualizedScrollLayout.js';\n\nconst scrollDirectionRetentionDurationMs = 100;\n\nexport interface ICompressedVirtualizedScrollItem {\n\treadonly size: IObservable<number>;\n\treadonly maxScroll: IObservable<{ readonly maxScroll: number }>;\n\trender(renderedRange: OffsetRange, scrollOffset: number, width: number, renderedViewport: OffsetRange, context: ICompressedVirtualizedScrollItemContext): void;\n\thide(): void;\n}\n\nexport interface ICompressedVirtualizedScrollViewContext {\n\treadonly contentDomNode: HTMLElement;\n\treadonly overflowWidgetsDomNode: HTMLElement;\n\treadonly scrollLeft: IObservable<number>;\n}\n\nexport interface ICompressedVirtualizedScrollItemContext {\n\trunWithScrollAnchor(getItemOffset: () => number, update: (tx: ITransaction) => void): void;\n}\n\nexport interface ICompressedVirtualizedGeometryEdit {\n\treadonly fromRevision: LayoutRevision;\n\treadonly toRevision: LayoutRevision;\n\treadonly edits: readonly ISizeEdit[];\n\treadonly anchorKind: 'viewportTop' | 'viewportBottom' | 'logical' | 'item';\n\treadonly anchorOffset: number;\n\treadonly mappedAnchorOffset: number;\n\treadonly anchorViewportOffset: number;\n\treadonly desiredScrollTop: number;\n\treadonly appliedScrollTop: number;\n\treadonly leadingScrollSlack: number;\n\treadonly trailingScrollSlack: number;\n}\n\n/**\n * Virtualizes complete-height items into viewport-capped rows whose removed height is represented by item-local scrolling.\n */\nexport class CompressedVirtualizedScrollView<TItem extends ICompressedVirtualizedScrollItem> extends Disposable {\n\tprivate readonly _scrollableElements;\n\tprivate readonly _scrollable;\n\tprivate readonly _scrollableElement;\n\tprivate readonly _sizeObserver;\n\tprivate readonly _items;\n\tprivate readonly _layout;\n\tprivate readonly _scrollDimensions;\n\tprivate readonly _lastGeometryEdit = observableValue<ICompressedVirtualizedGeometryEdit | undefined>(this, undefined);\n\tprivate readonly _itemAnchorEditSignal = observableSignal(this);\n\tprivate _revision = asLayoutRevision(0);\n\tprivate _leadingScrollSlack = 0;\n\tprivate _trailingScrollSlack = 0;\n\tprivate _previousItems: readonly TItem[] | undefined;\n\tprivate _previousItemHeights: readonly number[] | undefined;\n\tprivate _previousItemGap = 0;\n\tprivate _lastScrollTop = 0;\n\tprivate _lastScrollDirection: 'up' | 'down' | undefined;\n\tprivate readonly _clearScrollDirection = this._register(new RunOnceScheduler(() => this._lastScrollDirection = undefined, scrollDirectionRetentionDurationMs));\n\tprivate _isUpdating = false;\n\tprivate _pendingAnchor: {\n\t\treadonly position: ILogicalPosition;\n\t\treadonly viewportOffset: number;\n\t\treadonly item?: ICompressedVirtualizedScrollItem;\n\t\treadonly getItemOffset?: () => number;\n\t} | undefined;\n\n\treadonly domNode: HTMLElement;\n\treadonly scrollTop: IObservable<number>;\n\treadonly scrollLeft: IObservable<number>;\n\treadonly layout: IObservable<ICompressedVirtualizedScrollLayout>;\n\treadonly scrollDimensions: IObservable<{ readonly width: number; readonly height: number; readonly scrollWidth: number; readonly scrollHeight: number }>;\n\treadonly lastGeometryEdit: IObservable<ICompressedVirtualizedGeometryEdit | undefined> = this._lastGeometryEdit;\n\n\tconstructor(\n\t\telementToObserve: HTMLElement,\n\t\tdimension: IObservable<Dimension | undefined>,\n\t\titemGap: IObservable<number>,\n\t\tcreateItems: (context: ICompressedVirtualizedScrollViewContext) => IObservable<readonly TItem[]>,\n\t) {\n\t\tsuper();\n\t\tthis._scrollableElements = h('div.scrollContent', [\n\t\t\th('div@content', {\n\t\t\t\tstyle: {\n\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\tposition: 'relative',\n\t\t\t\t}\n\t\t\t}),\n\t\t\th('div.monaco-editor@overflowWidgetsDomNode'),\n\t\t]);\n\t\tthis._scrollable = this._register(new Scrollable({\n\t\t\tforceIntegerValues: false,\n\t\t\tscheduleAtNextAnimationFrame: callback => scheduleAtNextAnimationFrame(getWindow(elementToObserve), callback),\n\t\t\tsmoothScrollDuration: 100,\n\t\t}));\n\t\tthis._scrollableElement = this._register(new SmoothScrollableElement(this._scrollableElements.root, {\n\t\t\tvertical: ScrollbarVisibility.Auto,\n\t\t\thorizontal: ScrollbarVisibility.Auto,\n\t\t\tuseShadows: false,\n\t\t}, this._scrollable));\n\t\tthis.domNode = h('div', {}, [this._scrollableElement.getDomNode()]).root;\n\t\tthis._sizeObserver = this._register(new ObservableElementSizeObserver(elementToObserve, undefined));\n\t\tthis.scrollTop = observableFromEvent(this, this._scrollableElement.onScroll, () => /** @description scrollTop */ this._scrollableElement.getScrollPosition().scrollTop);\n\t\tthis.scrollLeft = observableFromEvent(this, this._scrollableElement.onScroll, () => /** @description scrollLeft */ this._scrollableElement.getScrollPosition().scrollLeft);\n\t\tthis._items = createItems({\n\t\t\tcontentDomNode: this._scrollableElements.content,\n\t\t\toverflowWidgetsDomNode: this._scrollableElements.overflowWidgetsDomNode,\n\t\t\tscrollLeft: this.scrollLeft,\n\t\t});\n\t\tthis._layout = observableValue(this, computeCompressedVirtualizedScrollLayout({\n\t\t\trevision: this._revision,\n\t\t\tscrollTop: 0,\n\t\t\tviewportHeight: 0,\n\t\t\titemGap: 0,\n\t\t\titemHeights: [],\n\t\t}));\n\t\tthis.layout = this._layout;\n\t\tthis._scrollDimensions = observableValue(this, { width: 0, height: 0, scrollWidth: 0, scrollHeight: 0 });\n\t\tthis.scrollDimensions = this._scrollDimensions;\n\n\t\tthis._register(autorun(reader => {\n\t\t\tthis._sizeObserver.observe(dimension.read(reader));\n\t\t}));\n\t\tthis._register(autorun(reader => {\n\t\t\tthis._itemAnchorEditSignal.read(reader);\n\t\t\tconst width = this._sizeObserver.width.read(reader);\n\t\t\tconst height = this._sizeObserver.height.read(reader);\n\t\t\tconst items = this._items.read(reader);\n\t\t\tconst itemHeights = items.map(item => item.size.read(reader));\n\t\t\tconst max = findFirstMax(items, compareBy(item => item.maxScroll.read(reader).maxScroll, numberComparator));\n\t\t\tconst maxScroll = max?.maxScroll.read(reader).maxScroll ?? 0;\n\t\t\tconst gap = itemGap.read(reader);\n\t\t\tconst requestedScrollTop = this.scrollTop.read(reader);\n\t\t\tglobalTransaction(tx => this._update(items, itemHeights, gap, width, height, width + maxScroll, requestedScrollTop, tx));\n\t\t}));\n\t}\n\n\tsetScrollPosition(position: INewScrollPosition, smooth = false): void {\n\t\tthis._scrollableElement.setScrollPosition({\n\t\t\t...position,\n\t\t\treuseAnimation: smooth,\n\t\t});\n\t}\n\n\tsetLogicalScrollPosition(scrollTop: number, smooth = false): void {\n\t\tthis.setScrollPosition({ scrollTop: this._leadingScrollSlack + scrollTop }, smooth);\n\t}\n\n\tgetScrollPosition(): IScrollPosition {\n\t\treturn this._scrollableElement.getScrollPosition();\n\t}\n\n\tprivate _runWithItemScrollAnchor(item: ICompressedVirtualizedScrollItem, getItemOffset: () => number, update: (tx: ITransaction) => void): void {\n\t\tconst items = this._items.get();\n\t\tconst itemIndex = items.findIndex(candidate => candidate === item);\n\t\tif (itemIndex === -1) {\n\t\t\tthrow new BugIndicatingError('Cannot anchor an item that is not in the compacted virtualized scroll view');\n\t\t}\n\t\tconst itemRange = this._layout.get().items[itemIndex].contentRange;\n\t\tconst itemOffset = getItemOffset();\n\t\tif (!Number.isFinite(itemOffset) || itemOffset < 0 || itemOffset > itemRange.length) {\n\t\t\tthrow new BugIndicatingError(`Item anchor ${itemOffset} is outside item range ${itemRange}`);\n\t\t}\n\t\tconst position = {\n\t\t\trevision: this._revision,\n\t\t\toffset: itemRange.start + itemOffset,\n\t\t};\n\t\tconst logicalViewportTop = this.getScrollPosition().scrollTop - this._leadingScrollSlack;\n\t\tthis._runWithPendingAnchor({\n\t\t\tposition,\n\t\t\tviewportOffset: position.offset - logicalViewportTop,\n\t\t\titem,\n\t\t\tgetItemOffset,\n\t\t}, tx => {\n\t\t\tupdate(tx);\n\t\t\tif (getItemOffset() !== itemOffset) {\n\t\t\t\tthis._itemAnchorEditSignal.trigger(tx);\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate _runWithPendingAnchor(pendingAnchor: NonNullable<typeof this._pendingAnchor>, update: (tx: ITransaction) => void): void {\n\t\tif (this._pendingAnchor) {\n\t\t\tthrow new BugIndicatingError('Cannot nest compacted virtualized scroll anchors');\n\t\t}\n\t\tthis._pendingAnchor = pendingAnchor;\n\t\ttry {\n\t\t\tglobalTransaction(update);\n\t\t} finally {\n\t\t\tif (this._pendingAnchor === pendingAnchor) {\n\t\t\t\tthis._pendingAnchor = undefined;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate _update(\n\t\titems: readonly TItem[],\n\t\titemHeights: readonly number[],\n\t\titemGap: number,\n\t\twidth: number,\n\t\theight: number,\n\t\tscrollWidth: number,\n\t\trequestedScrollTop: number,\n\t\ttx: ITransaction,\n\t): void {\n\t\tif (this._isUpdating) {\n\t\t\treturn;\n\t\t}\n\t\tthis._isUpdating = true;\n\t\ttry {\n\t\t\tlet targetScrollTop = requestedScrollTop;\n\t\t\tconst scrollDelta = requestedScrollTop - this._lastScrollTop;\n\t\t\tif (scrollDelta !== 0) {\n\t\t\t\tthis._lastScrollDirection = scrollDelta < 0 ? 'up' : 'down';\n\t\t\t\tthis._clearScrollDirection.schedule();\n\t\t\t}\n\t\t\tconst previousItemHeights = this._previousItemHeights;\n\t\t\tconst geometryChanged = previousItemHeights !== undefined\n\t\t\t\t&& (itemGap !== this._previousItemGap || !arrayEquals(previousItemHeights, itemHeights));\n\t\t\tconst hasStableItems = this._previousItems !== undefined\n\t\t\t\t&& this._previousItems.length === items.length\n\t\t\t\t&& this._previousItems.every((item, index) => item === items[index]);\n\t\t\tconst itemsChanged = this._previousItems !== undefined && !hasStableItems;\n\t\t\tlet didApplyAnchor = false;\n\n\t\t\tconst appliesPendingAnchor = !!this._pendingAnchor && hasStableItems;\n\t\t\tif (previousItemHeights && (geometryChanged || appliesPendingAnchor) && hasStableItems) {\n\t\t\t\tconst oldLogicalScrollHeight = computeCompressedVirtualizedScrollHeight(previousItemHeights, this._previousItemGap);\n\t\t\t\tconst oldLogicalViewportTop = requestedScrollTop - this._leadingScrollSlack;\n\t\t\t\tconst pendingAnchor = this._pendingAnchor;\n\t\t\t\tconst isScrollingUp = this._lastScrollDirection === 'up';\n\t\t\t\tconst defaultAnchorViewportOffset = isScrollingUp ? height : 0;\n\t\t\t\tconst anchorKind = pendingAnchor?.item ? 'item' : pendingAnchor ? 'logical' : isScrollingUp ? 'viewportBottom' : 'viewportTop';\n\t\t\t\tconst anchorOffset = pendingAnchor?.position.offset ?? Math.max(0, Math.min(oldLogicalViewportTop + defaultAnchorViewportOffset, oldLogicalScrollHeight));\n\t\t\t\tconst anchorViewportOffset = pendingAnchor?.viewportOffset ?? anchorOffset - oldLogicalViewportTop;\n\t\t\t\tconst fromRevision = this._revision;\n\t\t\t\tconst toRevision = geometryChanged ? asLayoutRevision(fromRevision + 1) : fromRevision;\n\t\t\t\tconst edit = createAnchoredSizeEditBatch(fromRevision, toRevision, previousItemHeights, itemHeights, this._previousItemGap, itemGap, anchorOffset);\n\t\t\t\tlet mappedAnchor = mapLogicalPosition(edit.anchor, edit);\n\t\t\t\tif (pendingAnchor?.item && pendingAnchor.getItemOffset) {\n\t\t\t\t\tconst itemIndex = items.findIndex(item => item === pendingAnchor.item);\n\t\t\t\t\tif (itemIndex === -1) {\n\t\t\t\t\t\tthrow new BugIndicatingError('Compacted virtualized scroll anchor item was removed during its edit');\n\t\t\t\t\t}\n\t\t\t\t\tconst itemRange = computeItemRanges(itemHeights, itemGap)[itemIndex];\n\t\t\t\t\tconst itemOffset = pendingAnchor.getItemOffset();\n\t\t\t\t\tif (!Number.isFinite(itemOffset) || itemOffset < 0 || itemOffset > itemRange.length) {\n\t\t\t\t\t\tthrow new BugIndicatingError(`Mapped item anchor ${itemOffset} is outside item range ${itemRange}`);\n\t\t\t\t\t}\n\t\t\t\t\tmappedAnchor = {\n\t\t\t\t\t\trevision: toRevision,\n\t\t\t\t\t\toffset: itemRange.start + itemOffset,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tconst newLogicalScrollHeight = computeCompressedVirtualizedScrollHeight(itemHeights, itemGap);\n\t\t\t\tconst desiredLogicalScrollTop = mappedAnchor.offset - anchorViewportOffset;\n\t\t\t\tconst naturalMaxScrollTop = Math.max(0, newLogicalScrollHeight - height);\n\n\t\t\t\tthis._leadingScrollSlack = Math.max(0, -desiredLogicalScrollTop);\n\t\t\t\tthis._trailingScrollSlack = Math.max(0, desiredLogicalScrollTop - naturalMaxScrollTop);\n\t\t\t\ttargetScrollTop = this._leadingScrollSlack + desiredLogicalScrollTop;\n\t\t\t\tthis._revision = toRevision;\n\t\t\t\tthis._pendingAnchor = undefined;\n\t\t\t\tdidApplyAnchor = true;\n\t\t\t\tthis._lastGeometryEdit.set({\n\t\t\t\t\tfromRevision,\n\t\t\t\t\ttoRevision,\n\t\t\t\t\tedits: edit.edits,\n\t\t\t\t\tanchorKind,\n\t\t\t\t\tanchorOffset,\n\t\t\t\t\tmappedAnchorOffset: mappedAnchor.offset,\n\t\t\t\t\tanchorViewportOffset,\n\t\t\t\t\tdesiredScrollTop: targetScrollTop,\n\t\t\t\t\tappliedScrollTop: targetScrollTop,\n\t\t\t\t\tleadingScrollSlack: this._leadingScrollSlack,\n\t\t\t\t\ttrailingScrollSlack: this._trailingScrollSlack,\n\t\t\t\t}, tx);\n\t\t\t} else if (geometryChanged || itemsChanged) {\n\t\t\t\tif (geometryChanged) {\n\t\t\t\t\tthis._revision = asLayoutRevision(this._revision + 1);\n\t\t\t\t}\n\t\t\t\tthis._leadingScrollSlack = 0;\n\t\t\t\tthis._trailingScrollSlack = 0;\n\t\t\t\tthis._lastGeometryEdit.set(undefined, tx);\n\t\t\t} else {\n\t\t\t\tif (scrollDelta > 0 && this._leadingScrollSlack > 0) {\n\t\t\t\t\tconst consumedSlack = Math.min(scrollDelta, this._leadingScrollSlack);\n\t\t\t\t\tthis._leadingScrollSlack -= consumedSlack;\n\t\t\t\t\ttargetScrollTop -= consumedSlack;\n\t\t\t\t} else if (scrollDelta < 0 && this._trailingScrollSlack > 0) {\n\t\t\t\t\tconst logicalScrollHeight = computeCompressedVirtualizedScrollHeight(itemHeights, itemGap);\n\t\t\t\t\tconst naturalMaxScrollTop = this._leadingScrollSlack + Math.max(0, logicalScrollHeight - height);\n\t\t\t\t\tthis._trailingScrollSlack = Math.max(0, targetScrollTop - naturalMaxScrollTop);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet layout = computeCompressedVirtualizedScrollLayout({\n\t\t\t\trevision: this._revision,\n\t\t\t\tscrollTop: targetScrollTop,\n\t\t\t\tviewportHeight: height,\n\t\t\t\titemGap,\n\t\t\t\titemHeights,\n\t\t\t\tleadingScrollSlack: this._leadingScrollSlack,\n\t\t\t\ttrailingScrollSlack: this._trailingScrollSlack,\n\t\t\t});\n\t\t\tconst dimensions = { width, height, scrollWidth, scrollHeight: layout.scrollHeight };\n\t\t\tthis._scrollableElements.root.style.height = `${height}px`;\n\t\t\tthis._scrollableElements.content.style.height = `${layout.scrollHeight}px`;\n\t\t\tthis._scrollable.setScrollDimensions(dimensions, true);\n\t\t\tconst needsImmediateScrollCorrection = geometryChanged || targetScrollTop !== requestedScrollTop;\n\t\t\tif (needsImmediateScrollCorrection) {\n\t\t\t\tthis._scrollable.setScrollPositionNow({ scrollTop: layout.scrollTop });\n\t\t\t}\n\t\t\tconst appliedScrollTop = this._scrollableElement.getScrollPosition().scrollTop;\n\t\t\tif (appliedScrollTop !== layout.scrollTop) {\n\t\t\t\tlayout = computeCompressedVirtualizedScrollLayout({\n\t\t\t\t\trevision: this._revision,\n\t\t\t\t\tscrollTop: appliedScrollTop,\n\t\t\t\t\tviewportHeight: height,\n\t\t\t\t\titemGap,\n\t\t\t\t\titemHeights,\n\t\t\t\t\tleadingScrollSlack: this._leadingScrollSlack,\n\t\t\t\t\ttrailingScrollSlack: this._trailingScrollSlack,\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst geometryEdit = this._lastGeometryEdit.get();\n\t\t\tif (didApplyAnchor && geometryEdit) {\n\t\t\t\tthis._lastGeometryEdit.set({ ...geometryEdit, appliedScrollTop }, tx);\n\t\t\t}\n\t\t\tthis._layout.set(layout, tx);\n\t\t\tthis._scrollDimensions.set(dimensions, tx);\n\t\t\tthis._render(items, layout, width);\n\t\t\tthis._previousItems = items;\n\t\t\tthis._previousItemHeights = itemHeights;\n\t\t\tthis._previousItemGap = itemGap;\n\t\t\tthis._lastScrollTop = layout.scrollTop;\n\t\t} finally {\n\t\t\tthis._isUpdating = false;\n\t\t}\n\t}\n\n\tprivate _render(items: readonly TItem[], layout: ICompressedVirtualizedScrollLayout, width: number): void {\n\t\tfor (let index = 0; index < items.length; index++) {\n\t\t\tconst item = items[index];\n\t\t\tconst itemLayout = layout.items[index];\n\t\t\tif (itemLayout.visibility !== 'visible') {\n\t\t\t\titem.hide();\n\t\t\t} else {\n\t\t\t\titem.render(itemLayout.renderedRange, itemLayout.scrollOffset, width, layout.renderedViewport, {\n\t\t\t\t\trunWithScrollAnchor: (getItemOffset, update) => this._runWithItemScrollAnchor(item, getItemOffset, update),\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tthis._scrollableElements.content.style.transform = `translateY(${-layout.renderedViewport.start}px)`;\n\t}\n}\n\nfunction arrayEquals(a: readonly number[], b: readonly number[]): boolean {\n\treturn a.length === b.length && a.every((value, index) => value === b[index]);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/browser/widget/multiDiffEditor/compressedVirtualizedScrollView.ts","vs/editor/browser/widget/multiDiffEditor/compressedVirtualizedScrollView.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,qBAAqB,EAAa,SAAS,EAAE,CAAC,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAC/H,OAAO,EAAE,uBAAuB,EAAE,MAAM,4DAA4D,CAAC;AACrG,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,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ies/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 { addDisposableListener, Dimension, getWindow, h, scheduleAtNextAnimationFrame } from '../../../../base/browser/dom.js';\nimport { SmoothScrollableElement } from '../../../../base/browser/ui/scrollbar/scrollableElement.js';\nimport { compareBy, numberComparator } from '../../../../base/common/arrays.js';\nimport { findFirstMax } from '../../../../base/common/arraysFind.js';\nimport { RunOnceScheduler } from '../../../../base/common/async.js';\nimport { BugIndicatingError } from '../../../../base/common/errors.js';\nimport { Disposable } from '../../../../base/common/lifecycle.js';\nimport { autorun, globalTransaction, IObservable, ITransaction, observableFromEvent, observableSignal, observableValue } from '../../../../base/common/observable.js';\nimport { INewScrollPosition, IScrollPosition, Scrollable, ScrollbarVisibility } from '../../../../base/common/scrollable.js';\nimport { OffsetRange } from '../../../common/core/ranges/offsetRange.js';\nimport { ObservableElementSizeObserver } from '../diffEditor/utils.js';\nimport { asLayoutRevision, computeCompressedVirtualizedScrollHeight, computeCompressedVirtualizedScrollLayout, computeItemRanges, createAnchoredSizeEditBatch, ICompressedVirtualizedScrollLayout, ILogicalPosition, ISizeEdit, LayoutRevision, mapLogicalPosition } from './compressedVirtualizedScrollLayout.js';\n\nconst scrollDirectionRetentionDurationMs = 100;\n\nexport interface ICompressedVirtualizedScrollItem {\n\treadonly size: IObservable<number>;\n\treadonly maxScroll: IObservable<{ readonly maxScroll: number }>;\n\trender(renderedRange: OffsetRange, scrollOffset: number, width: number, renderedViewport: OffsetRange, context: ICompressedVirtualizedScrollItemContext): void;\n\thide(): void;\n}\n\nexport interface ICompressedVirtualizedScrollViewContext {\n\treadonly contentDomNode: HTMLElement;\n\treadonly overflowWidgetsDomNode: HTMLElement;\n\treadonly scrollLeft: IObservable<number>;\n}\n\nexport interface ICompressedVirtualizedScrollItemContext {\n\trunWithScrollAnchor(getItemOffset: () => number, update: (tx: ITransaction) => void): void;\n}\n\nexport interface ICompressedVirtualizedGeometryEdit {\n\treadonly fromRevision: LayoutRevision;\n\treadonly toRevision: LayoutRevision;\n\treadonly edits: readonly ISizeEdit[];\n\treadonly anchorKind: 'viewportTop' | 'viewportBottom' | 'logical' | 'item';\n\treadonly anchorOffset: number;\n\treadonly mappedAnchorOffset: number;\n\treadonly anchorViewportOffset: number;\n\treadonly desiredScrollTop: number;\n\treadonly appliedScrollTop: number;\n\treadonly leadingScrollSlack: number;\n\treadonly trailingScrollSlack: number;\n}\n\n/**\n * Virtualizes complete-height items into viewport-capped rows whose removed height is represented by item-local scrolling.\n */\nexport class CompressedVirtualizedScrollView<TItem extends ICompressedVirtualizedScrollItem> extends Disposable {\n\tprivate readonly _scrollableElements;\n\tprivate readonly _scrollable;\n\tprivate readonly _scrollableElement;\n\tprivate readonly _sizeObserver;\n\tprivate readonly _items;\n\tprivate readonly _layout;\n\tprivate readonly _scrollDimensions;\n\tprivate readonly _lastGeometryEdit = observableValue<ICompressedVirtualizedGeometryEdit | undefined>(this, undefined);\n\tprivate readonly _itemAnchorEditSignal = observableSignal(this);\n\tprivate _revision = asLayoutRevision(0);\n\tprivate _leadingScrollSlack = 0;\n\tprivate _trailingScrollSlack = 0;\n\tprivate _previousItems: readonly TItem[] | undefined;\n\tprivate _previousItemHeights: readonly number[] | undefined;\n\tprivate _previousItemGap = 0;\n\tprivate _lastScrollTop = 0;\n\tprivate _lastScrollDirection: 'up' | 'down' | undefined;\n\tprivate readonly _clearScrollDirection = this._register(new RunOnceScheduler(() => this._lastScrollDirection = undefined, scrollDirectionRetentionDurationMs));\n\tprivate _isUpdating = false;\n\tprivate _pendingAnchor: {\n\t\treadonly position: ILogicalPosition;\n\t\treadonly viewportOffset: number;\n\t\treadonly item?: ICompressedVirtualizedScrollItem;\n\t\treadonly getItemOffset?: () => number;\n\t} | undefined;\n\n\treadonly domNode: HTMLElement;\n\treadonly scrollTop: IObservable<number>;\n\treadonly scrollLeft: IObservable<number>;\n\treadonly layout: IObservable<ICompressedVirtualizedScrollLayout>;\n\treadonly scrollDimensions: IObservable<{ readonly width: number; readonly height: number; readonly scrollWidth: number; readonly scrollHeight: number }>;\n\treadonly lastGeometryEdit: IObservable<ICompressedVirtualizedGeometryEdit | undefined> = this._lastGeometryEdit;\n\n\tconstructor(\n\t\telementToObserve: HTMLElement,\n\t\tdimension: IObservable<Dimension | undefined>,\n\t\titemGap: IObservable<number>,\n\t\tcreateItems: (context: ICompressedVirtualizedScrollViewContext) => IObservable<readonly TItem[]>,\n\t) {\n\t\tsuper();\n\t\tthis._scrollableElements = h('div.scrollContent', [\n\t\t\th('div@content', {\n\t\t\t\tstyle: {\n\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\tposition: 'relative',\n\t\t\t\t}\n\t\t\t}),\n\t\t\th('div.monaco-editor@overflowWidgetsDomNode'),\n\t\t]);\n\t\tthis._scrollable = this._register(new Scrollable({\n\t\t\tforceIntegerValues: false,\n\t\t\tscheduleAtNextAnimationFrame: callback => scheduleAtNextAnimationFrame(getWindow(elementToObserve), callback),\n\t\t\tsmoothScrollDuration: 100,\n\t\t}));\n\t\tthis._scrollableElement = this._register(new SmoothScrollableElement(this._scrollableElements.root, {\n\t\t\tvertical: ScrollbarVisibility.Auto,\n\t\t\thorizontal: ScrollbarVisibility.Auto,\n\t\t\tuseShadows: false,\n\t\t}, this._scrollable));\n\t\tthis.domNode = h('div', {}, [this._scrollableElement.getDomNode()]).root;\n\t\t// The browser can natively scroll the `overflow: hidden` content (e.g. when focusing an element or\n\t\t// calling `scrollIntoView`), which the virtualized layout does not account for. Undo that native\n\t\t// scroll and apply it to the virtual scroll position instead, so the focused element stays visible.\n\t\tthis._register(addDisposableListener(this._scrollableElements.root, 'scroll', () => {\n\t\t\tconst element = this._scrollableElements.root;\n\t\t\tconst nativeScrollTop = element.scrollTop;\n\t\t\tconst nativeScrollLeft = element.scrollLeft;\n\t\t\tif (nativeScrollTop === 0 && nativeScrollLeft === 0) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telement.scrollTop = 0;\n\t\t\telement.scrollLeft = 0;\n\t\t\tconst position = this._scrollableElement.getScrollPosition();\n\t\t\tthis._scrollableElement.setScrollPosition({\n\t\t\t\tscrollTop: position.scrollTop + nativeScrollTop,\n\t\t\t\tscrollLeft: position.scrollLeft + nativeScrollLeft,\n\t\t\t});\n\t\t}));\n\t\tthis._sizeObserver = this._register(new ObservableElementSizeObserver(elementToObserve, undefined));\n\t\tthis.scrollTop = observableFromEvent(this, this._scrollableElement.onScroll, () => /** @description scrollTop */ this._scrollableElement.getScrollPosition().scrollTop);\n\t\tthis.scrollLeft = observableFromEvent(this, this._scrollableElement.onScroll, () => /** @description scrollLeft */ this._scrollableElement.getScrollPosition().scrollLeft);\n\t\tthis._items = createItems({\n\t\t\tcontentDomNode: this._scrollableElements.content,\n\t\t\toverflowWidgetsDomNode: this._scrollableElements.overflowWidgetsDomNode,\n\t\t\tscrollLeft: this.scrollLeft,\n\t\t});\n\t\tthis._layout = observableValue(this, computeCompressedVirtualizedScrollLayout({\n\t\t\trevision: this._revision,\n\t\t\tscrollTop: 0,\n\t\t\tviewportHeight: 0,\n\t\t\titemGap: 0,\n\t\t\titemHeights: [],\n\t\t}));\n\t\tthis.layout = this._layout;\n\t\tthis._scrollDimensions = observableValue(this, { width: 0, height: 0, scrollWidth: 0, scrollHeight: 0 });\n\t\tthis.scrollDimensions = this._scrollDimensions;\n\n\t\tthis._register(autorun(reader => {\n\t\t\tthis._sizeObserver.observe(dimension.read(reader));\n\t\t}));\n\t\tthis._register(autorun(reader => {\n\t\t\tthis._itemAnchorEditSignal.read(reader);\n\t\t\tconst width = this._sizeObserver.width.read(reader);\n\t\t\tconst height = this._sizeObserver.height.read(reader);\n\t\t\tconst items = this._items.read(reader);\n\t\t\tconst itemHeights = items.map(item => item.size.read(reader));\n\t\t\tconst max = findFirstMax(items, compareBy(item => item.maxScroll.read(reader).maxScroll, numberComparator));\n\t\t\tconst maxScroll = max?.maxScroll.read(reader).maxScroll ?? 0;\n\t\t\tconst gap = itemGap.read(reader);\n\t\t\tconst requestedScrollTop = this.scrollTop.read(reader);\n\t\t\tglobalTransaction(tx => this._update(items, itemHeights, gap, width, height, width + maxScroll, requestedScrollTop, tx));\n\t\t}));\n\t}\n\n\tsetScrollPosition(position: INewScrollPosition, smooth = false): void {\n\t\tthis._scrollableElement.setScrollPosition({\n\t\t\t...position,\n\t\t\treuseAnimation: smooth,\n\t\t});\n\t}\n\n\tsetLogicalScrollPosition(scrollTop: number, smooth = false): void {\n\t\tthis.setScrollPosition({ scrollTop: this._leadingScrollSlack + scrollTop }, smooth);\n\t}\n\n\tgetScrollPosition(): IScrollPosition {\n\t\treturn this._scrollableElement.getScrollPosition();\n\t}\n\n\tprivate _runWithItemScrollAnchor(item: ICompressedVirtualizedScrollItem, getItemOffset: () => number, update: (tx: ITransaction) => void): void {\n\t\tconst items = this._items.get();\n\t\tconst itemIndex = items.findIndex(candidate => candidate === item);\n\t\tif (itemIndex === -1) {\n\t\t\tthrow new BugIndicatingError('Cannot anchor an item that is not in the compacted virtualized scroll view');\n\t\t}\n\t\tconst itemRange = this._layout.get().items[itemIndex].contentRange;\n\t\tconst itemOffset = getItemOffset();\n\t\tif (!Number.isFinite(itemOffset) || itemOffset < 0 || itemOffset > itemRange.length) {\n\t\t\tthrow new BugIndicatingError(`Item anchor ${itemOffset} is outside item range ${itemRange}`);\n\t\t}\n\t\tconst position = {\n\t\t\trevision: this._revision,\n\t\t\toffset: itemRange.start + itemOffset,\n\t\t};\n\t\tconst logicalViewportTop = this.getScrollPosition().scrollTop - this._leadingScrollSlack;\n\t\tthis._runWithPendingAnchor({\n\t\t\tposition,\n\t\t\tviewportOffset: position.offset - logicalViewportTop,\n\t\t\titem,\n\t\t\tgetItemOffset,\n\t\t}, tx => {\n\t\t\tupdate(tx);\n\t\t\tif (getItemOffset() !== itemOffset) {\n\t\t\t\tthis._itemAnchorEditSignal.trigger(tx);\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate _runWithPendingAnchor(pendingAnchor: NonNullable<typeof this._pendingAnchor>, update: (tx: ITransaction) => void): void {\n\t\tif (this._pendingAnchor) {\n\t\t\tthrow new BugIndicatingError('Cannot nest compacted virtualized scroll anchors');\n\t\t}\n\t\tthis._pendingAnchor = pendingAnchor;\n\t\ttry {\n\t\t\tglobalTransaction(update);\n\t\t} finally {\n\t\t\tif (this._pendingAnchor === pendingAnchor) {\n\t\t\t\tthis._pendingAnchor = undefined;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate _update(\n\t\titems: readonly TItem[],\n\t\titemHeights: readonly number[],\n\t\titemGap: number,\n\t\twidth: number,\n\t\theight: number,\n\t\tscrollWidth: number,\n\t\trequestedScrollTop: number,\n\t\ttx: ITransaction,\n\t): void {\n\t\tif (this._isUpdating) {\n\t\t\treturn;\n\t\t}\n\t\tthis._isUpdating = true;\n\t\ttry {\n\t\t\tlet targetScrollTop = requestedScrollTop;\n\t\t\tconst scrollDelta = requestedScrollTop - this._lastScrollTop;\n\t\t\tif (scrollDelta !== 0) {\n\t\t\t\tthis._lastScrollDirection = scrollDelta < 0 ? 'up' : 'down';\n\t\t\t\tthis._clearScrollDirection.schedule();\n\t\t\t}\n\t\t\tconst previousItemHeights = this._previousItemHeights;\n\t\t\tconst geometryChanged = previousItemHeights !== undefined\n\t\t\t\t&& (itemGap !== this._previousItemGap || !arrayEquals(previousItemHeights, itemHeights));\n\t\t\tconst hasStableItems = this._previousItems !== undefined\n\t\t\t\t&& this._previousItems.length === items.length\n\t\t\t\t&& this._previousItems.every((item, index) => item === items[index]);\n\t\t\tconst itemsChanged = this._previousItems !== undefined && !hasStableItems;\n\t\t\tlet didApplyAnchor = false;\n\n\t\t\tconst appliesPendingAnchor = !!this._pendingAnchor && hasStableItems;\n\t\t\tif (previousItemHeights && (geometryChanged || appliesPendingAnchor) && hasStableItems) {\n\t\t\t\tconst oldLogicalScrollHeight = computeCompressedVirtualizedScrollHeight(previousItemHeights, this._previousItemGap);\n\t\t\t\tconst oldLogicalViewportTop = requestedScrollTop - this._leadingScrollSlack;\n\t\t\t\tconst pendingAnchor = this._pendingAnchor;\n\t\t\t\tconst isScrollingUp = this._lastScrollDirection === 'up';\n\t\t\t\tconst defaultAnchorViewportOffset = isScrollingUp ? height : 0;\n\t\t\t\tconst anchorKind = pendingAnchor?.item ? 'item' : pendingAnchor ? 'logical' : isScrollingUp ? 'viewportBottom' : 'viewportTop';\n\t\t\t\tconst anchorOffset = pendingAnchor?.position.offset ?? Math.max(0, Math.min(oldLogicalViewportTop + defaultAnchorViewportOffset, oldLogicalScrollHeight));\n\t\t\t\tconst anchorViewportOffset = pendingAnchor?.viewportOffset ?? anchorOffset - oldLogicalViewportTop;\n\t\t\t\tconst fromRevision = this._revision;\n\t\t\t\tconst toRevision = geometryChanged ? asLayoutRevision(fromRevision + 1) : fromRevision;\n\t\t\t\tconst edit = createAnchoredSizeEditBatch(fromRevision, toRevision, previousItemHeights, itemHeights, this._previousItemGap, itemGap, anchorOffset);\n\t\t\t\t// Mapping a removed bottom anchor to the item start would place the whole item below the viewport.\n\t\t\t\tlet mappedAnchor = mapLogicalPosition(edit.anchor, edit, anchorKind === 'viewportBottom' ? 'itemEnd' : 'itemStart');\n\t\t\t\tif (pendingAnchor?.item && pendingAnchor.getItemOffset) {\n\t\t\t\t\tconst itemIndex = items.findIndex(item => item === pendingAnchor.item);\n\t\t\t\t\tif (itemIndex === -1) {\n\t\t\t\t\t\tthrow new BugIndicatingError('Compacted virtualized scroll anchor item was removed during its edit');\n\t\t\t\t\t}\n\t\t\t\t\tconst itemRange = computeItemRanges(itemHeights, itemGap)[itemIndex];\n\t\t\t\t\tconst itemOffset = pendingAnchor.getItemOffset();\n\t\t\t\t\tif (!Number.isFinite(itemOffset) || itemOffset < 0 || itemOffset > itemRange.length) {\n\t\t\t\t\t\tthrow new BugIndicatingError(`Mapped item anchor ${itemOffset} is outside item range ${itemRange}`);\n\t\t\t\t\t}\n\t\t\t\t\tmappedAnchor = {\n\t\t\t\t\t\trevision: toRevision,\n\t\t\t\t\t\toffset: itemRange.start + itemOffset,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tconst newLogicalScrollHeight = computeCompressedVirtualizedScrollHeight(itemHeights, itemGap);\n\t\t\t\tconst desiredLogicalScrollTop = mappedAnchor.offset - anchorViewportOffset;\n\t\t\t\tconst naturalMaxScrollTop = Math.max(0, newLogicalScrollHeight - height);\n\n\t\t\t\tthis._leadingScrollSlack = Math.max(0, -desiredLogicalScrollTop);\n\t\t\t\tthis._trailingScrollSlack = Math.max(0, desiredLogicalScrollTop - naturalMaxScrollTop);\n\t\t\t\ttargetScrollTop = this._leadingScrollSlack + desiredLogicalScrollTop;\n\t\t\t\tthis._revision = toRevision;\n\t\t\t\tthis._pendingAnchor = undefined;\n\t\t\t\tdidApplyAnchor = true;\n\t\t\t\tthis._lastGeometryEdit.set({\n\t\t\t\t\tfromRevision,\n\t\t\t\t\ttoRevision,\n\t\t\t\t\tedits: edit.edits,\n\t\t\t\t\tanchorKind,\n\t\t\t\t\tanchorOffset,\n\t\t\t\t\tmappedAnchorOffset: mappedAnchor.offset,\n\t\t\t\t\tanchorViewportOffset,\n\t\t\t\t\tdesiredScrollTop: targetScrollTop,\n\t\t\t\t\tappliedScrollTop: targetScrollTop,\n\t\t\t\t\tleadingScrollSlack: this._leadingScrollSlack,\n\t\t\t\t\ttrailingScrollSlack: this._trailingScrollSlack,\n\t\t\t\t}, tx);\n\t\t\t} else if (geometryChanged || itemsChanged) {\n\t\t\t\tif (geometryChanged) {\n\t\t\t\t\tthis._revision = asLayoutRevision(this._revision + 1);\n\t\t\t\t}\n\t\t\t\tthis._leadingScrollSlack = 0;\n\t\t\t\tthis._trailingScrollSlack = 0;\n\t\t\t\tthis._lastGeometryEdit.set(undefined, tx);\n\t\t\t} else {\n\t\t\t\tif (scrollDelta > 0 && this._leadingScrollSlack > 0) {\n\t\t\t\t\tconst consumedSlack = Math.min(scrollDelta, this._leadingScrollSlack);\n\t\t\t\t\tthis._leadingScrollSlack -= consumedSlack;\n\t\t\t\t\ttargetScrollTop -= consumedSlack;\n\t\t\t\t} else if (scrollDelta < 0 && this._trailingScrollSlack > 0) {\n\t\t\t\t\tconst logicalScrollHeight = computeCompressedVirtualizedScrollHeight(itemHeights, itemGap);\n\t\t\t\t\tconst naturalMaxScrollTop = this._leadingScrollSlack + Math.max(0, logicalScrollHeight - height);\n\t\t\t\t\tthis._trailingScrollSlack = Math.max(0, targetScrollTop - naturalMaxScrollTop);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet layout = computeCompressedVirtualizedScrollLayout({\n\t\t\t\trevision: this._revision,\n\t\t\t\tscrollTop: targetScrollTop,\n\t\t\t\tviewportHeight: height,\n\t\t\t\titemGap,\n\t\t\t\titemHeights,\n\t\t\t\tleadingScrollSlack: this._leadingScrollSlack,\n\t\t\t\ttrailingScrollSlack: this._trailingScrollSlack,\n\t\t\t});\n\t\t\tconst dimensions = { width, height, scrollWidth, scrollHeight: layout.scrollHeight };\n\t\t\tthis._scrollableElements.root.style.height = `${height}px`;\n\t\t\tthis._scrollableElements.content.style.height = `${layout.scrollHeight}px`;\n\t\t\tthis._scrollable.setScrollDimensions(dimensions, true);\n\t\t\tconst needsImmediateScrollCorrection = geometryChanged || targetScrollTop !== requestedScrollTop;\n\t\t\tif (needsImmediateScrollCorrection) {\n\t\t\t\tthis._scrollable.setScrollPositionNow({ scrollTop: layout.scrollTop });\n\t\t\t}\n\t\t\tconst appliedScrollTop = this._scrollableElement.getScrollPosition().scrollTop;\n\t\t\tif (appliedScrollTop !== layout.scrollTop) {\n\t\t\t\tlayout = computeCompressedVirtualizedScrollLayout({\n\t\t\t\t\trevision: this._revision,\n\t\t\t\t\tscrollTop: appliedScrollTop,\n\t\t\t\t\tviewportHeight: height,\n\t\t\t\t\titemGap,\n\t\t\t\t\titemHeights,\n\t\t\t\t\tleadingScrollSlack: this._leadingScrollSlack,\n\t\t\t\t\ttrailingScrollSlack: this._trailingScrollSlack,\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst geometryEdit = this._lastGeometryEdit.get();\n\t\t\tif (didApplyAnchor && geometryEdit) {\n\t\t\t\tthis._lastGeometryEdit.set({ ...geometryEdit, appliedScrollTop }, tx);\n\t\t\t}\n\t\t\tthis._layout.set(layout, tx);\n\t\t\tthis._scrollDimensions.set(dimensions, tx);\n\t\t\tthis._render(items, layout, width);\n\t\t\tthis._previousItems = items;\n\t\t\tthis._previousItemHeights = itemHeights;\n\t\t\tthis._previousItemGap = itemGap;\n\t\t\tthis._lastScrollTop = layout.scrollTop;\n\t\t} finally {\n\t\t\tthis._isUpdating = false;\n\t\t}\n\t}\n\n\tprivate _render(items: readonly TItem[], layout: ICompressedVirtualizedScrollLayout, width: number): void {\n\t\tfor (let index = 0; index < items.length; index++) {\n\t\t\tconst item = items[index];\n\t\t\tconst itemLayout = layout.items[index];\n\t\t\tif (itemLayout.visibility !== 'visible') {\n\t\t\t\titem.hide();\n\t\t\t} else {\n\t\t\t\titem.render(itemLayout.renderedRange, itemLayout.scrollOffset, width, layout.renderedViewport, {\n\t\t\t\t\trunWithScrollAnchor: (getItemOffset, update) => this._runWithItemScrollAnchor(item, getItemOffset, update),\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tthis._scrollableElements.content.style.transform = `translateY(${-layout.renderedViewport.start}px)`;\n\t}\n}\n\nfunction arrayEquals(a: readonly number[], b: readonly number[]): boolean {\n\treturn a.length === b.length && a.every((value, index) => value === b[index]);\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 { addDisposableListener, Dimension, getWindow, h, scheduleAtNextAnimationFrame } from '../../../../base/browser/dom.js';\nimport { SmoothScrollableElement } from '../../../../base/browser/ui/scrollbar/scrollableElement.js';\nimport { compareBy, numberComparator } from '../../../../base/common/arrays.js';\nimport { findFirstMax } from '../../../../base/common/arraysFind.js';\nimport { RunOnceScheduler } from '../../../../base/common/async.js';\nimport { BugIndicatingError } from '../../../../base/common/errors.js';\nimport { Disposable } from '../../../../base/common/lifecycle.js';\nimport { autorun, globalTransaction, IObservable, ITransaction, observableFromEvent, observableSignal, observableValue } from '../../../../base/common/observable.js';\nimport { INewScrollPosition, IScrollPosition, Scrollable, ScrollbarVisibility } from '../../../../base/common/scrollable.js';\nimport { OffsetRange } from '../../../common/core/ranges/offsetRange.js';\nimport { ObservableElementSizeObserver } from '../diffEditor/utils.js';\nimport { asLayoutRevision, computeCompressedVirtualizedScrollHeight, computeCompressedVirtualizedScrollLayout, computeItemRanges, createAnchoredSizeEditBatch, ICompressedVirtualizedScrollLayout, ILogicalPosition, ISizeEdit, LayoutRevision, mapLogicalPosition } from './compressedVirtualizedScrollLayout.js';\n\nconst scrollDirectionRetentionDurationMs = 100;\n\nexport interface ICompressedVirtualizedScrollItem {\n\treadonly size: IObservable<number>;\n\treadonly maxScroll: IObservable<{ readonly maxScroll: number }>;\n\trender(renderedRange: OffsetRange, scrollOffset: number, width: number, renderedViewport: OffsetRange, context: ICompressedVirtualizedScrollItemContext): void;\n\thide(): void;\n}\n\nexport interface ICompressedVirtualizedScrollViewContext {\n\treadonly contentDomNode: HTMLElement;\n\treadonly overflowWidgetsDomNode: HTMLElement;\n\treadonly scrollLeft: IObservable<number>;\n}\n\nexport interface ICompressedVirtualizedScrollItemContext {\n\trunWithScrollAnchor(getItemOffset: () => number, update: (tx: ITransaction) => void): void;\n}\n\nexport interface ICompressedVirtualizedGeometryEdit {\n\treadonly fromRevision: LayoutRevision;\n\treadonly toRevision: LayoutRevision;\n\treadonly edits: readonly ISizeEdit[];\n\treadonly anchorKind: 'viewportTop' | 'viewportBottom' | 'logical' | 'item';\n\treadonly anchorOffset: number;\n\treadonly mappedAnchorOffset: number;\n\treadonly anchorViewportOffset: number;\n\treadonly desiredScrollTop: number;\n\treadonly appliedScrollTop: number;\n\treadonly leadingScrollSlack: number;\n\treadonly trailingScrollSlack: number;\n}\n\n/**\n * Virtualizes complete-height items into viewport-capped rows whose removed height is represented by item-local scrolling.\n */\nexport class CompressedVirtualizedScrollView<TItem extends ICompressedVirtualizedScrollItem> extends Disposable {\n\tprivate readonly _scrollableElements;\n\tprivate readonly _scrollable;\n\tprivate readonly _scrollableElement;\n\tprivate readonly _sizeObserver;\n\tprivate readonly _items;\n\tprivate readonly _layout;\n\tprivate readonly _scrollDimensions;\n\tprivate readonly _lastGeometryEdit = observableValue<ICompressedVirtualizedGeometryEdit | undefined>(this, undefined);\n\tprivate readonly _itemAnchorEditSignal = observableSignal(this);\n\tprivate _revision = asLayoutRevision(0);\n\tprivate _leadingScrollSlack = 0;\n\tprivate _trailingScrollSlack = 0;\n\tprivate _previousItems: readonly TItem[] | undefined;\n\tprivate _previousItemHeights: readonly number[] | undefined;\n\tprivate _previousItemGap = 0;\n\tprivate _lastScrollTop = 0;\n\tprivate _lastScrollDirection: 'up' | 'down' | undefined;\n\tprivate readonly _clearScrollDirection = this._register(new RunOnceScheduler(() => this._lastScrollDirection = undefined, scrollDirectionRetentionDurationMs));\n\tprivate _isUpdating = false;\n\tprivate _pendingAnchor: {\n\t\treadonly position: ILogicalPosition;\n\t\treadonly viewportOffset: number;\n\t\treadonly item?: ICompressedVirtualizedScrollItem;\n\t\treadonly getItemOffset?: () => number;\n\t} | undefined;\n\n\treadonly domNode: HTMLElement;\n\treadonly scrollTop: IObservable<number>;\n\treadonly scrollLeft: IObservable<number>;\n\treadonly layout: IObservable<ICompressedVirtualizedScrollLayout>;\n\treadonly scrollDimensions: IObservable<{ readonly width: number; readonly height: number; readonly scrollWidth: number; readonly scrollHeight: number }>;\n\treadonly lastGeometryEdit: IObservable<ICompressedVirtualizedGeometryEdit | undefined> = this._lastGeometryEdit;\n\n\tconstructor(\n\t\telementToObserve: HTMLElement,\n\t\tdimension: IObservable<Dimension | undefined>,\n\t\titemGap: IObservable<number>,\n\t\tcreateItems: (context: ICompressedVirtualizedScrollViewContext) => IObservable<readonly TItem[]>,\n\t) {\n\t\tsuper();\n\t\tthis._scrollableElements = h('div.scrollContent', [\n\t\t\th('div@content', {\n\t\t\t\tstyle: {\n\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\tposition: 'relative',\n\t\t\t\t}\n\t\t\t}),\n\t\t\th('div.monaco-editor@overflowWidgetsDomNode'),\n\t\t]);\n\t\tthis._scrollable = this._register(new Scrollable({\n\t\t\tforceIntegerValues: false,\n\t\t\tscheduleAtNextAnimationFrame: callback => scheduleAtNextAnimationFrame(getWindow(elementToObserve), callback),\n\t\t\tsmoothScrollDuration: 100,\n\t\t}));\n\t\tthis._scrollableElement = this._register(new SmoothScrollableElement(this._scrollableElements.root, {\n\t\t\tvertical: ScrollbarVisibility.Auto,\n\t\t\thorizontal: ScrollbarVisibility.Auto,\n\t\t\tuseShadows: false,\n\t\t}, this._scrollable));\n\t\tthis.domNode = h('div', {}, [this._scrollableElement.getDomNode()]).root;\n\t\t// The browser can natively scroll the `overflow: hidden` content (e.g. when focusing an element or\n\t\t// calling `scrollIntoView`), which the virtualized layout does not account for. Undo that native\n\t\t// scroll and apply it to the virtual scroll position instead, so the focused element stays visible.\n\t\tthis._register(addDisposableListener(this._scrollableElements.root, 'scroll', () => {\n\t\t\tconst element = this._scrollableElements.root;\n\t\t\tconst nativeScrollTop = element.scrollTop;\n\t\t\tconst nativeScrollLeft = element.scrollLeft;\n\t\t\tif (nativeScrollTop === 0 && nativeScrollLeft === 0) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telement.scrollTop = 0;\n\t\t\telement.scrollLeft = 0;\n\t\t\tconst position = this._scrollableElement.getScrollPosition();\n\t\t\tthis._scrollableElement.setScrollPosition({\n\t\t\t\tscrollTop: position.scrollTop + nativeScrollTop,\n\t\t\t\tscrollLeft: position.scrollLeft + nativeScrollLeft,\n\t\t\t});\n\t\t}));\n\t\tthis._sizeObserver = this._register(new ObservableElementSizeObserver(elementToObserve, undefined));\n\t\tthis.scrollTop = observableFromEvent(this, this._scrollableElement.onScroll, () => /** @description scrollTop */ this._scrollableElement.getScrollPosition().scrollTop);\n\t\tthis.scrollLeft = observableFromEvent(this, this._scrollableElement.onScroll, () => /** @description scrollLeft */ this._scrollableElement.getScrollPosition().scrollLeft);\n\t\tthis._items = createItems({\n\t\t\tcontentDomNode: this._scrollableElements.content,\n\t\t\toverflowWidgetsDomNode: this._scrollableElements.overflowWidgetsDomNode,\n\t\t\tscrollLeft: this.scrollLeft,\n\t\t});\n\t\tthis._layout = observableValue(this, computeCompressedVirtualizedScrollLayout({\n\t\t\trevision: this._revision,\n\t\t\tscrollTop: 0,\n\t\t\tviewportHeight: 0,\n\t\t\titemGap: 0,\n\t\t\titemHeights: [],\n\t\t}));\n\t\tthis.layout = this._layout;\n\t\tthis._scrollDimensions = observableValue(this, { width: 0, height: 0, scrollWidth: 0, scrollHeight: 0 });\n\t\tthis.scrollDimensions = this._scrollDimensions;\n\n\t\tthis._register(autorun(reader => {\n\t\t\tthis._sizeObserver.observe(dimension.read(reader));\n\t\t}));\n\t\tthis._register(autorun(reader => {\n\t\t\tthis._itemAnchorEditSignal.read(reader);\n\t\t\tconst width = this._sizeObserver.width.read(reader);\n\t\t\tconst height = this._sizeObserver.height.read(reader);\n\t\t\tconst items = this._items.read(reader);\n\t\t\tconst itemHeights = items.map(item => item.size.read(reader));\n\t\t\tconst max = findFirstMax(items, compareBy(item => item.maxScroll.read(reader).maxScroll, numberComparator));\n\t\t\tconst maxScroll = max?.maxScroll.read(reader).maxScroll ?? 0;\n\t\t\tconst gap = itemGap.read(reader);\n\t\t\tconst requestedScrollTop = this.scrollTop.read(reader);\n\t\t\tglobalTransaction(tx => this._update(items, itemHeights, gap, width, height, width + maxScroll, requestedScrollTop, tx));\n\t\t}));\n\t}\n\n\tsetScrollPosition(position: INewScrollPosition, smooth = false): void {\n\t\tthis._scrollableElement.setScrollPosition({\n\t\t\t...position,\n\t\t\treuseAnimation: smooth,\n\t\t});\n\t}\n\n\tsetLogicalScrollPosition(scrollTop: number, smooth = false): void {\n\t\tthis.setScrollPosition({ scrollTop: this._leadingScrollSlack + scrollTop }, smooth);\n\t}\n\n\tgetScrollPosition(): IScrollPosition {\n\t\treturn this._scrollableElement.getScrollPosition();\n\t}\n\n\tprivate _runWithItemScrollAnchor(item: ICompressedVirtualizedScrollItem, getItemOffset: () => number, update: (tx: ITransaction) => void): void {\n\t\tconst items = this._items.get();\n\t\tconst itemIndex = items.findIndex(candidate => candidate === item);\n\t\tif (itemIndex === -1) {\n\t\t\tthrow new BugIndicatingError('Cannot anchor an item that is not in the compacted virtualized scroll view');\n\t\t}\n\t\tconst itemRange = this._layout.get().items[itemIndex].contentRange;\n\t\tconst itemOffset = getItemOffset();\n\t\tif (!Number.isFinite(itemOffset) || itemOffset < 0 || itemOffset > itemRange.length) {\n\t\t\tthrow new BugIndicatingError(`Item anchor ${itemOffset} is outside item range ${itemRange}`);\n\t\t}\n\t\tconst position = {\n\t\t\trevision: this._revision,\n\t\t\toffset: itemRange.start + itemOffset,\n\t\t};\n\t\tconst logicalViewportTop = this.getScrollPosition().scrollTop - this._leadingScrollSlack;\n\t\tthis._runWithPendingAnchor({\n\t\t\tposition,\n\t\t\tviewportOffset: position.offset - logicalViewportTop,\n\t\t\titem,\n\t\t\tgetItemOffset,\n\t\t}, tx => {\n\t\t\tupdate(tx);\n\t\t\tif (getItemOffset() !== itemOffset) {\n\t\t\t\tthis._itemAnchorEditSignal.trigger(tx);\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate _runWithPendingAnchor(pendingAnchor: NonNullable<typeof this._pendingAnchor>, update: (tx: ITransaction) => void): void {\n\t\tif (this._pendingAnchor) {\n\t\t\tthrow new BugIndicatingError('Cannot nest compacted virtualized scroll anchors');\n\t\t}\n\t\tthis._pendingAnchor = pendingAnchor;\n\t\ttry {\n\t\t\tglobalTransaction(update);\n\t\t} finally {\n\t\t\tif (this._pendingAnchor === pendingAnchor) {\n\t\t\t\tthis._pendingAnchor = undefined;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate _update(\n\t\titems: readonly TItem[],\n\t\titemHeights: readonly number[],\n\t\titemGap: number,\n\t\twidth: number,\n\t\theight: number,\n\t\tscrollWidth: number,\n\t\trequestedScrollTop: number,\n\t\ttx: ITransaction,\n\t): void {\n\t\tif (this._isUpdating) {\n\t\t\treturn;\n\t\t}\n\t\tthis._isUpdating = true;\n\t\ttry {\n\t\t\tlet targetScrollTop = requestedScrollTop;\n\t\t\tconst scrollDelta = requestedScrollTop - this._lastScrollTop;\n\t\t\tif (scrollDelta !== 0) {\n\t\t\t\tthis._lastScrollDirection = scrollDelta < 0 ? 'up' : 'down';\n\t\t\t\tthis._clearScrollDirection.schedule();\n\t\t\t}\n\t\t\tconst previousItemHeights = this._previousItemHeights;\n\t\t\tconst geometryChanged = previousItemHeights !== undefined\n\t\t\t\t&& (itemGap !== this._previousItemGap || !arrayEquals(previousItemHeights, itemHeights));\n\t\t\tconst hasStableItems = this._previousItems !== undefined\n\t\t\t\t&& this._previousItems.length === items.length\n\t\t\t\t&& this._previousItems.every((item, index) => item === items[index]);\n\t\t\tconst itemsChanged = this._previousItems !== undefined && !hasStableItems;\n\t\t\tlet didApplyAnchor = false;\n\n\t\t\tconst appliesPendingAnchor = !!this._pendingAnchor && hasStableItems;\n\t\t\tif (previousItemHeights && (geometryChanged || appliesPendingAnchor) && hasStableItems) {\n\t\t\t\tconst oldLogicalScrollHeight = computeCompressedVirtualizedScrollHeight(previousItemHeights, this._previousItemGap);\n\t\t\t\tconst oldLogicalViewportTop = requestedScrollTop - this._leadingScrollSlack;\n\t\t\t\tconst pendingAnchor = this._pendingAnchor;\n\t\t\t\tconst isScrollingUp = this._lastScrollDirection === 'up';\n\t\t\t\tconst defaultAnchorViewportOffset = isScrollingUp ? height : 0;\n\t\t\t\tconst anchorKind = pendingAnchor?.item ? 'item' : pendingAnchor ? 'logical' : isScrollingUp ? 'viewportBottom' : 'viewportTop';\n\t\t\t\tconst anchorOffset = pendingAnchor?.position.offset ?? Math.max(0, Math.min(oldLogicalViewportTop + defaultAnchorViewportOffset, oldLogicalScrollHeight));\n\t\t\t\tconst anchorViewportOffset = pendingAnchor?.viewportOffset ?? anchorOffset - oldLogicalViewportTop;\n\t\t\t\tconst fromRevision = this._revision;\n\t\t\t\tconst toRevision = geometryChanged ? asLayoutRevision(fromRevision + 1) : fromRevision;\n\t\t\t\tconst edit = createAnchoredSizeEditBatch(fromRevision, toRevision, previousItemHeights, itemHeights, this._previousItemGap, itemGap, anchorOffset);\n\t\t\t\t// Mapping a removed bottom anchor to the item start would place the whole item below the viewport.\n\t\t\t\tlet mappedAnchor = mapLogicalPosition(edit.anchor, edit, anchorKind === 'viewportBottom' ? 'itemEnd' : 'itemStart');\n\t\t\t\tif (pendingAnchor?.item && pendingAnchor.getItemOffset) {\n\t\t\t\t\tconst itemIndex = items.findIndex(item => item === pendingAnchor.item);\n\t\t\t\t\tif (itemIndex === -1) {\n\t\t\t\t\t\tthrow new BugIndicatingError('Compacted virtualized scroll anchor item was removed during its edit');\n\t\t\t\t\t}\n\t\t\t\t\tconst itemRange = computeItemRanges(itemHeights, itemGap)[itemIndex];\n\t\t\t\t\tconst itemOffset = pendingAnchor.getItemOffset();\n\t\t\t\t\tif (!Number.isFinite(itemOffset) || itemOffset < 0 || itemOffset > itemRange.length) {\n\t\t\t\t\t\tthrow new BugIndicatingError(`Mapped item anchor ${itemOffset} is outside item range ${itemRange}`);\n\t\t\t\t\t}\n\t\t\t\t\tmappedAnchor = {\n\t\t\t\t\t\trevision: toRevision,\n\t\t\t\t\t\toffset: itemRange.start + itemOffset,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tconst newLogicalScrollHeight = computeCompressedVirtualizedScrollHeight(itemHeights, itemGap);\n\t\t\t\tconst desiredLogicalScrollTop = mappedAnchor.offset - anchorViewportOffset;\n\t\t\t\tconst naturalMaxScrollTop = Math.max(0, newLogicalScrollHeight - height);\n\n\t\t\t\tthis._leadingScrollSlack = Math.max(0, -desiredLogicalScrollTop);\n\t\t\t\tthis._trailingScrollSlack = Math.max(0, desiredLogicalScrollTop - naturalMaxScrollTop);\n\t\t\t\ttargetScrollTop = this._leadingScrollSlack + desiredLogicalScrollTop;\n\t\t\t\tthis._revision = toRevision;\n\t\t\t\tthis._pendingAnchor = undefined;\n\t\t\t\tdidApplyAnchor = true;\n\t\t\t\tthis._lastGeometryEdit.set({\n\t\t\t\t\tfromRevision,\n\t\t\t\t\ttoRevision,\n\t\t\t\t\tedits: edit.edits,\n\t\t\t\t\tanchorKind,\n\t\t\t\t\tanchorOffset,\n\t\t\t\t\tmappedAnchorOffset: mappedAnchor.offset,\n\t\t\t\t\tanchorViewportOffset,\n\t\t\t\t\tdesiredScrollTop: targetScrollTop,\n\t\t\t\t\tappliedScrollTop: targetScrollTop,\n\t\t\t\t\tleadingScrollSlack: this._leadingScrollSlack,\n\t\t\t\t\ttrailingScrollSlack: this._trailingScrollSlack,\n\t\t\t\t}, tx);\n\t\t\t} else if (geometryChanged || itemsChanged) {\n\t\t\t\tif (geometryChanged) {\n\t\t\t\t\tthis._revision = asLayoutRevision(this._revision + 1);\n\t\t\t\t}\n\t\t\t\tthis._leadingScrollSlack = 0;\n\t\t\t\tthis._trailingScrollSlack = 0;\n\t\t\t\tthis._lastGeometryEdit.set(undefined, tx);\n\t\t\t} else {\n\t\t\t\tif (scrollDelta > 0 && this._leadingScrollSlack > 0) {\n\t\t\t\t\tconst consumedSlack = Math.min(scrollDelta, this._leadingScrollSlack);\n\t\t\t\t\tthis._leadingScrollSlack -= consumedSlack;\n\t\t\t\t\ttargetScrollTop -= consumedSlack;\n\t\t\t\t} else if (scrollDelta < 0 && this._trailingScrollSlack > 0) {\n\t\t\t\t\tconst logicalScrollHeight = computeCompressedVirtualizedScrollHeight(itemHeights, itemGap);\n\t\t\t\t\tconst naturalMaxScrollTop = this._leadingScrollSlack + Math.max(0, logicalScrollHeight - height);\n\t\t\t\t\tthis._trailingScrollSlack = Math.max(0, targetScrollTop - naturalMaxScrollTop);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet layout = computeCompressedVirtualizedScrollLayout({\n\t\t\t\trevision: this._revision,\n\t\t\t\tscrollTop: targetScrollTop,\n\t\t\t\tviewportHeight: height,\n\t\t\t\titemGap,\n\t\t\t\titemHeights,\n\t\t\t\tleadingScrollSlack: this._leadingScrollSlack,\n\t\t\t\ttrailingScrollSlack: this._trailingScrollSlack,\n\t\t\t});\n\t\t\tconst dimensions = { width, height, scrollWidth, scrollHeight: layout.scrollHeight };\n\t\t\tthis._scrollableElements.root.style.height = `${height}px`;\n\t\t\tthis._scrollableElements.content.style.height = `${layout.scrollHeight}px`;\n\t\t\tthis._scrollable.setScrollDimensions(dimensions, true);\n\t\t\tconst needsImmediateScrollCorrection = geometryChanged || targetScrollTop !== requestedScrollTop;\n\t\t\tif (needsImmediateScrollCorrection) {\n\t\t\t\tthis._scrollable.setScrollPositionNow({ scrollTop: layout.scrollTop });\n\t\t\t}\n\t\t\tconst appliedScrollTop = this._scrollableElement.getScrollPosition().scrollTop;\n\t\t\tif (appliedScrollTop !== layout.scrollTop) {\n\t\t\t\tlayout = computeCompressedVirtualizedScrollLayout({\n\t\t\t\t\trevision: this._revision,\n\t\t\t\t\tscrollTop: appliedScrollTop,\n\t\t\t\t\tviewportHeight: height,\n\t\t\t\t\titemGap,\n\t\t\t\t\titemHeights,\n\t\t\t\t\tleadingScrollSlack: this._leadingScrollSlack,\n\t\t\t\t\ttrailingScrollSlack: this._trailingScrollSlack,\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst geometryEdit = this._lastGeometryEdit.get();\n\t\t\tif (didApplyAnchor && geometryEdit) {\n\t\t\t\tthis._lastGeometryEdit.set({ ...geometryEdit, appliedScrollTop }, tx);\n\t\t\t}\n\t\t\tthis._layout.set(layout, tx);\n\t\t\tthis._scrollDimensions.set(dimensions, tx);\n\t\t\tthis._render(items, layout, width);\n\t\t\tthis._previousItems = items;\n\t\t\tthis._previousItemHeights = itemHeights;\n\t\t\tthis._previousItemGap = itemGap;\n\t\t\tthis._lastScrollTop = layout.scrollTop;\n\t\t} finally {\n\t\t\tthis._isUpdating = false;\n\t\t}\n\t}\n\n\tprivate _render(items: readonly TItem[], layout: ICompressedVirtualizedScrollLayout, width: number): void {\n\t\tfor (let index = 0; index < items.length; index++) {\n\t\t\tconst item = items[index];\n\t\t\tconst itemLayout = layout.items[index];\n\t\t\tif (itemLayout.visibility !== 'visible') {\n\t\t\t\titem.hide();\n\t\t\t} else {\n\t\t\t\titem.render(itemLayout.renderedRange, itemLayout.scrollOffset, width, layout.renderedViewport, {\n\t\t\t\t\trunWithScrollAnchor: (getItemOffset, update) => this._runWithItemScrollAnchor(item, getItemOffset, update),\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tthis._scrollableElements.content.style.transform = `translateY(${-layout.renderedViewport.start}px)`;\n\t}\n}\n\nfunction arrayEquals(a: readonly number[], b: readonly number[]): boolean {\n\treturn a.length === b.length && a.every((value, index) => value === b[index]);\n}\n"]}
|