monaco-editor-core 0.55.1 → 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/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
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
export class InlineEdit {
|
|
6
|
-
constructor(edit, commands,
|
|
6
|
+
constructor(edit, commands, inlineSuggestion) {
|
|
7
7
|
this.edit = edit;
|
|
8
8
|
this.commands = commands;
|
|
9
|
-
this.
|
|
9
|
+
this.inlineSuggestion = inlineSuggestion;
|
|
10
10
|
}
|
|
11
11
|
equals(other) {
|
|
12
12
|
return this.edit.equals(other.edit)
|
|
13
|
-
&& this.
|
|
13
|
+
&& this.inlineSuggestion === other.inlineSuggestion;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
//# sourceMappingURL=inlineEdit.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/inlineCompletions/browser/model/inlineEdit.ts","vs/editor/contrib/inlineCompletions/browser/model/inlineEdit.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAMhG,MAAM,OAAO,UAAU;IACtB,YACiB,IAAqB,EACrB,QAA4C,EAC5C,gBAAsC;QAFtC,SAAI,GAAJ,IAAI,CAAiB;QACrB,aAAQ,GAAR,QAAQ,CAAoC;QAC5C,qBAAgB,GAAhB,gBAAgB,CAAsB;IACnD,CAAC;IAEE,MAAM,CAAC,KAAiB;QAC9B,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;eAC/B,IAAI,CAAC,gBAAgB,KAAK,KAAK,CAAC,gBAAgB,CAAC;IACtD,CAAC;CACD","file":"inlineEdit.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 { TextReplacement } from '../../../../common/core/edits/textEdit.js';\nimport { InlineCompletionCommand } from '../../../../common/languages.js';\nimport { InlineSuggestionItem } from './inlineSuggestionItem.js';\n\nexport class InlineEdit {\n\tconstructor(\n\t\tpublic readonly edit: TextReplacement,\n\t\tpublic readonly commands: readonly InlineCompletionCommand[],\n\t\tpublic readonly
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/inlineCompletions/browser/model/inlineEdit.ts","vs/editor/contrib/inlineCompletions/browser/model/inlineEdit.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAMhG,MAAM,OAAO,UAAU;IACtB,YACiB,IAAqB,EACrB,QAA4C,EAC5C,gBAAsC;QAFtC,SAAI,GAAJ,IAAI,CAAiB;QACrB,aAAQ,GAAR,QAAQ,CAAoC;QAC5C,qBAAgB,GAAhB,gBAAgB,CAAsB;IACnD,CAAC;IAEE,MAAM,CAAC,KAAiB;QAC9B,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;eAC/B,IAAI,CAAC,gBAAgB,KAAK,KAAK,CAAC,gBAAgB,CAAC;IACtD,CAAC;CACD","file":"inlineEdit.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 { TextReplacement } from '../../../../common/core/edits/textEdit.js';\nimport { InlineCompletionCommand } from '../../../../common/languages.js';\nimport { InlineSuggestionItem } from './inlineSuggestionItem.js';\n\nexport class InlineEdit {\n\tconstructor(\n\t\tpublic readonly edit: TextReplacement,\n\t\tpublic readonly commands: readonly InlineCompletionCommand[],\n\t\tpublic readonly inlineSuggestion: InlineSuggestionItem,\n\t) { }\n\n\tpublic equals(other: InlineEdit): boolean {\n\t\treturn this.edit.equals(other.edit)\n\t\t\t&& this.inlineSuggestion === other.inlineSuggestion;\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 { TextReplacement } from '../../../../common/core/edits/textEdit.js';\nimport { InlineCompletionCommand } from '../../../../common/languages.js';\nimport { InlineSuggestionItem } from './inlineSuggestionItem.js';\n\nexport class InlineEdit {\n\tconstructor(\n\t\tpublic readonly edit: TextReplacement,\n\t\tpublic readonly commands: readonly InlineCompletionCommand[],\n\t\tpublic readonly inlineSuggestion: InlineSuggestionItem,\n\t) { }\n\n\tpublic equals(other: InlineEdit): boolean {\n\t\treturn this.edit.equals(other.edit)\n\t\t\t&& this.inlineSuggestion === other.inlineSuggestion;\n\t}\n}\n"]}
|
|
@@ -43,7 +43,7 @@ class InlineSuggestionItemBase {
|
|
|
43
43
|
get isFromExplicitRequest() { return this._data.context.triggerKind === InlineCompletionTriggerKind.Explicit; }
|
|
44
44
|
get forwardStable() { return this.source.inlineSuggestions.enableForwardStability ?? false; }
|
|
45
45
|
get editRange() { return this.getSingleTextEdit().range; }
|
|
46
|
-
get targetRange() { return this.hint?.range
|
|
46
|
+
get targetRange() { return this.hint?.range ?? this.editRange; }
|
|
47
47
|
get insertText() { return this.getSingleTextEdit().text; }
|
|
48
48
|
get semanticId() { return this.hash; }
|
|
49
49
|
get action() { return this._sourceInlineCompletion.gutterMenuLinkAction; }
|
|
@@ -122,13 +122,12 @@ export class InlineSuggestionIdentity {
|
|
|
122
122
|
}
|
|
123
123
|
export class InlineSuggestHint {
|
|
124
124
|
static create(displayLocation) {
|
|
125
|
-
return new InlineSuggestHint(Range.lift(displayLocation.range), displayLocation.content, displayLocation.style
|
|
125
|
+
return new InlineSuggestHint(Range.lift(displayLocation.range), displayLocation.content, displayLocation.style);
|
|
126
126
|
}
|
|
127
|
-
constructor(range, content, style
|
|
127
|
+
constructor(range, content, style) {
|
|
128
128
|
this.range = range;
|
|
129
129
|
this.content = content;
|
|
130
130
|
this.style = style;
|
|
131
|
-
this.jumpToEdit = jumpToEdit;
|
|
132
131
|
}
|
|
133
132
|
withEdit(edit, positionOffsetTransformer) {
|
|
134
133
|
const offsetRange = new OffsetRange(positionOffsetTransformer.getOffset(this.range.getStartPosition()), positionOffsetTransformer.getOffset(this.range.getEndPosition()));
|
|
@@ -137,7 +136,7 @@ export class InlineSuggestHint {
|
|
|
137
136
|
return undefined;
|
|
138
137
|
}
|
|
139
138
|
const newRange = positionOffsetTransformer.getRange(newOffsetRange);
|
|
140
|
-
return new InlineSuggestHint(newRange, this.content, this.style
|
|
139
|
+
return new InlineSuggestHint(newRange, this.content, this.style);
|
|
141
140
|
}
|
|
142
141
|
}
|
|
143
142
|
export class InlineCompletionItem extends InlineSuggestionItemBase {
|
|
@@ -235,7 +234,7 @@ export function inlineCompletionIsVisible(singleTextEdit, originalRange, model,
|
|
|
235
234
|
}
|
|
236
235
|
export class InlineEditItem extends InlineSuggestionItemBase {
|
|
237
236
|
static create(data, textModel) {
|
|
238
|
-
const offsetEdit = getStringEdit(textModel, data.range, data.insertText);
|
|
237
|
+
const offsetEdit = getStringEdit(textModel, data.range, data.insertText); // TODO compute async
|
|
239
238
|
const text = new TextModelText(textModel);
|
|
240
239
|
const textEdit = TextEdit.fromStringEdit(offsetEdit, text);
|
|
241
240
|
const singleTextEdit = offsetEdit.isEmpty() ? new TextReplacement(new Range(1, 1, 1, 1), '') : textEdit.toReplacement(text); // FIXME: .toReplacement() can throw because offsetEdit is empty because we get an empty diff in getStringEdit after diffing
|
|
@@ -248,7 +247,8 @@ export class InlineEditItem extends InlineSuggestionItemBase {
|
|
|
248
247
|
const hint = data.hint ? InlineSuggestHint.create(data.hint) : undefined;
|
|
249
248
|
return new InlineEditItem(offsetEdit, singleTextEdit, data.uri, data, identity, edits, hint, false, textModel.getVersionId());
|
|
250
249
|
}
|
|
251
|
-
constructor(_edit,
|
|
250
|
+
constructor(_edit, // TODO@hediet remove, compute & cache from _edits
|
|
251
|
+
_textEdit, uri, data, identity, _edits, hint, _lastChangePartOfInlineEdit = false, _inlineEditModelVersion) {
|
|
252
252
|
super(data, identity, hint);
|
|
253
253
|
this._edit = _edit;
|
|
254
254
|
this._textEdit = _textEdit;
|
|
@@ -359,7 +359,7 @@ class SingleUpdatedNextEdit {
|
|
|
359
359
|
return new SingleUpdatedNextEdit(this._edit, this._trimmedNewText, this._prefixLength, this._suffixLength, this._lastChangeUpdatedEdit);
|
|
360
360
|
}
|
|
361
361
|
_applyTextModelChanges(textModelChanges) {
|
|
362
|
-
this._lastChangeUpdatedEdit = false;
|
|
362
|
+
this._lastChangeUpdatedEdit = false; // TODO @benibenj make immutable
|
|
363
363
|
if (!this._edit) {
|
|
364
364
|
throw new BugIndicatingError('UpdatedInnerEdits: No edit to apply changes to');
|
|
365
365
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/inlineCompletions/browser/model/inlineSuggestionItem.ts","vs/editor/contrib/inlineCompletions/browser/model/inlineSuggestionItem.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,EAA6B,gBAAgB,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AACxH,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AAI3G,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AAChH,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AAEtF,OAAO,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM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iB,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;IACrG,CAAC;IAED,OAAO,IAAI,CAAC;AACb,CAAC","file":"inlineSuggestionItem.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { BugIndicatingError } from '../../../../../base/common/errors.js';\nimport { matchesSubString } from '../../../../../base/common/filters.js';\nimport { IObservable, ITransaction, observableSignal, observableValue } from '../../../../../base/common/observable.js';\nimport { commonPrefixLength, commonSuffixLength, splitLines } from '../../../../../base/common/strings.js';\nimport { URI } from '../../../../../base/common/uri.js';\nimport { ICommandService } from '../../../../../platform/commands/common/commands.js';\nimport { ISingleEditOperation } from '../../../../common/core/editOperation.js';\nimport { applyEditsToRanges, StringEdit, StringReplacement } from '../../../../common/core/edits/stringEdit.js';\nimport { TextEdit, TextReplacement } from '../../../../common/core/edits/textEdit.js';\nimport { Position } from '../../../../common/core/position.js';\nimport { Range } from '../../../../common/core/range.js';\nimport { OffsetRange } from '../../../../common/core/ranges/offsetRange.js';\nimport { StringText } from '../../../../common/core/text/abstractText.js';\nimport { getPositionOffsetTransformerFromTextModel } from '../../../../common/core/text/getPositionOffsetTransformerFromTextModel.js';\nimport { PositionOffsetTransformerBase } from '../../../../common/core/text/positionToOffset.js';\nimport { TextLength } from '../../../../common/core/text/textLength.js';\nimport { linesDiffComputers } from '../../../../common/diff/linesDiffComputers.js';\nimport { Command, InlineCompletion, InlineCompletionHintStyle, InlineCompletionEndOfLifeReason, InlineCompletionTriggerKind, InlineCompletionWarning, PartialAcceptInfo, InlineCompletionHint } from '../../../../common/languages.js';\nimport { EndOfLinePreference, ITextModel } from '../../../../common/model.js';\nimport { TextModelText } from '../../../../common/model/textModelText.js';\nimport { InlineCompletionViewData, InlineCompletionViewKind } from '../view/inlineEdits/inlineEditsViewInterface.js';\nimport { InlineSuggestData, InlineSuggestionList, PartialAcceptance, SnippetInfo } from './provideInlineCompletions.js';\nimport { singleTextRemoveCommonPrefix } from './singleTextEditHelpers.js';\n\nexport type InlineSuggestionItem = InlineEditItem | InlineCompletionItem;\n\nexport namespace InlineSuggestionItem {\n\texport function create(\n\t\tdata: InlineSuggestData,\n\t\ttextModel: ITextModel,\n\t): InlineSuggestionItem {\n\t\tif (!data.isInlineEdit && !data.uri) {\n\t\t\treturn InlineCompletionItem.create(data, textModel);\n\t\t} else {\n\t\t\treturn InlineEditItem.create(data, textModel);\n\t\t}\n\t}\n}\n\nabstract class InlineSuggestionItemBase {\n\tconstructor(\n\t\tprotected readonly _data: InlineSuggestData,\n\t\tpublic readonly identity: InlineSuggestionIdentity,\n\t\tpublic readonly hint: InlineSuggestHint | undefined\n\t) { }\n\n\t/**\n\t * A reference to the original inline completion list this inline completion has been constructed from.\n\t * Used for event data to ensure referential equality.\n\t*/\n\tpublic get source(): InlineSuggestionList { return this._data.source; }\n\n\tpublic get isFromExplicitRequest(): boolean { return this._data.context.triggerKind === InlineCompletionTriggerKind.Explicit; }\n\tpublic get forwardStable(): boolean { return this.source.inlineSuggestions.enableForwardStability ?? false; }\n\tpublic get editRange(): Range { return this.getSingleTextEdit().range; }\n\tpublic get targetRange(): Range { return this.hint?.range && !this.hint.jumpToEdit ? this.hint?.range : this.editRange; }\n\tpublic get insertText(): string { return this.getSingleTextEdit().text; }\n\tpublic get semanticId(): string { return this.hash; }\n\tpublic get action(): Command | undefined { return this._sourceInlineCompletion.gutterMenuLinkAction; }\n\tpublic get command(): Command | undefined { return this._sourceInlineCompletion.command; }\n\tpublic get warning(): InlineCompletionWarning | undefined { return this._sourceInlineCompletion.warning; }\n\tpublic get showInlineEditMenu(): boolean { return !!this._sourceInlineCompletion.showInlineEditMenu; }\n\tpublic get hash() {\n\t\treturn JSON.stringify([\n\t\t\tthis.getSingleTextEdit().text,\n\t\t\tthis.getSingleTextEdit().range.getStartPosition().toString()\n\t\t]);\n\t}\n\n\tpublic get requestUuid(): string { return this._data.context.requestUuid; }\n\n\tpublic get partialAccepts(): PartialAcceptance { return this._data.partialAccepts; }\n\n\t/**\n\t * A reference to the original inline completion this inline completion has been constructed from.\n\t * Used for event data to ensure referential equality.\n\t*/\n\tprivate get _sourceInlineCompletion(): InlineCompletion { return this._data.sourceInlineCompletion; }\n\n\n\tpublic abstract getSingleTextEdit(): TextReplacement;\n\n\tpublic abstract withEdit(userEdit: StringEdit, textModel: ITextModel): InlineSuggestionItem | undefined;\n\n\tpublic abstract withIdentity(identity: InlineSuggestionIdentity): InlineSuggestionItem;\n\tpublic abstract canBeReused(model: ITextModel, position: Position): boolean;\n\n\n\tpublic addRef(): void {\n\t\tthis.identity.addRef();\n\t\tthis.source.addRef();\n\t}\n\n\tpublic removeRef(): void {\n\t\tthis.identity.removeRef();\n\t\tthis.source.removeRef();\n\t}\n\n\tpublic reportInlineEditShown(commandService: ICommandService, viewKind: InlineCompletionViewKind, viewData: InlineCompletionViewData) {\n\t\tthis._data.reportInlineEditShown(commandService, this.insertText, viewKind, viewData);\n\t}\n\n\tpublic reportPartialAccept(acceptedCharacters: number, info: PartialAcceptInfo, partialAcceptance: PartialAcceptance) {\n\t\tthis._data.reportPartialAccept(acceptedCharacters, info, partialAcceptance);\n\t}\n\n\tpublic reportEndOfLife(reason: InlineCompletionEndOfLifeReason): void {\n\t\tthis._data.reportEndOfLife(reason);\n\t}\n\n\tpublic setEndOfLifeReason(reason: InlineCompletionEndOfLifeReason): void {\n\t\tthis._data.setEndOfLifeReason(reason);\n\t}\n\n\tpublic setIsPreceeded(item: InlineSuggestionItem): void {\n\t\tthis._data.setIsPreceeded(item.partialAccepts);\n\t}\n\n\tpublic setNotShownReasonIfNotSet(reason: string): void {\n\t\tthis._data.setNotShownReason(reason);\n\t}\n\n\t/**\n\t * Avoid using this method. Instead introduce getters for the needed properties.\n\t*/\n\tpublic getSourceCompletion(): InlineCompletion {\n\t\treturn this._sourceInlineCompletion;\n\t}\n}\n\nexport class InlineSuggestionIdentity {\n\tprivate static idCounter = 0;\n\tprivate readonly _onDispose = observableSignal(this);\n\n\tprivate readonly _jumpedTo = observableValue(this, false);\n\tpublic get jumpedTo(): IObservable<boolean> {\n\t\treturn this._jumpedTo;\n\t}\n\n\tprivate _refCount = 1;\n\tpublic readonly id = 'InlineCompletionIdentity' + InlineSuggestionIdentity.idCounter++;\n\n\taddRef() {\n\t\tthis._refCount++;\n\t}\n\n\tremoveRef() {\n\t\tthis._refCount--;\n\t\tif (this._refCount === 0) {\n\t\t\tthis._onDispose.trigger(undefined);\n\t\t}\n\t}\n\n\tsetJumpTo(tx: ITransaction | undefined): void {\n\t\tthis._jumpedTo.set(true, tx);\n\t}\n}\n\nexport class InlineSuggestHint {\n\n\tpublic static create(displayLocation: InlineCompletionHint) {\n\t\treturn new InlineSuggestHint(\n\t\t\tRange.lift(displayLocation.range),\n\t\t\tdisplayLocation.content,\n\t\t\tdisplayLocation.style,\n\t\t\tdisplayLocation.jumpToEdit\n\t\t);\n\t}\n\n\tprivate constructor(\n\t\tpublic readonly range: Range,\n\t\tpublic readonly content: string,\n\t\tpublic readonly style: InlineCompletionHintStyle,\n\t\tpublic readonly jumpToEdit: boolean,\n\t) { }\n\n\tpublic withEdit(edit: StringEdit, positionOffsetTransformer: PositionOffsetTransformerBase): InlineSuggestHint | undefined {\n\t\tconst offsetRange = new OffsetRange(\n\t\t\tpositionOffsetTransformer.getOffset(this.range.getStartPosition()),\n\t\t\tpositionOffsetTransformer.getOffset(this.range.getEndPosition())\n\t\t);\n\n\t\tconst newOffsetRange = applyEditsToRanges([offsetRange], edit)[0];\n\t\tif (!newOffsetRange) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst newRange = positionOffsetTransformer.getRange(newOffsetRange);\n\n\t\treturn new InlineSuggestHint(newRange, this.content, this.style, this.jumpToEdit);\n\t}\n}\n\nexport class InlineCompletionItem extends InlineSuggestionItemBase {\n\tpublic static create(\n\t\tdata: InlineSuggestData,\n\t\ttextModel: ITextModel,\n\t): InlineCompletionItem {\n\t\tconst identity = new InlineSuggestionIdentity();\n\t\tconst transformer = getPositionOffsetTransformerFromTextModel(textModel);\n\n\t\tconst insertText = data.insertText.replace(/\\r\\n|\\r|\\n/g, textModel.getEOL());\n\n\t\tconst edit = reshapeInlineCompletion(new StringReplacement(transformer.getOffsetRange(data.range), insertText), textModel);\n\t\tconst trimmedEdit = edit.removeCommonSuffixAndPrefix(textModel.getValue());\n\t\tconst textEdit = transformer.getTextReplacement(edit);\n\n\t\tconst displayLocation = data.hint ? InlineSuggestHint.create(data.hint) : undefined;\n\n\t\treturn new InlineCompletionItem(edit, trimmedEdit, textEdit, textEdit.range, data.snippetInfo, data.additionalTextEdits, data, identity, displayLocation);\n\t}\n\n\tpublic readonly isInlineEdit = false;\n\n\tprivate constructor(\n\t\tprivate readonly _edit: StringReplacement,\n\t\tprivate readonly _trimmedEdit: StringReplacement,\n\t\tprivate readonly _textEdit: TextReplacement,\n\t\tprivate readonly _originalRange: Range,\n\t\tpublic readonly snippetInfo: SnippetInfo | undefined,\n\t\tpublic readonly additionalTextEdits: readonly ISingleEditOperation[],\n\n\t\tdata: InlineSuggestData,\n\t\tidentity: InlineSuggestionIdentity,\n\t\tdisplayLocation: InlineSuggestHint | undefined,\n\t) {\n\t\tsuper(data, identity, displayLocation);\n\t}\n\n\toverride get hash(): string {\n\t\treturn JSON.stringify(this._trimmedEdit.toJson());\n\t}\n\n\toverride getSingleTextEdit(): TextReplacement { return this._textEdit; }\n\n\toverride withIdentity(identity: InlineSuggestionIdentity): InlineCompletionItem {\n\t\treturn new InlineCompletionItem(\n\t\t\tthis._edit,\n\t\t\tthis._trimmedEdit,\n\t\t\tthis._textEdit,\n\t\t\tthis._originalRange,\n\t\t\tthis.snippetInfo,\n\t\t\tthis.additionalTextEdits,\n\t\t\tthis._data,\n\t\t\tidentity,\n\t\t\tthis.hint\n\t\t);\n\t}\n\n\toverride withEdit(textModelEdit: StringEdit, textModel: ITextModel): InlineCompletionItem | undefined {\n\t\tconst newEditRange = applyEditsToRanges([this._edit.replaceRange], textModelEdit);\n\t\tif (newEditRange.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst newEdit = new StringReplacement(newEditRange[0], this._textEdit.text);\n\t\tconst positionOffsetTransformer = getPositionOffsetTransformerFromTextModel(textModel);\n\t\tconst newTextEdit = positionOffsetTransformer.getTextReplacement(newEdit);\n\n\t\tlet newDisplayLocation = this.hint;\n\t\tif (newDisplayLocation) {\n\t\t\tnewDisplayLocation = newDisplayLocation.withEdit(textModelEdit, positionOffsetTransformer);\n\t\t\tif (!newDisplayLocation) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t}\n\n\t\tconst trimmedEdit = newEdit.removeCommonSuffixAndPrefix(textModel.getValue());\n\n\t\treturn new InlineCompletionItem(\n\t\t\tnewEdit,\n\t\t\ttrimmedEdit,\n\t\t\tnewTextEdit,\n\t\t\tthis._originalRange,\n\t\t\tthis.snippetInfo,\n\t\t\tthis.additionalTextEdits,\n\t\t\tthis._data,\n\t\t\tthis.identity,\n\t\t\tnewDisplayLocation\n\t\t);\n\t}\n\n\toverride canBeReused(model: ITextModel, position: Position): boolean {\n\t\t// TODO@hediet I believe this can be simplified to `return true;`, as applying an edit should kick out this suggestion.\n\t\tconst updatedRange = this._textEdit.range;\n\t\tconst result = !!updatedRange\n\t\t\t&& updatedRange.containsPosition(position)\n\t\t\t&& this.isVisible(model, position)\n\t\t\t&& TextLength.ofRange(updatedRange).isGreaterThanOrEqualTo(TextLength.ofRange(this._originalRange));\n\t\treturn result;\n\t}\n\n\tpublic isVisible(model: ITextModel, cursorPosition: Position): boolean {\n\t\tconst singleTextEdit = this.getSingleTextEdit();\n\t\treturn inlineCompletionIsVisible(singleTextEdit, this._originalRange, model, cursorPosition);\n\t}\n}\n\nexport function inlineCompletionIsVisible(singleTextEdit: TextReplacement, originalRange: Range | undefined, model: ITextModel, cursorPosition: Position): boolean {\n\tconst minimizedReplacement = singleTextRemoveCommonPrefix(singleTextEdit, model);\n\tconst editRange = singleTextEdit.range;\n\tif (!editRange\n\t\t|| (originalRange && !originalRange.getStartPosition().equals(editRange.getStartPosition()))\n\t\t|| cursorPosition.lineNumber !== minimizedReplacement.range.startLineNumber\n\t\t|| minimizedReplacement.isEmpty // if the completion is empty after removing the common prefix of the completion and the model, the completion item would not be visible\n\t) {\n\t\treturn false;\n\t}\n\n\t// We might consider comparing by .toLowerText, but this requires GhostTextReplacement\n\tconst originalValue = model.getValueInRange(minimizedReplacement.range, EndOfLinePreference.LF);\n\tconst filterText = minimizedReplacement.text;\n\n\tconst cursorPosIndex = Math.max(0, cursorPosition.column - minimizedReplacement.range.startColumn);\n\n\tlet filterTextBefore = filterText.substring(0, cursorPosIndex);\n\tlet filterTextAfter = filterText.substring(cursorPosIndex);\n\n\tlet originalValueBefore = originalValue.substring(0, cursorPosIndex);\n\tlet originalValueAfter = originalValue.substring(cursorPosIndex);\n\n\tconst originalValueIndent = model.getLineIndentColumn(minimizedReplacement.range.startLineNumber);\n\tif (minimizedReplacement.range.startColumn <= originalValueIndent) {\n\t\t// Remove indentation\n\t\toriginalValueBefore = originalValueBefore.trimStart();\n\t\tif (originalValueBefore.length === 0) {\n\t\t\toriginalValueAfter = originalValueAfter.trimStart();\n\t\t}\n\t\tfilterTextBefore = filterTextBefore.trimStart();\n\t\tif (filterTextBefore.length === 0) {\n\t\t\tfilterTextAfter = filterTextAfter.trimStart();\n\t\t}\n\t}\n\n\treturn filterTextBefore.startsWith(originalValueBefore)\n\t\t&& !!matchesSubString(originalValueAfter, filterTextAfter);\n}\n\nexport class InlineEditItem extends InlineSuggestionItemBase {\n\tpublic static create(\n\t\tdata: InlineSuggestData,\n\t\ttextModel: ITextModel,\n\t): InlineEditItem {\n\t\tconst offsetEdit = getStringEdit(textModel, data.range, data.insertText);\n\t\tconst text = new TextModelText(textModel);\n\t\tconst textEdit = TextEdit.fromStringEdit(offsetEdit, text);\n\t\tconst singleTextEdit = offsetEdit.isEmpty() ? new TextReplacement(new Range(1, 1, 1, 1), '') : textEdit.toReplacement(text); // FIXME: .toReplacement() can throw because offsetEdit is empty because we get an empty diff in getStringEdit after diffing\n\t\tconst identity = new InlineSuggestionIdentity();\n\n\t\tconst edits = offsetEdit.replacements.map(edit => {\n\t\t\tconst replacedRange = Range.fromPositions(textModel.getPositionAt(edit.replaceRange.start), textModel.getPositionAt(edit.replaceRange.endExclusive));\n\t\t\tconst replacedText = textModel.getValueInRange(replacedRange);\n\t\t\treturn SingleUpdatedNextEdit.create(edit, replacedText);\n\t\t});\n\t\tconst hint = data.hint ? InlineSuggestHint.create(data.hint) : undefined;\n\t\treturn new InlineEditItem(offsetEdit, singleTextEdit, data.uri, data, identity, edits, hint, false, textModel.getVersionId());\n\t}\n\n\tpublic readonly snippetInfo: SnippetInfo | undefined = undefined;\n\tpublic readonly additionalTextEdits: readonly ISingleEditOperation[] = [];\n\tpublic readonly isInlineEdit = true;\n\n\tprivate constructor(\n\t\tprivate readonly _edit: StringEdit,\n\t\tprivate readonly _textEdit: TextReplacement,\n\t\tpublic readonly uri: URI | undefined,\n\n\t\tdata: InlineSuggestData,\n\n\t\tidentity: InlineSuggestionIdentity,\n\t\tprivate readonly _edits: readonly SingleUpdatedNextEdit[],\n\t\thint: InlineSuggestHint | undefined,\n\t\tprivate readonly _lastChangePartOfInlineEdit = false,\n\t\tprivate readonly _inlineEditModelVersion: number,\n\t) {\n\t\tsuper(data, identity, hint);\n\t}\n\n\tpublic get updatedEditModelVersion(): number { return this._inlineEditModelVersion; }\n\tpublic get updatedEdit(): StringEdit { return this._edit; }\n\n\toverride getSingleTextEdit(): TextReplacement {\n\t\treturn this._textEdit;\n\t}\n\n\toverride withIdentity(identity: InlineSuggestionIdentity): InlineEditItem {\n\t\treturn new InlineEditItem(\n\t\t\tthis._edit,\n\t\t\tthis._textEdit,\n\t\t\tthis.uri,\n\t\t\tthis._data,\n\t\t\tidentity,\n\t\t\tthis._edits,\n\t\t\tthis.hint,\n\t\t\tthis._lastChangePartOfInlineEdit,\n\t\t\tthis._inlineEditModelVersion,\n\t\t);\n\t}\n\n\toverride canBeReused(model: ITextModel, position: Position): boolean {\n\t\t// TODO@hediet I believe this can be simplified to `return true;`, as applying an edit should kick out this suggestion.\n\t\treturn this._lastChangePartOfInlineEdit && this.updatedEditModelVersion === model.getVersionId();\n\t}\n\n\toverride withEdit(textModelChanges: StringEdit, textModel: ITextModel): InlineEditItem | undefined {\n\t\tconst edit = this._applyTextModelChanges(textModelChanges, this._edits, textModel);\n\t\treturn edit;\n\t}\n\n\tprivate _applyTextModelChanges(textModelChanges: StringEdit, edits: readonly SingleUpdatedNextEdit[], textModel: ITextModel): InlineEditItem | undefined {\n\t\tedits = edits.map(innerEdit => innerEdit.applyTextModelChanges(textModelChanges));\n\n\t\tif (edits.some(edit => edit.edit === undefined)) {\n\t\t\treturn undefined; // change is invalid, so we will have to drop the completion\n\t\t}\n\n\t\tconst newTextModelVersion = textModel.getVersionId();\n\n\t\tlet inlineEditModelVersion = this._inlineEditModelVersion;\n\t\tconst lastChangePartOfInlineEdit = edits.some(edit => edit.lastChangeUpdatedEdit);\n\t\tif (lastChangePartOfInlineEdit) {\n\t\t\tinlineEditModelVersion = newTextModelVersion ?? -1;\n\t\t}\n\n\t\tif (newTextModelVersion === null || inlineEditModelVersion + 20 < newTextModelVersion) {\n\t\t\treturn undefined; // the completion has been ignored for a while, remove it\n\t\t}\n\n\t\tedits = edits.filter(innerEdit => !innerEdit.edit!.isEmpty);\n\t\tif (edits.length === 0) {\n\t\t\treturn undefined; // the completion has been typed by the user\n\t\t}\n\n\t\tconst newEdit = new StringEdit(edits.map(edit => edit.edit!));\n\t\tconst positionOffsetTransformer = getPositionOffsetTransformerFromTextModel(textModel);\n\t\tconst newTextEdit = positionOffsetTransformer.getTextEdit(newEdit).toReplacement(new TextModelText(textModel));\n\n\t\tlet newDisplayLocation = this.hint;\n\t\tif (newDisplayLocation) {\n\t\t\tnewDisplayLocation = newDisplayLocation.withEdit(textModelChanges, positionOffsetTransformer);\n\t\t\tif (!newDisplayLocation) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t}\n\n\t\treturn new InlineEditItem(\n\t\t\tnewEdit,\n\t\t\tnewTextEdit,\n\t\t\tthis.uri,\n\t\t\tthis._data,\n\t\t\tthis.identity,\n\t\t\tedits,\n\t\t\tnewDisplayLocation,\n\t\t\tlastChangePartOfInlineEdit,\n\t\t\tinlineEditModelVersion,\n\t\t);\n\t}\n}\n\nfunction getStringEdit(textModel: ITextModel, editRange: Range, replaceText: string): StringEdit {\n\tconst eol = textModel.getEOL();\n\tconst editOriginalText = textModel.getValueInRange(editRange);\n\tconst editReplaceText = replaceText.replace(/\\r\\n|\\r|\\n/g, eol);\n\n\tconst diffAlgorithm = linesDiffComputers.getDefault();\n\tconst lineDiffs = diffAlgorithm.computeDiff(\n\t\tsplitLines(editOriginalText),\n\t\tsplitLines(editReplaceText),\n\t\t{\n\t\t\tignoreTrimWhitespace: false,\n\t\t\tcomputeMoves: false,\n\t\t\textendToSubwords: true,\n\t\t\tmaxComputationTimeMs: 500,\n\t\t}\n\t);\n\n\tconst innerChanges = lineDiffs.changes.flatMap(c => c.innerChanges ?? []);\n\n\tfunction addRangeToPos(pos: Position, range: Range): Range {\n\t\tconst start = TextLength.fromPosition(range.getStartPosition());\n\t\treturn TextLength.ofRange(range).createRange(start.addToPosition(pos));\n\t}\n\n\tconst modifiedText = new StringText(editReplaceText);\n\n\tconst offsetEdit = new StringEdit(\n\t\tinnerChanges.map(c => {\n\t\t\tconst rangeInModel = addRangeToPos(editRange.getStartPosition(), c.originalRange);\n\t\t\tconst originalRange = getPositionOffsetTransformerFromTextModel(textModel).getOffsetRange(rangeInModel);\n\n\t\t\tconst replaceText = modifiedText.getValueOfRange(c.modifiedRange);\n\t\t\tconst edit = new StringReplacement(originalRange, replaceText);\n\n\t\t\tconst originalText = textModel.getValueInRange(rangeInModel);\n\t\t\treturn reshapeInlineEdit(edit, originalText, innerChanges.length, textModel);\n\t\t})\n\t);\n\n\treturn offsetEdit;\n}\n\nclass SingleUpdatedNextEdit {\n\tpublic static create(\n\t\tedit: StringReplacement,\n\t\treplacedText: string,\n\t): SingleUpdatedNextEdit {\n\t\tconst prefixLength = commonPrefixLength(edit.newText, replacedText);\n\t\tconst suffixLength = commonSuffixLength(edit.newText, replacedText);\n\t\tconst trimmedNewText = edit.newText.substring(prefixLength, edit.newText.length - suffixLength);\n\t\treturn new SingleUpdatedNextEdit(edit, trimmedNewText, prefixLength, suffixLength);\n\t}\n\n\tpublic get edit() { return this._edit; }\n\tpublic get lastChangeUpdatedEdit() { return this._lastChangeUpdatedEdit; }\n\n\tconstructor(\n\t\tprivate _edit: StringReplacement | undefined,\n\t\tprivate _trimmedNewText: string,\n\t\tprivate _prefixLength: number,\n\t\tprivate _suffixLength: number,\n\t\tprivate _lastChangeUpdatedEdit: boolean = false,\n\t) {\n\t}\n\n\tpublic applyTextModelChanges(textModelChanges: StringEdit) {\n\t\tconst c = this._clone();\n\t\tc._applyTextModelChanges(textModelChanges);\n\t\treturn c;\n\t}\n\n\tprivate _clone(): SingleUpdatedNextEdit {\n\t\treturn new SingleUpdatedNextEdit(\n\t\t\tthis._edit,\n\t\t\tthis._trimmedNewText,\n\t\t\tthis._prefixLength,\n\t\t\tthis._suffixLength,\n\t\t\tthis._lastChangeUpdatedEdit,\n\t\t);\n\t}\n\n\tprivate _applyTextModelChanges(textModelChanges: StringEdit) {\n\t\tthis._lastChangeUpdatedEdit = false;\n\n\t\tif (!this._edit) {\n\t\t\tthrow new BugIndicatingError('UpdatedInnerEdits: No edit to apply changes to');\n\t\t}\n\n\t\tconst result = this._applyChanges(this._edit, textModelChanges);\n\t\tif (!result) {\n\t\t\tthis._edit = undefined;\n\t\t\treturn;\n\t\t}\n\n\t\tthis._edit = result.edit;\n\t\tthis._lastChangeUpdatedEdit = result.editHasChanged;\n\t}\n\n\tprivate _applyChanges(edit: StringReplacement, textModelChanges: StringEdit): { edit: StringReplacement; editHasChanged: boolean } | undefined {\n\t\tlet editStart = edit.replaceRange.start;\n\t\tlet editEnd = edit.replaceRange.endExclusive;\n\t\tlet editReplaceText = edit.newText;\n\t\tlet editHasChanged = false;\n\n\t\tconst shouldPreserveEditShape = this._prefixLength > 0 || this._suffixLength > 0;\n\n\t\tfor (let i = textModelChanges.replacements.length - 1; i >= 0; i--) {\n\t\t\tconst change = textModelChanges.replacements[i];\n\n\t\t\t// INSERTIONS (only support inserting at start of edit)\n\t\t\tconst isInsertion = change.newText.length > 0 && change.replaceRange.isEmpty;\n\n\t\t\tif (isInsertion && !shouldPreserveEditShape && change.replaceRange.start === editStart && editReplaceText.startsWith(change.newText)) {\n\t\t\t\teditStart += change.newText.length;\n\t\t\t\teditReplaceText = editReplaceText.substring(change.newText.length);\n\t\t\t\teditEnd = Math.max(editStart, editEnd);\n\t\t\t\teditHasChanged = true;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (isInsertion && shouldPreserveEditShape && change.replaceRange.start === editStart + this._prefixLength && this._trimmedNewText.startsWith(change.newText)) {\n\t\t\t\teditEnd += change.newText.length;\n\t\t\t\teditHasChanged = true;\n\t\t\t\tthis._prefixLength += change.newText.length;\n\t\t\t\tthis._trimmedNewText = this._trimmedNewText.substring(change.newText.length);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// DELETIONS\n\t\t\tconst isDeletion = change.newText.length === 0 && change.replaceRange.length > 0;\n\t\t\tif (isDeletion && change.replaceRange.start >= editStart + this._prefixLength && change.replaceRange.endExclusive <= editEnd - this._suffixLength) {\n\t\t\t\t// user deleted text IN-BETWEEN the deletion range\n\t\t\t\teditEnd -= change.replaceRange.length;\n\t\t\t\teditHasChanged = true;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// user did exactly the edit\n\t\t\tif (change.equals(edit)) {\n\t\t\t\teditHasChanged = true;\n\t\t\t\teditStart = change.replaceRange.endExclusive;\n\t\t\t\teditReplaceText = '';\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// MOVE EDIT\n\t\t\tif (change.replaceRange.start > editEnd) {\n\t\t\t\t// the change happens after the completion range\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (change.replaceRange.endExclusive < editStart) {\n\t\t\t\t// the change happens before the completion range\n\t\t\t\teditStart += change.newText.length - change.replaceRange.length;\n\t\t\t\teditEnd += change.newText.length - change.replaceRange.length;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// The change intersects the completion, so we will have to drop the completion\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// the resulting edit is a noop as the original and new text are the same\n\t\tif (this._trimmedNewText.length === 0 && editStart + this._prefixLength === editEnd - this._suffixLength) {\n\t\t\treturn { edit: new StringReplacement(new OffsetRange(editStart + this._prefixLength, editStart + this._prefixLength), ''), editHasChanged: true };\n\t\t}\n\n\t\treturn { edit: new StringReplacement(new OffsetRange(editStart, editEnd), editReplaceText), editHasChanged };\n\t}\n}\n\nfunction reshapeInlineCompletion(edit: StringReplacement, textModel: ITextModel): StringReplacement {\n\t// If the insertion is a multi line insertion starting on the next line\n\t// Move it forwards so that the multi line insertion starts on the current line\n\tconst eol = textModel.getEOL();\n\tif (edit.replaceRange.isEmpty && edit.newText.includes(eol)) {\n\t\tedit = reshapeMultiLineInsertion(edit, textModel);\n\t}\n\n\treturn edit;\n}\n\nfunction reshapeInlineEdit(edit: StringReplacement, originalText: string, totalInnerEdits: number, textModel: ITextModel): StringReplacement {\n\t// TODO: EOL are not properly trimmed by the diffAlgorithm #12680\n\tconst eol = textModel.getEOL();\n\tif (edit.newText.endsWith(eol) && originalText.endsWith(eol)) {\n\t\tedit = new StringReplacement(edit.replaceRange.deltaEnd(-eol.length), edit.newText.slice(0, -eol.length));\n\t}\n\n\t// INSERTION\n\t// If the insertion ends with a new line and is inserted at the start of a line which has text,\n\t// we move the insertion to the end of the previous line if possible\n\tif (totalInnerEdits === 1 && edit.replaceRange.isEmpty && edit.newText.includes(eol)) {\n\t\tconst startPosition = textModel.getPositionAt(edit.replaceRange.start);\n\t\tconst hasTextOnInsertionLine = textModel.getLineLength(startPosition.lineNumber) !== 0;\n\t\tif (hasTextOnInsertionLine) {\n\t\t\tedit = reshapeMultiLineInsertion(edit, textModel);\n\t\t}\n\t}\n\n\t// The diff algorithm extended a simple edit to the entire word\n\t// shrink it back to a simple edit if it is deletion/insertion only\n\tif (totalInnerEdits === 1) {\n\t\tconst prefixLength = commonPrefixLength(originalText, edit.newText);\n\t\tconst suffixLength = commonSuffixLength(originalText.slice(prefixLength), edit.newText.slice(prefixLength));\n\n\t\t// reshape it back to an insertion\n\t\tif (prefixLength + suffixLength === originalText.length) {\n\t\t\treturn new StringReplacement(edit.replaceRange.deltaStart(prefixLength).deltaEnd(-suffixLength), edit.newText.substring(prefixLength, edit.newText.length - suffixLength));\n\t\t}\n\n\t\t// reshape it back to a deletion\n\t\tif (prefixLength + suffixLength === edit.newText.length) {\n\t\t\treturn new StringReplacement(edit.replaceRange.deltaStart(prefixLength).deltaEnd(-suffixLength), '');\n\t\t}\n\t}\n\n\treturn edit;\n}\n\nfunction reshapeMultiLineInsertion(edit: StringReplacement, textModel: ITextModel): StringReplacement {\n\tif (!edit.replaceRange.isEmpty) {\n\t\tthrow new BugIndicatingError('Unexpected original range');\n\t}\n\n\tif (edit.replaceRange.start === 0) {\n\t\treturn edit;\n\t}\n\n\tconst eol = textModel.getEOL();\n\tconst startPosition = textModel.getPositionAt(edit.replaceRange.start);\n\tconst startColumn = startPosition.column;\n\tconst startLineNumber = startPosition.lineNumber;\n\n\t// If the insertion ends with a new line and is inserted at the start of a line which has text,\n\t// we move the insertion to the end of the previous line if possible\n\tif (startColumn === 1 && startLineNumber > 1 && edit.newText.endsWith(eol) && !edit.newText.startsWith(eol)) {\n\t\treturn new StringReplacement(edit.replaceRange.delta(-1), eol + edit.newText.slice(0, -eol.length));\n\t}\n\n\treturn edit;\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { BugIndicatingError } from '../../../../../base/common/errors.js';\nimport { matchesSubString } from '../../../../../base/common/filters.js';\nimport { IObservable, ITransaction, observableSignal, observableValue } from '../../../../../base/common/observable.js';\nimport { commonPrefixLength, commonSuffixLength, splitLines } from '../../../../../base/common/strings.js';\nimport { URI } from '../../../../../base/common/uri.js';\nimport { ICommandService } from '../../../../../platform/commands/common/commands.js';\nimport { ISingleEditOperation } from '../../../../common/core/editOperation.js';\nimport { applyEditsToRanges, StringEdit, StringReplacement } from '../../../../common/core/edits/stringEdit.js';\nimport { TextEdit, TextReplacement } from '../../../../common/core/edits/textEdit.js';\nimport { Position } from '../../../../common/core/position.js';\nimport { Range } from '../../../../common/core/range.js';\nimport { OffsetRange } from '../../../../common/core/ranges/offsetRange.js';\nimport { StringText } from '../../../../common/core/text/abstractText.js';\nimport { getPositionOffsetTransformerFromTextModel } from '../../../../common/core/text/getPositionOffsetTransformerFromTextModel.js';\nimport { PositionOffsetTransformerBase } from '../../../../common/core/text/positionToOffset.js';\nimport { TextLength } from '../../../../common/core/text/textLength.js';\nimport { linesDiffComputers } from '../../../../common/diff/linesDiffComputers.js';\nimport { Command, InlineCompletion, InlineCompletionHintStyle, InlineCompletionEndOfLifeReason, InlineCompletionTriggerKind, InlineCompletionWarning, PartialAcceptInfo, InlineCompletionHint } from '../../../../common/languages.js';\nimport { EndOfLinePreference, ITextModel } from '../../../../common/model.js';\nimport { TextModelText } from '../../../../common/model/textModelText.js';\nimport { InlineCompletionViewData, InlineCompletionViewKind } from '../view/inlineEdits/inlineEditsViewInterface.js';\nimport { InlineSuggestData, InlineSuggestionList, PartialAcceptance, SnippetInfo } from './provideInlineCompletions.js';\nimport { singleTextRemoveCommonPrefix } from './singleTextEditHelpers.js';\n\nexport type InlineSuggestionItem = InlineEditItem | InlineCompletionItem;\n\nexport namespace InlineSuggestionItem {\n\texport function create(\n\t\tdata: InlineSuggestData,\n\t\ttextModel: ITextModel,\n\t): InlineSuggestionItem {\n\t\tif (!data.isInlineEdit && !data.uri) {\n\t\t\treturn InlineCompletionItem.create(data, textModel);\n\t\t} else {\n\t\t\treturn InlineEditItem.create(data, textModel);\n\t\t}\n\t}\n}\n\nabstract class InlineSuggestionItemBase {\n\tconstructor(\n\t\tprotected readonly _data: InlineSuggestData,\n\t\tpublic readonly identity: InlineSuggestionIdentity,\n\t\tpublic readonly hint: InlineSuggestHint | undefined\n\t) { }\n\n\t/**\n\t * A reference to the original inline completion list this inline completion has been constructed from.\n\t * Used for event data to ensure referential equality.\n\t*/\n\tpublic get source(): InlineSuggestionList { return this._data.source; }\n\n\tpublic get isFromExplicitRequest(): boolean { return this._data.context.triggerKind === InlineCompletionTriggerKind.Explicit; }\n\tpublic get forwardStable(): boolean { return this.source.inlineSuggestions.enableForwardStability ?? false; }\n\tpublic get editRange(): Range { return this.getSingleTextEdit().range; }\n\tpublic get targetRange(): Range { return this.hint?.range && !this.hint.jumpToEdit ? this.hint?.range : this.editRange; }\n\tpublic get insertText(): string { return this.getSingleTextEdit().text; }\n\tpublic get semanticId(): string { return this.hash; }\n\tpublic get action(): Command | undefined { return this._sourceInlineCompletion.gutterMenuLinkAction; }\n\tpublic get command(): Command | undefined { return this._sourceInlineCompletion.command; }\n\tpublic get warning(): InlineCompletionWarning | undefined { return this._sourceInlineCompletion.warning; }\n\tpublic get showInlineEditMenu(): boolean { return !!this._sourceInlineCompletion.showInlineEditMenu; }\n\tpublic get hash() {\n\t\treturn JSON.stringify([\n\t\t\tthis.getSingleTextEdit().text,\n\t\t\tthis.getSingleTextEdit().range.getStartPosition().toString()\n\t\t]);\n\t}\n\n\tpublic get requestUuid(): string { return this._data.context.requestUuid; }\n\n\tpublic get partialAccepts(): PartialAcceptance { return this._data.partialAccepts; }\n\n\t/**\n\t * A reference to the original inline completion this inline completion has been constructed from.\n\t * Used for event data to ensure referential equality.\n\t*/\n\tprivate get _sourceInlineCompletion(): InlineCompletion { return this._data.sourceInlineCompletion; }\n\n\n\tpublic abstract getSingleTextEdit(): TextReplacement;\n\n\tpublic abstract withEdit(userEdit: StringEdit, textModel: ITextModel): InlineSuggestionItem | undefined;\n\n\tpublic abstract withIdentity(identity: InlineSuggestionIdentity): InlineSuggestionItem;\n\tpublic abstract canBeReused(model: ITextModel, position: Position): boolean;\n\n\n\tpublic addRef(): void {\n\t\tthis.identity.addRef();\n\t\tthis.source.addRef();\n\t}\n\n\tpublic removeRef(): void {\n\t\tthis.identity.removeRef();\n\t\tthis.source.removeRef();\n\t}\n\n\tpublic reportInlineEditShown(commandService: ICommandService, viewKind: InlineCompletionViewKind, viewData: InlineCompletionViewData) {\n\t\tthis._data.reportInlineEditShown(commandService, this.insertText, viewKind, viewData);\n\t}\n\n\tpublic reportPartialAccept(acceptedCharacters: number, info: PartialAcceptInfo, partialAcceptance: PartialAcceptance) {\n\t\tthis._data.reportPartialAccept(acceptedCharacters, info, partialAcceptance);\n\t}\n\n\tpublic reportEndOfLife(reason: InlineCompletionEndOfLifeReason): void {\n\t\tthis._data.reportEndOfLife(reason);\n\t}\n\n\tpublic setEndOfLifeReason(reason: InlineCompletionEndOfLifeReason): void {\n\t\tthis._data.setEndOfLifeReason(reason);\n\t}\n\n\tpublic setIsPreceeded(item: InlineSuggestionItem): void {\n\t\tthis._data.setIsPreceeded(item.partialAccepts);\n\t}\n\n\tpublic setNotShownReasonIfNotSet(reason: string): void {\n\t\tthis._data.setNotShownReason(reason);\n\t}\n\n\t/**\n\t * Avoid using this method. Instead introduce getters for the needed properties.\n\t*/\n\tpublic getSourceCompletion(): InlineCompletion {\n\t\treturn this._sourceInlineCompletion;\n\t}\n}\n\nexport class InlineSuggestionIdentity {\n\tprivate static idCounter = 0;\n\tprivate readonly _onDispose = observableSignal(this);\n\n\tprivate readonly _jumpedTo = observableValue(this, false);\n\tpublic get jumpedTo(): IObservable<boolean> {\n\t\treturn this._jumpedTo;\n\t}\n\n\tprivate _refCount = 1;\n\tpublic readonly id = 'InlineCompletionIdentity' + InlineSuggestionIdentity.idCounter++;\n\n\taddRef() {\n\t\tthis._refCount++;\n\t}\n\n\tremoveRef() {\n\t\tthis._refCount--;\n\t\tif (this._refCount === 0) {\n\t\t\tthis._onDispose.trigger(undefined);\n\t\t}\n\t}\n\n\tsetJumpTo(tx: ITransaction | undefined): void {\n\t\tthis._jumpedTo.set(true, tx);\n\t}\n}\n\nexport class InlineSuggestHint {\n\n\tpublic static create(displayLocation: InlineCompletionHint) {\n\t\treturn new InlineSuggestHint(\n\t\t\tRange.lift(displayLocation.range),\n\t\t\tdisplayLocation.content,\n\t\t\tdisplayLocation.style,\n\t\t\tdisplayLocation.jumpToEdit\n\t\t);\n\t}\n\n\tprivate constructor(\n\t\tpublic readonly range: Range,\n\t\tpublic readonly content: string,\n\t\tpublic readonly style: InlineCompletionHintStyle,\n\t\tpublic readonly jumpToEdit: boolean,\n\t) { }\n\n\tpublic withEdit(edit: StringEdit, positionOffsetTransformer: PositionOffsetTransformerBase): InlineSuggestHint | undefined {\n\t\tconst offsetRange = new OffsetRange(\n\t\t\tpositionOffsetTransformer.getOffset(this.range.getStartPosition()),\n\t\t\tpositionOffsetTransformer.getOffset(this.range.getEndPosition())\n\t\t);\n\n\t\tconst newOffsetRange = applyEditsToRanges([offsetRange], edit)[0];\n\t\tif (!newOffsetRange) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst newRange = positionOffsetTransformer.getRange(newOffsetRange);\n\n\t\treturn new InlineSuggestHint(newRange, this.content, this.style, this.jumpToEdit);\n\t}\n}\n\nexport class InlineCompletionItem extends InlineSuggestionItemBase {\n\tpublic static create(\n\t\tdata: InlineSuggestData,\n\t\ttextModel: ITextModel,\n\t): InlineCompletionItem {\n\t\tconst identity = new InlineSuggestionIdentity();\n\t\tconst transformer = getPositionOffsetTransformerFromTextModel(textModel);\n\n\t\tconst insertText = data.insertText.replace(/\\r\\n|\\r|\\n/g, textModel.getEOL());\n\n\t\tconst edit = reshapeInlineCompletion(new StringReplacement(transformer.getOffsetRange(data.range), insertText), textModel);\n\t\tconst trimmedEdit = edit.removeCommonSuffixAndPrefix(textModel.getValue());\n\t\tconst textEdit = transformer.getTextReplacement(edit);\n\n\t\tconst displayLocation = data.hint ? InlineSuggestHint.create(data.hint) : undefined;\n\n\t\treturn new InlineCompletionItem(edit, trimmedEdit, textEdit, textEdit.range, data.snippetInfo, data.additionalTextEdits, data, identity, displayLocation);\n\t}\n\n\tpublic readonly isInlineEdit = false;\n\n\tprivate constructor(\n\t\tprivate readonly _edit: StringReplacement,\n\t\tprivate readonly _trimmedEdit: StringReplacement,\n\t\tprivate readonly _textEdit: TextReplacement,\n\t\tprivate readonly _originalRange: Range,\n\t\tpublic readonly snippetInfo: SnippetInfo | undefined,\n\t\tpublic readonly additionalTextEdits: readonly ISingleEditOperation[],\n\n\t\tdata: InlineSuggestData,\n\t\tidentity: InlineSuggestionIdentity,\n\t\tdisplayLocation: InlineSuggestHint | undefined,\n\t) {\n\t\tsuper(data, identity, displayLocation);\n\t}\n\n\toverride get hash(): string {\n\t\treturn JSON.stringify(this._trimmedEdit.toJson());\n\t}\n\n\toverride getSingleTextEdit(): TextReplacement { return this._textEdit; }\n\n\toverride withIdentity(identity: InlineSuggestionIdentity): InlineCompletionItem {\n\t\treturn new InlineCompletionItem(\n\t\t\tthis._edit,\n\t\t\tthis._trimmedEdit,\n\t\t\tthis._textEdit,\n\t\t\tthis._originalRange,\n\t\t\tthis.snippetInfo,\n\t\t\tthis.additionalTextEdits,\n\t\t\tthis._data,\n\t\t\tidentity,\n\t\t\tthis.hint\n\t\t);\n\t}\n\n\toverride withEdit(textModelEdit: StringEdit, textModel: ITextModel): InlineCompletionItem | undefined {\n\t\tconst newEditRange = applyEditsToRanges([this._edit.replaceRange], textModelEdit);\n\t\tif (newEditRange.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst newEdit = new StringReplacement(newEditRange[0], this._textEdit.text);\n\t\tconst positionOffsetTransformer = getPositionOffsetTransformerFromTextModel(textModel);\n\t\tconst newTextEdit = positionOffsetTransformer.getTextReplacement(newEdit);\n\n\t\tlet newDisplayLocation = this.hint;\n\t\tif (newDisplayLocation) {\n\t\t\tnewDisplayLocation = newDisplayLocation.withEdit(textModelEdit, positionOffsetTransformer);\n\t\t\tif (!newDisplayLocation) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t}\n\n\t\tconst trimmedEdit = newEdit.removeCommonSuffixAndPrefix(textModel.getValue());\n\n\t\treturn new InlineCompletionItem(\n\t\t\tnewEdit,\n\t\t\ttrimmedEdit,\n\t\t\tnewTextEdit,\n\t\t\tthis._originalRange,\n\t\t\tthis.snippetInfo,\n\t\t\tthis.additionalTextEdits,\n\t\t\tthis._data,\n\t\t\tthis.identity,\n\t\t\tnewDisplayLocation\n\t\t);\n\t}\n\n\toverride canBeReused(model: ITextModel, position: Position): boolean {\n\t\t// TODO@hediet I believe this can be simplified to `return true;`, as applying an edit should kick out this suggestion.\n\t\tconst updatedRange = this._textEdit.range;\n\t\tconst result = !!updatedRange\n\t\t\t&& updatedRange.containsPosition(position)\n\t\t\t&& this.isVisible(model, position)\n\t\t\t&& TextLength.ofRange(updatedRange).isGreaterThanOrEqualTo(TextLength.ofRange(this._originalRange));\n\t\treturn result;\n\t}\n\n\tpublic isVisible(model: ITextModel, cursorPosition: Position): boolean {\n\t\tconst singleTextEdit = this.getSingleTextEdit();\n\t\treturn inlineCompletionIsVisible(singleTextEdit, this._originalRange, model, cursorPosition);\n\t}\n}\n\nexport function inlineCompletionIsVisible(singleTextEdit: TextReplacement, originalRange: Range | undefined, model: ITextModel, cursorPosition: Position): boolean {\n\tconst minimizedReplacement = singleTextRemoveCommonPrefix(singleTextEdit, model);\n\tconst editRange = singleTextEdit.range;\n\tif (!editRange\n\t\t|| (originalRange && !originalRange.getStartPosition().equals(editRange.getStartPosition()))\n\t\t|| cursorPosition.lineNumber !== minimizedReplacement.range.startLineNumber\n\t\t|| minimizedReplacement.isEmpty // if the completion is empty after removing the common prefix of the completion and the model, the completion item would not be visible\n\t) {\n\t\treturn false;\n\t}\n\n\t// We might consider comparing by .toLowerText, but this requires GhostTextReplacement\n\tconst originalValue = model.getValueInRange(minimizedReplacement.range, EndOfLinePreference.LF);\n\tconst filterText = minimizedReplacement.text;\n\n\tconst cursorPosIndex = Math.max(0, cursorPosition.column - minimizedReplacement.range.startColumn);\n\n\tlet filterTextBefore = filterText.substring(0, cursorPosIndex);\n\tlet filterTextAfter = filterText.substring(cursorPosIndex);\n\n\tlet originalValueBefore = originalValue.substring(0, cursorPosIndex);\n\tlet originalValueAfter = originalValue.substring(cursorPosIndex);\n\n\tconst originalValueIndent = model.getLineIndentColumn(minimizedReplacement.range.startLineNumber);\n\tif (minimizedReplacement.range.startColumn <= originalValueIndent) {\n\t\t// Remove indentation\n\t\toriginalValueBefore = originalValueBefore.trimStart();\n\t\tif (originalValueBefore.length === 0) {\n\t\t\toriginalValueAfter = originalValueAfter.trimStart();\n\t\t}\n\t\tfilterTextBefore = filterTextBefore.trimStart();\n\t\tif (filterTextBefore.length === 0) {\n\t\t\tfilterTextAfter = filterTextAfter.trimStart();\n\t\t}\n\t}\n\n\treturn filterTextBefore.startsWith(originalValueBefore)\n\t\t&& !!matchesSubString(originalValueAfter, filterTextAfter);\n}\n\nexport class InlineEditItem extends InlineSuggestionItemBase {\n\tpublic static create(\n\t\tdata: InlineSuggestData,\n\t\ttextModel: ITextModel,\n\t): InlineEditItem {\n\t\tconst offsetEdit = getStringEdit(textModel, data.range, data.insertText);\n\t\tconst text = new TextModelText(textModel);\n\t\tconst textEdit = TextEdit.fromStringEdit(offsetEdit, text);\n\t\tconst singleTextEdit = offsetEdit.isEmpty() ? new TextReplacement(new Range(1, 1, 1, 1), '') : textEdit.toReplacement(text); // FIXME: .toReplacement() can throw because offsetEdit is empty because we get an empty diff in getStringEdit after diffing\n\t\tconst identity = new InlineSuggestionIdentity();\n\n\t\tconst edits = offsetEdit.replacements.map(edit => {\n\t\t\tconst replacedRange = Range.fromPositions(textModel.getPositionAt(edit.replaceRange.start), textModel.getPositionAt(edit.replaceRange.endExclusive));\n\t\t\tconst replacedText = textModel.getValueInRange(replacedRange);\n\t\t\treturn SingleUpdatedNextEdit.create(edit, replacedText);\n\t\t});\n\t\tconst hint = data.hint ? InlineSuggestHint.create(data.hint) : undefined;\n\t\treturn new InlineEditItem(offsetEdit, singleTextEdit, data.uri, data, identity, edits, hint, false, textModel.getVersionId());\n\t}\n\n\tpublic readonly snippetInfo: SnippetInfo | undefined = undefined;\n\tpublic readonly additionalTextEdits: readonly ISingleEditOperation[] = [];\n\tpublic readonly isInlineEdit = true;\n\n\tprivate constructor(\n\t\tprivate readonly _edit: StringEdit,\n\t\tprivate readonly _textEdit: TextReplacement,\n\t\tpublic readonly uri: URI | undefined,\n\n\t\tdata: InlineSuggestData,\n\n\t\tidentity: InlineSuggestionIdentity,\n\t\tprivate readonly _edits: readonly SingleUpdatedNextEdit[],\n\t\thint: InlineSuggestHint | undefined,\n\t\tprivate readonly _lastChangePartOfInlineEdit = false,\n\t\tprivate readonly _inlineEditModelVersion: number,\n\t) {\n\t\tsuper(data, identity, hint);\n\t}\n\n\tpublic get updatedEditModelVersion(): number { return this._inlineEditModelVersion; }\n\tpublic get updatedEdit(): StringEdit { return this._edit; }\n\n\toverride getSingleTextEdit(): TextReplacement {\n\t\treturn this._textEdit;\n\t}\n\n\toverride withIdentity(identity: InlineSuggestionIdentity): InlineEditItem {\n\t\treturn new InlineEditItem(\n\t\t\tthis._edit,\n\t\t\tthis._textEdit,\n\t\t\tthis.uri,\n\t\t\tthis._data,\n\t\t\tidentity,\n\t\t\tthis._edits,\n\t\t\tthis.hint,\n\t\t\tthis._lastChangePartOfInlineEdit,\n\t\t\tthis._inlineEditModelVersion,\n\t\t);\n\t}\n\n\toverride canBeReused(model: ITextModel, position: Position): boolean {\n\t\t// TODO@hediet I believe this can be simplified to `return true;`, as applying an edit should kick out this suggestion.\n\t\treturn this._lastChangePartOfInlineEdit && this.updatedEditModelVersion === model.getVersionId();\n\t}\n\n\toverride withEdit(textModelChanges: StringEdit, textModel: ITextModel): InlineEditItem | undefined {\n\t\tconst edit = this._applyTextModelChanges(textModelChanges, this._edits, textModel);\n\t\treturn edit;\n\t}\n\n\tprivate _applyTextModelChanges(textModelChanges: StringEdit, edits: readonly SingleUpdatedNextEdit[], textModel: ITextModel): InlineEditItem | undefined {\n\t\tedits = edits.map(innerEdit => innerEdit.applyTextModelChanges(textModelChanges));\n\n\t\tif (edits.some(edit => edit.edit === undefined)) {\n\t\t\treturn undefined; // change is invalid, so we will have to drop the completion\n\t\t}\n\n\t\tconst newTextModelVersion = textModel.getVersionId();\n\n\t\tlet inlineEditModelVersion = this._inlineEditModelVersion;\n\t\tconst lastChangePartOfInlineEdit = edits.some(edit => edit.lastChangeUpdatedEdit);\n\t\tif (lastChangePartOfInlineEdit) {\n\t\t\tinlineEditModelVersion = newTextModelVersion ?? -1;\n\t\t}\n\n\t\tif (newTextModelVersion === null || inlineEditModelVersion + 20 < newTextModelVersion) {\n\t\t\treturn undefined; // the completion has been ignored for a while, remove it\n\t\t}\n\n\t\tedits = edits.filter(innerEdit => !innerEdit.edit!.isEmpty);\n\t\tif (edits.length === 0) {\n\t\t\treturn undefined; // the completion has been typed by the user\n\t\t}\n\n\t\tconst newEdit = new StringEdit(edits.map(edit => edit.edit!));\n\t\tconst positionOffsetTransformer = getPositionOffsetTransformerFromTextModel(textModel);\n\t\tconst newTextEdit = positionOffsetTransformer.getTextEdit(newEdit).toReplacement(new TextModelText(textModel));\n\n\t\tlet newDisplayLocation = this.hint;\n\t\tif (newDisplayLocation) {\n\t\t\tnewDisplayLocation = newDisplayLocation.withEdit(textModelChanges, positionOffsetTransformer);\n\t\t\tif (!newDisplayLocation) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t}\n\n\t\treturn new InlineEditItem(\n\t\t\tnewEdit,\n\t\t\tnewTextEdit,\n\t\t\tthis.uri,\n\t\t\tthis._data,\n\t\t\tthis.identity,\n\t\t\tedits,\n\t\t\tnewDisplayLocation,\n\t\t\tlastChangePartOfInlineEdit,\n\t\t\tinlineEditModelVersion,\n\t\t);\n\t}\n}\n\nfunction getStringEdit(textModel: ITextModel, editRange: Range, replaceText: string): StringEdit {\n\tconst eol = textModel.getEOL();\n\tconst editOriginalText = textModel.getValueInRange(editRange);\n\tconst editReplaceText = replaceText.replace(/\\r\\n|\\r|\\n/g, eol);\n\n\tconst diffAlgorithm = linesDiffComputers.getDefault();\n\tconst lineDiffs = diffAlgorithm.computeDiff(\n\t\tsplitLines(editOriginalText),\n\t\tsplitLines(editReplaceText),\n\t\t{\n\t\t\tignoreTrimWhitespace: false,\n\t\t\tcomputeMoves: false,\n\t\t\textendToSubwords: true,\n\t\t\tmaxComputationTimeMs: 500,\n\t\t}\n\t);\n\n\tconst innerChanges = lineDiffs.changes.flatMap(c => c.innerChanges ?? []);\n\n\tfunction addRangeToPos(pos: Position, range: Range): Range {\n\t\tconst start = TextLength.fromPosition(range.getStartPosition());\n\t\treturn TextLength.ofRange(range).createRange(start.addToPosition(pos));\n\t}\n\n\tconst modifiedText = new StringText(editReplaceText);\n\n\tconst offsetEdit = new StringEdit(\n\t\tinnerChanges.map(c => {\n\t\t\tconst rangeInModel = addRangeToPos(editRange.getStartPosition(), c.originalRange);\n\t\t\tconst originalRange = getPositionOffsetTransformerFromTextModel(textModel).getOffsetRange(rangeInModel);\n\n\t\t\tconst replaceText = modifiedText.getValueOfRange(c.modifiedRange);\n\t\t\tconst edit = new StringReplacement(originalRange, replaceText);\n\n\t\t\tconst originalText = textModel.getValueInRange(rangeInModel);\n\t\t\treturn reshapeInlineEdit(edit, originalText, innerChanges.length, textModel);\n\t\t})\n\t);\n\n\treturn offsetEdit;\n}\n\nclass SingleUpdatedNextEdit {\n\tpublic static create(\n\t\tedit: StringReplacement,\n\t\treplacedText: string,\n\t): SingleUpdatedNextEdit {\n\t\tconst prefixLength = commonPrefixLength(edit.newText, replacedText);\n\t\tconst suffixLength = commonSuffixLength(edit.newText, replacedText);\n\t\tconst trimmedNewText = edit.newText.substring(prefixLength, edit.newText.length - suffixLength);\n\t\treturn new SingleUpdatedNextEdit(edit, trimmedNewText, prefixLength, suffixLength);\n\t}\n\n\tpublic get edit() { return this._edit; }\n\tpublic get lastChangeUpdatedEdit() { return this._lastChangeUpdatedEdit; }\n\n\tconstructor(\n\t\tprivate _edit: StringReplacement | undefined,\n\t\tprivate _trimmedNewText: string,\n\t\tprivate _prefixLength: number,\n\t\tprivate _suffixLength: number,\n\t\tprivate _lastChangeUpdatedEdit: boolean = false,\n\t) {\n\t}\n\n\tpublic applyTextModelChanges(textModelChanges: StringEdit) {\n\t\tconst c = this._clone();\n\t\tc._applyTextModelChanges(textModelChanges);\n\t\treturn c;\n\t}\n\n\tprivate _clone(): SingleUpdatedNextEdit {\n\t\treturn new SingleUpdatedNextEdit(\n\t\t\tthis._edit,\n\t\t\tthis._trimmedNewText,\n\t\t\tthis._prefixLength,\n\t\t\tthis._suffixLength,\n\t\t\tthis._lastChangeUpdatedEdit,\n\t\t);\n\t}\n\n\tprivate _applyTextModelChanges(textModelChanges: StringEdit) {\n\t\tthis._lastChangeUpdatedEdit = false;\n\n\t\tif (!this._edit) {\n\t\t\tthrow new BugIndicatingError('UpdatedInnerEdits: No edit to apply changes to');\n\t\t}\n\n\t\tconst result = this._applyChanges(this._edit, textModelChanges);\n\t\tif (!result) {\n\t\t\tthis._edit = undefined;\n\t\t\treturn;\n\t\t}\n\n\t\tthis._edit = result.edit;\n\t\tthis._lastChangeUpdatedEdit = result.editHasChanged;\n\t}\n\n\tprivate _applyChanges(edit: StringReplacement, textModelChanges: StringEdit): { edit: StringReplacement; editHasChanged: boolean } | undefined {\n\t\tlet editStart = edit.replaceRange.start;\n\t\tlet editEnd = edit.replaceRange.endExclusive;\n\t\tlet editReplaceText = edit.newText;\n\t\tlet editHasChanged = false;\n\n\t\tconst shouldPreserveEditShape = this._prefixLength > 0 || this._suffixLength > 0;\n\n\t\tfor (let i = textModelChanges.replacements.length - 1; i >= 0; i--) {\n\t\t\tconst change = textModelChanges.replacements[i];\n\n\t\t\t// INSERTIONS (only support inserting at start of edit)\n\t\t\tconst isInsertion = change.newText.length > 0 && change.replaceRange.isEmpty;\n\n\t\t\tif (isInsertion && !shouldPreserveEditShape && change.replaceRange.start === editStart && editReplaceText.startsWith(change.newText)) {\n\t\t\t\teditStart += change.newText.length;\n\t\t\t\teditReplaceText = editReplaceText.substring(change.newText.length);\n\t\t\t\teditEnd = Math.max(editStart, editEnd);\n\t\t\t\teditHasChanged = true;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (isInsertion && shouldPreserveEditShape && change.replaceRange.start === editStart + this._prefixLength && this._trimmedNewText.startsWith(change.newText)) {\n\t\t\t\teditEnd += change.newText.length;\n\t\t\t\teditHasChanged = true;\n\t\t\t\tthis._prefixLength += change.newText.length;\n\t\t\t\tthis._trimmedNewText = this._trimmedNewText.substring(change.newText.length);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// DELETIONS\n\t\t\tconst isDeletion = change.newText.length === 0 && change.replaceRange.length > 0;\n\t\t\tif (isDeletion && change.replaceRange.start >= editStart + this._prefixLength && change.replaceRange.endExclusive <= editEnd - this._suffixLength) {\n\t\t\t\t// user deleted text IN-BETWEEN the deletion range\n\t\t\t\teditEnd -= change.replaceRange.length;\n\t\t\t\teditHasChanged = true;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// user did exactly the edit\n\t\t\tif (change.equals(edit)) {\n\t\t\t\teditHasChanged = true;\n\t\t\t\teditStart = change.replaceRange.endExclusive;\n\t\t\t\teditReplaceText = '';\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// MOVE EDIT\n\t\t\tif (change.replaceRange.start > editEnd) {\n\t\t\t\t// the change happens after the completion range\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (change.replaceRange.endExclusive < editStart) {\n\t\t\t\t// the change happens before the completion range\n\t\t\t\teditStart += change.newText.length - change.replaceRange.length;\n\t\t\t\teditEnd += change.newText.length - change.replaceRange.length;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// The change intersects the completion, so we will have to drop the completion\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// the resulting edit is a noop as the original and new text are the same\n\t\tif (this._trimmedNewText.length === 0 && editStart + this._prefixLength === editEnd - this._suffixLength) {\n\t\t\treturn { edit: new StringReplacement(new OffsetRange(editStart + this._prefixLength, editStart + this._prefixLength), ''), editHasChanged: true };\n\t\t}\n\n\t\treturn { edit: new StringReplacement(new OffsetRange(editStart, editEnd), editReplaceText), editHasChanged };\n\t}\n}\n\nfunction reshapeInlineCompletion(edit: StringReplacement, textModel: ITextModel): StringReplacement {\n\t// If the insertion is a multi line insertion starting on the next line\n\t// Move it forwards so that the multi line insertion starts on the current line\n\tconst eol = textModel.getEOL();\n\tif (edit.replaceRange.isEmpty && edit.newText.includes(eol)) {\n\t\tedit = reshapeMultiLineInsertion(edit, textModel);\n\t}\n\n\treturn edit;\n}\n\nfunction reshapeInlineEdit(edit: StringReplacement, originalText: string, totalInnerEdits: number, textModel: ITextModel): StringReplacement {\n\t// TODO: EOL are not properly trimmed by the diffAlgorithm #12680\n\tconst eol = textModel.getEOL();\n\tif (edit.newText.endsWith(eol) && originalText.endsWith(eol)) {\n\t\tedit = new StringReplacement(edit.replaceRange.deltaEnd(-eol.length), edit.newText.slice(0, -eol.length));\n\t}\n\n\t// INSERTION\n\t// If the insertion ends with a new line and is inserted at the start of a line which has text,\n\t// we move the insertion to the end of the previous line if possible\n\tif (totalInnerEdits === 1 && edit.replaceRange.isEmpty && edit.newText.includes(eol)) {\n\t\tconst startPosition = textModel.getPositionAt(edit.replaceRange.start);\n\t\tconst hasTextOnInsertionLine = textModel.getLineLength(startPosition.lineNumber) !== 0;\n\t\tif (hasTextOnInsertionLine) {\n\t\t\tedit = reshapeMultiLineInsertion(edit, textModel);\n\t\t}\n\t}\n\n\t// The diff algorithm extended a simple edit to the entire word\n\t// shrink it back to a simple edit if it is deletion/insertion only\n\tif (totalInnerEdits === 1) {\n\t\tconst prefixLength = commonPrefixLength(originalText, edit.newText);\n\t\tconst suffixLength = commonSuffixLength(originalText.slice(prefixLength), edit.newText.slice(prefixLength));\n\n\t\t// reshape it back to an insertion\n\t\tif (prefixLength + suffixLength === originalText.length) {\n\t\t\treturn new StringReplacement(edit.replaceRange.deltaStart(prefixLength).deltaEnd(-suffixLength), edit.newText.substring(prefixLength, edit.newText.length - suffixLength));\n\t\t}\n\n\t\t// reshape it back to a deletion\n\t\tif (prefixLength + suffixLength === edit.newText.length) {\n\t\t\treturn new StringReplacement(edit.replaceRange.deltaStart(prefixLength).deltaEnd(-suffixLength), '');\n\t\t}\n\t}\n\n\treturn edit;\n}\n\nfunction reshapeMultiLineInsertion(edit: StringReplacement, textModel: ITextModel): StringReplacement {\n\tif (!edit.replaceRange.isEmpty) {\n\t\tthrow new BugIndicatingError('Unexpected original range');\n\t}\n\n\tif (edit.replaceRange.start === 0) {\n\t\treturn edit;\n\t}\n\n\tconst eol = textModel.getEOL();\n\tconst startPosition = textModel.getPositionAt(edit.replaceRange.start);\n\tconst startColumn = startPosition.column;\n\tconst startLineNumber = startPosition.lineNumber;\n\n\t// If the insertion ends with a new line and is inserted at the start of a line which has text,\n\t// we move the insertion to the end of the previous line if possible\n\tif (startColumn === 1 && startLineNumber > 1 && edit.newText.endsWith(eol) && !edit.newText.startsWith(eol)) {\n\t\treturn new StringReplacement(edit.replaceRange.delta(-1), eol + edit.newText.slice(0, -eol.length));\n\t}\n\n\treturn edit;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/inlineCompletions/browser/model/inlineSuggestionItem.ts","vs/editor/contrib/inlineCompletions/browser/model/inlineSuggestionItem.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,EAA6B,gBAAgB,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AACxH,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AAI3G,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AAChH,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AAEtF,OAAO,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,8CAA8C,CAAC;AAC1E,OAAO,EAAE,yCAAyC,EAAE,MAAM,2EAA2E,CAAC;AAEtI,OAAO,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AACnF,OAAO,EAAyF,2BAA2B,EAAoE,MAAM,iCAAiC,CAAC;AAEvO,OAAO,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAG1E,OAAO,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAI1E,MAAM,KAAW,oBAAoB,CAWpC;AAXD,WAAiB,oBAAoB;IACpC,SAAgB,MAAM,CACrB,IAAuB,EACvB,SAAqB;QAErB,IAAI,CAAC,IAAI,CAAC,YAAY,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;YACrC,OAAO,oBAAoB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AAC,KAAK,KAAK,CAAC,EAAE,CAAC;QACnC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,MAAM,GAAG,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC;IAC/B,MAAM,aAAa,GAAG,SAAS,CAAC,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IACvE,MAAM,WAAW,GAAG,aAAa,CAAC,MAAM,CAAC;IACzC,MAAM,eAAe,GAAG,aAAa,CAAC,UAAU,CAAC;IAEjD,+FAA+F;IAC/F,oEAAoE;IACpE,IAAI,WAAW,KAAK,CAAC,IAAI,eAAe,GAAG,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC7G,OAAO,IAAI,iBAAiB,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;IACrG,CAAC;IAED,OAAO,IAAI,CAAC;AACb,CAAC","file":"inlineSuggestionItem.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { BugIndicatingError } from '../../../../../base/common/errors.js';\nimport { matchesSubString } from '../../../../../base/common/filters.js';\nimport { IObservable, ITransaction, observableSignal, observableValue } from '../../../../../base/common/observable.js';\nimport { commonPrefixLength, commonSuffixLength, splitLines } from '../../../../../base/common/strings.js';\nimport { URI } from '../../../../../base/common/uri.js';\nimport { ICommandService } from '../../../../../platform/commands/common/commands.js';\nimport { ISingleEditOperation } from '../../../../common/core/editOperation.js';\nimport { applyEditsToRanges, StringEdit, StringReplacement } from '../../../../common/core/edits/stringEdit.js';\nimport { TextEdit, TextReplacement } from '../../../../common/core/edits/textEdit.js';\nimport { Position } from '../../../../common/core/position.js';\nimport { Range } from '../../../../common/core/range.js';\nimport { OffsetRange } from '../../../../common/core/ranges/offsetRange.js';\nimport { StringText } from '../../../../common/core/text/abstractText.js';\nimport { getPositionOffsetTransformerFromTextModel } from '../../../../common/core/text/getPositionOffsetTransformerFromTextModel.js';\nimport { PositionOffsetTransformerBase } from '../../../../common/core/text/positionToOffset.js';\nimport { TextLength } from '../../../../common/core/text/textLength.js';\nimport { linesDiffComputers } from '../../../../common/diff/linesDiffComputers.js';\nimport { Command, InlineCompletion, InlineCompletionHintStyle, InlineCompletionEndOfLifeReason, InlineCompletionTriggerKind, InlineCompletionWarning, PartialAcceptInfo, InlineCompletionHint } from '../../../../common/languages.js';\nimport { EndOfLinePreference, ITextModel } from '../../../../common/model.js';\nimport { TextModelText } from '../../../../common/model/textModelText.js';\nimport { InlineCompletionViewData, InlineCompletionViewKind } from '../view/inlineEdits/inlineEditsViewInterface.js';\nimport { InlineSuggestData, InlineSuggestionList, PartialAcceptance, SnippetInfo } from './provideInlineCompletions.js';\nimport { singleTextRemoveCommonPrefix } from './singleTextEditHelpers.js';\n\nexport type InlineSuggestionItem = InlineEditItem | InlineCompletionItem;\n\nexport namespace InlineSuggestionItem {\n\texport function create(\n\t\tdata: InlineSuggestData,\n\t\ttextModel: ITextModel,\n\t): InlineSuggestionItem {\n\t\tif (!data.isInlineEdit && !data.uri) {\n\t\t\treturn InlineCompletionItem.create(data, textModel);\n\t\t} else {\n\t\t\treturn InlineEditItem.create(data, textModel);\n\t\t}\n\t}\n}\n\nabstract class InlineSuggestionItemBase {\n\tconstructor(\n\t\tprotected readonly _data: InlineSuggestData,\n\t\tpublic readonly identity: InlineSuggestionIdentity,\n\t\tpublic readonly hint: InlineSuggestHint | undefined\n\t) { }\n\n\t/**\n\t * A reference to the original inline completion list this inline completion has been constructed from.\n\t * Used for event data to ensure referential equality.\n\t*/\n\tpublic get source(): InlineSuggestionList { return this._data.source; }\n\n\tpublic get isFromExplicitRequest(): boolean { return this._data.context.triggerKind === InlineCompletionTriggerKind.Explicit; }\n\tpublic get forwardStable(): boolean { return this.source.inlineSuggestions.enableForwardStability ?? false; }\n\tpublic get editRange(): Range { return this.getSingleTextEdit().range; }\n\tpublic get targetRange(): Range { return this.hint?.range ?? this.editRange; }\n\tpublic get insertText(): string { return this.getSingleTextEdit().text; }\n\tpublic get semanticId(): string { return this.hash; }\n\tpublic get action(): Command | undefined { return this._sourceInlineCompletion.gutterMenuLinkAction; }\n\tpublic get command(): Command | undefined { return this._sourceInlineCompletion.command; }\n\tpublic get warning(): InlineCompletionWarning | undefined { return this._sourceInlineCompletion.warning; }\n\tpublic get showInlineEditMenu(): boolean { return !!this._sourceInlineCompletion.showInlineEditMenu; }\n\tpublic get hash() {\n\t\treturn JSON.stringify([\n\t\t\tthis.getSingleTextEdit().text,\n\t\t\tthis.getSingleTextEdit().range.getStartPosition().toString()\n\t\t]);\n\t}\n\n\tpublic get requestUuid(): string { return this._data.context.requestUuid; }\n\n\tpublic get partialAccepts(): PartialAcceptance { return this._data.partialAccepts; }\n\n\t/**\n\t * A reference to the original inline completion this inline completion has been constructed from.\n\t * Used for event data to ensure referential equality.\n\t*/\n\tprivate get _sourceInlineCompletion(): InlineCompletion { return this._data.sourceInlineCompletion; }\n\n\n\tpublic abstract getSingleTextEdit(): TextReplacement;\n\n\tpublic abstract withEdit(userEdit: StringEdit, textModel: ITextModel): InlineSuggestionItem | undefined;\n\n\tpublic abstract withIdentity(identity: InlineSuggestionIdentity): InlineSuggestionItem;\n\tpublic abstract canBeReused(model: ITextModel, position: Position): boolean;\n\n\n\tpublic addRef(): void {\n\t\tthis.identity.addRef();\n\t\tthis.source.addRef();\n\t}\n\n\tpublic removeRef(): void {\n\t\tthis.identity.removeRef();\n\t\tthis.source.removeRef();\n\t}\n\n\tpublic reportInlineEditShown(commandService: ICommandService, viewKind: InlineCompletionViewKind, viewData: InlineCompletionViewData) {\n\t\tthis._data.reportInlineEditShown(commandService, this.insertText, viewKind, viewData);\n\t}\n\n\tpublic reportPartialAccept(acceptedCharacters: number, info: PartialAcceptInfo, partialAcceptance: PartialAcceptance) {\n\t\tthis._data.reportPartialAccept(acceptedCharacters, info, partialAcceptance);\n\t}\n\n\tpublic reportEndOfLife(reason: InlineCompletionEndOfLifeReason): void {\n\t\tthis._data.reportEndOfLife(reason);\n\t}\n\n\tpublic setEndOfLifeReason(reason: InlineCompletionEndOfLifeReason): void {\n\t\tthis._data.setEndOfLifeReason(reason);\n\t}\n\n\tpublic setIsPreceeded(item: InlineSuggestionItem): void {\n\t\tthis._data.setIsPreceeded(item.partialAccepts);\n\t}\n\n\tpublic setNotShownReasonIfNotSet(reason: string): void {\n\t\tthis._data.setNotShownReason(reason);\n\t}\n\n\t/**\n\t * Avoid using this method. Instead introduce getters for the needed properties.\n\t*/\n\tpublic getSourceCompletion(): InlineCompletion {\n\t\treturn this._sourceInlineCompletion;\n\t}\n}\n\nexport class InlineSuggestionIdentity {\n\tprivate static idCounter = 0;\n\tprivate readonly _onDispose = observableSignal(this);\n\n\tprivate readonly _jumpedTo = observableValue(this, false);\n\tpublic get jumpedTo(): IObservable<boolean> {\n\t\treturn this._jumpedTo;\n\t}\n\n\tprivate _refCount = 1;\n\tpublic readonly id = 'InlineCompletionIdentity' + InlineSuggestionIdentity.idCounter++;\n\n\taddRef() {\n\t\tthis._refCount++;\n\t}\n\n\tremoveRef() {\n\t\tthis._refCount--;\n\t\tif (this._refCount === 0) {\n\t\t\tthis._onDispose.trigger(undefined);\n\t\t}\n\t}\n\n\tsetJumpTo(tx: ITransaction | undefined): void {\n\t\tthis._jumpedTo.set(true, tx);\n\t}\n}\n\nexport class InlineSuggestHint {\n\n\tpublic static create(displayLocation: InlineCompletionHint) {\n\t\treturn new InlineSuggestHint(\n\t\t\tRange.lift(displayLocation.range),\n\t\t\tdisplayLocation.content,\n\t\t\tdisplayLocation.style,\n\t\t);\n\t}\n\n\tprivate constructor(\n\t\tpublic readonly range: Range,\n\t\tpublic readonly content: string,\n\t\tpublic readonly style: InlineCompletionHintStyle,\n\t) { }\n\n\tpublic withEdit(edit: StringEdit, positionOffsetTransformer: PositionOffsetTransformerBase): InlineSuggestHint | undefined {\n\t\tconst offsetRange = new OffsetRange(\n\t\t\tpositionOffsetTransformer.getOffset(this.range.getStartPosition()),\n\t\t\tpositionOffsetTransformer.getOffset(this.range.getEndPosition())\n\t\t);\n\n\t\tconst newOffsetRange = applyEditsToRanges([offsetRange], edit)[0];\n\t\tif (!newOffsetRange) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst newRange = positionOffsetTransformer.getRange(newOffsetRange);\n\n\t\treturn new InlineSuggestHint(newRange, this.content, this.style);\n\t}\n}\n\nexport class InlineCompletionItem extends InlineSuggestionItemBase {\n\tpublic static create(\n\t\tdata: InlineSuggestData,\n\t\ttextModel: ITextModel,\n\t): InlineCompletionItem {\n\t\tconst identity = new InlineSuggestionIdentity();\n\t\tconst transformer = getPositionOffsetTransformerFromTextModel(textModel);\n\n\t\tconst insertText = data.insertText.replace(/\\r\\n|\\r|\\n/g, textModel.getEOL());\n\n\t\tconst edit = reshapeInlineCompletion(new StringReplacement(transformer.getOffsetRange(data.range), insertText), textModel);\n\t\tconst trimmedEdit = edit.removeCommonSuffixAndPrefix(textModel.getValue());\n\t\tconst textEdit = transformer.getTextReplacement(edit);\n\n\t\tconst displayLocation = data.hint ? InlineSuggestHint.create(data.hint) : undefined;\n\n\t\treturn new InlineCompletionItem(edit, trimmedEdit, textEdit, textEdit.range, data.snippetInfo, data.additionalTextEdits, data, identity, displayLocation);\n\t}\n\n\tpublic readonly isInlineEdit = false;\n\n\tprivate constructor(\n\t\tprivate readonly _edit: StringReplacement,\n\t\tprivate readonly _trimmedEdit: StringReplacement,\n\t\tprivate readonly _textEdit: TextReplacement,\n\t\tprivate readonly _originalRange: Range,\n\t\tpublic readonly snippetInfo: SnippetInfo | undefined,\n\t\tpublic readonly additionalTextEdits: readonly ISingleEditOperation[],\n\n\t\tdata: InlineSuggestData,\n\t\tidentity: InlineSuggestionIdentity,\n\t\tdisplayLocation: InlineSuggestHint | undefined,\n\t) {\n\t\tsuper(data, identity, displayLocation);\n\t}\n\n\toverride get hash(): string {\n\t\treturn JSON.stringify(this._trimmedEdit.toJson());\n\t}\n\n\toverride getSingleTextEdit(): TextReplacement { return this._textEdit; }\n\n\toverride withIdentity(identity: InlineSuggestionIdentity): InlineCompletionItem {\n\t\treturn new InlineCompletionItem(\n\t\t\tthis._edit,\n\t\t\tthis._trimmedEdit,\n\t\t\tthis._textEdit,\n\t\t\tthis._originalRange,\n\t\t\tthis.snippetInfo,\n\t\t\tthis.additionalTextEdits,\n\t\t\tthis._data,\n\t\t\tidentity,\n\t\t\tthis.hint\n\t\t);\n\t}\n\n\toverride withEdit(textModelEdit: StringEdit, textModel: ITextModel): InlineCompletionItem | undefined {\n\t\tconst newEditRange = applyEditsToRanges([this._edit.replaceRange], textModelEdit);\n\t\tif (newEditRange.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst newEdit = new StringReplacement(newEditRange[0], this._textEdit.text);\n\t\tconst positionOffsetTransformer = getPositionOffsetTransformerFromTextModel(textModel);\n\t\tconst newTextEdit = positionOffsetTransformer.getTextReplacement(newEdit);\n\n\t\tlet newDisplayLocation = this.hint;\n\t\tif (newDisplayLocation) {\n\t\t\tnewDisplayLocation = newDisplayLocation.withEdit(textModelEdit, positionOffsetTransformer);\n\t\t\tif (!newDisplayLocation) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t}\n\n\t\tconst trimmedEdit = newEdit.removeCommonSuffixAndPrefix(textModel.getValue());\n\n\t\treturn new InlineCompletionItem(\n\t\t\tnewEdit,\n\t\t\ttrimmedEdit,\n\t\t\tnewTextEdit,\n\t\t\tthis._originalRange,\n\t\t\tthis.snippetInfo,\n\t\t\tthis.additionalTextEdits,\n\t\t\tthis._data,\n\t\t\tthis.identity,\n\t\t\tnewDisplayLocation\n\t\t);\n\t}\n\n\toverride canBeReused(model: ITextModel, position: Position): boolean {\n\t\t// TODO@hediet I believe this can be simplified to `return true;`, as applying an edit should kick out this suggestion.\n\t\tconst updatedRange = this._textEdit.range;\n\t\tconst result = !!updatedRange\n\t\t\t&& updatedRange.containsPosition(position)\n\t\t\t&& this.isVisible(model, position)\n\t\t\t&& TextLength.ofRange(updatedRange).isGreaterThanOrEqualTo(TextLength.ofRange(this._originalRange));\n\t\treturn result;\n\t}\n\n\tpublic isVisible(model: ITextModel, cursorPosition: Position): boolean {\n\t\tconst singleTextEdit = this.getSingleTextEdit();\n\t\treturn inlineCompletionIsVisible(singleTextEdit, this._originalRange, model, cursorPosition);\n\t}\n}\n\nexport function inlineCompletionIsVisible(singleTextEdit: TextReplacement, originalRange: Range | undefined, model: ITextModel, cursorPosition: Position): boolean {\n\tconst minimizedReplacement = singleTextRemoveCommonPrefix(singleTextEdit, model);\n\tconst editRange = singleTextEdit.range;\n\tif (!editRange\n\t\t|| (originalRange && !originalRange.getStartPosition().equals(editRange.getStartPosition()))\n\t\t|| cursorPosition.lineNumber !== minimizedReplacement.range.startLineNumber\n\t\t|| minimizedReplacement.isEmpty // if the completion is empty after removing the common prefix of the completion and the model, the completion item would not be visible\n\t) {\n\t\treturn false;\n\t}\n\n\t// We might consider comparing by .toLowerText, but this requires GhostTextReplacement\n\tconst originalValue = model.getValueInRange(minimizedReplacement.range, EndOfLinePreference.LF);\n\tconst filterText = minimizedReplacement.text;\n\n\tconst cursorPosIndex = Math.max(0, cursorPosition.column - minimizedReplacement.range.startColumn);\n\n\tlet filterTextBefore = filterText.substring(0, cursorPosIndex);\n\tlet filterTextAfter = filterText.substring(cursorPosIndex);\n\n\tlet originalValueBefore = originalValue.substring(0, cursorPosIndex);\n\tlet originalValueAfter = originalValue.substring(cursorPosIndex);\n\n\tconst originalValueIndent = model.getLineIndentColumn(minimizedReplacement.range.startLineNumber);\n\tif (minimizedReplacement.range.startColumn <= originalValueIndent) {\n\t\t// Remove indentation\n\t\toriginalValueBefore = originalValueBefore.trimStart();\n\t\tif (originalValueBefore.length === 0) {\n\t\t\toriginalValueAfter = originalValueAfter.trimStart();\n\t\t}\n\t\tfilterTextBefore = filterTextBefore.trimStart();\n\t\tif (filterTextBefore.length === 0) {\n\t\t\tfilterTextAfter = filterTextAfter.trimStart();\n\t\t}\n\t}\n\n\treturn filterTextBefore.startsWith(originalValueBefore)\n\t\t&& !!matchesSubString(originalValueAfter, filterTextAfter);\n}\n\nexport class InlineEditItem extends InlineSuggestionItemBase {\n\tpublic static create(\n\t\tdata: InlineSuggestData,\n\t\ttextModel: ITextModel,\n\t): InlineEditItem {\n\t\tconst offsetEdit = getStringEdit(textModel, data.range, data.insertText); // TODO compute async\n\t\tconst text = new TextModelText(textModel);\n\t\tconst textEdit = TextEdit.fromStringEdit(offsetEdit, text);\n\t\tconst singleTextEdit = offsetEdit.isEmpty() ? new TextReplacement(new Range(1, 1, 1, 1), '') : textEdit.toReplacement(text); // FIXME: .toReplacement() can throw because offsetEdit is empty because we get an empty diff in getStringEdit after diffing\n\t\tconst identity = new InlineSuggestionIdentity();\n\n\t\tconst edits = offsetEdit.replacements.map(edit => {\n\t\t\tconst replacedRange = Range.fromPositions(textModel.getPositionAt(edit.replaceRange.start), textModel.getPositionAt(edit.replaceRange.endExclusive));\n\t\t\tconst replacedText = textModel.getValueInRange(replacedRange);\n\t\t\treturn SingleUpdatedNextEdit.create(edit, replacedText);\n\t\t});\n\t\tconst hint = data.hint ? InlineSuggestHint.create(data.hint) : undefined;\n\t\treturn new InlineEditItem(offsetEdit, singleTextEdit, data.uri, data, identity, edits, hint, false, textModel.getVersionId());\n\t}\n\n\tpublic readonly snippetInfo: SnippetInfo | undefined = undefined;\n\tpublic readonly additionalTextEdits: readonly ISingleEditOperation[] = [];\n\tpublic readonly isInlineEdit = true;\n\n\tprivate constructor(\n\t\tprivate readonly _edit: StringEdit, // TODO@hediet remove, compute & cache from _edits\n\t\tprivate readonly _textEdit: TextReplacement,\n\t\tpublic readonly uri: URI | undefined,\n\n\t\tdata: InlineSuggestData,\n\n\t\tidentity: InlineSuggestionIdentity,\n\t\tprivate readonly _edits: readonly SingleUpdatedNextEdit[],\n\t\thint: InlineSuggestHint | undefined,\n\t\tprivate readonly _lastChangePartOfInlineEdit = false,\n\t\tprivate readonly _inlineEditModelVersion: number,\n\t) {\n\t\tsuper(data, identity, hint);\n\t}\n\n\tpublic get updatedEditModelVersion(): number { return this._inlineEditModelVersion; }\n\tpublic get updatedEdit(): StringEdit { return this._edit; }\n\n\toverride getSingleTextEdit(): TextReplacement {\n\t\treturn this._textEdit;\n\t}\n\n\toverride withIdentity(identity: InlineSuggestionIdentity): InlineEditItem {\n\t\treturn new InlineEditItem(\n\t\t\tthis._edit,\n\t\t\tthis._textEdit,\n\t\t\tthis.uri,\n\t\t\tthis._data,\n\t\t\tidentity,\n\t\t\tthis._edits,\n\t\t\tthis.hint,\n\t\t\tthis._lastChangePartOfInlineEdit,\n\t\t\tthis._inlineEditModelVersion,\n\t\t);\n\t}\n\n\toverride canBeReused(model: ITextModel, position: Position): boolean {\n\t\t// TODO@hediet I believe this can be simplified to `return true;`, as applying an edit should kick out this suggestion.\n\t\treturn this._lastChangePartOfInlineEdit && this.updatedEditModelVersion === model.getVersionId();\n\t}\n\n\toverride withEdit(textModelChanges: StringEdit, textModel: ITextModel): InlineEditItem | undefined {\n\t\tconst edit = this._applyTextModelChanges(textModelChanges, this._edits, textModel);\n\t\treturn edit;\n\t}\n\n\tprivate _applyTextModelChanges(textModelChanges: StringEdit, edits: readonly SingleUpdatedNextEdit[], textModel: ITextModel): InlineEditItem | undefined {\n\t\tedits = edits.map(innerEdit => innerEdit.applyTextModelChanges(textModelChanges));\n\n\t\tif (edits.some(edit => edit.edit === undefined)) {\n\t\t\treturn undefined; // change is invalid, so we will have to drop the completion\n\t\t}\n\n\t\tconst newTextModelVersion = textModel.getVersionId();\n\n\t\tlet inlineEditModelVersion = this._inlineEditModelVersion;\n\t\tconst lastChangePartOfInlineEdit = edits.some(edit => edit.lastChangeUpdatedEdit);\n\t\tif (lastChangePartOfInlineEdit) {\n\t\t\tinlineEditModelVersion = newTextModelVersion ?? -1;\n\t\t}\n\n\t\tif (newTextModelVersion === null || inlineEditModelVersion + 20 < newTextModelVersion) {\n\t\t\treturn undefined; // the completion has been ignored for a while, remove it\n\t\t}\n\n\t\tedits = edits.filter(innerEdit => !innerEdit.edit!.isEmpty);\n\t\tif (edits.length === 0) {\n\t\t\treturn undefined; // the completion has been typed by the user\n\t\t}\n\n\t\tconst newEdit = new StringEdit(edits.map(edit => edit.edit!));\n\t\tconst positionOffsetTransformer = getPositionOffsetTransformerFromTextModel(textModel);\n\t\tconst newTextEdit = positionOffsetTransformer.getTextEdit(newEdit).toReplacement(new TextModelText(textModel));\n\n\t\tlet newDisplayLocation = this.hint;\n\t\tif (newDisplayLocation) {\n\t\t\tnewDisplayLocation = newDisplayLocation.withEdit(textModelChanges, positionOffsetTransformer);\n\t\t\tif (!newDisplayLocation) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t}\n\n\t\treturn new InlineEditItem(\n\t\t\tnewEdit,\n\t\t\tnewTextEdit,\n\t\t\tthis.uri,\n\t\t\tthis._data,\n\t\t\tthis.identity,\n\t\t\tedits,\n\t\t\tnewDisplayLocation,\n\t\t\tlastChangePartOfInlineEdit,\n\t\t\tinlineEditModelVersion,\n\t\t);\n\t}\n}\n\nfunction getStringEdit(textModel: ITextModel, editRange: Range, replaceText: string): StringEdit {\n\tconst eol = textModel.getEOL();\n\tconst editOriginalText = textModel.getValueInRange(editRange);\n\tconst editReplaceText = replaceText.replace(/\\r\\n|\\r|\\n/g, eol);\n\n\tconst diffAlgorithm = linesDiffComputers.getDefault();\n\tconst lineDiffs = diffAlgorithm.computeDiff(\n\t\tsplitLines(editOriginalText),\n\t\tsplitLines(editReplaceText),\n\t\t{\n\t\t\tignoreTrimWhitespace: false,\n\t\t\tcomputeMoves: false,\n\t\t\textendToSubwords: true,\n\t\t\tmaxComputationTimeMs: 500,\n\t\t}\n\t);\n\n\tconst innerChanges = lineDiffs.changes.flatMap(c => c.innerChanges ?? []);\n\n\tfunction addRangeToPos(pos: Position, range: Range): Range {\n\t\tconst start = TextLength.fromPosition(range.getStartPosition());\n\t\treturn TextLength.ofRange(range).createRange(start.addToPosition(pos));\n\t}\n\n\tconst modifiedText = new StringText(editReplaceText);\n\n\tconst offsetEdit = new StringEdit(\n\t\tinnerChanges.map(c => {\n\t\t\tconst rangeInModel = addRangeToPos(editRange.getStartPosition(), c.originalRange);\n\t\t\tconst originalRange = getPositionOffsetTransformerFromTextModel(textModel).getOffsetRange(rangeInModel);\n\n\t\t\tconst replaceText = modifiedText.getValueOfRange(c.modifiedRange);\n\t\t\tconst edit = new StringReplacement(originalRange, replaceText);\n\n\t\t\tconst originalText = textModel.getValueInRange(rangeInModel);\n\t\t\treturn reshapeInlineEdit(edit, originalText, innerChanges.length, textModel);\n\t\t})\n\t);\n\n\treturn offsetEdit;\n}\n\nclass SingleUpdatedNextEdit {\n\tpublic static create(\n\t\tedit: StringReplacement,\n\t\treplacedText: string,\n\t): SingleUpdatedNextEdit {\n\t\tconst prefixLength = commonPrefixLength(edit.newText, replacedText);\n\t\tconst suffixLength = commonSuffixLength(edit.newText, replacedText);\n\t\tconst trimmedNewText = edit.newText.substring(prefixLength, edit.newText.length - suffixLength);\n\t\treturn new SingleUpdatedNextEdit(edit, trimmedNewText, prefixLength, suffixLength);\n\t}\n\n\tpublic get edit() { return this._edit; }\n\tpublic get lastChangeUpdatedEdit() { return this._lastChangeUpdatedEdit; }\n\n\tconstructor(\n\t\tprivate _edit: StringReplacement | undefined,\n\t\tprivate _trimmedNewText: string,\n\t\tprivate _prefixLength: number,\n\t\tprivate _suffixLength: number,\n\t\tprivate _lastChangeUpdatedEdit: boolean = false,\n\t) {\n\t}\n\n\tpublic applyTextModelChanges(textModelChanges: StringEdit) {\n\t\tconst c = this._clone();\n\t\tc._applyTextModelChanges(textModelChanges);\n\t\treturn c;\n\t}\n\n\tprivate _clone(): SingleUpdatedNextEdit {\n\t\treturn new SingleUpdatedNextEdit(\n\t\t\tthis._edit,\n\t\t\tthis._trimmedNewText,\n\t\t\tthis._prefixLength,\n\t\t\tthis._suffixLength,\n\t\t\tthis._lastChangeUpdatedEdit,\n\t\t);\n\t}\n\n\tprivate _applyTextModelChanges(textModelChanges: StringEdit) {\n\t\tthis._lastChangeUpdatedEdit = false; // TODO @benibenj make immutable\n\n\t\tif (!this._edit) {\n\t\t\tthrow new BugIndicatingError('UpdatedInnerEdits: No edit to apply changes to');\n\t\t}\n\n\t\tconst result = this._applyChanges(this._edit, textModelChanges);\n\t\tif (!result) {\n\t\t\tthis._edit = undefined;\n\t\t\treturn;\n\t\t}\n\n\t\tthis._edit = result.edit;\n\t\tthis._lastChangeUpdatedEdit = result.editHasChanged;\n\t}\n\n\tprivate _applyChanges(edit: StringReplacement, textModelChanges: StringEdit): { edit: StringReplacement; editHasChanged: boolean } | undefined {\n\t\tlet editStart = edit.replaceRange.start;\n\t\tlet editEnd = edit.replaceRange.endExclusive;\n\t\tlet editReplaceText = edit.newText;\n\t\tlet editHasChanged = false;\n\n\t\tconst shouldPreserveEditShape = this._prefixLength > 0 || this._suffixLength > 0;\n\n\t\tfor (let i = textModelChanges.replacements.length - 1; i >= 0; i--) {\n\t\t\tconst change = textModelChanges.replacements[i];\n\n\t\t\t// INSERTIONS (only support inserting at start of edit)\n\t\t\tconst isInsertion = change.newText.length > 0 && change.replaceRange.isEmpty;\n\n\t\t\tif (isInsertion && !shouldPreserveEditShape && change.replaceRange.start === editStart && editReplaceText.startsWith(change.newText)) {\n\t\t\t\teditStart += change.newText.length;\n\t\t\t\teditReplaceText = editReplaceText.substring(change.newText.length);\n\t\t\t\teditEnd = Math.max(editStart, editEnd);\n\t\t\t\teditHasChanged = true;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (isInsertion && shouldPreserveEditShape && change.replaceRange.start === editStart + this._prefixLength && this._trimmedNewText.startsWith(change.newText)) {\n\t\t\t\teditEnd += change.newText.length;\n\t\t\t\teditHasChanged = true;\n\t\t\t\tthis._prefixLength += change.newText.length;\n\t\t\t\tthis._trimmedNewText = this._trimmedNewText.substring(change.newText.length);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// DELETIONS\n\t\t\tconst isDeletion = change.newText.length === 0 && change.replaceRange.length > 0;\n\t\t\tif (isDeletion && change.replaceRange.start >= editStart + this._prefixLength && change.replaceRange.endExclusive <= editEnd - this._suffixLength) {\n\t\t\t\t// user deleted text IN-BETWEEN the deletion range\n\t\t\t\teditEnd -= change.replaceRange.length;\n\t\t\t\teditHasChanged = true;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// user did exactly the edit\n\t\t\tif (change.equals(edit)) {\n\t\t\t\teditHasChanged = true;\n\t\t\t\teditStart = change.replaceRange.endExclusive;\n\t\t\t\teditReplaceText = '';\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// MOVE EDIT\n\t\t\tif (change.replaceRange.start > editEnd) {\n\t\t\t\t// the change happens after the completion range\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (change.replaceRange.endExclusive < editStart) {\n\t\t\t\t// the change happens before the completion range\n\t\t\t\teditStart += change.newText.length - change.replaceRange.length;\n\t\t\t\teditEnd += change.newText.length - change.replaceRange.length;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// The change intersects the completion, so we will have to drop the completion\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// the resulting edit is a noop as the original and new text are the same\n\t\tif (this._trimmedNewText.length === 0 && editStart + this._prefixLength === editEnd - this._suffixLength) {\n\t\t\treturn { edit: new StringReplacement(new OffsetRange(editStart + this._prefixLength, editStart + this._prefixLength), ''), editHasChanged: true };\n\t\t}\n\n\t\treturn { edit: new StringReplacement(new OffsetRange(editStart, editEnd), editReplaceText), editHasChanged };\n\t}\n}\n\nfunction reshapeInlineCompletion(edit: StringReplacement, textModel: ITextModel): StringReplacement {\n\t// If the insertion is a multi line insertion starting on the next line\n\t// Move it forwards so that the multi line insertion starts on the current line\n\tconst eol = textModel.getEOL();\n\tif (edit.replaceRange.isEmpty && edit.newText.includes(eol)) {\n\t\tedit = reshapeMultiLineInsertion(edit, textModel);\n\t}\n\n\treturn edit;\n}\n\nfunction reshapeInlineEdit(edit: StringReplacement, originalText: string, totalInnerEdits: number, textModel: ITextModel): StringReplacement {\n\t// TODO: EOL are not properly trimmed by the diffAlgorithm #12680\n\tconst eol = textModel.getEOL();\n\tif (edit.newText.endsWith(eol) && originalText.endsWith(eol)) {\n\t\tedit = new StringReplacement(edit.replaceRange.deltaEnd(-eol.length), edit.newText.slice(0, -eol.length));\n\t}\n\n\t// INSERTION\n\t// If the insertion ends with a new line and is inserted at the start of a line which has text,\n\t// we move the insertion to the end of the previous line if possible\n\tif (totalInnerEdits === 1 && edit.replaceRange.isEmpty && edit.newText.includes(eol)) {\n\t\tconst startPosition = textModel.getPositionAt(edit.replaceRange.start);\n\t\tconst hasTextOnInsertionLine = textModel.getLineLength(startPosition.lineNumber) !== 0;\n\t\tif (hasTextOnInsertionLine) {\n\t\t\tedit = reshapeMultiLineInsertion(edit, textModel);\n\t\t}\n\t}\n\n\t// The diff algorithm extended a simple edit to the entire word\n\t// shrink it back to a simple edit if it is deletion/insertion only\n\tif (totalInnerEdits === 1) {\n\t\tconst prefixLength = commonPrefixLength(originalText, edit.newText);\n\t\tconst suffixLength = commonSuffixLength(originalText.slice(prefixLength), edit.newText.slice(prefixLength));\n\n\t\t// reshape it back to an insertion\n\t\tif (prefixLength + suffixLength === originalText.length) {\n\t\t\treturn new StringReplacement(edit.replaceRange.deltaStart(prefixLength).deltaEnd(-suffixLength), edit.newText.substring(prefixLength, edit.newText.length - suffixLength));\n\t\t}\n\n\t\t// reshape it back to a deletion\n\t\tif (prefixLength + suffixLength === edit.newText.length) {\n\t\t\treturn new StringReplacement(edit.replaceRange.deltaStart(prefixLength).deltaEnd(-suffixLength), '');\n\t\t}\n\t}\n\n\treturn edit;\n}\n\nfunction reshapeMultiLineInsertion(edit: StringReplacement, textModel: ITextModel): StringReplacement {\n\tif (!edit.replaceRange.isEmpty) {\n\t\tthrow new BugIndicatingError('Unexpected original range');\n\t}\n\n\tif (edit.replaceRange.start === 0) {\n\t\treturn edit;\n\t}\n\n\tconst eol = textModel.getEOL();\n\tconst startPosition = textModel.getPositionAt(edit.replaceRange.start);\n\tconst startColumn = startPosition.column;\n\tconst startLineNumber = startPosition.lineNumber;\n\n\t// If the insertion ends with a new line and is inserted at the start of a line which has text,\n\t// we move the insertion to the end of the previous line if possible\n\tif (startColumn === 1 && startLineNumber > 1 && edit.newText.endsWith(eol) && !edit.newText.startsWith(eol)) {\n\t\treturn new StringReplacement(edit.replaceRange.delta(-1), eol + edit.newText.slice(0, -eol.length));\n\t}\n\n\treturn edit;\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { BugIndicatingError } from '../../../../../base/common/errors.js';\nimport { matchesSubString } from '../../../../../base/common/filters.js';\nimport { IObservable, ITransaction, observableSignal, observableValue } from '../../../../../base/common/observable.js';\nimport { commonPrefixLength, commonSuffixLength, splitLines } from '../../../../../base/common/strings.js';\nimport { URI } from '../../../../../base/common/uri.js';\nimport { ICommandService } from '../../../../../platform/commands/common/commands.js';\nimport { ISingleEditOperation } from '../../../../common/core/editOperation.js';\nimport { applyEditsToRanges, StringEdit, StringReplacement } from '../../../../common/core/edits/stringEdit.js';\nimport { TextEdit, TextReplacement } from '../../../../common/core/edits/textEdit.js';\nimport { Position } from '../../../../common/core/position.js';\nimport { Range } from '../../../../common/core/range.js';\nimport { OffsetRange } from '../../../../common/core/ranges/offsetRange.js';\nimport { StringText } from '../../../../common/core/text/abstractText.js';\nimport { getPositionOffsetTransformerFromTextModel } from '../../../../common/core/text/getPositionOffsetTransformerFromTextModel.js';\nimport { PositionOffsetTransformerBase } from '../../../../common/core/text/positionToOffset.js';\nimport { TextLength } from '../../../../common/core/text/textLength.js';\nimport { linesDiffComputers } from '../../../../common/diff/linesDiffComputers.js';\nimport { Command, InlineCompletion, InlineCompletionHintStyle, InlineCompletionEndOfLifeReason, InlineCompletionTriggerKind, InlineCompletionWarning, PartialAcceptInfo, InlineCompletionHint } from '../../../../common/languages.js';\nimport { EndOfLinePreference, ITextModel } from '../../../../common/model.js';\nimport { TextModelText } from '../../../../common/model/textModelText.js';\nimport { InlineCompletionViewData, InlineCompletionViewKind } from '../view/inlineEdits/inlineEditsViewInterface.js';\nimport { InlineSuggestData, InlineSuggestionList, PartialAcceptance, SnippetInfo } from './provideInlineCompletions.js';\nimport { singleTextRemoveCommonPrefix } from './singleTextEditHelpers.js';\n\nexport type InlineSuggestionItem = InlineEditItem | InlineCompletionItem;\n\nexport namespace InlineSuggestionItem {\n\texport function create(\n\t\tdata: InlineSuggestData,\n\t\ttextModel: ITextModel,\n\t): InlineSuggestionItem {\n\t\tif (!data.isInlineEdit && !data.uri) {\n\t\t\treturn InlineCompletionItem.create(data, textModel);\n\t\t} else {\n\t\t\treturn InlineEditItem.create(data, textModel);\n\t\t}\n\t}\n}\n\nabstract class InlineSuggestionItemBase {\n\tconstructor(\n\t\tprotected readonly _data: InlineSuggestData,\n\t\tpublic readonly identity: InlineSuggestionIdentity,\n\t\tpublic readonly hint: InlineSuggestHint | undefined\n\t) { }\n\n\t/**\n\t * A reference to the original inline completion list this inline completion has been constructed from.\n\t * Used for event data to ensure referential equality.\n\t*/\n\tpublic get source(): InlineSuggestionList { return this._data.source; }\n\n\tpublic get isFromExplicitRequest(): boolean { return this._data.context.triggerKind === InlineCompletionTriggerKind.Explicit; }\n\tpublic get forwardStable(): boolean { return this.source.inlineSuggestions.enableForwardStability ?? false; }\n\tpublic get editRange(): Range { return this.getSingleTextEdit().range; }\n\tpublic get targetRange(): Range { return this.hint?.range ?? this.editRange; }\n\tpublic get insertText(): string { return this.getSingleTextEdit().text; }\n\tpublic get semanticId(): string { return this.hash; }\n\tpublic get action(): Command | undefined { return this._sourceInlineCompletion.gutterMenuLinkAction; }\n\tpublic get command(): Command | undefined { return this._sourceInlineCompletion.command; }\n\tpublic get warning(): InlineCompletionWarning | undefined { return this._sourceInlineCompletion.warning; }\n\tpublic get showInlineEditMenu(): boolean { return !!this._sourceInlineCompletion.showInlineEditMenu; }\n\tpublic get hash() {\n\t\treturn JSON.stringify([\n\t\t\tthis.getSingleTextEdit().text,\n\t\t\tthis.getSingleTextEdit().range.getStartPosition().toString()\n\t\t]);\n\t}\n\n\tpublic get requestUuid(): string { return this._data.context.requestUuid; }\n\n\tpublic get partialAccepts(): PartialAcceptance { return this._data.partialAccepts; }\n\n\t/**\n\t * A reference to the original inline completion this inline completion has been constructed from.\n\t * Used for event data to ensure referential equality.\n\t*/\n\tprivate get _sourceInlineCompletion(): InlineCompletion { return this._data.sourceInlineCompletion; }\n\n\n\tpublic abstract getSingleTextEdit(): TextReplacement;\n\n\tpublic abstract withEdit(userEdit: StringEdit, textModel: ITextModel): InlineSuggestionItem | undefined;\n\n\tpublic abstract withIdentity(identity: InlineSuggestionIdentity): InlineSuggestionItem;\n\tpublic abstract canBeReused(model: ITextModel, position: Position): boolean;\n\n\n\tpublic addRef(): void {\n\t\tthis.identity.addRef();\n\t\tthis.source.addRef();\n\t}\n\n\tpublic removeRef(): void {\n\t\tthis.identity.removeRef();\n\t\tthis.source.removeRef();\n\t}\n\n\tpublic reportInlineEditShown(commandService: ICommandService, viewKind: InlineCompletionViewKind, viewData: InlineCompletionViewData) {\n\t\tthis._data.reportInlineEditShown(commandService, this.insertText, viewKind, viewData);\n\t}\n\n\tpublic reportPartialAccept(acceptedCharacters: number, info: PartialAcceptInfo, partialAcceptance: PartialAcceptance) {\n\t\tthis._data.reportPartialAccept(acceptedCharacters, info, partialAcceptance);\n\t}\n\n\tpublic reportEndOfLife(reason: InlineCompletionEndOfLifeReason): void {\n\t\tthis._data.reportEndOfLife(reason);\n\t}\n\n\tpublic setEndOfLifeReason(reason: InlineCompletionEndOfLifeReason): void {\n\t\tthis._data.setEndOfLifeReason(reason);\n\t}\n\n\tpublic setIsPreceeded(item: InlineSuggestionItem): void {\n\t\tthis._data.setIsPreceeded(item.partialAccepts);\n\t}\n\n\tpublic setNotShownReasonIfNotSet(reason: string): void {\n\t\tthis._data.setNotShownReason(reason);\n\t}\n\n\t/**\n\t * Avoid using this method. Instead introduce getters for the needed properties.\n\t*/\n\tpublic getSourceCompletion(): InlineCompletion {\n\t\treturn this._sourceInlineCompletion;\n\t}\n}\n\nexport class InlineSuggestionIdentity {\n\tprivate static idCounter = 0;\n\tprivate readonly _onDispose = observableSignal(this);\n\n\tprivate readonly _jumpedTo = observableValue(this, false);\n\tpublic get jumpedTo(): IObservable<boolean> {\n\t\treturn this._jumpedTo;\n\t}\n\n\tprivate _refCount = 1;\n\tpublic readonly id = 'InlineCompletionIdentity' + InlineSuggestionIdentity.idCounter++;\n\n\taddRef() {\n\t\tthis._refCount++;\n\t}\n\n\tremoveRef() {\n\t\tthis._refCount--;\n\t\tif (this._refCount === 0) {\n\t\t\tthis._onDispose.trigger(undefined);\n\t\t}\n\t}\n\n\tsetJumpTo(tx: ITransaction | undefined): void {\n\t\tthis._jumpedTo.set(true, tx);\n\t}\n}\n\nexport class InlineSuggestHint {\n\n\tpublic static create(displayLocation: InlineCompletionHint) {\n\t\treturn new InlineSuggestHint(\n\t\t\tRange.lift(displayLocation.range),\n\t\t\tdisplayLocation.content,\n\t\t\tdisplayLocation.style,\n\t\t);\n\t}\n\n\tprivate constructor(\n\t\tpublic readonly range: Range,\n\t\tpublic readonly content: string,\n\t\tpublic readonly style: InlineCompletionHintStyle,\n\t) { }\n\n\tpublic withEdit(edit: StringEdit, positionOffsetTransformer: PositionOffsetTransformerBase): InlineSuggestHint | undefined {\n\t\tconst offsetRange = new OffsetRange(\n\t\t\tpositionOffsetTransformer.getOffset(this.range.getStartPosition()),\n\t\t\tpositionOffsetTransformer.getOffset(this.range.getEndPosition())\n\t\t);\n\n\t\tconst newOffsetRange = applyEditsToRanges([offsetRange], edit)[0];\n\t\tif (!newOffsetRange) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst newRange = positionOffsetTransformer.getRange(newOffsetRange);\n\n\t\treturn new InlineSuggestHint(newRange, this.content, this.style);\n\t}\n}\n\nexport class InlineCompletionItem extends InlineSuggestionItemBase {\n\tpublic static create(\n\t\tdata: InlineSuggestData,\n\t\ttextModel: ITextModel,\n\t): InlineCompletionItem {\n\t\tconst identity = new InlineSuggestionIdentity();\n\t\tconst transformer = getPositionOffsetTransformerFromTextModel(textModel);\n\n\t\tconst insertText = data.insertText.replace(/\\r\\n|\\r|\\n/g, textModel.getEOL());\n\n\t\tconst edit = reshapeInlineCompletion(new StringReplacement(transformer.getOffsetRange(data.range), insertText), textModel);\n\t\tconst trimmedEdit = edit.removeCommonSuffixAndPrefix(textModel.getValue());\n\t\tconst textEdit = transformer.getTextReplacement(edit);\n\n\t\tconst displayLocation = data.hint ? InlineSuggestHint.create(data.hint) : undefined;\n\n\t\treturn new InlineCompletionItem(edit, trimmedEdit, textEdit, textEdit.range, data.snippetInfo, data.additionalTextEdits, data, identity, displayLocation);\n\t}\n\n\tpublic readonly isInlineEdit = false;\n\n\tprivate constructor(\n\t\tprivate readonly _edit: StringReplacement,\n\t\tprivate readonly _trimmedEdit: StringReplacement,\n\t\tprivate readonly _textEdit: TextReplacement,\n\t\tprivate readonly _originalRange: Range,\n\t\tpublic readonly snippetInfo: SnippetInfo | undefined,\n\t\tpublic readonly additionalTextEdits: readonly ISingleEditOperation[],\n\n\t\tdata: InlineSuggestData,\n\t\tidentity: InlineSuggestionIdentity,\n\t\tdisplayLocation: InlineSuggestHint | undefined,\n\t) {\n\t\tsuper(data, identity, displayLocation);\n\t}\n\n\toverride get hash(): string {\n\t\treturn JSON.stringify(this._trimmedEdit.toJson());\n\t}\n\n\toverride getSingleTextEdit(): TextReplacement { return this._textEdit; }\n\n\toverride withIdentity(identity: InlineSuggestionIdentity): InlineCompletionItem {\n\t\treturn new InlineCompletionItem(\n\t\t\tthis._edit,\n\t\t\tthis._trimmedEdit,\n\t\t\tthis._textEdit,\n\t\t\tthis._originalRange,\n\t\t\tthis.snippetInfo,\n\t\t\tthis.additionalTextEdits,\n\t\t\tthis._data,\n\t\t\tidentity,\n\t\t\tthis.hint\n\t\t);\n\t}\n\n\toverride withEdit(textModelEdit: StringEdit, textModel: ITextModel): InlineCompletionItem | undefined {\n\t\tconst newEditRange = applyEditsToRanges([this._edit.replaceRange], textModelEdit);\n\t\tif (newEditRange.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst newEdit = new StringReplacement(newEditRange[0], this._textEdit.text);\n\t\tconst positionOffsetTransformer = getPositionOffsetTransformerFromTextModel(textModel);\n\t\tconst newTextEdit = positionOffsetTransformer.getTextReplacement(newEdit);\n\n\t\tlet newDisplayLocation = this.hint;\n\t\tif (newDisplayLocation) {\n\t\t\tnewDisplayLocation = newDisplayLocation.withEdit(textModelEdit, positionOffsetTransformer);\n\t\t\tif (!newDisplayLocation) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t}\n\n\t\tconst trimmedEdit = newEdit.removeCommonSuffixAndPrefix(textModel.getValue());\n\n\t\treturn new InlineCompletionItem(\n\t\t\tnewEdit,\n\t\t\ttrimmedEdit,\n\t\t\tnewTextEdit,\n\t\t\tthis._originalRange,\n\t\t\tthis.snippetInfo,\n\t\t\tthis.additionalTextEdits,\n\t\t\tthis._data,\n\t\t\tthis.identity,\n\t\t\tnewDisplayLocation\n\t\t);\n\t}\n\n\toverride canBeReused(model: ITextModel, position: Position): boolean {\n\t\t// TODO@hediet I believe this can be simplified to `return true;`, as applying an edit should kick out this suggestion.\n\t\tconst updatedRange = this._textEdit.range;\n\t\tconst result = !!updatedRange\n\t\t\t&& updatedRange.containsPosition(position)\n\t\t\t&& this.isVisible(model, position)\n\t\t\t&& TextLength.ofRange(updatedRange).isGreaterThanOrEqualTo(TextLength.ofRange(this._originalRange));\n\t\treturn result;\n\t}\n\n\tpublic isVisible(model: ITextModel, cursorPosition: Position): boolean {\n\t\tconst singleTextEdit = this.getSingleTextEdit();\n\t\treturn inlineCompletionIsVisible(singleTextEdit, this._originalRange, model, cursorPosition);\n\t}\n}\n\nexport function inlineCompletionIsVisible(singleTextEdit: TextReplacement, originalRange: Range | undefined, model: ITextModel, cursorPosition: Position): boolean {\n\tconst minimizedReplacement = singleTextRemoveCommonPrefix(singleTextEdit, model);\n\tconst editRange = singleTextEdit.range;\n\tif (!editRange\n\t\t|| (originalRange && !originalRange.getStartPosition().equals(editRange.getStartPosition()))\n\t\t|| cursorPosition.lineNumber !== minimizedReplacement.range.startLineNumber\n\t\t|| minimizedReplacement.isEmpty // if the completion is empty after removing the common prefix of the completion and the model, the completion item would not be visible\n\t) {\n\t\treturn false;\n\t}\n\n\t// We might consider comparing by .toLowerText, but this requires GhostTextReplacement\n\tconst originalValue = model.getValueInRange(minimizedReplacement.range, EndOfLinePreference.LF);\n\tconst filterText = minimizedReplacement.text;\n\n\tconst cursorPosIndex = Math.max(0, cursorPosition.column - minimizedReplacement.range.startColumn);\n\n\tlet filterTextBefore = filterText.substring(0, cursorPosIndex);\n\tlet filterTextAfter = filterText.substring(cursorPosIndex);\n\n\tlet originalValueBefore = originalValue.substring(0, cursorPosIndex);\n\tlet originalValueAfter = originalValue.substring(cursorPosIndex);\n\n\tconst originalValueIndent = model.getLineIndentColumn(minimizedReplacement.range.startLineNumber);\n\tif (minimizedReplacement.range.startColumn <= originalValueIndent) {\n\t\t// Remove indentation\n\t\toriginalValueBefore = originalValueBefore.trimStart();\n\t\tif (originalValueBefore.length === 0) {\n\t\t\toriginalValueAfter = originalValueAfter.trimStart();\n\t\t}\n\t\tfilterTextBefore = filterTextBefore.trimStart();\n\t\tif (filterTextBefore.length === 0) {\n\t\t\tfilterTextAfter = filterTextAfter.trimStart();\n\t\t}\n\t}\n\n\treturn filterTextBefore.startsWith(originalValueBefore)\n\t\t&& !!matchesSubString(originalValueAfter, filterTextAfter);\n}\n\nexport class InlineEditItem extends InlineSuggestionItemBase {\n\tpublic static create(\n\t\tdata: InlineSuggestData,\n\t\ttextModel: ITextModel,\n\t): InlineEditItem {\n\t\tconst offsetEdit = getStringEdit(textModel, data.range, data.insertText); // TODO compute async\n\t\tconst text = new TextModelText(textModel);\n\t\tconst textEdit = TextEdit.fromStringEdit(offsetEdit, text);\n\t\tconst singleTextEdit = offsetEdit.isEmpty() ? new TextReplacement(new Range(1, 1, 1, 1), '') : textEdit.toReplacement(text); // FIXME: .toReplacement() can throw because offsetEdit is empty because we get an empty diff in getStringEdit after diffing\n\t\tconst identity = new InlineSuggestionIdentity();\n\n\t\tconst edits = offsetEdit.replacements.map(edit => {\n\t\t\tconst replacedRange = Range.fromPositions(textModel.getPositionAt(edit.replaceRange.start), textModel.getPositionAt(edit.replaceRange.endExclusive));\n\t\t\tconst replacedText = textModel.getValueInRange(replacedRange);\n\t\t\treturn SingleUpdatedNextEdit.create(edit, replacedText);\n\t\t});\n\t\tconst hint = data.hint ? InlineSuggestHint.create(data.hint) : undefined;\n\t\treturn new InlineEditItem(offsetEdit, singleTextEdit, data.uri, data, identity, edits, hint, false, textModel.getVersionId());\n\t}\n\n\tpublic readonly snippetInfo: SnippetInfo | undefined = undefined;\n\tpublic readonly additionalTextEdits: readonly ISingleEditOperation[] = [];\n\tpublic readonly isInlineEdit = true;\n\n\tprivate constructor(\n\t\tprivate readonly _edit: StringEdit, // TODO@hediet remove, compute & cache from _edits\n\t\tprivate readonly _textEdit: TextReplacement,\n\t\tpublic readonly uri: URI | undefined,\n\n\t\tdata: InlineSuggestData,\n\n\t\tidentity: InlineSuggestionIdentity,\n\t\tprivate readonly _edits: readonly SingleUpdatedNextEdit[],\n\t\thint: InlineSuggestHint | undefined,\n\t\tprivate readonly _lastChangePartOfInlineEdit = false,\n\t\tprivate readonly _inlineEditModelVersion: number,\n\t) {\n\t\tsuper(data, identity, hint);\n\t}\n\n\tpublic get updatedEditModelVersion(): number { return this._inlineEditModelVersion; }\n\tpublic get updatedEdit(): StringEdit { return this._edit; }\n\n\toverride getSingleTextEdit(): TextReplacement {\n\t\treturn this._textEdit;\n\t}\n\n\toverride withIdentity(identity: InlineSuggestionIdentity): InlineEditItem {\n\t\treturn new InlineEditItem(\n\t\t\tthis._edit,\n\t\t\tthis._textEdit,\n\t\t\tthis.uri,\n\t\t\tthis._data,\n\t\t\tidentity,\n\t\t\tthis._edits,\n\t\t\tthis.hint,\n\t\t\tthis._lastChangePartOfInlineEdit,\n\t\t\tthis._inlineEditModelVersion,\n\t\t);\n\t}\n\n\toverride canBeReused(model: ITextModel, position: Position): boolean {\n\t\t// TODO@hediet I believe this can be simplified to `return true;`, as applying an edit should kick out this suggestion.\n\t\treturn this._lastChangePartOfInlineEdit && this.updatedEditModelVersion === model.getVersionId();\n\t}\n\n\toverride withEdit(textModelChanges: StringEdit, textModel: ITextModel): InlineEditItem | undefined {\n\t\tconst edit = this._applyTextModelChanges(textModelChanges, this._edits, textModel);\n\t\treturn edit;\n\t}\n\n\tprivate _applyTextModelChanges(textModelChanges: StringEdit, edits: readonly SingleUpdatedNextEdit[], textModel: ITextModel): InlineEditItem | undefined {\n\t\tedits = edits.map(innerEdit => innerEdit.applyTextModelChanges(textModelChanges));\n\n\t\tif (edits.some(edit => edit.edit === undefined)) {\n\t\t\treturn undefined; // change is invalid, so we will have to drop the completion\n\t\t}\n\n\t\tconst newTextModelVersion = textModel.getVersionId();\n\n\t\tlet inlineEditModelVersion = this._inlineEditModelVersion;\n\t\tconst lastChangePartOfInlineEdit = edits.some(edit => edit.lastChangeUpdatedEdit);\n\t\tif (lastChangePartOfInlineEdit) {\n\t\t\tinlineEditModelVersion = newTextModelVersion ?? -1;\n\t\t}\n\n\t\tif (newTextModelVersion === null || inlineEditModelVersion + 20 < newTextModelVersion) {\n\t\t\treturn undefined; // the completion has been ignored for a while, remove it\n\t\t}\n\n\t\tedits = edits.filter(innerEdit => !innerEdit.edit!.isEmpty);\n\t\tif (edits.length === 0) {\n\t\t\treturn undefined; // the completion has been typed by the user\n\t\t}\n\n\t\tconst newEdit = new StringEdit(edits.map(edit => edit.edit!));\n\t\tconst positionOffsetTransformer = getPositionOffsetTransformerFromTextModel(textModel);\n\t\tconst newTextEdit = positionOffsetTransformer.getTextEdit(newEdit).toReplacement(new TextModelText(textModel));\n\n\t\tlet newDisplayLocation = this.hint;\n\t\tif (newDisplayLocation) {\n\t\t\tnewDisplayLocation = newDisplayLocation.withEdit(textModelChanges, positionOffsetTransformer);\n\t\t\tif (!newDisplayLocation) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t}\n\n\t\treturn new InlineEditItem(\n\t\t\tnewEdit,\n\t\t\tnewTextEdit,\n\t\t\tthis.uri,\n\t\t\tthis._data,\n\t\t\tthis.identity,\n\t\t\tedits,\n\t\t\tnewDisplayLocation,\n\t\t\tlastChangePartOfInlineEdit,\n\t\t\tinlineEditModelVersion,\n\t\t);\n\t}\n}\n\nfunction getStringEdit(textModel: ITextModel, editRange: Range, replaceText: string): StringEdit {\n\tconst eol = textModel.getEOL();\n\tconst editOriginalText = textModel.getValueInRange(editRange);\n\tconst editReplaceText = replaceText.replace(/\\r\\n|\\r|\\n/g, eol);\n\n\tconst diffAlgorithm = linesDiffComputers.getDefault();\n\tconst lineDiffs = diffAlgorithm.computeDiff(\n\t\tsplitLines(editOriginalText),\n\t\tsplitLines(editReplaceText),\n\t\t{\n\t\t\tignoreTrimWhitespace: false,\n\t\t\tcomputeMoves: false,\n\t\t\textendToSubwords: true,\n\t\t\tmaxComputationTimeMs: 500,\n\t\t}\n\t);\n\n\tconst innerChanges = lineDiffs.changes.flatMap(c => c.innerChanges ?? []);\n\n\tfunction addRangeToPos(pos: Position, range: Range): Range {\n\t\tconst start = TextLength.fromPosition(range.getStartPosition());\n\t\treturn TextLength.ofRange(range).createRange(start.addToPosition(pos));\n\t}\n\n\tconst modifiedText = new StringText(editReplaceText);\n\n\tconst offsetEdit = new StringEdit(\n\t\tinnerChanges.map(c => {\n\t\t\tconst rangeInModel = addRangeToPos(editRange.getStartPosition(), c.originalRange);\n\t\t\tconst originalRange = getPositionOffsetTransformerFromTextModel(textModel).getOffsetRange(rangeInModel);\n\n\t\t\tconst replaceText = modifiedText.getValueOfRange(c.modifiedRange);\n\t\t\tconst edit = new StringReplacement(originalRange, replaceText);\n\n\t\t\tconst originalText = textModel.getValueInRange(rangeInModel);\n\t\t\treturn reshapeInlineEdit(edit, originalText, innerChanges.length, textModel);\n\t\t})\n\t);\n\n\treturn offsetEdit;\n}\n\nclass SingleUpdatedNextEdit {\n\tpublic static create(\n\t\tedit: StringReplacement,\n\t\treplacedText: string,\n\t): SingleUpdatedNextEdit {\n\t\tconst prefixLength = commonPrefixLength(edit.newText, replacedText);\n\t\tconst suffixLength = commonSuffixLength(edit.newText, replacedText);\n\t\tconst trimmedNewText = edit.newText.substring(prefixLength, edit.newText.length - suffixLength);\n\t\treturn new SingleUpdatedNextEdit(edit, trimmedNewText, prefixLength, suffixLength);\n\t}\n\n\tpublic get edit() { return this._edit; }\n\tpublic get lastChangeUpdatedEdit() { return this._lastChangeUpdatedEdit; }\n\n\tconstructor(\n\t\tprivate _edit: StringReplacement | undefined,\n\t\tprivate _trimmedNewText: string,\n\t\tprivate _prefixLength: number,\n\t\tprivate _suffixLength: number,\n\t\tprivate _lastChangeUpdatedEdit: boolean = false,\n\t) {\n\t}\n\n\tpublic applyTextModelChanges(textModelChanges: StringEdit) {\n\t\tconst c = this._clone();\n\t\tc._applyTextModelChanges(textModelChanges);\n\t\treturn c;\n\t}\n\n\tprivate _clone(): SingleUpdatedNextEdit {\n\t\treturn new SingleUpdatedNextEdit(\n\t\t\tthis._edit,\n\t\t\tthis._trimmedNewText,\n\t\t\tthis._prefixLength,\n\t\t\tthis._suffixLength,\n\t\t\tthis._lastChangeUpdatedEdit,\n\t\t);\n\t}\n\n\tprivate _applyTextModelChanges(textModelChanges: StringEdit) {\n\t\tthis._lastChangeUpdatedEdit = false; // TODO @benibenj make immutable\n\n\t\tif (!this._edit) {\n\t\t\tthrow new BugIndicatingError('UpdatedInnerEdits: No edit to apply changes to');\n\t\t}\n\n\t\tconst result = this._applyChanges(this._edit, textModelChanges);\n\t\tif (!result) {\n\t\t\tthis._edit = undefined;\n\t\t\treturn;\n\t\t}\n\n\t\tthis._edit = result.edit;\n\t\tthis._lastChangeUpdatedEdit = result.editHasChanged;\n\t}\n\n\tprivate _applyChanges(edit: StringReplacement, textModelChanges: StringEdit): { edit: StringReplacement; editHasChanged: boolean } | undefined {\n\t\tlet editStart = edit.replaceRange.start;\n\t\tlet editEnd = edit.replaceRange.endExclusive;\n\t\tlet editReplaceText = edit.newText;\n\t\tlet editHasChanged = false;\n\n\t\tconst shouldPreserveEditShape = this._prefixLength > 0 || this._suffixLength > 0;\n\n\t\tfor (let i = textModelChanges.replacements.length - 1; i >= 0; i--) {\n\t\t\tconst change = textModelChanges.replacements[i];\n\n\t\t\t// INSERTIONS (only support inserting at start of edit)\n\t\t\tconst isInsertion = change.newText.length > 0 && change.replaceRange.isEmpty;\n\n\t\t\tif (isInsertion && !shouldPreserveEditShape && change.replaceRange.start === editStart && editReplaceText.startsWith(change.newText)) {\n\t\t\t\teditStart += change.newText.length;\n\t\t\t\teditReplaceText = editReplaceText.substring(change.newText.length);\n\t\t\t\teditEnd = Math.max(editStart, editEnd);\n\t\t\t\teditHasChanged = true;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (isInsertion && shouldPreserveEditShape && change.replaceRange.start === editStart + this._prefixLength && this._trimmedNewText.startsWith(change.newText)) {\n\t\t\t\teditEnd += change.newText.length;\n\t\t\t\teditHasChanged = true;\n\t\t\t\tthis._prefixLength += change.newText.length;\n\t\t\t\tthis._trimmedNewText = this._trimmedNewText.substring(change.newText.length);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// DELETIONS\n\t\t\tconst isDeletion = change.newText.length === 0 && change.replaceRange.length > 0;\n\t\t\tif (isDeletion && change.replaceRange.start >= editStart + this._prefixLength && change.replaceRange.endExclusive <= editEnd - this._suffixLength) {\n\t\t\t\t// user deleted text IN-BETWEEN the deletion range\n\t\t\t\teditEnd -= change.replaceRange.length;\n\t\t\t\teditHasChanged = true;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// user did exactly the edit\n\t\t\tif (change.equals(edit)) {\n\t\t\t\teditHasChanged = true;\n\t\t\t\teditStart = change.replaceRange.endExclusive;\n\t\t\t\teditReplaceText = '';\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// MOVE EDIT\n\t\t\tif (change.replaceRange.start > editEnd) {\n\t\t\t\t// the change happens after the completion range\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (change.replaceRange.endExclusive < editStart) {\n\t\t\t\t// the change happens before the completion range\n\t\t\t\teditStart += change.newText.length - change.replaceRange.length;\n\t\t\t\teditEnd += change.newText.length - change.replaceRange.length;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// The change intersects the completion, so we will have to drop the completion\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// the resulting edit is a noop as the original and new text are the same\n\t\tif (this._trimmedNewText.length === 0 && editStart + this._prefixLength === editEnd - this._suffixLength) {\n\t\t\treturn { edit: new StringReplacement(new OffsetRange(editStart + this._prefixLength, editStart + this._prefixLength), ''), editHasChanged: true };\n\t\t}\n\n\t\treturn { edit: new StringReplacement(new OffsetRange(editStart, editEnd), editReplaceText), editHasChanged };\n\t}\n}\n\nfunction reshapeInlineCompletion(edit: StringReplacement, textModel: ITextModel): StringReplacement {\n\t// If the insertion is a multi line insertion starting on the next line\n\t// Move it forwards so that the multi line insertion starts on the current line\n\tconst eol = textModel.getEOL();\n\tif (edit.replaceRange.isEmpty && edit.newText.includes(eol)) {\n\t\tedit = reshapeMultiLineInsertion(edit, textModel);\n\t}\n\n\treturn edit;\n}\n\nfunction reshapeInlineEdit(edit: StringReplacement, originalText: string, totalInnerEdits: number, textModel: ITextModel): StringReplacement {\n\t// TODO: EOL are not properly trimmed by the diffAlgorithm #12680\n\tconst eol = textModel.getEOL();\n\tif (edit.newText.endsWith(eol) && originalText.endsWith(eol)) {\n\t\tedit = new StringReplacement(edit.replaceRange.deltaEnd(-eol.length), edit.newText.slice(0, -eol.length));\n\t}\n\n\t// INSERTION\n\t// If the insertion ends with a new line and is inserted at the start of a line which has text,\n\t// we move the insertion to the end of the previous line if possible\n\tif (totalInnerEdits === 1 && edit.replaceRange.isEmpty && edit.newText.includes(eol)) {\n\t\tconst startPosition = textModel.getPositionAt(edit.replaceRange.start);\n\t\tconst hasTextOnInsertionLine = textModel.getLineLength(startPosition.lineNumber) !== 0;\n\t\tif (hasTextOnInsertionLine) {\n\t\t\tedit = reshapeMultiLineInsertion(edit, textModel);\n\t\t}\n\t}\n\n\t// The diff algorithm extended a simple edit to the entire word\n\t// shrink it back to a simple edit if it is deletion/insertion only\n\tif (totalInnerEdits === 1) {\n\t\tconst prefixLength = commonPrefixLength(originalText, edit.newText);\n\t\tconst suffixLength = commonSuffixLength(originalText.slice(prefixLength), edit.newText.slice(prefixLength));\n\n\t\t// reshape it back to an insertion\n\t\tif (prefixLength + suffixLength === originalText.length) {\n\t\t\treturn new StringReplacement(edit.replaceRange.deltaStart(prefixLength).deltaEnd(-suffixLength), edit.newText.substring(prefixLength, edit.newText.length - suffixLength));\n\t\t}\n\n\t\t// reshape it back to a deletion\n\t\tif (prefixLength + suffixLength === edit.newText.length) {\n\t\t\treturn new StringReplacement(edit.replaceRange.deltaStart(prefixLength).deltaEnd(-suffixLength), '');\n\t\t}\n\t}\n\n\treturn edit;\n}\n\nfunction reshapeMultiLineInsertion(edit: StringReplacement, textModel: ITextModel): StringReplacement {\n\tif (!edit.replaceRange.isEmpty) {\n\t\tthrow new BugIndicatingError('Unexpected original range');\n\t}\n\n\tif (edit.replaceRange.start === 0) {\n\t\treturn edit;\n\t}\n\n\tconst eol = textModel.getEOL();\n\tconst startPosition = textModel.getPositionAt(edit.replaceRange.start);\n\tconst startColumn = startPosition.column;\n\tconst startLineNumber = startPosition.lineNumber;\n\n\t// If the insertion ends with a new line and is inserted at the start of a line which has text,\n\t// we move the insertion to the end of the previous line if possible\n\tif (startColumn === 1 && startLineNumber > 1 && edit.newText.endsWith(eol) && !edit.newText.startsWith(eol)) {\n\t\treturn new StringReplacement(edit.replaceRange.delta(-1), eol + edit.newText.slice(0, -eol.length));\n\t}\n\n\treturn edit;\n}\n"]}
|