monaco-editor-core 0.56.0-dev-20251124 → 0.56.0-dev-20251125
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 +6 -0
- package/esm/vs/base/common/async.js +11 -0
- package/esm/vs/base/common/async.js.map +1 -1
- package/esm/vs/editor/common/core/edits/textEdit.js +3 -0
- package/esm/vs/editor/common/core/edits/textEdit.js.map +1 -1
- package/esm/vs/editor/common/languages.js.map +1 -1
- package/esm/vs/editor/contrib/inPlaceReplace/browser/inPlaceReplace.js +2 -2
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/commandIds.js +1 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/commandIds.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.js +5 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsSource.js +10 -2
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsSource.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineSuggestionItem.js +10 -2
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineSuggestionItem.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/provideInlineCompletions.js +18 -3
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/provideInlineCompletions.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/renameSymbolProcessor.js +151 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/renameSymbolProcessor.js.map +1 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/telemetry.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorMenu.js +6 -6
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorView.js +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/theme.js +20 -20
- package/esm/vs/editor/contrib/insertFinalNewLine/browser/insertFinalNewLine.js +1 -1
- package/esm/vs/editor/contrib/lineSelection/browser/lineSelection.js +1 -1
- package/esm/vs/editor/contrib/linesOperations/browser/linesOperations.js +31 -31
- 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/gotoLineQuickAccess.js +11 -11
- 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 +15 -11
- 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/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 +24 -24
- 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 +3 -3
- package/esm/vs/editor/contrib/wordOperations/browser/wordOperations.js +1 -1
- package/esm/vs/editor/editor.api.d.ts +6 -2
- 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 +5 -5
- package/esm/vs/platform/actions/browser/toolbar.js +2 -2
- package/esm/vs/platform/actions/common/actions.js +1 -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/configurationRegistry.js +10 -10
- package/esm/vs/platform/contextkey/browser/contextKeyService.js +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/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/markers/common/markerService.js +2 -2
- package/esm/vs/platform/markers/common/markers.js +6 -6
- package/esm/vs/platform/quickinput/browser/commandsQuickAccess.js +8 -8
- package/esm/vs/platform/quickinput/browser/helpQuickAccess.js +1 -1
- package/esm/vs/platform/quickinput/browser/quickInput.js +10 -10
- package/esm/vs/platform/quickinput/browser/quickInputActions.js +5 -5
- package/esm/vs/platform/quickinput/browser/quickInputController.js +6 -6
- package/esm/vs/platform/quickinput/browser/quickInputList.js +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/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/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/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/workspace/common/workspace.js +1 -1
- package/monaco.d.ts +6 -2
- package/package.json +2 -2
|
@@ -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,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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AAC,CAAC;QACtG,CAAC;IACF,CAAC;IAED,OAAO,IAAI,CAAC;AACb,CAAC;AAED,SAAS,yBAAyB,CAAC,IAAuB,EAAE,SAAqB;IAChF,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;QAChC,MAAM,IAAI,kBAAkB,CAAC,2BAA2B,CAAC,CAAC;IAC3D,CAAC;IAED,IAAI,IAAI,CAAC,YAAY,CAAC,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"]}
|
|
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,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AE,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, IInlineCompletionHint } 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, RenameInfo, 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 supportsRename(): boolean { return this._data.supportsRename; }\n\tpublic get renameCommand(): Command | undefined { return this._data.renameCommand; }\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\tpublic setRenameProcessingInfo(info: RenameInfo): void {\n\t\tthis._data.setRenameProcessingInfo(info);\n\t}\n\n\tpublic withRename(command: Command, hint: InlineSuggestHint): InlineSuggestData {\n\t\treturn this._data.withRename(command, hint);\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(hint: IInlineCompletionHint) {\n\t\treturn new InlineSuggestHint(\n\t\t\tRange.lift(hint.range),\n\t\t\thint.content,\n\t\t\thint.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, IInlineCompletionHint } 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, RenameInfo, 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 supportsRename(): boolean { return this._data.supportsRename; }\n\tpublic get renameCommand(): Command | undefined { return this._data.renameCommand; }\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\tpublic setRenameProcessingInfo(info: RenameInfo): void {\n\t\tthis._data.setRenameProcessingInfo(info);\n\t}\n\n\tpublic withRename(command: Command, hint: InlineSuggestHint): InlineSuggestData {\n\t\treturn this._data.withRename(command, hint);\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(hint: IInlineCompletionHint) {\n\t\treturn new InlineSuggestHint(\n\t\t\tRange.lift(hint.range),\n\t\t\thint.content,\n\t\t\thint.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"]}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { assertNever } from '../../../../../base/common/assert.js';
|
|
6
6
|
import { AsyncIterableProducer } from '../../../../../base/common/async.js';
|
|
7
7
|
import { CancellationTokenSource } from '../../../../../base/common/cancellation.js';
|
|
8
|
-
import { onUnexpectedExternalError } from '../../../../../base/common/errors.js';
|
|
8
|
+
import { BugIndicatingError, onUnexpectedExternalError } from '../../../../../base/common/errors.js';
|
|
9
9
|
import { Disposable } from '../../../../../base/common/lifecycle.js';
|
|
10
10
|
import { prefixedUuid } from '../../../../../base/common/uuid.js';
|
|
11
11
|
import { StringReplacement } from '../../../../common/core/edits/stringEdit.js';
|
|
@@ -171,10 +171,10 @@ function toInlineSuggestData(inlineCompletion, source, defaultReplaceRange, text
|
|
|
171
171
|
else {
|
|
172
172
|
assertNever(inlineCompletion.insertText);
|
|
173
173
|
}
|
|
174
|
-
return new InlineSuggestData(range, insertText, snippetInfo, URI.revive(inlineCompletion.uri), inlineCompletion.hint, inlineCompletion.additionalTextEdits || getReadonlyEmptyArray(), inlineCompletion, source, context, inlineCompletion.isInlineEdit ?? false, requestInfo, providerRequestInfo, inlineCompletion.correlationId);
|
|
174
|
+
return new InlineSuggestData(range, insertText, snippetInfo, URI.revive(inlineCompletion.uri), inlineCompletion.hint, inlineCompletion.additionalTextEdits || getReadonlyEmptyArray(), inlineCompletion, source, context, inlineCompletion.isInlineEdit ?? false, inlineCompletion.supportsRename ?? false, undefined, requestInfo, providerRequestInfo, inlineCompletion.correlationId);
|
|
175
175
|
}
|
|
176
176
|
export class InlineSuggestData {
|
|
177
|
-
constructor(range, insertText, snippetInfo, uri, hint, additionalTextEdits, sourceInlineCompletion, source, context, isInlineEdit, _requestInfo, _providerRequestInfo, _correlationId) {
|
|
177
|
+
constructor(range, insertText, snippetInfo, uri, hint, additionalTextEdits, sourceInlineCompletion, source, context, isInlineEdit, supportsRename, renameCommand, _requestInfo, _providerRequestInfo, _correlationId) {
|
|
178
178
|
this.range = range;
|
|
179
179
|
this.insertText = insertText;
|
|
180
180
|
this.snippetInfo = snippetInfo;
|
|
@@ -185,6 +185,8 @@ export class InlineSuggestData {
|
|
|
185
185
|
this.source = source;
|
|
186
186
|
this.context = context;
|
|
187
187
|
this.isInlineEdit = isInlineEdit;
|
|
188
|
+
this.supportsRename = supportsRename;
|
|
189
|
+
this.renameCommand = renameCommand;
|
|
188
190
|
this._requestInfo = _requestInfo;
|
|
189
191
|
this._providerRequestInfo = _providerRequestInfo;
|
|
190
192
|
this._correlationId = _correlationId;
|
|
@@ -200,6 +202,7 @@ export class InlineSuggestData {
|
|
|
200
202
|
this._isPreceeded = false;
|
|
201
203
|
this._partiallyAcceptedCount = 0;
|
|
202
204
|
this._partiallyAcceptedSinceOriginal = { characters: 0, ratio: 0, count: 0 };
|
|
205
|
+
this._renameInfo = undefined;
|
|
203
206
|
this._viewData = { editorType: _requestInfo.editorType };
|
|
204
207
|
}
|
|
205
208
|
get showInlineEditMenu() { return this.sourceInlineCompletion.showInlineEditMenu ?? false; }
|
|
@@ -264,6 +267,9 @@ export class InlineSuggestData {
|
|
|
264
267
|
requestReason: this._requestInfo.reason,
|
|
265
268
|
viewKind: this._viewData.viewKind,
|
|
266
269
|
notShownReason: this._notShownReason,
|
|
270
|
+
renameCreated: this._renameInfo?.createdRename ?? false,
|
|
271
|
+
renameDuration: this._renameInfo?.duration,
|
|
272
|
+
renameTimedOut: this._renameInfo?.timedOut ?? false,
|
|
267
273
|
typingInterval: this._requestInfo.typingInterval,
|
|
268
274
|
typingIntervalCharacterCount: this._requestInfo.typingIntervalCharacterCount,
|
|
269
275
|
availableProviders: this._requestInfo.availableProviders.map(p => p.toString()).join(','),
|
|
@@ -315,6 +321,15 @@ export class InlineSuggestData {
|
|
|
315
321
|
this._showUncollapsedDuration += timeNow - this._showUncollapsedStartTime;
|
|
316
322
|
this._showUncollapsedStartTime = undefined;
|
|
317
323
|
}
|
|
324
|
+
setRenameProcessingInfo(info) {
|
|
325
|
+
if (this._renameInfo) {
|
|
326
|
+
throw new BugIndicatingError('Rename info has already been set.');
|
|
327
|
+
}
|
|
328
|
+
this._renameInfo = info;
|
|
329
|
+
}
|
|
330
|
+
withRename(command, hint) {
|
|
331
|
+
return new InlineSuggestData(new Range(1, 1, 1, 1), '', this.snippetInfo, this.uri, hint, this.additionalTextEdits, this.sourceInlineCompletion, this.source, this.context, this.isInlineEdit, this.supportsRename, command, this._requestInfo, this._providerRequestInfo, this._correlationId);
|
|
332
|
+
}
|
|
318
333
|
}
|
|
319
334
|
export var InlineCompletionEditorType;
|
|
320
335
|
(function (InlineCompletionEditorType) {
|