monaco-editor-core 0.55.0 → 0.56.0-dev-20251121
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 +27 -8
- package/esm/vs/base/browser/dom.js +31 -34
- package/esm/vs/base/browser/dom.js.map +1 -1
- package/esm/vs/base/browser/dompurify/dompurify.js +0 -1
- package/esm/vs/base/browser/keyboardEvent.js +3 -3
- package/esm/vs/base/browser/keyboardEvent.js.map +1 -1
- package/esm/vs/base/browser/markdownRenderer.js +5 -2
- package/esm/vs/base/browser/markdownRenderer.js.map +1 -1
- package/esm/vs/base/browser/pixelRatio.js +5 -5
- package/esm/vs/base/browser/pixelRatio.js.map +1 -1
- package/esm/vs/base/browser/trustedTypes.js +1 -1
- package/esm/vs/base/browser/trustedTypes.js.map +1 -1
- package/esm/vs/base/browser/ui/actionbar/actionbar.js +3 -0
- package/esm/vs/base/browser/ui/actionbar/actionbar.js.map +1 -1
- package/esm/vs/base/browser/ui/codicons/codicon/codicon.ttf +0 -0
- package/esm/vs/base/browser/ui/dropdown/dropdownActionViewItem.js +7 -0
- package/esm/vs/base/browser/ui/dropdown/dropdownActionViewItem.js.map +1 -1
- package/esm/vs/base/browser/ui/hover/hoverWidget.css +0 -13
- package/esm/vs/base/browser/ui/inputbox/inputBox.js +7 -0
- package/esm/vs/base/browser/ui/inputbox/inputBox.js.map +1 -1
- package/esm/vs/base/browser/ui/keybindingLabel/keybindingLabel.css +4 -2
- package/esm/vs/base/browser/ui/list/listView.js +7 -2
- package/esm/vs/base/browser/ui/list/listView.js.map +1 -1
- package/esm/vs/base/browser/ui/selectBox/selectBox.js +4 -0
- package/esm/vs/base/browser/ui/selectBox/selectBox.js.map +1 -1
- package/esm/vs/base/browser/ui/selectBox/selectBoxCustom.css +12 -32
- package/esm/vs/base/browser/ui/selectBox/selectBoxCustom.js +8 -18
- package/esm/vs/base/browser/ui/selectBox/selectBoxCustom.js.map +1 -1
- package/esm/vs/base/browser/ui/toolbar/toolbar.js +41 -14
- package/esm/vs/base/browser/ui/toolbar/toolbar.js.map +1 -1
- package/esm/vs/base/browser/ui/tree/abstractTree.js +11 -0
- package/esm/vs/base/browser/ui/tree/abstractTree.js.map +1 -1
- package/esm/vs/base/browser/ui/tree/asyncDataTree.js +1 -0
- package/esm/vs/base/browser/ui/tree/asyncDataTree.js.map +1 -1
- package/esm/vs/base/browser/ui/tree/compressedObjectTreeModel.js.map +1 -1
- package/esm/vs/base/browser/ui/tree/dataTree.js.map +1 -1
- package/esm/vs/base/browser/ui/tree/indexTreeModel.js.map +1 -1
- package/esm/vs/base/browser/ui/tree/objectTree.js.map +1 -1
- package/esm/vs/base/browser/ui/tree/objectTreeModel.js.map +1 -1
- package/esm/vs/base/browser/ui/tree/tree.js.map +1 -1
- package/esm/vs/base/common/arrays.js +10 -0
- package/esm/vs/base/common/arrays.js.map +1 -1
- package/esm/vs/base/common/async.js +34 -0
- package/esm/vs/base/common/async.js.map +1 -1
- package/esm/vs/base/common/buffer.js +1 -1
- package/esm/vs/base/common/buffer.js.map +1 -1
- package/esm/vs/base/common/cancellation.js.map +1 -1
- package/esm/vs/base/common/codiconsLibrary.js +3 -0
- package/esm/vs/base/common/codiconsLibrary.js.map +1 -1
- package/esm/vs/base/common/collections.js.map +1 -1
- package/esm/vs/base/common/equals.js.map +1 -1
- package/esm/vs/base/common/event.js +32 -15
- package/esm/vs/base/common/event.js.map +1 -1
- package/esm/vs/base/common/filters.js +22 -3
- package/esm/vs/base/common/filters.js.map +1 -1
- package/esm/vs/base/common/hotReload.js +2 -2
- package/esm/vs/base/common/hotReload.js.map +1 -1
- package/esm/vs/base/common/iterator.js +1 -1
- package/esm/vs/base/common/iterator.js.map +1 -1
- package/esm/vs/base/common/keyCodes.js +7 -6
- package/esm/vs/base/common/keyCodes.js.map +1 -1
- package/esm/vs/base/common/linkedList.js.map +1 -1
- package/esm/vs/base/common/map.js.map +1 -1
- package/esm/vs/base/common/marked/marked.js +0 -1
- package/esm/vs/base/common/network.js +26 -1
- package/esm/vs/base/common/network.js.map +1 -1
- package/esm/vs/base/common/normalization.js +19 -6
- package/esm/vs/base/common/normalization.js.map +1 -1
- package/esm/vs/base/common/observableInternal/debugLocation.js +1 -2
- package/esm/vs/base/common/observableInternal/debugLocation.js.map +1 -1
- package/esm/vs/base/common/observableInternal/debugName.js +0 -1
- package/esm/vs/base/common/observableInternal/debugName.js.map +1 -1
- package/esm/vs/base/common/observableInternal/index.js +4 -4
- package/esm/vs/base/common/observableInternal/index.js.map +1 -1
- package/esm/vs/base/common/observableInternal/logging/debugGetDependencyGraph.js +38 -10
- package/esm/vs/base/common/observableInternal/logging/debugGetDependencyGraph.js.map +1 -1
- package/esm/vs/base/common/observableInternal/observables/baseObservable.js +3 -3
- package/esm/vs/base/common/observableInternal/observables/baseObservable.js.map +1 -1
- package/esm/vs/base/common/observableInternal/utils/utils.js +46 -5
- package/esm/vs/base/common/observableInternal/utils/utils.js.map +1 -1
- package/esm/vs/base/common/path.js +1 -0
- package/esm/vs/base/common/path.js.map +1 -1
- package/esm/vs/base/common/strings.js +27 -19
- package/esm/vs/base/common/strings.js.map +1 -1
- package/esm/vs/editor/browser/config/elementSizeObserver.js +5 -5
- package/esm/vs/editor/browser/config/elementSizeObserver.js.map +1 -1
- package/esm/vs/editor/browser/config/fontMeasurements.js.map +1 -1
- package/esm/vs/editor/browser/config/migrateOptions.js +6 -0
- package/esm/vs/editor/browser/config/migrateOptions.js.map +1 -1
- package/esm/vs/editor/browser/config/tabFocus.js +4 -2
- package/esm/vs/editor/browser/config/tabFocus.js.map +1 -1
- package/esm/vs/editor/browser/controller/editContext/native/nativeEditContext.js +8 -0
- package/esm/vs/editor/browser/controller/editContext/native/nativeEditContext.js.map +1 -1
- package/esm/vs/editor/browser/coreCommands.js +1 -2
- package/esm/vs/editor/browser/coreCommands.js.map +1 -1
- package/esm/vs/editor/browser/editorBrowser.js.map +1 -1
- package/esm/vs/editor/browser/observableCodeEditor.js +32 -1
- package/esm/vs/editor/browser/observableCodeEditor.js.map +1 -1
- package/esm/vs/editor/browser/services/contribution.js +9 -0
- package/esm/vs/editor/browser/services/contribution.js.map +1 -0
- package/esm/vs/editor/browser/services/editorWorkerService.js +27 -14
- package/esm/vs/editor/browser/services/editorWorkerService.js.map +1 -1
- package/esm/vs/editor/browser/services/openerService.js +5 -1
- package/esm/vs/editor/browser/services/openerService.js.map +1 -1
- package/esm/vs/editor/browser/view/domLineBreaksComputer.js +1 -1
- package/esm/vs/editor/browser/view/domLineBreaksComputer.js.map +1 -1
- package/esm/vs/editor/browser/view/renderingContext.js +1 -1
- package/esm/vs/editor/browser/view/renderingContext.js.map +1 -1
- package/esm/vs/editor/browser/viewParts/currentLineHighlight/currentLineHighlight.js +10 -3
- package/esm/vs/editor/browser/viewParts/currentLineHighlight/currentLineHighlight.js.map +1 -1
- package/esm/vs/editor/browser/viewParts/glyphMargin/glyphMargin.js +3 -4
- package/esm/vs/editor/browser/viewParts/glyphMargin/glyphMargin.js.map +1 -1
- package/esm/vs/editor/browser/viewParts/minimap/minimap.js +1 -1
- package/esm/vs/editor/browser/viewParts/minimap/minimap.js.map +1 -1
- package/esm/vs/editor/browser/viewParts/overlayWidgets/overlayWidgets.js +1 -1
- package/esm/vs/editor/browser/viewParts/overlayWidgets/overlayWidgets.js.map +1 -1
- package/esm/vs/editor/browser/viewParts/overviewRuler/overviewRuler.js +4 -2
- package/esm/vs/editor/browser/viewParts/overviewRuler/overviewRuler.js.map +1 -1
- package/esm/vs/editor/browser/viewParts/rulers/rulers.js +1 -3
- package/esm/vs/editor/browser/viewParts/rulers/rulers.js.map +1 -1
- package/esm/vs/editor/browser/viewParts/scrollDecoration/scrollDecoration.js +1 -1
- package/esm/vs/editor/browser/viewParts/scrollDecoration/scrollDecoration.js.map +1 -1
- package/esm/vs/editor/browser/viewParts/viewLines/domReadingContext.js +2 -1
- package/esm/vs/editor/browser/viewParts/viewLines/domReadingContext.js.map +1 -1
- package/esm/vs/editor/browser/viewParts/viewLines/viewLines.js +6 -18
- package/esm/vs/editor/browser/viewParts/viewLines/viewLines.js.map +1 -1
- package/esm/vs/editor/browser/viewParts/whitespace/whitespace.js +0 -7
- package/esm/vs/editor/browser/viewParts/whitespace/whitespace.js.map +1 -1
- package/esm/vs/editor/browser/widget/codeEditor/codeEditorWidget.js +7 -2
- package/esm/vs/editor/browser/widget/codeEditor/codeEditorWidget.js.map +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/features/hideUnchangedRegionsFeature.js +1 -0
- package/esm/vs/editor/browser/widget/diffEditor/features/hideUnchangedRegionsFeature.js.map +1 -1
- package/esm/vs/editor/common/commands/replaceCommand.js +2 -2
- package/esm/vs/editor/common/commands/replaceCommand.js.map +1 -1
- package/esm/vs/editor/common/config/editorOptions.js +374 -360
- package/esm/vs/editor/common/config/editorOptions.js.map +1 -1
- package/esm/vs/editor/common/core/2d/rect.js +7 -0
- package/esm/vs/editor/common/core/2d/rect.js.map +1 -1
- package/esm/vs/editor/common/core/2d/size.js +20 -0
- package/esm/vs/editor/common/core/2d/size.js.map +1 -0
- package/esm/vs/editor/common/core/editorColorRegistry.js +69 -68
- package/esm/vs/editor/common/core/editorColorRegistry.js.map +1 -1
- package/esm/vs/editor/common/core/ranges/offsetRange.js +9 -0
- package/esm/vs/editor/common/core/ranges/offsetRange.js.map +1 -1
- package/esm/vs/editor/common/cursor/cursorMoveCommands.js +4 -4
- package/esm/vs/editor/common/cursor/cursorMoveCommands.js.map +1 -1
- package/esm/vs/editor/common/editorContextKeys.js +47 -47
- package/esm/vs/editor/common/languages/modesRegistry.js +1 -1
- package/esm/vs/editor/common/languages.js +56 -56
- package/esm/vs/editor/common/languages.js.map +1 -1
- package/esm/vs/editor/common/model/editStack.js +1 -1
- package/esm/vs/editor/common/services/languagesAssociations.js +6 -8
- package/esm/vs/editor/common/services/languagesAssociations.js.map +1 -1
- package/esm/vs/editor/common/standaloneStrings.js +11 -10
- package/esm/vs/editor/common/standaloneStrings.js.map +1 -1
- package/esm/vs/editor/common/textModelEditSource.js +1 -1
- package/esm/vs/editor/common/textModelEditSource.js.map +1 -1
- package/esm/vs/editor/common/viewLayout/viewLineRenderer.js +2 -2
- package/esm/vs/editor/contrib/anchorSelect/browser/anchorSelect.js +6 -6
- package/esm/vs/editor/contrib/bracketMatching/browser/bracketMatching.js +6 -6
- 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 +17 -17
- 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/lightBulbWidget.js +9 -9
- package/esm/vs/editor/contrib/codelens/browser/codelens.js.map +1 -1
- package/esm/vs/editor/contrib/codelens/browser/codelensController.js +2 -2
- package/esm/vs/editor/contrib/codelens/browser/codelensController.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/hoverColorPickerParticipant.js +1 -1
- package/esm/vs/editor/contrib/colorPicker/browser/standaloneColorPicker/standaloneColorPickerActions.js +7 -7
- package/esm/vs/editor/contrib/comment/browser/comment.js +6 -6
- package/esm/vs/editor/contrib/contextmenu/browser/contextmenu.js +10 -10
- package/esm/vs/editor/contrib/cursorUndo/browser/cursorUndo.js +2 -2
- package/esm/vs/editor/contrib/diffEditorBreadcrumbs/browser/contribution.js +14 -0
- package/esm/vs/editor/contrib/diffEditorBreadcrumbs/browser/contribution.js.map +1 -1
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteContribution.js +4 -4
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.js +9 -9
- 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/postEditWidget.js +2 -2
- package/esm/vs/editor/contrib/editorState/browser/keybindingCancellation.js +1 -1
- package/esm/vs/editor/contrib/find/browser/findController.js +17 -17
- package/esm/vs/editor/contrib/find/browser/findController.js.map +1 -1
- package/esm/vs/editor/contrib/find/browser/findWidget.js +26 -26
- package/esm/vs/editor/contrib/floatingMenu/browser/floatingMenu.css +1 -1
- package/esm/vs/editor/contrib/folding/browser/folding.js +20 -20
- package/esm/vs/editor/contrib/folding/browser/folding.js.map +1 -1
- 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/format.js +21 -6
- package/esm/vs/editor/contrib/format/browser/format.js.map +1 -1
- 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/goToDefinitionAtPosition.js +1 -1
- package/esm/vs/editor/contrib/gotoSymbol/browser/peek/referencesController.js +3 -3
- 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 +5 -10
- package/esm/vs/editor/contrib/hover/browser/contentHoverController.js.map +1 -1
- package/esm/vs/editor/contrib/hover/browser/glyphHoverController.js +11 -6
- package/esm/vs/editor/contrib/hover/browser/glyphHoverController.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/hoverUtils.js +24 -0
- package/esm/vs/editor/contrib/hover/browser/hoverUtils.js.map +1 -1
- package/esm/vs/editor/contrib/hover/browser/markdownHoverParticipant.js +9 -9
- package/esm/vs/editor/contrib/hover/browser/markerHoverParticipant.js +5 -5
- 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/inlayHintsHover.js +8 -8
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/commands.js +20 -20
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionContextKeys.js +12 -12
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionsController.js +18 -16
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionsController.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/hintsWidget/hoverParticipant.js +2 -2
- package/esm/vs/editor/contrib/inlineCompletions/browser/hintsWidget/inlineCompletionsHintsWidget.js +5 -5
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.js +42 -37
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineEdit.js +3 -3
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineEdit.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineSuggestionItem.js +8 -8
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineSuggestionItem.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.js +54 -43
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorMenu.js +12 -12
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorMenu.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorView.js +74 -48
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsModel.js +8 -36
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsModel.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsNewUsers.js +10 -11
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsNewUsers.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsView.js +105 -119
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViewInterface.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViewProducer.js +8 -36
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViewProducer.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/debugVisualization.js +95 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/debugVisualization.js.map +1 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsInsertionView.js +17 -9
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsInsertionView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/inlineEditsLongDistanceHint.js +415 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/inlineEditsLongDistanceHint.js.map +1 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/longDistancePreviewEditor.js +253 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/longDistancePreviewEditor.js.map +1 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/theme.js +20 -20
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/utils/flexBoxLayout.js +103 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/utils/flexBoxLayout.js.map +1 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/utils/towersLayout.js +32 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/utils/towersLayout.js.map +1 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/utils/utils.js +44 -11
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/utils/utils.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineSuggestionsView.js +181 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineSuggestionsView.js.map +1 -0
- 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 -31
- package/esm/vs/editor/contrib/linesOperations/browser/linesOperations.js.map +1 -1
- package/esm/vs/editor/contrib/linkedEditing/browser/linkedEditing.js +2 -2
- package/esm/vs/editor/contrib/links/browser/links.js +10 -10
- package/esm/vs/editor/contrib/message/browser/messageController.js +1 -1
- package/esm/vs/editor/contrib/multicursor/browser/multicursor.js +22 -22
- package/esm/vs/editor/contrib/parameterHints/browser/parameterHints.js +1 -1
- package/esm/vs/editor/contrib/parameterHints/browser/parameterHintsWidget.js +4 -4
- 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/quickAccess/browser/editorNavigationQuickAccess.js +2 -2
- package/esm/vs/editor/contrib/quickAccess/browser/editorNavigationQuickAccess.js.map +1 -1
- package/esm/vs/editor/contrib/quickAccess/browser/gotoLineQuickAccess.js +18 -13
- package/esm/vs/editor/contrib/quickAccess/browser/gotoLineQuickAccess.js.map +1 -1
- package/esm/vs/editor/contrib/quickAccess/browser/gotoSymbolQuickAccess.js +32 -32
- package/esm/vs/editor/contrib/readOnlyMessage/browser/contribution.js +2 -2
- package/esm/vs/editor/contrib/rename/browser/rename.js +12 -12
- package/esm/vs/editor/contrib/rename/browser/rename.js.map +1 -1
- package/esm/vs/editor/contrib/rename/browser/renameWidget.js +7 -7
- package/esm/vs/editor/contrib/smartSelect/browser/smartSelect.js +4 -4
- package/esm/vs/editor/contrib/snippet/browser/snippetController2.js +4 -4
- 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/stickyScrollWidget.js +1 -1
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollWidget.js.map +1 -1
- package/esm/vs/editor/contrib/suggest/browser/suggest.js +8 -8
- package/esm/vs/editor/contrib/suggest/browser/suggestController.js +10 -10
- package/esm/vs/editor/contrib/suggest/browser/suggestWidget.js +17 -17
- package/esm/vs/editor/contrib/suggest/browser/suggestWidgetDetails.js +2 -2
- package/esm/vs/editor/contrib/suggest/browser/suggestWidgetRenderer.js +2 -2
- package/esm/vs/editor/contrib/suggest/browser/wordContextKey.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 +29 -29
- package/esm/vs/editor/contrib/unicodeHighlighter/browser/unicodeHighlighter.js.map +1 -1
- package/esm/vs/editor/contrib/unusualLineTerminators/browser/unusualLineTerminators.js +5 -5
- package/esm/vs/editor/contrib/wordHighlighter/browser/highlightDecorations.js +9 -9
- package/esm/vs/editor/contrib/wordHighlighter/browser/wordHighlighter.js +4 -4
- package/esm/vs/editor/contrib/wordHighlighter/browser/wordHighlighter.js.map +1 -1
- package/esm/vs/editor/contrib/wordOperations/browser/wordOperations.js +1 -1
- package/esm/vs/editor/editor.all.js +1 -0
- package/esm/vs/editor/editor.all.js.map +1 -1
- package/esm/vs/editor/editor.api.d.ts +9 -5
- package/esm/vs/editor/standalone/browser/quickAccess/standaloneGotoLineQuickAccess.js +22 -2
- package/esm/vs/editor/standalone/browser/quickAccess/standaloneGotoLineQuickAccess.js.map +1 -1
- package/esm/vs/editor/standalone/browser/services/standaloneWebWorkerService.js +39 -0
- package/esm/vs/editor/standalone/browser/services/standaloneWebWorkerService.js.map +1 -0
- package/esm/vs/editor/standalone/browser/standaloneEditor.js +2 -1
- package/esm/vs/editor/standalone/browser/standaloneEditor.js.map +1 -1
- package/esm/vs/editor/standalone/browser/standaloneServices.js +3 -21
- package/esm/vs/editor/standalone/browser/standaloneServices.js.map +1 -1
- package/esm/vs/editor/standalone/browser/standaloneWebWorker.js +4 -4
- package/esm/vs/editor/standalone/browser/standaloneWebWorker.js.map +1 -1
- package/esm/vs/platform/accessibilitySignal/browser/accessibilitySignalService.js +62 -62
- package/esm/vs/platform/action/common/actionCommonCategories.js +6 -6
- package/esm/vs/platform/actionWidget/browser/actionList.js +4 -4
- package/esm/vs/platform/actionWidget/browser/actionWidget.js +7 -7
- package/esm/vs/platform/actions/browser/menuEntryActionViewItem.js +7 -9
- package/esm/vs/platform/actions/browser/menuEntryActionViewItem.js.map +1 -1
- package/esm/vs/platform/actions/browser/toolbar.js +2 -2
- package/esm/vs/platform/actions/common/actions.js +2 -0
- package/esm/vs/platform/actions/common/actions.js.map +1 -1
- package/esm/vs/platform/actions/common/menuService.js +2 -2
- package/esm/vs/platform/configuration/common/configuration.js +5 -4
- package/esm/vs/platform/configuration/common/configuration.js.map +1 -1
- package/esm/vs/platform/configuration/common/configurationModels.js +21 -10
- package/esm/vs/platform/configuration/common/configurationModels.js.map +1 -1
- package/esm/vs/platform/configuration/common/configurationRegistry.js +10 -10
- package/esm/vs/platform/configuration/common/configurationRegistry.js.map +1 -1
- package/esm/vs/platform/configuration/common/configurations.js.map +1 -1
- package/esm/vs/platform/contextkey/browser/contextKeyService.js +3 -3
- package/esm/vs/platform/contextkey/browser/contextKeyService.js.map +1 -1
- package/esm/vs/platform/contextkey/common/contextkey.js +9 -9
- package/esm/vs/platform/contextkey/common/contextkeys.js +9 -9
- package/esm/vs/platform/contextkey/common/scanner.js +5 -5
- package/esm/vs/platform/contextview/browser/contextViewService.js.map +1 -1
- package/esm/vs/platform/history/browser/contextScopedHistoryWidget.js +1 -1
- package/esm/vs/platform/hover/browser/hoverWidget.js +1 -1
- package/esm/vs/platform/hover/browser/updatableHoverWidget.js +1 -1
- package/esm/vs/platform/keybinding/common/abstractKeybindingService.js +4 -4
- package/esm/vs/platform/list/browser/listService.js +27 -27
- package/esm/vs/platform/list/browser/listService.js.map +1 -1
- package/esm/vs/platform/markers/common/markerService.js +2 -2
- package/esm/vs/platform/markers/common/markers.js +6 -6
- package/esm/vs/platform/quickinput/browser/commandsQuickAccess.js +11 -32
- package/esm/vs/platform/quickinput/browser/commandsQuickAccess.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/helpQuickAccess.js +1 -1
- package/esm/vs/platform/quickinput/browser/media/quickInput.css +9 -3
- 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 +35 -14
- package/esm/vs/platform/quickinput/browser/quickInputController.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/quickInputList.js +4 -1
- package/esm/vs/platform/quickinput/browser/quickInputList.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/quickInputTreeController.js +71 -40
- package/esm/vs/platform/quickinput/browser/tree/quickInputTreeController.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/tree/quickInputTreeRenderer.js +21 -8
- package/esm/vs/platform/quickinput/browser/tree/quickInputTreeRenderer.js.map +1 -1
- package/esm/vs/platform/telemetry/common/gdprTypings.js.map +1 -1
- package/esm/vs/platform/telemetry/common/telemetry.js.map +1 -1
- package/esm/vs/platform/theme/common/colorUtils.js +2 -2
- package/esm/vs/platform/theme/common/colors/baseColors.js +17 -17
- package/esm/vs/platform/theme/common/colors/chartsColors.js +8 -8
- package/esm/vs/platform/theme/common/colors/editorColors.js +95 -95
- package/esm/vs/platform/theme/common/colors/editorColors.js.map +1 -1
- package/esm/vs/platform/theme/common/colors/inputColors.js +47 -47
- 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 +11 -11
- package/esm/vs/platform/theme/common/colors/miscColors.js +16 -16
- package/esm/vs/platform/theme/common/colors/miscColors.js.map +1 -1
- package/esm/vs/platform/theme/common/colors/quickpickColors.js +9 -9
- 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/webWorker/browser/webWorkerDescriptor.js +12 -0
- package/esm/vs/platform/webWorker/browser/webWorkerDescriptor.js.map +1 -0
- package/esm/vs/platform/webWorker/browser/webWorkerService.js +7 -0
- package/esm/vs/platform/webWorker/browser/webWorkerService.js.map +1 -0
- package/esm/vs/{base/browser/webWorkerFactory.js → platform/webWorker/browser/webWorkerServiceImpl.js} +47 -66
- package/esm/vs/platform/webWorker/browser/webWorkerServiceImpl.js.map +1 -0
- package/esm/vs/platform/workspace/common/workspace.js +1 -1
- package/monaco.d.ts +9 -5
- package/package.json +2 -2
- package/version.txt +1 -1
- package/esm/vs/base/browser/webWorkerFactory.js.map +0 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineCompletionsView.js +0 -82
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineCompletionsView.js.map +0 -1
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
6
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
8
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
9
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
import { n } from '../../../../../../../../base/browser/dom.js';
|
|
15
|
+
import { Disposable } from '../../../../../../../../base/common/lifecycle.js';
|
|
16
|
+
import { derived, constObservable, autorun, observableValue } from '../../../../../../../../base/common/observable.js';
|
|
17
|
+
import { IInstantiationService } from '../../../../../../../../platform/instantiation/common/instantiation.js';
|
|
18
|
+
import { observableCodeEditor } from '../../../../../../../browser/observableCodeEditor.js';
|
|
19
|
+
import { EmbeddedCodeEditorWidget } from '../../../../../../../browser/widget/codeEditor/embeddedCodeEditorWidget.js';
|
|
20
|
+
import { Position } from '../../../../../../../common/core/position.js';
|
|
21
|
+
import { Range } from '../../../../../../../common/core/range.js';
|
|
22
|
+
import { LineRange } from '../../../../../../../common/core/ranges/lineRange.js';
|
|
23
|
+
import { OffsetRange } from '../../../../../../../common/core/ranges/offsetRange.js';
|
|
24
|
+
import { ModelDecorationOptions } from '../../../../../../../common/model/textModel.js';
|
|
25
|
+
import { InlineCompletionContextKeys } from '../../../../controller/inlineCompletionContextKeys.js';
|
|
26
|
+
import { InlineEditsGutterIndicator, InlineEditsGutterIndicatorData } from '../../components/gutterIndicatorView.js';
|
|
27
|
+
import { classNames, maxContentWidthInRange } from '../../utils/utils.js';
|
|
28
|
+
let LongDistancePreviewEditor = class LongDistancePreviewEditor extends Disposable {
|
|
29
|
+
constructor(_previewTextModel, _properties, _parentEditor, _tabAction, _instantiationService) {
|
|
30
|
+
super();
|
|
31
|
+
this._previewTextModel = _previewTextModel;
|
|
32
|
+
this._properties = _properties;
|
|
33
|
+
this._parentEditor = _parentEditor;
|
|
34
|
+
this._tabAction = _tabAction;
|
|
35
|
+
this._instantiationService = _instantiationService;
|
|
36
|
+
this._previewRef = n.ref();
|
|
37
|
+
this.element = n.div({ class: 'preview', style: { /*pointerEvents: 'none'*/}, ref: this._previewRef });
|
|
38
|
+
this._state = derived(this, reader => {
|
|
39
|
+
const props = this._properties.read(reader);
|
|
40
|
+
if (!props) {
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
if (props.diff[0].innerChanges?.every(c => c.modifiedRange.isEmpty())) {
|
|
44
|
+
return {
|
|
45
|
+
diff: props.diff,
|
|
46
|
+
visibleLineRange: LineRange.ofLength(props.diff[0].original.startLineNumber, 1),
|
|
47
|
+
textModel: this._parentEditorObs.model.read(reader),
|
|
48
|
+
mode: 'original',
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
return {
|
|
53
|
+
diff: props.diff,
|
|
54
|
+
visibleLineRange: LineRange.ofLength(props.diff[0].modified.startLineNumber, 1),
|
|
55
|
+
textModel: this._previewTextModel,
|
|
56
|
+
mode: 'modified',
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
this.updatePreviewEditorEffect = derived(this, reader => {
|
|
61
|
+
// this._widgetContent.readEffect(reader);
|
|
62
|
+
this._previewEditorObs.model.read(reader); // update when the model is set
|
|
63
|
+
const range = this._state.read(reader)?.visibleLineRange;
|
|
64
|
+
if (!range) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const hiddenAreas = [];
|
|
68
|
+
if (range.startLineNumber > 1) {
|
|
69
|
+
hiddenAreas.push(new Range(1, 1, range.startLineNumber - 1, 1));
|
|
70
|
+
}
|
|
71
|
+
if (range.endLineNumberExclusive < this._previewTextModel.getLineCount() + 1) {
|
|
72
|
+
hiddenAreas.push(new Range(range.endLineNumberExclusive, 1, this._previewTextModel.getLineCount() + 1, 1));
|
|
73
|
+
}
|
|
74
|
+
this.previewEditor.setHiddenAreas(hiddenAreas, undefined, true);
|
|
75
|
+
});
|
|
76
|
+
this.horizontalContentRangeInPreviewEditorToShow = derived(this, reader => {
|
|
77
|
+
return this._getHorizontalContentRangeInPreviewEditorToShow(this.previewEditor, this._properties.read(reader)?.diff ?? [], reader);
|
|
78
|
+
});
|
|
79
|
+
this.contentHeight = derived(this, (reader) => {
|
|
80
|
+
const viewState = this._properties.read(reader);
|
|
81
|
+
if (!viewState) {
|
|
82
|
+
return constObservable(null);
|
|
83
|
+
}
|
|
84
|
+
const previewEditorHeight = this._previewEditorObs.observeLineHeightForLine(viewState.diff[0].modified.startLineNumber);
|
|
85
|
+
return previewEditorHeight;
|
|
86
|
+
}).flatten();
|
|
87
|
+
this._editorDecorations = derived(this, reader => {
|
|
88
|
+
const diff2 = this._state.read(reader);
|
|
89
|
+
if (!diff2) {
|
|
90
|
+
return undefined;
|
|
91
|
+
}
|
|
92
|
+
const diff = {
|
|
93
|
+
mode: 'insertionInline',
|
|
94
|
+
diff: diff2.diff,
|
|
95
|
+
};
|
|
96
|
+
const originalDecorations = [];
|
|
97
|
+
const modifiedDecorations = [];
|
|
98
|
+
const diffWholeLineDeleteDecoration = ModelDecorationOptions.register({
|
|
99
|
+
className: 'inlineCompletions-char-delete',
|
|
100
|
+
description: 'char-delete',
|
|
101
|
+
isWholeLine: false,
|
|
102
|
+
zIndex: 1, // be on top of diff background decoration
|
|
103
|
+
});
|
|
104
|
+
const diffWholeLineAddDecoration = ModelDecorationOptions.register({
|
|
105
|
+
className: 'inlineCompletions-char-insert',
|
|
106
|
+
description: 'char-insert',
|
|
107
|
+
isWholeLine: true,
|
|
108
|
+
});
|
|
109
|
+
const diffAddDecoration = ModelDecorationOptions.register({
|
|
110
|
+
className: 'inlineCompletions-char-insert',
|
|
111
|
+
description: 'char-insert',
|
|
112
|
+
shouldFillLineOnLineBreak: true,
|
|
113
|
+
});
|
|
114
|
+
const hideEmptyInnerDecorations = true; // diff.mode === 'lineReplacement';
|
|
115
|
+
for (const m of diff.diff) {
|
|
116
|
+
if (m.modified.isEmpty || m.original.isEmpty) {
|
|
117
|
+
if (!m.original.isEmpty) {
|
|
118
|
+
originalDecorations.push({ range: m.original.toInclusiveRange(), options: diffWholeLineDeleteDecoration });
|
|
119
|
+
}
|
|
120
|
+
if (!m.modified.isEmpty) {
|
|
121
|
+
modifiedDecorations.push({ range: m.modified.toInclusiveRange(), options: diffWholeLineAddDecoration });
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
for (const i of m.innerChanges || []) {
|
|
126
|
+
// Don't show empty markers outside the line range
|
|
127
|
+
if (m.original.contains(i.originalRange.startLineNumber) && !(hideEmptyInnerDecorations && i.originalRange.isEmpty())) {
|
|
128
|
+
originalDecorations.push({
|
|
129
|
+
range: i.originalRange,
|
|
130
|
+
options: {
|
|
131
|
+
description: 'char-delete',
|
|
132
|
+
shouldFillLineOnLineBreak: false,
|
|
133
|
+
className: classNames('inlineCompletions-char-delete',
|
|
134
|
+
// i.originalRange.isSingleLine() && diff.mode === 'insertionInline' && 'single-line-inline',
|
|
135
|
+
i.originalRange.isEmpty() && 'empty'),
|
|
136
|
+
zIndex: 1
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
if (m.modified.contains(i.modifiedRange.startLineNumber)) {
|
|
141
|
+
modifiedDecorations.push({
|
|
142
|
+
range: i.modifiedRange,
|
|
143
|
+
options: diffAddDecoration
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return { originalDecorations, modifiedDecorations };
|
|
150
|
+
});
|
|
151
|
+
this.previewEditor = this._register(this._createPreviewEditor());
|
|
152
|
+
this._parentEditorObs = observableCodeEditor(this._parentEditor);
|
|
153
|
+
this._register(autorun(reader => {
|
|
154
|
+
this.previewEditor.setModel(this._state.read(reader)?.textModel || null);
|
|
155
|
+
}));
|
|
156
|
+
this._previewEditorObs = observableCodeEditor(this.previewEditor);
|
|
157
|
+
this._register(this._previewEditorObs.setDecorations(derived(reader => {
|
|
158
|
+
const state = this._state.read(reader);
|
|
159
|
+
const decorations = this._editorDecorations.read(reader);
|
|
160
|
+
return (state?.mode === 'original' ? decorations?.originalDecorations : decorations?.modifiedDecorations) ?? [];
|
|
161
|
+
})));
|
|
162
|
+
this._register(autorun(reader => {
|
|
163
|
+
const state = this._properties.read(reader);
|
|
164
|
+
if (!state) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
// Ensure there is enough space to the left of the line number for the gutter indicator to fits.
|
|
168
|
+
const lineNumberDigets = state.diff[0].modified.startLineNumber.toString().length;
|
|
169
|
+
this.previewEditor.updateOptions({ lineNumbersMinChars: lineNumberDigets + 1 });
|
|
170
|
+
}));
|
|
171
|
+
this._register(this._instantiationService.createInstance(InlineEditsGutterIndicator, this._previewEditorObs, derived(reader => {
|
|
172
|
+
const state = this._properties.read(reader);
|
|
173
|
+
if (!state) {
|
|
174
|
+
return undefined;
|
|
175
|
+
}
|
|
176
|
+
return new InlineEditsGutterIndicatorData(state.suggestInfo, LineRange.ofLength(state.diff[0].original.startLineNumber, 1), state.model);
|
|
177
|
+
}), this._tabAction, constObservable(0), constObservable(false), observableValue(this, false)));
|
|
178
|
+
this.updatePreviewEditorEffect.recomputeInitiallyAndOnChange(this._store);
|
|
179
|
+
}
|
|
180
|
+
_createPreviewEditor() {
|
|
181
|
+
return this._instantiationService.createInstance(EmbeddedCodeEditorWidget, this._previewRef.element, {
|
|
182
|
+
glyphMargin: false,
|
|
183
|
+
lineNumbers: 'on',
|
|
184
|
+
minimap: { enabled: false },
|
|
185
|
+
guides: {
|
|
186
|
+
indentation: false,
|
|
187
|
+
bracketPairs: false,
|
|
188
|
+
bracketPairsHorizontal: false,
|
|
189
|
+
highlightActiveIndentation: false,
|
|
190
|
+
},
|
|
191
|
+
rulers: [],
|
|
192
|
+
padding: { top: 0, bottom: 0 },
|
|
193
|
+
//folding: false,
|
|
194
|
+
selectOnLineNumbers: false,
|
|
195
|
+
selectionHighlight: false,
|
|
196
|
+
columnSelection: false,
|
|
197
|
+
overviewRulerBorder: false,
|
|
198
|
+
overviewRulerLanes: 0,
|
|
199
|
+
//lineDecorationsWidth: 0,
|
|
200
|
+
//lineNumbersMinChars: 0,
|
|
201
|
+
revealHorizontalRightPadding: 0,
|
|
202
|
+
bracketPairColorization: { enabled: true, independentColorPoolPerBracketType: false },
|
|
203
|
+
scrollBeyondLastLine: false,
|
|
204
|
+
scrollbar: {
|
|
205
|
+
vertical: 'hidden',
|
|
206
|
+
horizontal: 'hidden',
|
|
207
|
+
handleMouseWheel: false,
|
|
208
|
+
},
|
|
209
|
+
readOnly: true,
|
|
210
|
+
wordWrap: 'off',
|
|
211
|
+
wordWrapOverride1: 'off',
|
|
212
|
+
wordWrapOverride2: 'off',
|
|
213
|
+
}, {
|
|
214
|
+
contextKeyValues: {
|
|
215
|
+
[InlineCompletionContextKeys.inInlineEditsPreviewEditor.key]: true,
|
|
216
|
+
},
|
|
217
|
+
contributions: [],
|
|
218
|
+
}, this._parentEditor);
|
|
219
|
+
}
|
|
220
|
+
_getHorizontalContentRangeInPreviewEditorToShow(editor, diff, reader) {
|
|
221
|
+
const r = LineRange.ofLength(diff[0].modified.startLineNumber, 1);
|
|
222
|
+
const l = this._previewEditorObs.layoutInfo.read(reader);
|
|
223
|
+
const trueContentWidth = maxContentWidthInRange(this._previewEditorObs, r, reader);
|
|
224
|
+
const state = this._state.read(reader);
|
|
225
|
+
if (!state || !diff[0].innerChanges) {
|
|
226
|
+
return undefined;
|
|
227
|
+
}
|
|
228
|
+
const firstCharacterChange = state.mode === 'modified' ? diff[0].innerChanges[0].modifiedRange : diff[0].innerChanges[0].originalRange;
|
|
229
|
+
// find the horizontal range we want to show.
|
|
230
|
+
// use 5 characters before the first change, at most 1 indentation
|
|
231
|
+
const left = this._previewEditorObs.getLeftOfPosition(firstCharacterChange.getStartPosition(), reader);
|
|
232
|
+
const right = this._previewEditorObs.getLeftOfPosition(firstCharacterChange.getEndPosition(), reader);
|
|
233
|
+
const indentCol = editor.getModel().getLineFirstNonWhitespaceColumn(firstCharacterChange.startLineNumber);
|
|
234
|
+
const indentationEnd = this._previewEditorObs.getLeftOfPosition(new Position(firstCharacterChange.startLineNumber, indentCol), reader);
|
|
235
|
+
const preferredRangeToReveal = new OffsetRange(left, right);
|
|
236
|
+
return {
|
|
237
|
+
indentationEnd,
|
|
238
|
+
preferredRangeToReveal,
|
|
239
|
+
maxEditorWidth: trueContentWidth + l.contentLeft,
|
|
240
|
+
contentWidth: trueContentWidth,
|
|
241
|
+
nonContentWidth: l.contentLeft, // Width of area that is not content
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
layout(dimension, desiredPreviewEditorScrollLeft) {
|
|
245
|
+
this.previewEditor.layout(dimension);
|
|
246
|
+
this._previewEditorObs.editor.setScrollLeft(desiredPreviewEditorScrollLeft);
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
LongDistancePreviewEditor = __decorate([
|
|
250
|
+
__param(4, IInstantiationService)
|
|
251
|
+
], LongDistancePreviewEditor);
|
|
252
|
+
export { LongDistancePreviewEditor };
|
|
253
|
+
//# sourceMappingURL=longDistancePreviewEditor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/longDistancePreviewEditor.ts","vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/longDistancePreviewEditor.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;AAEhG,OAAO,EAAE,CAAC,EAAE,MAAM,6CAA6C,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,kDAAkD,CAAC;AAC9E,OAAO,EAAe,OAAO,EAAE,eAAe,EAAW,OAAO,EAAE,eAAe,EAAE,MAAM,mDAAmD,CAAC;AAC7I,OAAO,EAAE,qBAAqB,EAAE,MAAM,wEAAwE,CAAC;AAE/G,OAAO,EAAwB,oBAAoB,EAAE,MAAM,sDAAsD,CAAC;AAClH,OAAO,EAAE,wBAAwB,EAAE,MAAM,4EAA4E,CAAC;AAEtH,OAAO,EAAE,QAAQ,EAAE,MAAM,8CAA8C,CAAC;AACxE,OAAO,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,sDAAsD,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,MAAM,wDAAwD,CAAC;AAGrF,OAAO,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AACxF,OAAO,EAAE,2BAA2B,EAAE,MAAM,uDAAuD,CAAC;AACpG,OAAO,EAAE,0BAA0B,EAAE,8BAA8B,EAA4D,MAAM,yCAAyC,CAAC;AAE/K,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAQnE,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,UAAU;IASxD,YACkB,iBAA6B,EAC7B,WAA+D,EAC/D,aAA0B,EAC1B,UAA4C,EACtC,qBAA6D;QAEpF,KAAK,EAAE,CAAC;QANS,sBAAiB,GAAjB,iBAAiB,CAAY;QAC7B,gBAAW,GAAX,WAAW,CAAoD;QAC/D,kBAAa,GAAb,aAAa,CAAa;QAC1B,eAAU,GAAV,UAAU,C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I,QAAQ,CAAC,oBAAoB,CAAC,eAAe,EAAE,SAAS,CAAC,EAAE,MAAM,CAAC,CAAC;QAEvI,MAAM,sBAAsB,GAAG,IAAI,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAE5D,OAAO;YACN,cAAc;YACd,sBAAsB;YACtB,cAAc,EAAE,gBAAgB,GAAG,CAAC,CAAC,WAAW;YAChD,YAAY,EAAE,gBAAgB;YAC9B,eAAe,EAAE,CAAC,CAAC,WAAW,EAAE,oCAAoC;SACpE,CAAC;IACH,CAAC;IAEM,MAAM,CAAC,SAAqB,EAAE,8BAAsC;QAC1E,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACrC,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,aAAa,CAAC,8BAA8B,CAAC,CAAC;IAC7E,CAAC;CAuED,CAAA;AAjRY,yBAAyB;IAcnC,WAAA,qBAAqB,CAAA;GAdX,yBAAyB,CAiRrC","file":"longDistancePreviewEditor.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 { n } from '../../../../../../../../base/browser/dom.js';\nimport { Disposable } from '../../../../../../../../base/common/lifecycle.js';\nimport { IObservable, derived, constObservable, IReader, autorun, observableValue } from '../../../../../../../../base/common/observable.js';\nimport { IInstantiationService } from '../../../../../../../../platform/instantiation/common/instantiation.js';\nimport { ICodeEditor } from '../../../../../../../browser/editorBrowser.js';\nimport { ObservableCodeEditor, observableCodeEditor } from '../../../../../../../browser/observableCodeEditor.js';\nimport { EmbeddedCodeEditorWidget } from '../../../../../../../browser/widget/codeEditor/embeddedCodeEditorWidget.js';\nimport { IDimension } from '../../../../../../../common/core/2d/dimension.js';\nimport { Position } from '../../../../../../../common/core/position.js';\nimport { Range } from '../../../../../../../common/core/range.js';\nimport { LineRange } from '../../../../../../../common/core/ranges/lineRange.js';\nimport { OffsetRange } from '../../../../../../../common/core/ranges/offsetRange.js';\nimport { DetailedLineRangeMapping } from '../../../../../../../common/diff/rangeMapping.js';\nimport { IModelDeltaDecoration, ITextModel } from '../../../../../../../common/model.js';\nimport { ModelDecorationOptions } from '../../../../../../../common/model/textModel.js';\nimport { InlineCompletionContextKeys } from '../../../../controller/inlineCompletionContextKeys.js';\nimport { InlineEditsGutterIndicator, InlineEditsGutterIndicatorData, InlineSuggestionGutterMenuData, SimpleInlineSuggestModel } from '../../components/gutterIndicatorView.js';\nimport { InlineEditTabAction } from '../../inlineEditsViewInterface.js';\nimport { classNames, maxContentWidthInRange } from '../../utils/utils.js';\n\nexport interface ILongDistancePreviewProps {\n\tdiff: DetailedLineRangeMapping[];\n\tmodel: SimpleInlineSuggestModel;\n\tsuggestInfo: InlineSuggestionGutterMenuData;\n}\n\nexport class LongDistancePreviewEditor extends Disposable {\n\tpublic readonly previewEditor;\n\tprivate readonly _previewEditorObs;\n\n\tprivate readonly _previewRef = n.ref<HTMLDivElement>();\n\tpublic readonly element = n.div({ class: 'preview', style: { /*pointerEvents: 'none'*/ }, ref: this._previewRef });\n\n\tprivate _parentEditorObs: ObservableCodeEditor;\n\n\tconstructor(\n\t\tprivate readonly _previewTextModel: ITextModel,\n\t\tprivate readonly _properties: IObservable<ILongDistancePreviewProps | undefined>,\n\t\tprivate readonly _parentEditor: ICodeEditor,\n\t\tprivate readonly _tabAction: IObservable<InlineEditTabAction>,\n\t\t@IInstantiationService private readonly _instantiationService: IInstantiationService,\n\t) {\n\t\tsuper();\n\n\t\tthis.previewEditor = this._register(this._createPreviewEditor());\n\t\tthis._parentEditorObs = observableCodeEditor(this._parentEditor);\n\n\t\tthis._register(autorun(reader => {\n\t\t\tthis.previewEditor.setModel(this._state.read(reader)?.textModel || null);\n\t\t}));\n\n\t\tthis._previewEditorObs = observableCodeEditor(this.previewEditor);\n\t\tthis._register(this._previewEditorObs.setDecorations(derived(reader => {\n\t\t\tconst state = this._state.read(reader);\n\t\t\tconst decorations = this._editorDecorations.read(reader);\n\t\t\treturn (state?.mode === 'original' ? decorations?.originalDecorations : decorations?.modifiedDecorations) ?? [];\n\t\t})));\n\n\t\tthis._register(autorun(reader => {\n\t\t\tconst state = this._properties.read(reader);\n\t\t\tif (!state) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Ensure there is enough space to the left of the line number for the gutter indicator to fits.\n\t\t\tconst lineNumberDigets = state.diff[0].modified.startLineNumber.toString().length;\n\t\t\tthis.previewEditor.updateOptions({ lineNumbersMinChars: lineNumberDigets + 1 });\n\t\t}));\n\n\t\tthis._register(this._instantiationService.createInstance(\n\t\t\tInlineEditsGutterIndicator,\n\t\t\tthis._previewEditorObs,\n\t\t\tderived(reader => {\n\t\t\t\tconst state = this._properties.read(reader);\n\t\t\t\tif (!state) { return undefined; }\n\t\t\t\treturn new InlineEditsGutterIndicatorData(\n\t\t\t\t\tstate.suggestInfo,\n\t\t\t\t\tLineRange.ofLength(state.diff[0].original.startLineNumber, 1),\n\t\t\t\t\tstate.model,\n\t\t\t\t);\n\t\t\t}),\n\t\t\tthis._tabAction,\n\t\t\tconstObservable(0),\n\t\t\tconstObservable(false),\n\t\t\tobservableValue(this, false),\n\t\t));\n\n\t\tthis.updatePreviewEditorEffect.recomputeInitiallyAndOnChange(this._store);\n\t}\n\n\tprivate readonly _state = derived(this, reader => {\n\t\tconst props = this._properties.read(reader);\n\t\tif (!props) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif (props.diff[0].innerChanges?.every(c => c.modifiedRange.isEmpty())) {\n\t\t\treturn {\n\t\t\t\tdiff: props.diff,\n\t\t\t\tvisibleLineRange: LineRange.ofLength(props.diff[0].original.startLineNumber, 1),\n\t\t\t\ttextModel: this._parentEditorObs.model.read(reader),\n\t\t\t\tmode: 'original' as const,\n\t\t\t};\n\t\t} else {\n\t\t\treturn {\n\t\t\t\tdiff: props.diff,\n\t\t\t\tvisibleLineRange: LineRange.ofLength(props.diff[0].modified.startLineNumber, 1),\n\t\t\t\ttextModel: this._previewTextModel,\n\t\t\t\tmode: 'modified' as const,\n\t\t\t};\n\t\t}\n\t});\n\n\tprivate _createPreviewEditor() {\n\t\treturn this._instantiationService.createInstance(\n\t\t\tEmbeddedCodeEditorWidget,\n\t\t\tthis._previewRef.element,\n\t\t\t{\n\t\t\t\tglyphMargin: false,\n\t\t\t\tlineNumbers: 'on',\n\t\t\t\tminimap: { enabled: false },\n\t\t\t\tguides: {\n\t\t\t\t\tindentation: false,\n\t\t\t\t\tbracketPairs: false,\n\t\t\t\t\tbracketPairsHorizontal: false,\n\t\t\t\t\thighlightActiveIndentation: false,\n\t\t\t\t},\n\n\t\t\t\trulers: [],\n\t\t\t\tpadding: { top: 0, bottom: 0 },\n\t\t\t\t//folding: false,\n\t\t\t\tselectOnLineNumbers: false,\n\t\t\t\tselectionHighlight: false,\n\t\t\t\tcolumnSelection: false,\n\t\t\t\toverviewRulerBorder: false,\n\t\t\t\toverviewRulerLanes: 0,\n\t\t\t\t//lineDecorationsWidth: 0,\n\t\t\t\t//lineNumbersMinChars: 0,\n\t\t\t\trevealHorizontalRightPadding: 0,\n\t\t\t\tbracketPairColorization: { enabled: true, independentColorPoolPerBracketType: false },\n\t\t\t\tscrollBeyondLastLine: false,\n\t\t\t\tscrollbar: {\n\t\t\t\t\tvertical: 'hidden',\n\t\t\t\t\thorizontal: 'hidden',\n\t\t\t\t\thandleMouseWheel: false,\n\t\t\t\t},\n\t\t\t\treadOnly: true,\n\t\t\t\twordWrap: 'off',\n\t\t\t\twordWrapOverride1: 'off',\n\t\t\t\twordWrapOverride2: 'off',\n\t\t\t},\n\t\t\t{\n\t\t\t\tcontextKeyValues: {\n\t\t\t\t\t[InlineCompletionContextKeys.inInlineEditsPreviewEditor.key]: true,\n\t\t\t\t},\n\t\t\t\tcontributions: [],\n\t\t\t},\n\t\t\tthis._parentEditor\n\t\t);\n\t}\n\n\tpublic readonly updatePreviewEditorEffect = derived(this, reader => {\n\t\t// this._widgetContent.readEffect(reader);\n\t\tthis._previewEditorObs.model.read(reader); // update when the model is set\n\n\t\tconst range = this._state.read(reader)?.visibleLineRange;\n\t\tif (!range) {\n\t\t\treturn;\n\t\t}\n\t\tconst hiddenAreas: Range[] = [];\n\t\tif (range.startLineNumber > 1) {\n\t\t\thiddenAreas.push(new Range(1, 1, range.startLineNumber - 1, 1));\n\t\t}\n\t\tif (range.endLineNumberExclusive < this._previewTextModel.getLineCount() + 1) {\n\t\t\thiddenAreas.push(new Range(range.endLineNumberExclusive, 1, this._previewTextModel.getLineCount() + 1, 1));\n\t\t}\n\t\tthis.previewEditor.setHiddenAreas(hiddenAreas, undefined, true);\n\t});\n\n\tpublic readonly horizontalContentRangeInPreviewEditorToShow = derived(this, reader => {\n\t\treturn this._getHorizontalContentRangeInPreviewEditorToShow(this.previewEditor, this._properties.read(reader)?.diff ?? [], reader);\n\t});\n\n\tpublic readonly contentHeight = derived(this, (reader) => {\n\t\tconst viewState = this._properties.read(reader);\n\t\tif (!viewState) {\n\t\t\treturn constObservable(null);\n\t\t}\n\n\t\tconst previewEditorHeight = this._previewEditorObs.observeLineHeightForLine(viewState.diff[0].modified.startLineNumber);\n\t\treturn previewEditorHeight;\n\t}).flatten();\n\n\tprivate _getHorizontalContentRangeInPreviewEditorToShow(editor: ICodeEditor, diff: DetailedLineRangeMapping[], reader: IReader) {\n\n\t\tconst r = LineRange.ofLength(diff[0].modified.startLineNumber, 1);\n\t\tconst l = this._previewEditorObs.layoutInfo.read(reader);\n\t\tconst trueContentWidth = maxContentWidthInRange(this._previewEditorObs, r, reader);\n\n\t\tconst state = this._state.read(reader);\n\t\tif (!state || !diff[0].innerChanges) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst firstCharacterChange = state.mode === 'modified' ? diff[0].innerChanges[0].modifiedRange : diff[0].innerChanges[0].originalRange;\n\n\n\t\t// find the horizontal range we want to show.\n\t\t// use 5 characters before the first change, at most 1 indentation\n\t\tconst left = this._previewEditorObs.getLeftOfPosition(firstCharacterChange.getStartPosition(), reader);\n\t\tconst right = this._previewEditorObs.getLeftOfPosition(firstCharacterChange.getEndPosition(), reader);\n\n\t\tconst indentCol = editor.getModel()!.getLineFirstNonWhitespaceColumn(firstCharacterChange.startLineNumber);\n\t\tconst indentationEnd = this._previewEditorObs.getLeftOfPosition(new Position(firstCharacterChange.startLineNumber, indentCol), reader);\n\n\t\tconst preferredRangeToReveal = new OffsetRange(left, right);\n\n\t\treturn {\n\t\t\tindentationEnd,\n\t\t\tpreferredRangeToReveal,\n\t\t\tmaxEditorWidth: trueContentWidth + l.contentLeft,\n\t\t\tcontentWidth: trueContentWidth,\n\t\t\tnonContentWidth: l.contentLeft, // Width of area that is not content\n\t\t};\n\t}\n\n\tpublic layout(dimension: IDimension, desiredPreviewEditorScrollLeft: number): void {\n\t\tthis.previewEditor.layout(dimension);\n\t\tthis._previewEditorObs.editor.setScrollLeft(desiredPreviewEditorScrollLeft);\n\t}\n\n\tprivate readonly _editorDecorations = derived(this, reader => {\n\t\tconst diff2 = this._state.read(reader);\n\t\tif (!diff2) { return undefined; }\n\n\t\tconst diff = {\n\t\t\tmode: 'insertionInline' as const,\n\t\t\tdiff: diff2.diff,\n\t\t};\n\t\tconst originalDecorations: IModelDeltaDecoration[] = [];\n\t\tconst modifiedDecorations: IModelDeltaDecoration[] = [];\n\n\t\tconst diffWholeLineDeleteDecoration = ModelDecorationOptions.register({\n\t\t\tclassName: 'inlineCompletions-char-delete',\n\t\t\tdescription: 'char-delete',\n\t\t\tisWholeLine: false,\n\t\t\tzIndex: 1, // be on top of diff background decoration\n\t\t});\n\n\t\tconst diffWholeLineAddDecoration = ModelDecorationOptions.register({\n\t\t\tclassName: 'inlineCompletions-char-insert',\n\t\t\tdescription: 'char-insert',\n\t\t\tisWholeLine: true,\n\t\t});\n\n\t\tconst diffAddDecoration = ModelDecorationOptions.register({\n\t\t\tclassName: 'inlineCompletions-char-insert',\n\t\t\tdescription: 'char-insert',\n\t\t\tshouldFillLineOnLineBreak: true,\n\t\t});\n\n\t\tconst hideEmptyInnerDecorations = true; // diff.mode === 'lineReplacement';\n\t\tfor (const m of diff.diff) {\n\t\t\tif (m.modified.isEmpty || m.original.isEmpty) {\n\t\t\t\tif (!m.original.isEmpty) {\n\t\t\t\t\toriginalDecorations.push({ range: m.original.toInclusiveRange()!, options: diffWholeLineDeleteDecoration });\n\t\t\t\t}\n\t\t\t\tif (!m.modified.isEmpty) {\n\t\t\t\t\tmodifiedDecorations.push({ range: m.modified.toInclusiveRange()!, options: diffWholeLineAddDecoration });\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor (const i of m.innerChanges || []) {\n\t\t\t\t\t// Don't show empty markers outside the line range\n\t\t\t\t\tif (m.original.contains(i.originalRange.startLineNumber) && !(hideEmptyInnerDecorations && i.originalRange.isEmpty())) {\n\t\t\t\t\t\toriginalDecorations.push({\n\t\t\t\t\t\t\trange: i.originalRange,\n\t\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\t\tdescription: 'char-delete',\n\t\t\t\t\t\t\t\tshouldFillLineOnLineBreak: false,\n\t\t\t\t\t\t\t\tclassName: classNames(\n\t\t\t\t\t\t\t\t\t'inlineCompletions-char-delete',\n\t\t\t\t\t\t\t\t\t// i.originalRange.isSingleLine() && diff.mode === 'insertionInline' && 'single-line-inline',\n\t\t\t\t\t\t\t\t\ti.originalRange.isEmpty() && 'empty',\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tzIndex: 1\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tif (m.modified.contains(i.modifiedRange.startLineNumber)) {\n\t\t\t\t\t\tmodifiedDecorations.push({\n\t\t\t\t\t\t\trange: i.modifiedRange,\n\t\t\t\t\t\t\toptions: diffAddDecoration\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn { originalDecorations, modifiedDecorations };\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 { n } from '../../../../../../../../base/browser/dom.js';\nimport { Disposable } from '../../../../../../../../base/common/lifecycle.js';\nimport { IObservable, derived, constObservable, IReader, autorun, observableValue } from '../../../../../../../../base/common/observable.js';\nimport { IInstantiationService } from '../../../../../../../../platform/instantiation/common/instantiation.js';\nimport { ICodeEditor } from '../../../../../../../browser/editorBrowser.js';\nimport { ObservableCodeEditor, observableCodeEditor } from '../../../../../../../browser/observableCodeEditor.js';\nimport { EmbeddedCodeEditorWidget } from '../../../../../../../browser/widget/codeEditor/embeddedCodeEditorWidget.js';\nimport { IDimension } from '../../../../../../../common/core/2d/dimension.js';\nimport { Position } from '../../../../../../../common/core/position.js';\nimport { Range } from '../../../../../../../common/core/range.js';\nimport { LineRange } from '../../../../../../../common/core/ranges/lineRange.js';\nimport { OffsetRange } from '../../../../../../../common/core/ranges/offsetRange.js';\nimport { DetailedLineRangeMapping } from '../../../../../../../common/diff/rangeMapping.js';\nimport { IModelDeltaDecoration, ITextModel } from '../../../../../../../common/model.js';\nimport { ModelDecorationOptions } from '../../../../../../../common/model/textModel.js';\nimport { InlineCompletionContextKeys } from '../../../../controller/inlineCompletionContextKeys.js';\nimport { InlineEditsGutterIndicator, InlineEditsGutterIndicatorData, InlineSuggestionGutterMenuData, SimpleInlineSuggestModel } from '../../components/gutterIndicatorView.js';\nimport { InlineEditTabAction } from '../../inlineEditsViewInterface.js';\nimport { classNames, maxContentWidthInRange } from '../../utils/utils.js';\n\nexport interface ILongDistancePreviewProps {\n\tdiff: DetailedLineRangeMapping[];\n\tmodel: SimpleInlineSuggestModel;\n\tsuggestInfo: InlineSuggestionGutterMenuData;\n}\n\nexport class LongDistancePreviewEditor extends Disposable {\n\tpublic readonly previewEditor;\n\tprivate readonly _previewEditorObs;\n\n\tprivate readonly _previewRef = n.ref<HTMLDivElement>();\n\tpublic readonly element = n.div({ class: 'preview', style: { /*pointerEvents: 'none'*/ }, ref: this._previewRef });\n\n\tprivate _parentEditorObs: ObservableCodeEditor;\n\n\tconstructor(\n\t\tprivate readonly _previewTextModel: ITextModel,\n\t\tprivate readonly _properties: IObservable<ILongDistancePreviewProps | undefined>,\n\t\tprivate readonly _parentEditor: ICodeEditor,\n\t\tprivate readonly _tabAction: IObservable<InlineEditTabAction>,\n\t\t@IInstantiationService private readonly _instantiationService: IInstantiationService,\n\t) {\n\t\tsuper();\n\n\t\tthis.previewEditor = this._register(this._createPreviewEditor());\n\t\tthis._parentEditorObs = observableCodeEditor(this._parentEditor);\n\n\t\tthis._register(autorun(reader => {\n\t\t\tthis.previewEditor.setModel(this._state.read(reader)?.textModel || null);\n\t\t}));\n\n\t\tthis._previewEditorObs = observableCodeEditor(this.previewEditor);\n\t\tthis._register(this._previewEditorObs.setDecorations(derived(reader => {\n\t\t\tconst state = this._state.read(reader);\n\t\t\tconst decorations = this._editorDecorations.read(reader);\n\t\t\treturn (state?.mode === 'original' ? decorations?.originalDecorations : decorations?.modifiedDecorations) ?? [];\n\t\t})));\n\n\t\tthis._register(autorun(reader => {\n\t\t\tconst state = this._properties.read(reader);\n\t\t\tif (!state) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Ensure there is enough space to the left of the line number for the gutter indicator to fits.\n\t\t\tconst lineNumberDigets = state.diff[0].modified.startLineNumber.toString().length;\n\t\t\tthis.previewEditor.updateOptions({ lineNumbersMinChars: lineNumberDigets + 1 });\n\t\t}));\n\n\t\tthis._register(this._instantiationService.createInstance(\n\t\t\tInlineEditsGutterIndicator,\n\t\t\tthis._previewEditorObs,\n\t\t\tderived(reader => {\n\t\t\t\tconst state = this._properties.read(reader);\n\t\t\t\tif (!state) { return undefined; }\n\t\t\t\treturn new InlineEditsGutterIndicatorData(\n\t\t\t\t\tstate.suggestInfo,\n\t\t\t\t\tLineRange.ofLength(state.diff[0].original.startLineNumber, 1),\n\t\t\t\t\tstate.model,\n\t\t\t\t);\n\t\t\t}),\n\t\t\tthis._tabAction,\n\t\t\tconstObservable(0),\n\t\t\tconstObservable(false),\n\t\t\tobservableValue(this, false),\n\t\t));\n\n\t\tthis.updatePreviewEditorEffect.recomputeInitiallyAndOnChange(this._store);\n\t}\n\n\tprivate readonly _state = derived(this, reader => {\n\t\tconst props = this._properties.read(reader);\n\t\tif (!props) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif (props.diff[0].innerChanges?.every(c => c.modifiedRange.isEmpty())) {\n\t\t\treturn {\n\t\t\t\tdiff: props.diff,\n\t\t\t\tvisibleLineRange: LineRange.ofLength(props.diff[0].original.startLineNumber, 1),\n\t\t\t\ttextModel: this._parentEditorObs.model.read(reader),\n\t\t\t\tmode: 'original' as const,\n\t\t\t};\n\t\t} else {\n\t\t\treturn {\n\t\t\t\tdiff: props.diff,\n\t\t\t\tvisibleLineRange: LineRange.ofLength(props.diff[0].modified.startLineNumber, 1),\n\t\t\t\ttextModel: this._previewTextModel,\n\t\t\t\tmode: 'modified' as const,\n\t\t\t};\n\t\t}\n\t});\n\n\tprivate _createPreviewEditor() {\n\t\treturn this._instantiationService.createInstance(\n\t\t\tEmbeddedCodeEditorWidget,\n\t\t\tthis._previewRef.element,\n\t\t\t{\n\t\t\t\tglyphMargin: false,\n\t\t\t\tlineNumbers: 'on',\n\t\t\t\tminimap: { enabled: false },\n\t\t\t\tguides: {\n\t\t\t\t\tindentation: false,\n\t\t\t\t\tbracketPairs: false,\n\t\t\t\t\tbracketPairsHorizontal: false,\n\t\t\t\t\thighlightActiveIndentation: false,\n\t\t\t\t},\n\n\t\t\t\trulers: [],\n\t\t\t\tpadding: { top: 0, bottom: 0 },\n\t\t\t\t//folding: false,\n\t\t\t\tselectOnLineNumbers: false,\n\t\t\t\tselectionHighlight: false,\n\t\t\t\tcolumnSelection: false,\n\t\t\t\toverviewRulerBorder: false,\n\t\t\t\toverviewRulerLanes: 0,\n\t\t\t\t//lineDecorationsWidth: 0,\n\t\t\t\t//lineNumbersMinChars: 0,\n\t\t\t\trevealHorizontalRightPadding: 0,\n\t\t\t\tbracketPairColorization: { enabled: true, independentColorPoolPerBracketType: false },\n\t\t\t\tscrollBeyondLastLine: false,\n\t\t\t\tscrollbar: {\n\t\t\t\t\tvertical: 'hidden',\n\t\t\t\t\thorizontal: 'hidden',\n\t\t\t\t\thandleMouseWheel: false,\n\t\t\t\t},\n\t\t\t\treadOnly: true,\n\t\t\t\twordWrap: 'off',\n\t\t\t\twordWrapOverride1: 'off',\n\t\t\t\twordWrapOverride2: 'off',\n\t\t\t},\n\t\t\t{\n\t\t\t\tcontextKeyValues: {\n\t\t\t\t\t[InlineCompletionContextKeys.inInlineEditsPreviewEditor.key]: true,\n\t\t\t\t},\n\t\t\t\tcontributions: [],\n\t\t\t},\n\t\t\tthis._parentEditor\n\t\t);\n\t}\n\n\tpublic readonly updatePreviewEditorEffect = derived(this, reader => {\n\t\t// this._widgetContent.readEffect(reader);\n\t\tthis._previewEditorObs.model.read(reader); // update when the model is set\n\n\t\tconst range = this._state.read(reader)?.visibleLineRange;\n\t\tif (!range) {\n\t\t\treturn;\n\t\t}\n\t\tconst hiddenAreas: Range[] = [];\n\t\tif (range.startLineNumber > 1) {\n\t\t\thiddenAreas.push(new Range(1, 1, range.startLineNumber - 1, 1));\n\t\t}\n\t\tif (range.endLineNumberExclusive < this._previewTextModel.getLineCount() + 1) {\n\t\t\thiddenAreas.push(new Range(range.endLineNumberExclusive, 1, this._previewTextModel.getLineCount() + 1, 1));\n\t\t}\n\t\tthis.previewEditor.setHiddenAreas(hiddenAreas, undefined, true);\n\t});\n\n\tpublic readonly horizontalContentRangeInPreviewEditorToShow = derived(this, reader => {\n\t\treturn this._getHorizontalContentRangeInPreviewEditorToShow(this.previewEditor, this._properties.read(reader)?.diff ?? [], reader);\n\t});\n\n\tpublic readonly contentHeight = derived(this, (reader) => {\n\t\tconst viewState = this._properties.read(reader);\n\t\tif (!viewState) {\n\t\t\treturn constObservable(null);\n\t\t}\n\n\t\tconst previewEditorHeight = this._previewEditorObs.observeLineHeightForLine(viewState.diff[0].modified.startLineNumber);\n\t\treturn previewEditorHeight;\n\t}).flatten();\n\n\tprivate _getHorizontalContentRangeInPreviewEditorToShow(editor: ICodeEditor, diff: DetailedLineRangeMapping[], reader: IReader) {\n\n\t\tconst r = LineRange.ofLength(diff[0].modified.startLineNumber, 1);\n\t\tconst l = this._previewEditorObs.layoutInfo.read(reader);\n\t\tconst trueContentWidth = maxContentWidthInRange(this._previewEditorObs, r, reader);\n\n\t\tconst state = this._state.read(reader);\n\t\tif (!state || !diff[0].innerChanges) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst firstCharacterChange = state.mode === 'modified' ? diff[0].innerChanges[0].modifiedRange : diff[0].innerChanges[0].originalRange;\n\n\n\t\t// find the horizontal range we want to show.\n\t\t// use 5 characters before the first change, at most 1 indentation\n\t\tconst left = this._previewEditorObs.getLeftOfPosition(firstCharacterChange.getStartPosition(), reader);\n\t\tconst right = this._previewEditorObs.getLeftOfPosition(firstCharacterChange.getEndPosition(), reader);\n\n\t\tconst indentCol = editor.getModel()!.getLineFirstNonWhitespaceColumn(firstCharacterChange.startLineNumber);\n\t\tconst indentationEnd = this._previewEditorObs.getLeftOfPosition(new Position(firstCharacterChange.startLineNumber, indentCol), reader);\n\n\t\tconst preferredRangeToReveal = new OffsetRange(left, right);\n\n\t\treturn {\n\t\t\tindentationEnd,\n\t\t\tpreferredRangeToReveal,\n\t\t\tmaxEditorWidth: trueContentWidth + l.contentLeft,\n\t\t\tcontentWidth: trueContentWidth,\n\t\t\tnonContentWidth: l.contentLeft, // Width of area that is not content\n\t\t};\n\t}\n\n\tpublic layout(dimension: IDimension, desiredPreviewEditorScrollLeft: number): void {\n\t\tthis.previewEditor.layout(dimension);\n\t\tthis._previewEditorObs.editor.setScrollLeft(desiredPreviewEditorScrollLeft);\n\t}\n\n\tprivate readonly _editorDecorations = derived(this, reader => {\n\t\tconst diff2 = this._state.read(reader);\n\t\tif (!diff2) { return undefined; }\n\n\t\tconst diff = {\n\t\t\tmode: 'insertionInline' as const,\n\t\t\tdiff: diff2.diff,\n\t\t};\n\t\tconst originalDecorations: IModelDeltaDecoration[] = [];\n\t\tconst modifiedDecorations: IModelDeltaDecoration[] = [];\n\n\t\tconst diffWholeLineDeleteDecoration = ModelDecorationOptions.register({\n\t\t\tclassName: 'inlineCompletions-char-delete',\n\t\t\tdescription: 'char-delete',\n\t\t\tisWholeLine: false,\n\t\t\tzIndex: 1, // be on top of diff background decoration\n\t\t});\n\n\t\tconst diffWholeLineAddDecoration = ModelDecorationOptions.register({\n\t\t\tclassName: 'inlineCompletions-char-insert',\n\t\t\tdescription: 'char-insert',\n\t\t\tisWholeLine: true,\n\t\t});\n\n\t\tconst diffAddDecoration = ModelDecorationOptions.register({\n\t\t\tclassName: 'inlineCompletions-char-insert',\n\t\t\tdescription: 'char-insert',\n\t\t\tshouldFillLineOnLineBreak: true,\n\t\t});\n\n\t\tconst hideEmptyInnerDecorations = true; // diff.mode === 'lineReplacement';\n\t\tfor (const m of diff.diff) {\n\t\t\tif (m.modified.isEmpty || m.original.isEmpty) {\n\t\t\t\tif (!m.original.isEmpty) {\n\t\t\t\t\toriginalDecorations.push({ range: m.original.toInclusiveRange()!, options: diffWholeLineDeleteDecoration });\n\t\t\t\t}\n\t\t\t\tif (!m.modified.isEmpty) {\n\t\t\t\t\tmodifiedDecorations.push({ range: m.modified.toInclusiveRange()!, options: diffWholeLineAddDecoration });\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor (const i of m.innerChanges || []) {\n\t\t\t\t\t// Don't show empty markers outside the line range\n\t\t\t\t\tif (m.original.contains(i.originalRange.startLineNumber) && !(hideEmptyInnerDecorations && i.originalRange.isEmpty())) {\n\t\t\t\t\t\toriginalDecorations.push({\n\t\t\t\t\t\t\trange: i.originalRange,\n\t\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\t\tdescription: 'char-delete',\n\t\t\t\t\t\t\t\tshouldFillLineOnLineBreak: false,\n\t\t\t\t\t\t\t\tclassName: classNames(\n\t\t\t\t\t\t\t\t\t'inlineCompletions-char-delete',\n\t\t\t\t\t\t\t\t\t// i.originalRange.isSingleLine() && diff.mode === 'insertionInline' && 'single-line-inline',\n\t\t\t\t\t\t\t\t\ti.originalRange.isEmpty() && 'empty',\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tzIndex: 1\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tif (m.modified.contains(i.modifiedRange.startLineNumber)) {\n\t\t\t\t\t\tmodifiedDecorations.push({\n\t\t\t\t\t\t\trange: i.modifiedRange,\n\t\t\t\t\t\t\toptions: diffAddDecoration\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn { originalDecorations, modifiedDecorations };\n\t});\n}\n"]}
|
|
@@ -8,63 +8,63 @@ import { localize } from '../../../../../../nls.js';
|
|
|
8
8
|
import { buttonBackground, buttonForeground, buttonSecondaryBackground, buttonSecondaryForeground, diffInserted, diffInsertedLine, diffRemoved, editorBackground } from '../../../../../../platform/theme/common/colorRegistry.js';
|
|
9
9
|
import { darken, registerColor, transparent } from '../../../../../../platform/theme/common/colorUtils.js';
|
|
10
10
|
import { InlineEditTabAction } from './inlineEditsViewInterface.js';
|
|
11
|
-
export const originalBackgroundColor = registerColor('inlineEdit.originalBackground', transparent(diffRemoved, 0.2), localize(
|
|
12
|
-
export const modifiedBackgroundColor = registerColor('inlineEdit.modifiedBackground', transparent(diffInserted, 0.3), localize(
|
|
13
|
-
export const originalChangedLineBackgroundColor = registerColor('inlineEdit.originalChangedLineBackground', transparent(diffRemoved, 0.8), localize(
|
|
14
|
-
export const originalChangedTextOverlayColor = registerColor('inlineEdit.originalChangedTextBackground', transparent(diffRemoved, 0.8), localize(
|
|
11
|
+
export const originalBackgroundColor = registerColor('inlineEdit.originalBackground', transparent(diffRemoved, 0.2), localize(1226, 'Background color for the original text in inline edits.'), true);
|
|
12
|
+
export const modifiedBackgroundColor = registerColor('inlineEdit.modifiedBackground', transparent(diffInserted, 0.3), localize(1227, 'Background color for the modified text in inline edits.'), true);
|
|
13
|
+
export const originalChangedLineBackgroundColor = registerColor('inlineEdit.originalChangedLineBackground', transparent(diffRemoved, 0.8), localize(1228, 'Background color for the changed lines in the original text of inline edits.'), true);
|
|
14
|
+
export const originalChangedTextOverlayColor = registerColor('inlineEdit.originalChangedTextBackground', transparent(diffRemoved, 0.8), localize(1229, 'Overlay color for the changed text in the original text of inline edits.'), true);
|
|
15
15
|
export const modifiedChangedLineBackgroundColor = registerColor('inlineEdit.modifiedChangedLineBackground', {
|
|
16
16
|
light: transparent(diffInsertedLine, 0.7),
|
|
17
17
|
dark: transparent(diffInsertedLine, 0.7),
|
|
18
18
|
hcDark: diffInsertedLine,
|
|
19
19
|
hcLight: diffInsertedLine
|
|
20
|
-
}, localize(
|
|
21
|
-
export const modifiedChangedTextOverlayColor = registerColor('inlineEdit.modifiedChangedTextBackground', transparent(diffInserted, 0.7), localize(
|
|
20
|
+
}, localize(1230, 'Background color for the changed lines in the modified text of inline edits.'), true);
|
|
21
|
+
export const modifiedChangedTextOverlayColor = registerColor('inlineEdit.modifiedChangedTextBackground', transparent(diffInserted, 0.7), localize(1231, 'Overlay color for the changed text in the modified text of inline edits.'), true);
|
|
22
22
|
// ------- GUTTER INDICATOR -------
|
|
23
|
-
export const inlineEditIndicatorPrimaryForeground = registerColor('inlineEdit.gutterIndicator.primaryForeground', buttonForeground, localize(
|
|
24
|
-
export const inlineEditIndicatorPrimaryBorder = registerColor('inlineEdit.gutterIndicator.primaryBorder', buttonBackground, localize(
|
|
23
|
+
export const inlineEditIndicatorPrimaryForeground = registerColor('inlineEdit.gutterIndicator.primaryForeground', buttonForeground, localize(1232, 'Foreground color for the primary inline edit gutter indicator.'));
|
|
24
|
+
export const inlineEditIndicatorPrimaryBorder = registerColor('inlineEdit.gutterIndicator.primaryBorder', buttonBackground, localize(1233, 'Border color for the primary inline edit gutter indicator.'));
|
|
25
25
|
export const inlineEditIndicatorPrimaryBackground = registerColor('inlineEdit.gutterIndicator.primaryBackground', {
|
|
26
26
|
light: transparent(inlineEditIndicatorPrimaryBorder, 0.5),
|
|
27
27
|
dark: transparent(inlineEditIndicatorPrimaryBorder, 0.4),
|
|
28
28
|
hcDark: transparent(inlineEditIndicatorPrimaryBorder, 0.4),
|
|
29
29
|
hcLight: transparent(inlineEditIndicatorPrimaryBorder, 0.5),
|
|
30
|
-
}, localize(
|
|
31
|
-
export const inlineEditIndicatorSecondaryForeground = registerColor('inlineEdit.gutterIndicator.secondaryForeground', buttonSecondaryForeground, localize(
|
|
32
|
-
export const inlineEditIndicatorSecondaryBorder = registerColor('inlineEdit.gutterIndicator.secondaryBorder', buttonSecondaryBackground, localize(
|
|
33
|
-
export const inlineEditIndicatorSecondaryBackground = registerColor('inlineEdit.gutterIndicator.secondaryBackground', inlineEditIndicatorSecondaryBorder, localize(
|
|
34
|
-
export const inlineEditIndicatorsuccessfulForeground = registerColor('inlineEdit.gutterIndicator.successfulForeground', buttonForeground, localize(
|
|
35
|
-
export const inlineEditIndicatorsuccessfulBorder = registerColor('inlineEdit.gutterIndicator.successfulBorder', buttonBackground, localize(
|
|
36
|
-
export const inlineEditIndicatorsuccessfulBackground = registerColor('inlineEdit.gutterIndicator.successfulBackground', inlineEditIndicatorsuccessfulBorder, localize(
|
|
30
|
+
}, localize(1234, 'Background color for the primary inline edit gutter indicator.'));
|
|
31
|
+
export const inlineEditIndicatorSecondaryForeground = registerColor('inlineEdit.gutterIndicator.secondaryForeground', buttonSecondaryForeground, localize(1235, 'Foreground color for the secondary inline edit gutter indicator.'));
|
|
32
|
+
export const inlineEditIndicatorSecondaryBorder = registerColor('inlineEdit.gutterIndicator.secondaryBorder', buttonSecondaryBackground, localize(1236, 'Border color for the secondary inline edit gutter indicator.'));
|
|
33
|
+
export const inlineEditIndicatorSecondaryBackground = registerColor('inlineEdit.gutterIndicator.secondaryBackground', inlineEditIndicatorSecondaryBorder, localize(1237, 'Background color for the secondary inline edit gutter indicator.'));
|
|
34
|
+
export const inlineEditIndicatorsuccessfulForeground = registerColor('inlineEdit.gutterIndicator.successfulForeground', buttonForeground, localize(1238, 'Foreground color for the successful inline edit gutter indicator.'));
|
|
35
|
+
export const inlineEditIndicatorsuccessfulBorder = registerColor('inlineEdit.gutterIndicator.successfulBorder', buttonBackground, localize(1239, 'Border color for the successful inline edit gutter indicator.'));
|
|
36
|
+
export const inlineEditIndicatorsuccessfulBackground = registerColor('inlineEdit.gutterIndicator.successfulBackground', inlineEditIndicatorsuccessfulBorder, localize(1240, 'Background color for the successful inline edit gutter indicator.'));
|
|
37
37
|
export const inlineEditIndicatorBackground = registerColor('inlineEdit.gutterIndicator.background', {
|
|
38
38
|
hcDark: transparent('tab.inactiveBackground', 0.5),
|
|
39
39
|
hcLight: transparent('tab.inactiveBackground', 0.5),
|
|
40
40
|
dark: transparent('tab.inactiveBackground', 0.5),
|
|
41
41
|
light: '#5f5f5f18',
|
|
42
|
-
}, localize(
|
|
42
|
+
}, localize(1241, 'Background color for the inline edit gutter indicator.'));
|
|
43
43
|
// ------- BORDER COLORS -------
|
|
44
44
|
const originalBorder = registerColor('inlineEdit.originalBorder', {
|
|
45
45
|
light: diffRemoved,
|
|
46
46
|
dark: diffRemoved,
|
|
47
47
|
hcDark: diffRemoved,
|
|
48
48
|
hcLight: diffRemoved
|
|
49
|
-
}, localize(
|
|
49
|
+
}, localize(1242, 'Border color for the original text in inline edits.'));
|
|
50
50
|
const modifiedBorder = registerColor('inlineEdit.modifiedBorder', {
|
|
51
51
|
light: darken(diffInserted, 0.6),
|
|
52
52
|
dark: diffInserted,
|
|
53
53
|
hcDark: diffInserted,
|
|
54
54
|
hcLight: diffInserted
|
|
55
|
-
}, localize(
|
|
55
|
+
}, localize(1243, 'Border color for the modified text in inline edits.'));
|
|
56
56
|
const tabWillAcceptModifiedBorder = registerColor('inlineEdit.tabWillAcceptModifiedBorder', {
|
|
57
57
|
light: darken(modifiedBorder, 0),
|
|
58
58
|
dark: darken(modifiedBorder, 0),
|
|
59
59
|
hcDark: darken(modifiedBorder, 0),
|
|
60
60
|
hcLight: darken(modifiedBorder, 0)
|
|
61
|
-
}, localize(
|
|
61
|
+
}, localize(1244, 'Modified border color for the inline edits widget when tab will accept it.'));
|
|
62
62
|
const tabWillAcceptOriginalBorder = registerColor('inlineEdit.tabWillAcceptOriginalBorder', {
|
|
63
63
|
light: darken(originalBorder, 0),
|
|
64
64
|
dark: darken(originalBorder, 0),
|
|
65
65
|
hcDark: darken(originalBorder, 0),
|
|
66
66
|
hcLight: darken(originalBorder, 0)
|
|
67
|
-
}, localize(
|
|
67
|
+
}, localize(1245, 'Original border color for the inline edits widget over the original text when tab will accept it.'));
|
|
68
68
|
export function getModifiedBorderColor(tabAction) {
|
|
69
69
|
return tabAction.map(a => a === InlineEditTabAction.Accept ? tabWillAcceptModifiedBorder : modifiedBorder);
|
|
70
70
|
}
|
package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/utils/flexBoxLayout.js
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
/**
|
|
6
|
+
* Distributes a total size into parts that each have a list of growth rules.
|
|
7
|
+
* Returns `null` if the layout is not possible.
|
|
8
|
+
* The sum of all returned sizes will be equal to `totalSize`.
|
|
9
|
+
*
|
|
10
|
+
* First, each part gets its minimum size.
|
|
11
|
+
* Then, remaining space is distributed to the rules with the highest priority, as long as the max constraint allows it (considering share).
|
|
12
|
+
* This continues with next lower priority rules until no space is left.
|
|
13
|
+
*/
|
|
14
|
+
export function distributeFlexBoxLayout(totalSize, parts) {
|
|
15
|
+
// Normalize parts to always have array of rules
|
|
16
|
+
const normalizedParts = {};
|
|
17
|
+
for (const [key, part] of Object.entries(parts)) {
|
|
18
|
+
if (Array.isArray(part)) {
|
|
19
|
+
normalizedParts[key] = { min: 0, rules: part };
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
normalizedParts[key] = {
|
|
23
|
+
min: part.min ?? 0,
|
|
24
|
+
rules: part.rules ?? [{ max: part.max, priority: part.priority, share: part.share }]
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
// Initialize result with minimum sizes
|
|
29
|
+
const result = {};
|
|
30
|
+
let usedSize = 0;
|
|
31
|
+
for (const [key, part] of Object.entries(normalizedParts)) {
|
|
32
|
+
result[key] = part.min;
|
|
33
|
+
usedSize += part.min;
|
|
34
|
+
}
|
|
35
|
+
// Check if we can satisfy minimum constraints
|
|
36
|
+
if (usedSize > totalSize) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
let remainingSize = totalSize - usedSize;
|
|
40
|
+
// Distribute remaining space by priority levels
|
|
41
|
+
while (remainingSize > 0) {
|
|
42
|
+
// Find all rules at current highest priority that can still grow
|
|
43
|
+
const candidateRules = [];
|
|
44
|
+
for (const [key, part] of Object.entries(normalizedParts)) {
|
|
45
|
+
for (let i = 0; i < part.rules.length; i++) {
|
|
46
|
+
const rule = part.rules[i];
|
|
47
|
+
const currentUsage = result[key];
|
|
48
|
+
const maxSize = rule.max ?? Infinity;
|
|
49
|
+
if (currentUsage < maxSize) {
|
|
50
|
+
candidateRules.push({
|
|
51
|
+
partKey: key,
|
|
52
|
+
ruleIndex: i,
|
|
53
|
+
rule,
|
|
54
|
+
priority: rule.priority ?? 0,
|
|
55
|
+
share: rule.share ?? 1
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (candidateRules.length === 0) {
|
|
61
|
+
// No rules can grow anymore, but we have remaining space
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
// Find the highest priority among candidates
|
|
65
|
+
const maxPriority = Math.max(...candidateRules.map(c => c.priority));
|
|
66
|
+
const highestPriorityCandidates = candidateRules.filter(c => c.priority === maxPriority);
|
|
67
|
+
// Calculate total share
|
|
68
|
+
const totalShare = highestPriorityCandidates.reduce((sum, c) => sum + c.share, 0);
|
|
69
|
+
// Distribute space proportionally by share
|
|
70
|
+
let distributedThisRound = 0;
|
|
71
|
+
const distributions = [];
|
|
72
|
+
for (const candidate of highestPriorityCandidates) {
|
|
73
|
+
const rule = candidate.rule;
|
|
74
|
+
const currentUsage = result[candidate.partKey];
|
|
75
|
+
const maxSize = rule.max ?? Infinity;
|
|
76
|
+
const availableForThisRule = maxSize - currentUsage;
|
|
77
|
+
// Calculate ideal share
|
|
78
|
+
const idealShare = (remainingSize * candidate.share) / totalShare;
|
|
79
|
+
const actualAmount = Math.min(idealShare, availableForThisRule);
|
|
80
|
+
distributions.push({
|
|
81
|
+
partKey: candidate.partKey,
|
|
82
|
+
ruleIndex: candidate.ruleIndex,
|
|
83
|
+
amount: actualAmount
|
|
84
|
+
});
|
|
85
|
+
distributedThisRound += actualAmount;
|
|
86
|
+
}
|
|
87
|
+
if (distributedThisRound === 0) {
|
|
88
|
+
// No progress can be made
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
// Apply distributions
|
|
92
|
+
for (const dist of distributions) {
|
|
93
|
+
result[dist.partKey] += dist.amount;
|
|
94
|
+
}
|
|
95
|
+
remainingSize -= distributedThisRound;
|
|
96
|
+
// Break if remaining is negligible (floating point precision)
|
|
97
|
+
if (remainingSize < 0.0001) {
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return result;
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=flexBoxLayout.js.map
|
package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/utils/flexBoxLayout.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/utils/flexBoxLayout.ts","vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/utils/flexBoxLayout.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAchG;;;;;;;;EAQE;AACF,MAAM,UAAU,uBAAuB,CACtC,SAAiB,EACjB,KAA4E;IAE5E,gDAAgD;IAChD,MAAM,eAAe,GAAwE,EAAE,CAAC;IAChG,KAAK,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACjD,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YACzB,eAAe,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QAChD,CAAC;aAAM,CAAC;YACP,eAAe,CAAC,GAAG,CAAC,GAAG;gBACtB,GAAG,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC;gBAClB,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;aACpF,CAAC;QACH,CAAC;IACF,CAAC;IAED,uCAAuC;IACvC,MAAM,MAAM,GAA2B,EAAE,CAAC;IAC1C,IAAI,QAAQ,GAAG,CAAC,CAAC;IACjB,KAAK,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,CAAC;QAC3D,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC;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,IAAI,IAAI,CAAC,MAAM,CAAC;QACrC,CAAC;QAED,aAAa,IAAI,oBAAoB,CAAC;QAEtC,8DAA8D;QAC9D,IAAI,aAAa,GAAG,MAAM,EAAE,CAAC;YAC5B,MAAM;QACP,CAAC;IACF,CAAC;IAED,OAAO,MAAiC,CAAC;AAC1C,CAAC","file":"flexBoxLayout.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\nexport interface IFlexBoxPartGrowthRule extends IFlexBoxPartExtensionRule {\n\tmin?: number;\n\trules?: IFlexBoxPartExtensionRule[];\n}\n\nexport interface IFlexBoxPartExtensionRule {\n\tmax?: number;\n\tpriority?: number;\n\tshare?: number;\n}\n\n\n/**\n * Distributes a total size into parts that each have a list of growth rules.\n * Returns `null` if the layout is not possible.\n * The sum of all returned sizes will be equal to `totalSize`.\n *\n * First, each part gets its minimum size.\n * Then, remaining space is distributed to the rules with the highest priority, as long as the max constraint allows it (considering share).\n * This continues with next lower priority rules until no space is left.\n*/\nexport function distributeFlexBoxLayout<T extends Record<string, IFlexBoxPartGrowthRule | IFlexBoxPartGrowthRule[]>>(\n\ttotalSize: number,\n\tparts: T & Record<string, IFlexBoxPartGrowthRule | IFlexBoxPartGrowthRule[]>\n): Record<keyof T, number> | null {\n\t// Normalize parts to always have array of rules\n\tconst normalizedParts: Record<string, { min: number; rules: IFlexBoxPartExtensionRule[] }> = {};\n\tfor (const [key, part] of Object.entries(parts)) {\n\t\tif (Array.isArray(part)) {\n\t\t\tnormalizedParts[key] = { min: 0, rules: part };\n\t\t} else {\n\t\t\tnormalizedParts[key] = {\n\t\t\t\tmin: part.min ?? 0,\n\t\t\t\trules: part.rules ?? [{ max: part.max, priority: part.priority, share: part.share }]\n\t\t\t};\n\t\t}\n\t}\n\n\t// Initialize result with minimum sizes\n\tconst result: Record<string, number> = {};\n\tlet usedSize = 0;\n\tfor (const [key, part] of Object.entries(normalizedParts)) {\n\t\tresult[key] = part.min;\n\t\tusedSize += part.min;\n\t}\n\n\t// Check if we can satisfy minimum constraints\n\tif (usedSize > totalSize) {\n\t\treturn null;\n\t}\n\n\tlet remainingSize = totalSize - usedSize;\n\n\t// Distribute remaining space by priority levels\n\twhile (remainingSize > 0) {\n\t\t// Find all rules at current highest priority that can still grow\n\t\tconst candidateRules: Array<{\n\t\t\tpartKey: string;\n\t\t\truleIndex: number;\n\t\t\trule: IFlexBoxPartExtensionRule;\n\t\t\tpriority: number;\n\t\t\tshare: number;\n\t\t}> = [];\n\n\t\tfor (const [key, part] of Object.entries(normalizedParts)) {\n\t\t\tfor (let i = 0; i < part.rules.length; i++) {\n\t\t\t\tconst rule = part.rules[i];\n\t\t\t\tconst currentUsage = result[key];\n\t\t\t\tconst maxSize = rule.max ?? Infinity;\n\n\t\t\t\tif (currentUsage < maxSize) {\n\t\t\t\t\tcandidateRules.push({\n\t\t\t\t\t\tpartKey: key,\n\t\t\t\t\t\truleIndex: i,\n\t\t\t\t\t\trule,\n\t\t\t\t\t\tpriority: rule.priority ?? 0,\n\t\t\t\t\t\tshare: rule.share ?? 1\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (candidateRules.length === 0) {\n\t\t\t// No rules can grow anymore, but we have remaining space\n\t\t\tbreak;\n\t\t}\n\n\t\t// Find the highest priority among candidates\n\t\tconst maxPriority = Math.max(...candidateRules.map(c => c.priority));\n\t\tconst highestPriorityCandidates = candidateRules.filter(c => c.priority === maxPriority);\n\n\t\t// Calculate total share\n\t\tconst totalShare = highestPriorityCandidates.reduce((sum, c) => sum + c.share, 0);\n\n\t\t// Distribute space proportionally by share\n\t\tlet distributedThisRound = 0;\n\t\tconst distributions: Array<{ partKey: string; ruleIndex: number; amount: number }> = [];\n\n\t\tfor (const candidate of highestPriorityCandidates) {\n\t\t\tconst rule = candidate.rule;\n\t\t\tconst currentUsage = result[candidate.partKey];\n\t\t\tconst maxSize = rule.max ?? Infinity;\n\t\t\tconst availableForThisRule = maxSize - currentUsage;\n\n\t\t\t// Calculate ideal share\n\t\t\tconst idealShare = (remainingSize * candidate.share) / totalShare;\n\t\t\tconst actualAmount = Math.min(idealShare, availableForThisRule);\n\n\t\t\tdistributions.push({\n\t\t\t\tpartKey: candidate.partKey,\n\t\t\t\truleIndex: candidate.ruleIndex,\n\t\t\t\tamount: actualAmount\n\t\t\t});\n\n\t\t\tdistributedThisRound += actualAmount;\n\t\t}\n\n\t\tif (distributedThisRound === 0) {\n\t\t\t// No progress can be made\n\t\t\tbreak;\n\t\t}\n\n\t\t// Apply distributions\n\t\tfor (const dist of distributions) {\n\t\t\tresult[dist.partKey] += dist.amount;\n\t\t}\n\n\t\tremainingSize -= distributedThisRound;\n\n\t\t// Break if remaining is negligible (floating point precision)\n\t\tif (remainingSize < 0.0001) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn result as Record<keyof T, number>;\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\nexport interface IFlexBoxPartGrowthRule extends IFlexBoxPartExtensionRule {\n\tmin?: number;\n\trules?: IFlexBoxPartExtensionRule[];\n}\n\nexport interface IFlexBoxPartExtensionRule {\n\tmax?: number;\n\tpriority?: number;\n\tshare?: number;\n}\n\n\n/**\n * Distributes a total size into parts that each have a list of growth rules.\n * Returns `null` if the layout is not possible.\n * The sum of all returned sizes will be equal to `totalSize`.\n *\n * First, each part gets its minimum size.\n * Then, remaining space is distributed to the rules with the highest priority, as long as the max constraint allows it (considering share).\n * This continues with next lower priority rules until no space is left.\n*/\nexport function distributeFlexBoxLayout<T extends Record<string, IFlexBoxPartGrowthRule | IFlexBoxPartGrowthRule[]>>(\n\ttotalSize: number,\n\tparts: T & Record<string, IFlexBoxPartGrowthRule | IFlexBoxPartGrowthRule[]>\n): Record<keyof T, number> | null {\n\t// Normalize parts to always have array of rules\n\tconst normalizedParts: Record<string, { min: number; rules: IFlexBoxPartExtensionRule[] }> = {};\n\tfor (const [key, part] of Object.entries(parts)) {\n\t\tif (Array.isArray(part)) {\n\t\t\tnormalizedParts[key] = { min: 0, rules: part };\n\t\t} else {\n\t\t\tnormalizedParts[key] = {\n\t\t\t\tmin: part.min ?? 0,\n\t\t\t\trules: part.rules ?? [{ max: part.max, priority: part.priority, share: part.share }]\n\t\t\t};\n\t\t}\n\t}\n\n\t// Initialize result with minimum sizes\n\tconst result: Record<string, number> = {};\n\tlet usedSize = 0;\n\tfor (const [key, part] of Object.entries(normalizedParts)) {\n\t\tresult[key] = part.min;\n\t\tusedSize += part.min;\n\t}\n\n\t// Check if we can satisfy minimum constraints\n\tif (usedSize > totalSize) {\n\t\treturn null;\n\t}\n\n\tlet remainingSize = totalSize - usedSize;\n\n\t// Distribute remaining space by priority levels\n\twhile (remainingSize > 0) {\n\t\t// Find all rules at current highest priority that can still grow\n\t\tconst candidateRules: Array<{\n\t\t\tpartKey: string;\n\t\t\truleIndex: number;\n\t\t\trule: IFlexBoxPartExtensionRule;\n\t\t\tpriority: number;\n\t\t\tshare: number;\n\t\t}> = [];\n\n\t\tfor (const [key, part] of Object.entries(normalizedParts)) {\n\t\t\tfor (let i = 0; i < part.rules.length; i++) {\n\t\t\t\tconst rule = part.rules[i];\n\t\t\t\tconst currentUsage = result[key];\n\t\t\t\tconst maxSize = rule.max ?? Infinity;\n\n\t\t\t\tif (currentUsage < maxSize) {\n\t\t\t\t\tcandidateRules.push({\n\t\t\t\t\t\tpartKey: key,\n\t\t\t\t\t\truleIndex: i,\n\t\t\t\t\t\trule,\n\t\t\t\t\t\tpriority: rule.priority ?? 0,\n\t\t\t\t\t\tshare: rule.share ?? 1\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (candidateRules.length === 0) {\n\t\t\t// No rules can grow anymore, but we have remaining space\n\t\t\tbreak;\n\t\t}\n\n\t\t// Find the highest priority among candidates\n\t\tconst maxPriority = Math.max(...candidateRules.map(c => c.priority));\n\t\tconst highestPriorityCandidates = candidateRules.filter(c => c.priority === maxPriority);\n\n\t\t// Calculate total share\n\t\tconst totalShare = highestPriorityCandidates.reduce((sum, c) => sum + c.share, 0);\n\n\t\t// Distribute space proportionally by share\n\t\tlet distributedThisRound = 0;\n\t\tconst distributions: Array<{ partKey: string; ruleIndex: number; amount: number }> = [];\n\n\t\tfor (const candidate of highestPriorityCandidates) {\n\t\t\tconst rule = candidate.rule;\n\t\t\tconst currentUsage = result[candidate.partKey];\n\t\t\tconst maxSize = rule.max ?? Infinity;\n\t\t\tconst availableForThisRule = maxSize - currentUsage;\n\n\t\t\t// Calculate ideal share\n\t\t\tconst idealShare = (remainingSize * candidate.share) / totalShare;\n\t\t\tconst actualAmount = Math.min(idealShare, availableForThisRule);\n\n\t\t\tdistributions.push({\n\t\t\t\tpartKey: candidate.partKey,\n\t\t\t\truleIndex: candidate.ruleIndex,\n\t\t\t\tamount: actualAmount\n\t\t\t});\n\n\t\t\tdistributedThisRound += actualAmount;\n\t\t}\n\n\t\tif (distributedThisRound === 0) {\n\t\t\t// No progress can be made\n\t\t\tbreak;\n\t\t}\n\n\t\t// Apply distributions\n\t\tfor (const dist of distributions) {\n\t\t\tresult[dist.partKey] += dist.amount;\n\t\t}\n\n\t\tremainingSize -= distributedThisRound;\n\n\t\t// Break if remaining is negligible (floating point precision)\n\t\tif (remainingSize < 0.0001) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn result as Record<keyof T, number>;\n}\n"]}
|
package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/utils/towersLayout.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
/**
|
|
6
|
+
* The tower areas are arranged from left to right, touch and are aligned at the bottom.
|
|
7
|
+
* How high can a tower be placed at the requested horizontal range, so that its size fits into the union of the stacked availableTowerAreas?
|
|
8
|
+
*/
|
|
9
|
+
export function getMaxTowerHeightInAvailableArea(towerHorizontalRange, availableTowerAreas) {
|
|
10
|
+
const towerLeftOffset = towerHorizontalRange.start;
|
|
11
|
+
const towerRightOffset = towerHorizontalRange.endExclusive;
|
|
12
|
+
let minHeight = Number.MAX_VALUE;
|
|
13
|
+
// Calculate the accumulated width to find which tower areas the requested tower overlaps
|
|
14
|
+
let currentLeftOffset = 0;
|
|
15
|
+
for (const availableArea of availableTowerAreas) {
|
|
16
|
+
const currentRightOffset = currentLeftOffset + availableArea.width;
|
|
17
|
+
// Check if the requested tower overlaps with this available area
|
|
18
|
+
const overlapLeft = Math.max(towerLeftOffset, currentLeftOffset);
|
|
19
|
+
const overlapRight = Math.min(towerRightOffset, currentRightOffset);
|
|
20
|
+
if (overlapLeft < overlapRight) {
|
|
21
|
+
// There is an overlap - track the minimum height
|
|
22
|
+
minHeight = Math.min(minHeight, availableArea.height);
|
|
23
|
+
}
|
|
24
|
+
currentLeftOffset = currentRightOffset;
|
|
25
|
+
}
|
|
26
|
+
if (towerRightOffset > currentLeftOffset) {
|
|
27
|
+
return 0;
|
|
28
|
+
}
|
|
29
|
+
// If no overlap was found, return 0
|
|
30
|
+
return minHeight === Number.MAX_VALUE ? 0 : minHeight;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=towersLayout.js.map
|
package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/utils/towersLayout.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/utils/towersLayout.ts","vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/utils/towersLayout.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAKhG;;;GAGG;AACH,MAAM,UAAU,gCAAgC,CAAC,oBAAiC,EAAE,mBAA6B;IAChH,MAAM,eAAe,GAAG,oBAAoB,CAAC,KAAK,CAAC;IACnD,MAAM,gBAAgB,GAAG,oBAAoB,CAAC,YAAY,CAAC;IAE3D,IAAI,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;IAEjC,yFAAyF;IACzF,IAAI,iBAAiB,GAAG,CAAC,CAAC;IAC1B,KAAK,MAAM,aAAa,IAAI,mBAAmB,EAAE,CAAC;QACjD,MAAM,kBAAkB,GAAG,iBAAiB,GAAG,aAAa,CAAC,KAAK,CAAC;QAEnE,iEAAiE;QACjE,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,eAAe,EAAE,iBAAiB,CAAC,CAAC;QACjE,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,CAAC;QAEpE,IAAI,WAAW,GAAG,YAAY,EAAE,CAAC;YAChC,iDAAiD;YACjD,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;QACvD,CAAC;QAED,iBAAiB,GAAG,kBAAkB,CAAC;IACxC,CAAC;IAED,IAAI,gBAAgB,GAAG,iBAAiB,EAAE,CAAC;QAC1C,OAAO,CAAC,CAAC;IACV,CAAC;IAED,oCAAoC;IACpC,OAAO,SAAS,KAAK,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACvD,CAAC","file":"towersLayout.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 { Size2D } from '../../../../../../common/core/2d/size.js';\nimport { OffsetRange } from '../../../../../../common/core/ranges/offsetRange.js';\n\n/**\n * The tower areas are arranged from left to right, touch and are aligned at the bottom.\n * How high can a tower be placed at the requested horizontal range, so that its size fits into the union of the stacked availableTowerAreas?\n */\nexport function getMaxTowerHeightInAvailableArea(towerHorizontalRange: OffsetRange, availableTowerAreas: Size2D[]): number {\n\tconst towerLeftOffset = towerHorizontalRange.start;\n\tconst towerRightOffset = towerHorizontalRange.endExclusive;\n\n\tlet minHeight = Number.MAX_VALUE;\n\n\t// Calculate the accumulated width to find which tower areas the requested tower overlaps\n\tlet currentLeftOffset = 0;\n\tfor (const availableArea of availableTowerAreas) {\n\t\tconst currentRightOffset = currentLeftOffset + availableArea.width;\n\n\t\t// Check if the requested tower overlaps with this available area\n\t\tconst overlapLeft = Math.max(towerLeftOffset, currentLeftOffset);\n\t\tconst overlapRight = Math.min(towerRightOffset, currentRightOffset);\n\n\t\tif (overlapLeft < overlapRight) {\n\t\t\t// There is an overlap - track the minimum height\n\t\t\tminHeight = Math.min(minHeight, availableArea.height);\n\t\t}\n\n\t\tcurrentLeftOffset = currentRightOffset;\n\t}\n\n\tif (towerRightOffset > currentLeftOffset) {\n\t\treturn 0;\n\t}\n\n\t// If no overlap was found, return 0\n\treturn minHeight === Number.MAX_VALUE ? 0 : minHeight;\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 { Size2D } from '../../../../../../common/core/2d/size.js';\nimport { OffsetRange } from '../../../../../../common/core/ranges/offsetRange.js';\n\n/**\n * The tower areas are arranged from left to right, touch and are aligned at the bottom.\n * How high can a tower be placed at the requested horizontal range, so that its size fits into the union of the stacked availableTowerAreas?\n */\nexport function getMaxTowerHeightInAvailableArea(towerHorizontalRange: OffsetRange, availableTowerAreas: Size2D[]): number {\n\tconst towerLeftOffset = towerHorizontalRange.start;\n\tconst towerRightOffset = towerHorizontalRange.endExclusive;\n\n\tlet minHeight = Number.MAX_VALUE;\n\n\t// Calculate the accumulated width to find which tower areas the requested tower overlaps\n\tlet currentLeftOffset = 0;\n\tfor (const availableArea of availableTowerAreas) {\n\t\tconst currentRightOffset = currentLeftOffset + availableArea.width;\n\n\t\t// Check if the requested tower overlaps with this available area\n\t\tconst overlapLeft = Math.max(towerLeftOffset, currentLeftOffset);\n\t\tconst overlapRight = Math.min(towerRightOffset, currentRightOffset);\n\n\t\tif (overlapLeft < overlapRight) {\n\t\t\t// There is an overlap - track the minimum height\n\t\t\tminHeight = Math.min(minHeight, availableArea.height);\n\t\t}\n\n\t\tcurrentLeftOffset = currentRightOffset;\n\t}\n\n\tif (towerRightOffset > currentLeftOffset) {\n\t\treturn 0;\n\t}\n\n\t// If no overlap was found, return 0\n\treturn minHeight === Number.MAX_VALUE ? 0 : minHeight;\n}\n"]}
|