monaco-editor-core 0.56.0-dev-20251218 → 0.56.0-dev-20251220
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.messages.cs.js +1 -1
- package/esm/nls.messages.de.js +1 -1
- package/esm/nls.messages.es.js +1 -1
- package/esm/nls.messages.fr.js +1 -1
- package/esm/nls.messages.it.js +1 -1
- package/esm/nls.messages.ja.js +1 -1
- package/esm/nls.messages.ko.js +1 -1
- package/esm/nls.messages.pl.js +1 -1
- package/esm/nls.messages.pt-br.js +1 -1
- package/esm/nls.messages.ru.js +1 -1
- package/esm/nls.messages.tr.js +1 -1
- package/esm/nls.messages.zh-cn.js +1 -1
- package/esm/nls.messages.zh-tw.js +1 -1
- package/esm/vs/base/common/fuzzyScorer.js +3 -2
- package/esm/vs/base/common/fuzzyScorer.js.map +1 -1
- package/esm/vs/editor/common/cursor/cursorTypeEditOperations.js +3 -3
- package/esm/vs/editor/common/cursor/cursorTypeEditOperations.js.map +1 -1
- package/esm/vs/editor/common/viewModel/viewModelImpl.js +4 -15
- package/esm/vs/editor/common/viewModel/viewModelImpl.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.js +2 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsSource.js +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsSource.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/renameSymbolProcessor.js +2 -2
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/renameSymbolProcessor.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorView.js +6 -6
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsModel.js +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsModel.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsView.js +13 -11
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsCustomView.js +5 -7
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsCustomView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsDeletionView.js +6 -5
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsDeletionView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsInsertionView.js +6 -5
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsInsertionView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsLineReplacementView.js +9 -7
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsLineReplacementView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsSideBySideView.js +14 -9
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsSideBySideView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsWordReplacementView.js +9 -7
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsWordReplacementView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/inlineEditsLongDistanceHint.js +5 -4
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/inlineEditsLongDistanceHint.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/originalEditorInlineDiffView.js +2 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/originalEditorInlineDiffView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/theme.js +20 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/theme.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/quickInput.js +3 -37
- package/esm/vs/platform/quickinput/browser/quickInput.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/quickInputController.js +1 -0
- package/esm/vs/platform/quickinput/browser/quickInputController.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/quickInputUtils.js +1 -1
- package/esm/vs/platform/quickinput/browser/quickInputUtils.js.map +1 -1
- package/esm/vs/platform/quickinput/common/quickInput.js.map +1 -1
- 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/view/inlineEdits/inlineEditsViews/inlineEditsInsertionView.ts","vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsInsertionView.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;gGAGgG;AAChG,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,0CAA0C,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,2CAA2C,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,OAAO,EAAe,eAAe,EAAE,MAAM,gDAAgD,CAAC;AACxH,OAAO,EAAE,qBAAqB,EAAE,MAAM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uB,CAAC;YACrC,CAAC,CAAC;SACF,CAAC,CAAC,CAAC;IACL,CAAC;CA+ID,CAAA;AA/RY,wBAAwB;IAkGlC,WAAA,qBAAqB,CAAA;IACrB,WAAA,gBAAgB,CAAA;GAnGN,wBAAwB,CA+RpC","file":"inlineEditsInsertionView.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 *--------------------------------------------------------------------------------------------*/\nimport { $, n } from '../../../../../../../base/browser/dom.js';\nimport { Emitter } from '../../../../../../../base/common/event.js';\nimport { Disposable } from '../../../../../../../base/common/lifecycle.js';\nimport { constObservable, derived, IObservable, observableValue } from '../../../../../../../base/common/observable.js';\nimport { IInstantiationService } from '../../../../../../../platform/instantiation/common/instantiation.js';\nimport { editorBackground } from '../../../../../../../platform/theme/common/colorRegistry.js';\nimport { asCssVariable } from '../../../../../../../platform/theme/common/colorUtils.js';\nimport { ICodeEditor } from '../../../../../../browser/editorBrowser.js';\nimport { ObservableCodeEditor, observableCodeEditor } from '../../../../../../browser/observableCodeEditor.js';\nimport { LineSource, renderLines, RenderOptions } from '../../../../../../browser/widget/diffEditor/components/diffEditorViewZones/renderLines.js';\nimport { Rect } from '../../../../../../common/core/2d/rect.js';\nimport { Position } from '../../../../../../common/core/position.js';\nimport { Range } from '../../../../../../common/core/range.js';\nimport { LineRange } from '../../../../../../common/core/ranges/lineRange.js';\nimport { OffsetRange } from '../../../../../../common/core/ranges/offsetRange.js';\nimport { ILanguageService } from '../../../../../../common/languages/language.js';\nimport { LineTokens, TokenArray } from '../../../../../../common/tokens/lineTokens.js';\nimport { InlineDecoration, InlineDecorationType } from '../../../../../../common/viewModel/inlineDecorations.js';\nimport { GhostText, GhostTextPart } from '../../../model/ghostText.js';\nimport { GhostTextView, IGhostTextWidgetData } from '../../ghostText/ghostTextView.js';\nimport { IInlineEditsView, InlineEditClickEvent, InlineEditTabAction } from '../inlineEditsViewInterface.js';\nimport { getModifiedBorderColor, INLINE_EDITS_BORDER_RADIUS, modifiedBackgroundColor } from '../theme.js';\nimport { getPrefixTrim, mapOutFalsy } from '../utils/utils.js';\n\nconst BORDER_WIDTH = 1;\nconst WIDGET_SEPARATOR_WIDTH = 1;\nconst WIDGET_SEPARATOR_DIFF_EDITOR_WIDTH = 3;\nconst BORDER_RADIUS = INLINE_EDITS_BORDER_RADIUS;\n\nexport class InlineEditsInsertionView extends Disposable implements IInlineEditsView {\n\tprivate readonly _editorObs: ObservableCodeEditor;\n\n\tprivate readonly _onDidClick = this._register(new Emitter<InlineEditClickEvent>());\n\treadonly onDidClick = this._onDidClick.event;\n\n\tprivate readonly _state = derived(this, reader => {\n\t\tconst state = this._input.read(reader);\n\t\tif (!state) { return undefined; }\n\n\t\tconst textModel = this._editor.getModel()!;\n\t\tconst eol = textModel.getEOL();\n\n\t\tif (state.startColumn === 1 && state.lineNumber > 1 && textModel.getLineLength(state.lineNumber) !== 0 && state.text.endsWith(eol) && !state.text.startsWith(eol)) {\n\t\t\tconst endOfLineColumn = textModel.getLineLength(state.lineNumber - 1) + 1;\n\t\t\treturn { lineNumber: state.lineNumber - 1, column: endOfLineColumn, text: eol + state.text.slice(0, -eol.length) };\n\t\t}\n\n\t\treturn { lineNumber: state.lineNumber, column: state.startColumn, text: state.text };\n\t});\n\n\tprivate readonly _trimVertically = derived(this, reader => {\n\t\tconst state = this._state.read(reader);\n\t\tconst text = state?.text;\n\t\tif (!text || text.trim() === '') {\n\t\t\treturn { topOffset: 0, bottomOffset: 0, linesTop: 0, linesBottom: 0 };\n\t\t}\n\n\t\t// Adjust for leading/trailing newlines\n\t\tconst lineHeight = this._editor.getLineHeightForPosition(new Position(state.lineNumber, 1));\n\t\tconst eol = this._editor.getModel()!.getEOL();\n\t\tlet linesTop = 0;\n\t\tlet linesBottom = 0;\n\n\t\tlet i = 0;\n\t\tfor (; i < text.length && text.startsWith(eol, i); i += eol.length) {\n\t\t\tlinesTop += 1;\n\t\t}\n\n\t\tfor (let j = text.length; j > i && text.endsWith(eol, j); j -= eol.length) {\n\t\t\tlinesBottom += 1;\n\t\t}\n\n\t\treturn { topOffset: linesTop * lineHeight, bottomOffset: linesBottom * lineHeight, linesTop, linesBottom };\n\t});\n\n\tprivate readonly _maxPrefixTrim = derived(this, reader => {\n\t\tconst state = this._state.read(reader);\n\t\tif (!state) {\n\t\t\treturn { prefixLeftOffset: 0, prefixTrim: 0 };\n\t\t}\n\n\t\tconst textModel = this._editor.getModel()!;\n\t\tconst eol = textModel.getEOL();\n\n\t\tconst trimVertically = this._trimVertically.read(reader);\n\n\t\tconst lines = state.text.split(eol);\n\t\tconst modifiedLines = lines.slice(trimVertically.linesTop, lines.length - trimVertically.linesBottom);\n\t\tif (trimVertically.linesTop === 0) {\n\t\t\tmodifiedLines[0] = textModel.getLineContent(state.lineNumber) + modifiedLines[0];\n\t\t}\n\n\t\tconst originalRange = new LineRange(state.lineNumber, state.lineNumber + (trimVertically.linesTop > 0 ? 0 : 1));\n\n\t\treturn getPrefixTrim([], originalRange, modifiedLines, this._editor);\n\t});\n\n\tprivate readonly _ghostText = derived<GhostText | undefined>(reader => {\n\t\tconst state = this._state.read(reader);\n\t\tconst prefixTrim = this._maxPrefixTrim.read(reader);\n\t\tif (!state) { return undefined; }\n\n\t\tconst textModel = this._editor.getModel()!;\n\t\tconst eol = textModel.getEOL();\n\t\tconst modifiedLines = state.text.split(eol);\n\n\t\tconst inlineDecorations = modifiedLines.map((line, i) => new InlineDecoration(\n\t\t\tnew Range(i + 1, i === 0 ? 1 : prefixTrim.prefixTrim + 1, i + 1, line.length + 1),\n\t\t\t'modified-background',\n\t\t\tInlineDecorationType.Regular\n\t\t));\n\n\t\treturn new GhostText(state.lineNumber, [new GhostTextPart(state.column, state.text, false, inlineDecorations)]);\n\t});\n\n\tprotected readonly _ghostTextView: GhostTextView;\n\treadonly isHovered: IObservable<boolean>;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tprivate readonly _input: IObservable<{\n\t\t\tlineNumber: number;\n\t\t\tstartColumn: number;\n\t\t\ttext: string;\n\t\t\tinDiffEditor: boolean;\n\t\t} | undefined>,\n\t\tprivate readonly _tabAction: IObservable<InlineEditTabAction>,\n\t\t@IInstantiationService instantiationService: IInstantiationService,\n\t\t@ILanguageService private readonly _languageService: ILanguageService,\n\t) {\n\t\tsuper();\n\n\t\tthis._editorObs = observableCodeEditor(this._editor);\n\n\t\tthis._ghostTextView = this._register(instantiationService.createInstance(\n\t\t\tGhostTextView,\n\t\t\tthis._editor,\n\t\t\tderived(reader => {\n\t\t\t\tconst ghostText = this._ghostText.read(reader);\n\t\t\t\tif (!ghostText) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tghostText: ghostText,\n\t\t\t\t\thandleInlineCompletionShown: (data) => {\n\t\t\t\t\t\t// This is a no-op for the insertion view, as it is handled by the InlineEditsView.\n\t\t\t\t\t},\n\t\t\t\t\twarning: undefined,\n\t\t\t\t} satisfies IGhostTextWidgetData;\n\t\t\t}),\n\t\t\t{\n\t\t\t\textraClasses: ['inline-edit'],\n\t\t\t\tisClickable: true,\n\t\t\t\tshouldKeepCursorStable: true,\n\t\t\t}\n\t\t));\n\n\t\tthis.isHovered = this._ghostTextView.isHovered;\n\n\t\tthis._register(this._ghostTextView.onDidClick((e) => {\n\t\t\tthis._onDidClick.fire(new InlineEditClickEvent(e));\n\t\t}));\n\n\t\tthis._register(this._editorObs.createOverlayWidget({\n\t\t\tdomNode: this._view.element,\n\t\t\tposition: constObservable(null),\n\t\t\tallowEditorOverflow: false,\n\t\t\tminContentWidthInPx: derived(this, reader => {\n\t\t\t\tconst info = this._overlayLayout.read(reader);\n\t\t\t\tif (info === null) { return 0; }\n\t\t\t\treturn info.minContentWidthRequired;\n\t\t\t}),\n\t\t}));\n\t}\n\n\tprivate readonly _display = derived(this, reader => !!this._state.read(reader) ? 'block' : 'none');\n\n\tprivate readonly _editorMaxContentWidthInRange = derived(this, reader => {\n\t\tconst state = this._state.read(reader);\n\t\tif (!state) {\n\t\t\treturn 0;\n\t\t}\n\t\tthis._editorObs.versionId.read(reader);\n\t\tconst textModel = this._editor.getModel()!;\n\t\tconst eol = textModel.getEOL();\n\n\t\tconst textBeforeInsertion = state.text.startsWith(eol) ? '' : textModel.getValueInRange(new Range(state.lineNumber, 1, state.lineNumber, state.column));\n\t\tconst textAfterInsertion = textModel.getValueInRange(new Range(state.lineNumber, state.column, state.lineNumber, textModel.getLineLength(state.lineNumber) + 1));\n\t\tconst text = textBeforeInsertion + state.text + textAfterInsertion;\n\t\tconst lines = text.split(eol);\n\n\t\tconst renderOptions = RenderOptions.fromEditor(this._editor).withSetWidth(false).withScrollBeyondLastColumn(0);\n\t\tconst lineWidths = lines.map(line => {\n\t\t\tconst t = textModel.tokenization.tokenizeLinesAt(state.lineNumber, [line])?.[0];\n\t\t\tlet tokens: LineTokens;\n\t\t\tif (t) {\n\t\t\t\ttokens = TokenArray.fromLineTokens(t).toLineTokens(line, this._languageService.languageIdCodec);\n\t\t\t} else {\n\t\t\t\ttokens = LineTokens.createEmpty(line, this._languageService.languageIdCodec);\n\t\t\t}\n\n\t\t\treturn renderLines(new LineSource([tokens]), renderOptions, [], $('div'), true).minWidthInPx;\n\t\t});\n\n\t\t// Take the max value that we observed.\n\t\t// Reset when either the edit changes or the editor text version.\n\t\treturn Math.max(...lineWidths);\n\t});\n\n\tpublic readonly startLineOffset = this._trimVertically.map(v => v.topOffset);\n\tpublic readonly originalLines = this._state.map(s => s ?\n\t\tnew LineRange(\n\t\t\ts.lineNumber,\n\t\t\tMath.min(s.lineNumber + 2, this._editor.getModel()!.getLineCount() + 1)\n\t\t) : undefined\n\t);\n\n\tprivate readonly _overlayLayout = derived(this, (reader) => {\n\t\tthis._ghostText.read(reader);\n\t\tconst state = this._state.read(reader);\n\t\tif (!state) {\n\t\t\treturn null;\n\t\t}\n\n\t\t// Update the overlay when the position changes\n\t\tthis._editorObs.observePosition(observableValue(this, new Position(state.lineNumber, state.column)), reader.store).read(reader);\n\n\t\tconst editorLayout = this._editorObs.layoutInfo.read(reader);\n\t\tconst horizontalScrollOffset = this._editorObs.scrollLeft.read(reader);\n\t\tconst verticalScrollbarWidth = this._editorObs.layoutInfoVerticalScrollbarWidth.read(reader);\n\n\t\tconst right = editorLayout.contentLeft + this._editorMaxContentWidthInRange.read(reader) - horizontalScrollOffset;\n\t\tconst prefixLeftOffset = this._maxPrefixTrim.read(reader).prefixLeftOffset ?? 0 /* fix due to observable bug? */;\n\t\tconst left = editorLayout.contentLeft + prefixLeftOffset - horizontalScrollOffset;\n\t\tif (right <= left) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst { topOffset: topTrim, bottomOffset: bottomTrim } = this._trimVertically.read(reader);\n\n\t\tconst scrollTop = this._editorObs.scrollTop.read(reader);\n\t\tconst height = this._ghostTextView.height.read(reader) - topTrim - bottomTrim;\n\t\tconst top = this._editor.getTopForLineNumber(state.lineNumber) - scrollTop + topTrim;\n\t\tconst bottom = top + height;\n\n\t\tconst overlay = new Rect(left, top, right, bottom);\n\n\t\treturn {\n\t\t\toverlay,\n\t\t\tstartsAtContentLeft: prefixLeftOffset === 0,\n\t\t\tcontentLeft: editorLayout.contentLeft,\n\t\t\tminContentWidthRequired: prefixLeftOffset + overlay.width + verticalScrollbarWidth,\n\t\t};\n\t}).recomputeInitiallyAndOnChange(this._store);\n\n\tprivate readonly _modifiedOverlay = n.div({\n\t\tstyle: { pointerEvents: 'none', }\n\t}, derived(this, reader => {\n\t\tconst overlayLayoutObs = mapOutFalsy(this._overlayLayout).read(reader);\n\t\tif (!overlayLayoutObs) { return undefined; }\n\n\t\t// Create an overlay which hides the left hand side of the original overlay when it overflows to the left\n\t\t// such that there is a smooth transition at the edge of content left\n\t\tconst overlayHider = overlayLayoutObs.map(layoutInfo => Rect.fromLeftTopRightBottom(\n\t\t\tlayoutInfo.contentLeft - BORDER_RADIUS - BORDER_WIDTH,\n\t\t\tlayoutInfo.overlay.top,\n\t\t\tlayoutInfo.contentLeft,\n\t\t\tlayoutInfo.overlay.bottom\n\t\t)).read(reader);\n\n\t\tconst separatorWidth = this._input.map(i => i?.inDiffEditor ? WIDGET_SEPARATOR_DIFF_EDITOR_WIDTH : WIDGET_SEPARATOR_WIDTH).read(reader);\n\t\tconst overlayRect = overlayLayoutObs.map(l => l.overlay.withMargin(0, BORDER_WIDTH, 0, l.startsAtContentLeft ? 0 : BORDER_WIDTH).intersectHorizontal(new OffsetRange(overlayHider.left, Number.MAX_SAFE_INTEGER)));\n\t\tconst underlayRect = overlayRect.map(rect => rect.withMargin(separatorWidth, separatorWidth));\n\n\t\treturn [\n\t\t\tn.div({\n\t\t\t\tclass: 'originalUnderlayInsertion',\n\t\t\t\tstyle: {\n\t\t\t\t\t...underlayRect.read(reader).toStyles(),\n\t\t\t\t\tborderRadius: BORDER_RADIUS,\n\t\t\t\t\tborder: `${BORDER_WIDTH + separatorWidth}px solid ${asCssVariable(editorBackground)}`,\n\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t}\n\t\t\t}),\n\t\t\tn.div({\n\t\t\t\tclass: 'originalOverlayInsertion',\n\t\t\t\tstyle: {\n\t\t\t\t\t...overlayRect.read(reader).toStyles(),\n\t\t\t\t\tborderRadius: BORDER_RADIUS,\n\t\t\t\t\tborder: getModifiedBorderColor(this._tabAction).map(bc => `${BORDER_WIDTH}px solid ${asCssVariable(bc)}`),\n\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\tbackgroundColor: asCssVariable(modifiedBackgroundColor),\n\t\t\t\t}\n\t\t\t}),\n\t\t\tn.div({\n\t\t\t\tclass: 'originalOverlayHiderInsertion',\n\t\t\t\tstyle: {\n\t\t\t\t\t...overlayHider.toStyles(),\n\t\t\t\t\tbackgroundColor: asCssVariable(editorBackground),\n\t\t\t\t}\n\t\t\t})\n\t\t];\n\t})).keepUpdated(this._store);\n\n\tprivate readonly _view = n.div({\n\t\tclass: 'inline-edits-view',\n\t\tstyle: {\n\t\t\tposition: 'absolute',\n\t\t\toverflow: 'visible',\n\t\t\ttop: '0px',\n\t\t\tleft: '0px',\n\t\t\tdisplay: this._display,\n\t\t},\n\t}, [\n\t\t[this._modifiedOverlay],\n\t]).keepUpdated(this._store);\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 *--------------------------------------------------------------------------------------------*/\nimport { $, n } from '../../../../../../../base/browser/dom.js';\nimport { Emitter } from '../../../../../../../base/common/event.js';\nimport { Disposable } from '../../../../../../../base/common/lifecycle.js';\nimport { constObservable, derived, IObservable, observableValue } from '../../../../../../../base/common/observable.js';\nimport { IInstantiationService } from '../../../../../../../platform/instantiation/common/instantiation.js';\nimport { editorBackground } from '../../../../../../../platform/theme/common/colorRegistry.js';\nimport { asCssVariable } from '../../../../../../../platform/theme/common/colorUtils.js';\nimport { ICodeEditor } from '../../../../../../browser/editorBrowser.js';\nimport { ObservableCodeEditor, observableCodeEditor } from '../../../../../../browser/observableCodeEditor.js';\nimport { LineSource, renderLines, RenderOptions } from '../../../../../../browser/widget/diffEditor/components/diffEditorViewZones/renderLines.js';\nimport { Rect } from '../../../../../../common/core/2d/rect.js';\nimport { Position } from '../../../../../../common/core/position.js';\nimport { Range } from '../../../../../../common/core/range.js';\nimport { LineRange } from '../../../../../../common/core/ranges/lineRange.js';\nimport { OffsetRange } from '../../../../../../common/core/ranges/offsetRange.js';\nimport { ILanguageService } from '../../../../../../common/languages/language.js';\nimport { LineTokens, TokenArray } from '../../../../../../common/tokens/lineTokens.js';\nimport { InlineDecoration, InlineDecorationType } from '../../../../../../common/viewModel/inlineDecorations.js';\nimport { GhostText, GhostTextPart } from '../../../model/ghostText.js';\nimport { GhostTextView, IGhostTextWidgetData } from '../../ghostText/ghostTextView.js';\nimport { IInlineEditsView, InlineEditClickEvent, InlineEditTabAction } from '../inlineEditsViewInterface.js';\nimport { getModifiedBorderColor, INLINE_EDITS_BORDER_RADIUS, modifiedBackgroundColor } from '../theme.js';\nimport { getPrefixTrim, mapOutFalsy } from '../utils/utils.js';\n\nconst BORDER_WIDTH = 1;\nconst WIDGET_SEPARATOR_WIDTH = 1;\nconst WIDGET_SEPARATOR_DIFF_EDITOR_WIDTH = 3;\nconst BORDER_RADIUS = INLINE_EDITS_BORDER_RADIUS;\n\nexport class InlineEditsInsertionView extends Disposable implements IInlineEditsView {\n\tprivate readonly _editorObs: ObservableCodeEditor;\n\n\tprivate readonly _onDidClick = this._register(new Emitter<InlineEditClickEvent>());\n\treadonly onDidClick = this._onDidClick.event;\n\n\tprivate readonly _state = derived(this, reader => {\n\t\tconst state = this._input.read(reader);\n\t\tif (!state) { return undefined; }\n\n\t\tconst textModel = this._editor.getModel()!;\n\t\tconst eol = textModel.getEOL();\n\n\t\tif (state.startColumn === 1 && state.lineNumber > 1 && textModel.getLineLength(state.lineNumber) !== 0 && state.text.endsWith(eol) && !state.text.startsWith(eol)) {\n\t\t\tconst endOfLineColumn = textModel.getLineLength(state.lineNumber - 1) + 1;\n\t\t\treturn { lineNumber: state.lineNumber - 1, column: endOfLineColumn, text: eol + state.text.slice(0, -eol.length) };\n\t\t}\n\n\t\treturn { lineNumber: state.lineNumber, column: state.startColumn, text: state.text };\n\t});\n\n\tprivate readonly _trimVertically = derived(this, reader => {\n\t\tconst state = this._state.read(reader);\n\t\tconst text = state?.text;\n\t\tif (!text || text.trim() === '') {\n\t\t\treturn { topOffset: 0, bottomOffset: 0, linesTop: 0, linesBottom: 0 };\n\t\t}\n\n\t\t// Adjust for leading/trailing newlines\n\t\tconst lineHeight = this._editor.getLineHeightForPosition(new Position(state.lineNumber, 1));\n\t\tconst eol = this._editor.getModel()!.getEOL();\n\t\tlet linesTop = 0;\n\t\tlet linesBottom = 0;\n\n\t\tlet i = 0;\n\t\tfor (; i < text.length && text.startsWith(eol, i); i += eol.length) {\n\t\t\tlinesTop += 1;\n\t\t}\n\n\t\tfor (let j = text.length; j > i && text.endsWith(eol, j); j -= eol.length) {\n\t\t\tlinesBottom += 1;\n\t\t}\n\n\t\treturn { topOffset: linesTop * lineHeight, bottomOffset: linesBottom * lineHeight, linesTop, linesBottom };\n\t});\n\n\tprivate readonly _maxPrefixTrim = derived(this, reader => {\n\t\tconst state = this._state.read(reader);\n\t\tif (!state) {\n\t\t\treturn { prefixLeftOffset: 0, prefixTrim: 0 };\n\t\t}\n\n\t\tconst textModel = this._editor.getModel()!;\n\t\tconst eol = textModel.getEOL();\n\n\t\tconst trimVertically = this._trimVertically.read(reader);\n\n\t\tconst lines = state.text.split(eol);\n\t\tconst modifiedLines = lines.slice(trimVertically.linesTop, lines.length - trimVertically.linesBottom);\n\t\tif (trimVertically.linesTop === 0) {\n\t\t\tmodifiedLines[0] = textModel.getLineContent(state.lineNumber) + modifiedLines[0];\n\t\t}\n\n\t\tconst originalRange = new LineRange(state.lineNumber, state.lineNumber + (trimVertically.linesTop > 0 ? 0 : 1));\n\n\t\treturn getPrefixTrim([], originalRange, modifiedLines, this._editor);\n\t});\n\n\tprivate readonly _ghostText = derived<GhostText | undefined>(reader => {\n\t\tconst state = this._state.read(reader);\n\t\tconst prefixTrim = this._maxPrefixTrim.read(reader);\n\t\tif (!state) { return undefined; }\n\n\t\tconst textModel = this._editor.getModel()!;\n\t\tconst eol = textModel.getEOL();\n\t\tconst modifiedLines = state.text.split(eol);\n\n\t\tconst inlineDecorations = modifiedLines.map((line, i) => new InlineDecoration(\n\t\t\tnew Range(i + 1, i === 0 ? 1 : prefixTrim.prefixTrim + 1, i + 1, line.length + 1),\n\t\t\t'modified-background',\n\t\t\tInlineDecorationType.Regular\n\t\t));\n\n\t\treturn new GhostText(state.lineNumber, [new GhostTextPart(state.column, state.text, false, inlineDecorations)]);\n\t});\n\n\tprotected readonly _ghostTextView: GhostTextView;\n\treadonly isHovered: IObservable<boolean>;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tprivate readonly _input: IObservable<{\n\t\t\tlineNumber: number;\n\t\t\tstartColumn: number;\n\t\t\ttext: string;\n\t\t\tinDiffEditor: boolean;\n\t\t} | undefined>,\n\t\tprivate readonly _tabAction: IObservable<InlineEditTabAction>,\n\t\t@IInstantiationService instantiationService: IInstantiationService,\n\t\t@ILanguageService private readonly _languageService: ILanguageService,\n\t) {\n\t\tsuper();\n\n\t\tthis._editorObs = observableCodeEditor(this._editor);\n\n\t\tthis._ghostTextView = this._register(instantiationService.createInstance(\n\t\t\tGhostTextView,\n\t\t\tthis._editor,\n\t\t\tderived(reader => {\n\t\t\t\tconst ghostText = this._ghostText.read(reader);\n\t\t\t\tif (!ghostText) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tghostText: ghostText,\n\t\t\t\t\thandleInlineCompletionShown: (data) => {\n\t\t\t\t\t\t// This is a no-op for the insertion view, as it is handled by the InlineEditsView.\n\t\t\t\t\t},\n\t\t\t\t\twarning: undefined,\n\t\t\t\t} satisfies IGhostTextWidgetData;\n\t\t\t}),\n\t\t\t{\n\t\t\t\textraClasses: ['inline-edit'],\n\t\t\t\tisClickable: true,\n\t\t\t\tshouldKeepCursorStable: true,\n\t\t\t}\n\t\t));\n\n\t\tthis.isHovered = this._ghostTextView.isHovered;\n\n\t\tthis._register(this._ghostTextView.onDidClick((e) => {\n\t\t\tthis._onDidClick.fire(new InlineEditClickEvent(e));\n\t\t}));\n\n\t\tthis._register(this._editorObs.createOverlayWidget({\n\t\t\tdomNode: this._view.element,\n\t\t\tposition: constObservable(null),\n\t\t\tallowEditorOverflow: false,\n\t\t\tminContentWidthInPx: derived(this, reader => {\n\t\t\t\tconst info = this._overlayLayout.read(reader);\n\t\t\t\tif (info === null) { return 0; }\n\t\t\t\treturn info.minContentWidthRequired;\n\t\t\t}),\n\t\t}));\n\t}\n\n\tprivate readonly _display = derived(this, reader => !!this._state.read(reader) ? 'block' : 'none');\n\n\tprivate readonly _editorMaxContentWidthInRange = derived(this, reader => {\n\t\tconst state = this._state.read(reader);\n\t\tif (!state) {\n\t\t\treturn 0;\n\t\t}\n\t\tthis._editorObs.versionId.read(reader);\n\t\tconst textModel = this._editor.getModel()!;\n\t\tconst eol = textModel.getEOL();\n\n\t\tconst textBeforeInsertion = state.text.startsWith(eol) ? '' : textModel.getValueInRange(new Range(state.lineNumber, 1, state.lineNumber, state.column));\n\t\tconst textAfterInsertion = textModel.getValueInRange(new Range(state.lineNumber, state.column, state.lineNumber, textModel.getLineLength(state.lineNumber) + 1));\n\t\tconst text = textBeforeInsertion + state.text + textAfterInsertion;\n\t\tconst lines = text.split(eol);\n\n\t\tconst renderOptions = RenderOptions.fromEditor(this._editor).withSetWidth(false).withScrollBeyondLastColumn(0);\n\t\tconst lineWidths = lines.map(line => {\n\t\t\tconst t = textModel.tokenization.tokenizeLinesAt(state.lineNumber, [line])?.[0];\n\t\t\tlet tokens: LineTokens;\n\t\t\tif (t) {\n\t\t\t\ttokens = TokenArray.fromLineTokens(t).toLineTokens(line, this._languageService.languageIdCodec);\n\t\t\t} else {\n\t\t\t\ttokens = LineTokens.createEmpty(line, this._languageService.languageIdCodec);\n\t\t\t}\n\n\t\t\treturn renderLines(new LineSource([tokens]), renderOptions, [], $('div'), true).minWidthInPx;\n\t\t});\n\n\t\t// Take the max value that we observed.\n\t\t// Reset when either the edit changes or the editor text version.\n\t\treturn Math.max(...lineWidths);\n\t});\n\n\tpublic readonly startLineOffset = this._trimVertically.map(v => v.topOffset);\n\tpublic readonly originalLines = this._state.map(s => s ?\n\t\tnew LineRange(\n\t\t\ts.lineNumber,\n\t\t\tMath.min(s.lineNumber + 2, this._editor.getModel()!.getLineCount() + 1)\n\t\t) : undefined\n\t);\n\n\tprivate readonly _overlayLayout = derived(this, (reader) => {\n\t\tthis._ghostText.read(reader);\n\t\tconst state = this._state.read(reader);\n\t\tif (!state) {\n\t\t\treturn null;\n\t\t}\n\n\t\t// Update the overlay when the position changes\n\t\tthis._editorObs.observePosition(observableValue(this, new Position(state.lineNumber, state.column)), reader.store).read(reader);\n\n\t\tconst editorLayout = this._editorObs.layoutInfo.read(reader);\n\t\tconst horizontalScrollOffset = this._editorObs.scrollLeft.read(reader);\n\t\tconst verticalScrollbarWidth = this._editorObs.layoutInfoVerticalScrollbarWidth.read(reader);\n\n\t\tconst right = editorLayout.contentLeft + this._editorMaxContentWidthInRange.read(reader) - horizontalScrollOffset;\n\t\tconst prefixLeftOffset = this._maxPrefixTrim.read(reader).prefixLeftOffset ?? 0 /* fix due to observable bug? */;\n\t\tconst left = editorLayout.contentLeft + prefixLeftOffset - horizontalScrollOffset;\n\t\tif (right <= left) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst { topOffset: topTrim, bottomOffset: bottomTrim } = this._trimVertically.read(reader);\n\n\t\tconst scrollTop = this._editorObs.scrollTop.read(reader);\n\t\tconst height = this._ghostTextView.height.read(reader) - topTrim - bottomTrim;\n\t\tconst top = this._editor.getTopForLineNumber(state.lineNumber) - scrollTop + topTrim;\n\t\tconst bottom = top + height;\n\n\t\tconst overlay = new Rect(left, top, right, bottom);\n\n\t\treturn {\n\t\t\toverlay,\n\t\t\tstartsAtContentLeft: prefixLeftOffset === 0,\n\t\t\tcontentLeft: editorLayout.contentLeft,\n\t\t\tminContentWidthRequired: prefixLeftOffset + overlay.width + verticalScrollbarWidth,\n\t\t};\n\t}).recomputeInitiallyAndOnChange(this._store);\n\n\tprivate readonly _modifiedOverlay = n.div({\n\t\tstyle: { pointerEvents: 'none', }\n\t}, derived(this, reader => {\n\t\tconst overlayLayoutObs = mapOutFalsy(this._overlayLayout).read(reader);\n\t\tif (!overlayLayoutObs) { return undefined; }\n\n\t\t// Create an overlay which hides the left hand side of the original overlay when it overflows to the left\n\t\t// such that there is a smooth transition at the edge of content left\n\t\tconst overlayHider = overlayLayoutObs.map(layoutInfo => Rect.fromLeftTopRightBottom(\n\t\t\tlayoutInfo.contentLeft - BORDER_RADIUS - BORDER_WIDTH,\n\t\t\tlayoutInfo.overlay.top,\n\t\t\tlayoutInfo.contentLeft,\n\t\t\tlayoutInfo.overlay.bottom\n\t\t)).read(reader);\n\n\t\tconst separatorWidth = this._input.map(i => i?.inDiffEditor ? WIDGET_SEPARATOR_DIFF_EDITOR_WIDTH : WIDGET_SEPARATOR_WIDTH).read(reader);\n\t\tconst overlayRect = overlayLayoutObs.map(l => l.overlay.withMargin(0, BORDER_WIDTH, 0, l.startsAtContentLeft ? 0 : BORDER_WIDTH).intersectHorizontal(new OffsetRange(overlayHider.left, Number.MAX_SAFE_INTEGER)));\n\t\tconst underlayRect = overlayRect.map(rect => rect.withMargin(separatorWidth, separatorWidth));\n\n\t\treturn [\n\t\t\tn.div({\n\t\t\t\tclass: 'originalUnderlayInsertion',\n\t\t\t\tstyle: {\n\t\t\t\t\t...underlayRect.read(reader).toStyles(),\n\t\t\t\t\tborderRadius: BORDER_RADIUS,\n\t\t\t\t\tborder: `${BORDER_WIDTH + separatorWidth}px solid ${asCssVariable(editorBackground)}`,\n\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t}\n\t\t\t}),\n\t\t\tn.div({\n\t\t\t\tclass: 'originalOverlayInsertion',\n\t\t\t\tstyle: {\n\t\t\t\t\t...overlayRect.read(reader).toStyles(),\n\t\t\t\t\tborderRadius: BORDER_RADIUS,\n\t\t\t\t\tborder: getModifiedBorderColor(this._tabAction).map(bc => `${BORDER_WIDTH}px solid ${asCssVariable(bc)}`),\n\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\tbackgroundColor: asCssVariable(modifiedBackgroundColor),\n\t\t\t\t}\n\t\t\t}),\n\t\t\tn.div({\n\t\t\t\tclass: 'originalOverlayHiderInsertion',\n\t\t\t\tstyle: {\n\t\t\t\t\t...overlayHider.toStyles(),\n\t\t\t\t\tbackgroundColor: asCssVariable(editorBackground),\n\t\t\t\t}\n\t\t\t})\n\t\t];\n\t})).keepUpdated(this._store);\n\n\tprivate readonly _view = n.div({\n\t\tclass: 'inline-edits-view',\n\t\tstyle: {\n\t\t\tposition: 'absolute',\n\t\t\toverflow: 'visible',\n\t\t\ttop: '0px',\n\t\t\tleft: '0px',\n\t\t\tdisplay: this._display,\n\t\t},\n\t}, [\n\t\t[this._modifiedOverlay],\n\t]).keepUpdated(this._store);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsInsertionView.ts","vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsInsertionView.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;gGAGgG;AAChG,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,0CAA0C,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,2CAA2C,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,OAAO,EAAe,eAAe,EAAE,MAAM,gDAAgD,CAAC;AACxH,OAAO,EAAE,qBAAqB,EAAE,MAAM,qEAAqE,CAAC;AAC5G,OAAO,EAAE,aAAa,EAAE,MAAM,0DAA0D,CAAC;AAEzF,OAAO,EAAwB,oBAAoB,EAAE,MAAM,mDAAmD,CAAC;AAC/G,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,2FAA2F,CAAC;AACnJ,OAAO,EAAE,IAAI,EAAE,MAAM,0CAA0C,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,2CAA2C,CAAC;AACrE,OAAO,EAAE,KAAK,EAAE,MAAM,wCAAwC,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,mDAAmD,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,qDAAqD,CAAC;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM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O,EAAE,SAAS;aACa,CAAC;QAClC,CAAC,CAAC,EACF;YACC,YAAY,EAAE,CAAC,aAAa,CAAC;YAC7B,WAAW,EAAE,IAAI;YACjB,sBAAsB,EAAE,IAAI;SAC5B,CACD,CAAC,CAAC;QAEH,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC;QAE/C,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,EAAE;YACnD,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC,CAAC;QAEJ,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC;YAClD,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO;YAC3B,QAAQ,EAAE,eAAe,CAAC,IAAI,CAAC;YAC/B,mBAAmB,EAAE,KAAK;YAC1B,mBAAmB,EAAE,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE;gBAC3C,MAAM,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBAC9C,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;oBAAC,OAAO,CAAC,CAAC;gBAAC,CAAC;gBAChC,OAAO,IAAI,CAAC,uBAAuB,CAAC;YACrC,CAAC,CAAC;SACF,CAAC,CAAC,CAAC;IACL,CAAC;CAgJD,CAAA;AAhSY,wBAAwB;IAkGlC,WAAA,qBAAqB,CAAA;IACrB,WAAA,gBAAgB,CAAA;GAnGN,wBAAwB,CAgSpC","file":"inlineEditsInsertionView.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 *--------------------------------------------------------------------------------------------*/\nimport { $, n } from '../../../../../../../base/browser/dom.js';\nimport { Emitter } from '../../../../../../../base/common/event.js';\nimport { Disposable } from '../../../../../../../base/common/lifecycle.js';\nimport { constObservable, derived, IObservable, observableValue } from '../../../../../../../base/common/observable.js';\nimport { IInstantiationService } from '../../../../../../../platform/instantiation/common/instantiation.js';\nimport { asCssVariable } from '../../../../../../../platform/theme/common/colorUtils.js';\nimport { ICodeEditor } from '../../../../../../browser/editorBrowser.js';\nimport { ObservableCodeEditor, observableCodeEditor } from '../../../../../../browser/observableCodeEditor.js';\nimport { LineSource, renderLines, RenderOptions } from '../../../../../../browser/widget/diffEditor/components/diffEditorViewZones/renderLines.js';\nimport { Rect } from '../../../../../../common/core/2d/rect.js';\nimport { Position } from '../../../../../../common/core/position.js';\nimport { Range } from '../../../../../../common/core/range.js';\nimport { LineRange } from '../../../../../../common/core/ranges/lineRange.js';\nimport { OffsetRange } from '../../../../../../common/core/ranges/offsetRange.js';\nimport { ILanguageService } from '../../../../../../common/languages/language.js';\nimport { LineTokens, TokenArray } from '../../../../../../common/tokens/lineTokens.js';\nimport { InlineDecoration, InlineDecorationType } from '../../../../../../common/viewModel/inlineDecorations.js';\nimport { GhostText, GhostTextPart } from '../../../model/ghostText.js';\nimport { InlineCompletionEditorType } from '../../../model/provideInlineCompletions.js';\nimport { GhostTextView, IGhostTextWidgetData } from '../../ghostText/ghostTextView.js';\nimport { IInlineEditsView, InlineEditClickEvent, InlineEditTabAction } from '../inlineEditsViewInterface.js';\nimport { getEditorBackgroundColor, getModifiedBorderColor, INLINE_EDITS_BORDER_RADIUS, modifiedBackgroundColor } from '../theme.js';\nimport { getPrefixTrim, mapOutFalsy } from '../utils/utils.js';\n\nconst BORDER_WIDTH = 1;\nconst WIDGET_SEPARATOR_WIDTH = 1;\nconst WIDGET_SEPARATOR_DIFF_EDITOR_WIDTH = 3;\nconst BORDER_RADIUS = INLINE_EDITS_BORDER_RADIUS;\n\nexport class InlineEditsInsertionView extends Disposable implements IInlineEditsView {\n\tprivate readonly _editorObs: ObservableCodeEditor;\n\n\tprivate readonly _onDidClick = this._register(new Emitter<InlineEditClickEvent>());\n\treadonly onDidClick = this._onDidClick.event;\n\n\tprivate readonly _state = derived(this, reader => {\n\t\tconst state = this._input.read(reader);\n\t\tif (!state) { return undefined; }\n\n\t\tconst textModel = this._editor.getModel()!;\n\t\tconst eol = textModel.getEOL();\n\n\t\tif (state.startColumn === 1 && state.lineNumber > 1 && textModel.getLineLength(state.lineNumber) !== 0 && state.text.endsWith(eol) && !state.text.startsWith(eol)) {\n\t\t\tconst endOfLineColumn = textModel.getLineLength(state.lineNumber - 1) + 1;\n\t\t\treturn { lineNumber: state.lineNumber - 1, column: endOfLineColumn, text: eol + state.text.slice(0, -eol.length) };\n\t\t}\n\n\t\treturn { lineNumber: state.lineNumber, column: state.startColumn, text: state.text };\n\t});\n\n\tprivate readonly _trimVertically = derived(this, reader => {\n\t\tconst state = this._state.read(reader);\n\t\tconst text = state?.text;\n\t\tif (!text || text.trim() === '') {\n\t\t\treturn { topOffset: 0, bottomOffset: 0, linesTop: 0, linesBottom: 0 };\n\t\t}\n\n\t\t// Adjust for leading/trailing newlines\n\t\tconst lineHeight = this._editor.getLineHeightForPosition(new Position(state.lineNumber, 1));\n\t\tconst eol = this._editor.getModel()!.getEOL();\n\t\tlet linesTop = 0;\n\t\tlet linesBottom = 0;\n\n\t\tlet i = 0;\n\t\tfor (; i < text.length && text.startsWith(eol, i); i += eol.length) {\n\t\t\tlinesTop += 1;\n\t\t}\n\n\t\tfor (let j = text.length; j > i && text.endsWith(eol, j); j -= eol.length) {\n\t\t\tlinesBottom += 1;\n\t\t}\n\n\t\treturn { topOffset: linesTop * lineHeight, bottomOffset: linesBottom * lineHeight, linesTop, linesBottom };\n\t});\n\n\tprivate readonly _maxPrefixTrim = derived(this, reader => {\n\t\tconst state = this._state.read(reader);\n\t\tif (!state) {\n\t\t\treturn { prefixLeftOffset: 0, prefixTrim: 0 };\n\t\t}\n\n\t\tconst textModel = this._editor.getModel()!;\n\t\tconst eol = textModel.getEOL();\n\n\t\tconst trimVertically = this._trimVertically.read(reader);\n\n\t\tconst lines = state.text.split(eol);\n\t\tconst modifiedLines = lines.slice(trimVertically.linesTop, lines.length - trimVertically.linesBottom);\n\t\tif (trimVertically.linesTop === 0) {\n\t\t\tmodifiedLines[0] = textModel.getLineContent(state.lineNumber) + modifiedLines[0];\n\t\t}\n\n\t\tconst originalRange = new LineRange(state.lineNumber, state.lineNumber + (trimVertically.linesTop > 0 ? 0 : 1));\n\n\t\treturn getPrefixTrim([], originalRange, modifiedLines, this._editor);\n\t});\n\n\tprivate readonly _ghostText = derived<GhostText | undefined>(reader => {\n\t\tconst state = this._state.read(reader);\n\t\tconst prefixTrim = this._maxPrefixTrim.read(reader);\n\t\tif (!state) { return undefined; }\n\n\t\tconst textModel = this._editor.getModel()!;\n\t\tconst eol = textModel.getEOL();\n\t\tconst modifiedLines = state.text.split(eol);\n\n\t\tconst inlineDecorations = modifiedLines.map((line, i) => new InlineDecoration(\n\t\t\tnew Range(i + 1, i === 0 ? 1 : prefixTrim.prefixTrim + 1, i + 1, line.length + 1),\n\t\t\t'modified-background',\n\t\t\tInlineDecorationType.Regular\n\t\t));\n\n\t\treturn new GhostText(state.lineNumber, [new GhostTextPart(state.column, state.text, false, inlineDecorations)]);\n\t});\n\n\tprotected readonly _ghostTextView: GhostTextView;\n\treadonly isHovered: IObservable<boolean>;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tprivate readonly _input: IObservable<{\n\t\t\tlineNumber: number;\n\t\t\tstartColumn: number;\n\t\t\ttext: string;\n\t\t\teditorType: InlineCompletionEditorType;\n\t\t} | undefined>,\n\t\tprivate readonly _tabAction: IObservable<InlineEditTabAction>,\n\t\t@IInstantiationService instantiationService: IInstantiationService,\n\t\t@ILanguageService private readonly _languageService: ILanguageService,\n\t) {\n\t\tsuper();\n\n\t\tthis._editorObs = observableCodeEditor(this._editor);\n\n\t\tthis._ghostTextView = this._register(instantiationService.createInstance(\n\t\t\tGhostTextView,\n\t\t\tthis._editor,\n\t\t\tderived(reader => {\n\t\t\t\tconst ghostText = this._ghostText.read(reader);\n\t\t\t\tif (!ghostText) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tghostText: ghostText,\n\t\t\t\t\thandleInlineCompletionShown: (data) => {\n\t\t\t\t\t\t// This is a no-op for the insertion view, as it is handled by the InlineEditsView.\n\t\t\t\t\t},\n\t\t\t\t\twarning: undefined,\n\t\t\t\t} satisfies IGhostTextWidgetData;\n\t\t\t}),\n\t\t\t{\n\t\t\t\textraClasses: ['inline-edit'],\n\t\t\t\tisClickable: true,\n\t\t\t\tshouldKeepCursorStable: true,\n\t\t\t}\n\t\t));\n\n\t\tthis.isHovered = this._ghostTextView.isHovered;\n\n\t\tthis._register(this._ghostTextView.onDidClick((e) => {\n\t\t\tthis._onDidClick.fire(new InlineEditClickEvent(e));\n\t\t}));\n\n\t\tthis._register(this._editorObs.createOverlayWidget({\n\t\t\tdomNode: this._view.element,\n\t\t\tposition: constObservable(null),\n\t\t\tallowEditorOverflow: false,\n\t\t\tminContentWidthInPx: derived(this, reader => {\n\t\t\t\tconst info = this._overlayLayout.read(reader);\n\t\t\t\tif (info === null) { return 0; }\n\t\t\t\treturn info.minContentWidthRequired;\n\t\t\t}),\n\t\t}));\n\t}\n\n\tprivate readonly _display = derived(this, reader => !!this._state.read(reader) ? 'block' : 'none');\n\n\tprivate readonly _editorMaxContentWidthInRange = derived(this, reader => {\n\t\tconst state = this._state.read(reader);\n\t\tif (!state) {\n\t\t\treturn 0;\n\t\t}\n\t\tthis._editorObs.versionId.read(reader);\n\t\tconst textModel = this._editor.getModel()!;\n\t\tconst eol = textModel.getEOL();\n\n\t\tconst textBeforeInsertion = state.text.startsWith(eol) ? '' : textModel.getValueInRange(new Range(state.lineNumber, 1, state.lineNumber, state.column));\n\t\tconst textAfterInsertion = textModel.getValueInRange(new Range(state.lineNumber, state.column, state.lineNumber, textModel.getLineLength(state.lineNumber) + 1));\n\t\tconst text = textBeforeInsertion + state.text + textAfterInsertion;\n\t\tconst lines = text.split(eol);\n\n\t\tconst renderOptions = RenderOptions.fromEditor(this._editor).withSetWidth(false).withScrollBeyondLastColumn(0);\n\t\tconst lineWidths = lines.map(line => {\n\t\t\tconst t = textModel.tokenization.tokenizeLinesAt(state.lineNumber, [line])?.[0];\n\t\t\tlet tokens: LineTokens;\n\t\t\tif (t) {\n\t\t\t\ttokens = TokenArray.fromLineTokens(t).toLineTokens(line, this._languageService.languageIdCodec);\n\t\t\t} else {\n\t\t\t\ttokens = LineTokens.createEmpty(line, this._languageService.languageIdCodec);\n\t\t\t}\n\n\t\t\treturn renderLines(new LineSource([tokens]), renderOptions, [], $('div'), true).minWidthInPx;\n\t\t});\n\n\t\t// Take the max value that we observed.\n\t\t// Reset when either the edit changes or the editor text version.\n\t\treturn Math.max(...lineWidths);\n\t});\n\n\tpublic readonly startLineOffset = this._trimVertically.map(v => v.topOffset);\n\tpublic readonly originalLines = this._state.map(s => s ?\n\t\tnew LineRange(\n\t\t\ts.lineNumber,\n\t\t\tMath.min(s.lineNumber + 2, this._editor.getModel()!.getLineCount() + 1)\n\t\t) : undefined\n\t);\n\n\tprivate readonly _overlayLayout = derived(this, (reader) => {\n\t\tthis._ghostText.read(reader);\n\t\tconst state = this._state.read(reader);\n\t\tif (!state) {\n\t\t\treturn null;\n\t\t}\n\n\t\t// Update the overlay when the position changes\n\t\tthis._editorObs.observePosition(observableValue(this, new Position(state.lineNumber, state.column)), reader.store).read(reader);\n\n\t\tconst editorLayout = this._editorObs.layoutInfo.read(reader);\n\t\tconst horizontalScrollOffset = this._editorObs.scrollLeft.read(reader);\n\t\tconst verticalScrollbarWidth = this._editorObs.layoutInfoVerticalScrollbarWidth.read(reader);\n\n\t\tconst right = editorLayout.contentLeft + this._editorMaxContentWidthInRange.read(reader) - horizontalScrollOffset;\n\t\tconst prefixLeftOffset = this._maxPrefixTrim.read(reader).prefixLeftOffset ?? 0 /* fix due to observable bug? */;\n\t\tconst left = editorLayout.contentLeft + prefixLeftOffset - horizontalScrollOffset;\n\t\tif (right <= left) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst { topOffset: topTrim, bottomOffset: bottomTrim } = this._trimVertically.read(reader);\n\n\t\tconst scrollTop = this._editorObs.scrollTop.read(reader);\n\t\tconst height = this._ghostTextView.height.read(reader) - topTrim - bottomTrim;\n\t\tconst top = this._editor.getTopForLineNumber(state.lineNumber) - scrollTop + topTrim;\n\t\tconst bottom = top + height;\n\n\t\tconst overlay = new Rect(left, top, right, bottom);\n\n\t\treturn {\n\t\t\toverlay,\n\t\t\tstartsAtContentLeft: prefixLeftOffset === 0,\n\t\t\tcontentLeft: editorLayout.contentLeft,\n\t\t\tminContentWidthRequired: prefixLeftOffset + overlay.width + verticalScrollbarWidth,\n\t\t};\n\t}).recomputeInitiallyAndOnChange(this._store);\n\n\tprivate readonly _modifiedOverlay = n.div({\n\t\tstyle: { pointerEvents: 'none', }\n\t}, derived(this, reader => {\n\t\tconst overlayLayoutObs = mapOutFalsy(this._overlayLayout).read(reader);\n\t\tif (!overlayLayoutObs) { return undefined; }\n\n\t\t// Create an overlay which hides the left hand side of the original overlay when it overflows to the left\n\t\t// such that there is a smooth transition at the edge of content left\n\t\tconst overlayHider = overlayLayoutObs.map(layoutInfo => Rect.fromLeftTopRightBottom(\n\t\t\tlayoutInfo.contentLeft - BORDER_RADIUS - BORDER_WIDTH,\n\t\t\tlayoutInfo.overlay.top,\n\t\t\tlayoutInfo.contentLeft,\n\t\t\tlayoutInfo.overlay.bottom\n\t\t)).read(reader);\n\n\t\tconst separatorWidth = this._input.map(i => i?.editorType === InlineCompletionEditorType.DiffEditor ? WIDGET_SEPARATOR_DIFF_EDITOR_WIDTH : WIDGET_SEPARATOR_WIDTH).read(reader);\n\t\tconst overlayRect = overlayLayoutObs.map(l => l.overlay.withMargin(0, BORDER_WIDTH, 0, l.startsAtContentLeft ? 0 : BORDER_WIDTH).intersectHorizontal(new OffsetRange(overlayHider.left, Number.MAX_SAFE_INTEGER)));\n\t\tconst underlayRect = overlayRect.map(rect => rect.withMargin(separatorWidth, separatorWidth));\n\n\t\tconst editorBackground = getEditorBackgroundColor(this._input.read(undefined)?.editorType ?? InlineCompletionEditorType.TextEditor);\n\t\treturn [\n\t\t\tn.div({\n\t\t\t\tclass: 'originalUnderlayInsertion',\n\t\t\t\tstyle: {\n\t\t\t\t\t...underlayRect.read(reader).toStyles(),\n\t\t\t\t\tborderRadius: BORDER_RADIUS,\n\t\t\t\t\tborder: `${BORDER_WIDTH + separatorWidth}px solid ${editorBackground}`,\n\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t}\n\t\t\t}),\n\t\t\tn.div({\n\t\t\t\tclass: 'originalOverlayInsertion',\n\t\t\t\tstyle: {\n\t\t\t\t\t...overlayRect.read(reader).toStyles(),\n\t\t\t\t\tborderRadius: BORDER_RADIUS,\n\t\t\t\t\tborder: getModifiedBorderColor(this._tabAction).map(bc => `${BORDER_WIDTH}px solid ${asCssVariable(bc)}`),\n\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\tbackgroundColor: asCssVariable(modifiedBackgroundColor),\n\t\t\t\t}\n\t\t\t}),\n\t\t\tn.div({\n\t\t\t\tclass: 'originalOverlayHiderInsertion',\n\t\t\t\tstyle: {\n\t\t\t\t\t...overlayHider.toStyles(),\n\t\t\t\t\tbackgroundColor: editorBackground,\n\t\t\t\t}\n\t\t\t})\n\t\t];\n\t})).keepUpdated(this._store);\n\n\tprivate readonly _view = n.div({\n\t\tclass: 'inline-edits-view',\n\t\tstyle: {\n\t\t\tposition: 'absolute',\n\t\t\toverflow: 'visible',\n\t\t\ttop: '0px',\n\t\t\tleft: '0px',\n\t\t\tdisplay: this._display,\n\t\t},\n\t}, [\n\t\t[this._modifiedOverlay],\n\t]).keepUpdated(this._store);\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 *--------------------------------------------------------------------------------------------*/\nimport { $, n } from '../../../../../../../base/browser/dom.js';\nimport { Emitter } from '../../../../../../../base/common/event.js';\nimport { Disposable } from '../../../../../../../base/common/lifecycle.js';\nimport { constObservable, derived, IObservable, observableValue } from '../../../../../../../base/common/observable.js';\nimport { IInstantiationService } from '../../../../../../../platform/instantiation/common/instantiation.js';\nimport { asCssVariable } from '../../../../../../../platform/theme/common/colorUtils.js';\nimport { ICodeEditor } from '../../../../../../browser/editorBrowser.js';\nimport { ObservableCodeEditor, observableCodeEditor } from '../../../../../../browser/observableCodeEditor.js';\nimport { LineSource, renderLines, RenderOptions } from '../../../../../../browser/widget/diffEditor/components/diffEditorViewZones/renderLines.js';\nimport { Rect } from '../../../../../../common/core/2d/rect.js';\nimport { Position } from '../../../../../../common/core/position.js';\nimport { Range } from '../../../../../../common/core/range.js';\nimport { LineRange } from '../../../../../../common/core/ranges/lineRange.js';\nimport { OffsetRange } from '../../../../../../common/core/ranges/offsetRange.js';\nimport { ILanguageService } from '../../../../../../common/languages/language.js';\nimport { LineTokens, TokenArray } from '../../../../../../common/tokens/lineTokens.js';\nimport { InlineDecoration, InlineDecorationType } from '../../../../../../common/viewModel/inlineDecorations.js';\nimport { GhostText, GhostTextPart } from '../../../model/ghostText.js';\nimport { InlineCompletionEditorType } from '../../../model/provideInlineCompletions.js';\nimport { GhostTextView, IGhostTextWidgetData } from '../../ghostText/ghostTextView.js';\nimport { IInlineEditsView, InlineEditClickEvent, InlineEditTabAction } from '../inlineEditsViewInterface.js';\nimport { getEditorBackgroundColor, getModifiedBorderColor, INLINE_EDITS_BORDER_RADIUS, modifiedBackgroundColor } from '../theme.js';\nimport { getPrefixTrim, mapOutFalsy } from '../utils/utils.js';\n\nconst BORDER_WIDTH = 1;\nconst WIDGET_SEPARATOR_WIDTH = 1;\nconst WIDGET_SEPARATOR_DIFF_EDITOR_WIDTH = 3;\nconst BORDER_RADIUS = INLINE_EDITS_BORDER_RADIUS;\n\nexport class InlineEditsInsertionView extends Disposable implements IInlineEditsView {\n\tprivate readonly _editorObs: ObservableCodeEditor;\n\n\tprivate readonly _onDidClick = this._register(new Emitter<InlineEditClickEvent>());\n\treadonly onDidClick = this._onDidClick.event;\n\n\tprivate readonly _state = derived(this, reader => {\n\t\tconst state = this._input.read(reader);\n\t\tif (!state) { return undefined; }\n\n\t\tconst textModel = this._editor.getModel()!;\n\t\tconst eol = textModel.getEOL();\n\n\t\tif (state.startColumn === 1 && state.lineNumber > 1 && textModel.getLineLength(state.lineNumber) !== 0 && state.text.endsWith(eol) && !state.text.startsWith(eol)) {\n\t\t\tconst endOfLineColumn = textModel.getLineLength(state.lineNumber - 1) + 1;\n\t\t\treturn { lineNumber: state.lineNumber - 1, column: endOfLineColumn, text: eol + state.text.slice(0, -eol.length) };\n\t\t}\n\n\t\treturn { lineNumber: state.lineNumber, column: state.startColumn, text: state.text };\n\t});\n\n\tprivate readonly _trimVertically = derived(this, reader => {\n\t\tconst state = this._state.read(reader);\n\t\tconst text = state?.text;\n\t\tif (!text || text.trim() === '') {\n\t\t\treturn { topOffset: 0, bottomOffset: 0, linesTop: 0, linesBottom: 0 };\n\t\t}\n\n\t\t// Adjust for leading/trailing newlines\n\t\tconst lineHeight = this._editor.getLineHeightForPosition(new Position(state.lineNumber, 1));\n\t\tconst eol = this._editor.getModel()!.getEOL();\n\t\tlet linesTop = 0;\n\t\tlet linesBottom = 0;\n\n\t\tlet i = 0;\n\t\tfor (; i < text.length && text.startsWith(eol, i); i += eol.length) {\n\t\t\tlinesTop += 1;\n\t\t}\n\n\t\tfor (let j = text.length; j > i && text.endsWith(eol, j); j -= eol.length) {\n\t\t\tlinesBottom += 1;\n\t\t}\n\n\t\treturn { topOffset: linesTop * lineHeight, bottomOffset: linesBottom * lineHeight, linesTop, linesBottom };\n\t});\n\n\tprivate readonly _maxPrefixTrim = derived(this, reader => {\n\t\tconst state = this._state.read(reader);\n\t\tif (!state) {\n\t\t\treturn { prefixLeftOffset: 0, prefixTrim: 0 };\n\t\t}\n\n\t\tconst textModel = this._editor.getModel()!;\n\t\tconst eol = textModel.getEOL();\n\n\t\tconst trimVertically = this._trimVertically.read(reader);\n\n\t\tconst lines = state.text.split(eol);\n\t\tconst modifiedLines = lines.slice(trimVertically.linesTop, lines.length - trimVertically.linesBottom);\n\t\tif (trimVertically.linesTop === 0) {\n\t\t\tmodifiedLines[0] = textModel.getLineContent(state.lineNumber) + modifiedLines[0];\n\t\t}\n\n\t\tconst originalRange = new LineRange(state.lineNumber, state.lineNumber + (trimVertically.linesTop > 0 ? 0 : 1));\n\n\t\treturn getPrefixTrim([], originalRange, modifiedLines, this._editor);\n\t});\n\n\tprivate readonly _ghostText = derived<GhostText | undefined>(reader => {\n\t\tconst state = this._state.read(reader);\n\t\tconst prefixTrim = this._maxPrefixTrim.read(reader);\n\t\tif (!state) { return undefined; }\n\n\t\tconst textModel = this._editor.getModel()!;\n\t\tconst eol = textModel.getEOL();\n\t\tconst modifiedLines = state.text.split(eol);\n\n\t\tconst inlineDecorations = modifiedLines.map((line, i) => new InlineDecoration(\n\t\t\tnew Range(i + 1, i === 0 ? 1 : prefixTrim.prefixTrim + 1, i + 1, line.length + 1),\n\t\t\t'modified-background',\n\t\t\tInlineDecorationType.Regular\n\t\t));\n\n\t\treturn new GhostText(state.lineNumber, [new GhostTextPart(state.column, state.text, false, inlineDecorations)]);\n\t});\n\n\tprotected readonly _ghostTextView: GhostTextView;\n\treadonly isHovered: IObservable<boolean>;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tprivate readonly _input: IObservable<{\n\t\t\tlineNumber: number;\n\t\t\tstartColumn: number;\n\t\t\ttext: string;\n\t\t\teditorType: InlineCompletionEditorType;\n\t\t} | undefined>,\n\t\tprivate readonly _tabAction: IObservable<InlineEditTabAction>,\n\t\t@IInstantiationService instantiationService: IInstantiationService,\n\t\t@ILanguageService private readonly _languageService: ILanguageService,\n\t) {\n\t\tsuper();\n\n\t\tthis._editorObs = observableCodeEditor(this._editor);\n\n\t\tthis._ghostTextView = this._register(instantiationService.createInstance(\n\t\t\tGhostTextView,\n\t\t\tthis._editor,\n\t\t\tderived(reader => {\n\t\t\t\tconst ghostText = this._ghostText.read(reader);\n\t\t\t\tif (!ghostText) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tghostText: ghostText,\n\t\t\t\t\thandleInlineCompletionShown: (data) => {\n\t\t\t\t\t\t// This is a no-op for the insertion view, as it is handled by the InlineEditsView.\n\t\t\t\t\t},\n\t\t\t\t\twarning: undefined,\n\t\t\t\t} satisfies IGhostTextWidgetData;\n\t\t\t}),\n\t\t\t{\n\t\t\t\textraClasses: ['inline-edit'],\n\t\t\t\tisClickable: true,\n\t\t\t\tshouldKeepCursorStable: true,\n\t\t\t}\n\t\t));\n\n\t\tthis.isHovered = this._ghostTextView.isHovered;\n\n\t\tthis._register(this._ghostTextView.onDidClick((e) => {\n\t\t\tthis._onDidClick.fire(new InlineEditClickEvent(e));\n\t\t}));\n\n\t\tthis._register(this._editorObs.createOverlayWidget({\n\t\t\tdomNode: this._view.element,\n\t\t\tposition: constObservable(null),\n\t\t\tallowEditorOverflow: false,\n\t\t\tminContentWidthInPx: derived(this, reader => {\n\t\t\t\tconst info = this._overlayLayout.read(reader);\n\t\t\t\tif (info === null) { return 0; }\n\t\t\t\treturn info.minContentWidthRequired;\n\t\t\t}),\n\t\t}));\n\t}\n\n\tprivate readonly _display = derived(this, reader => !!this._state.read(reader) ? 'block' : 'none');\n\n\tprivate readonly _editorMaxContentWidthInRange = derived(this, reader => {\n\t\tconst state = this._state.read(reader);\n\t\tif (!state) {\n\t\t\treturn 0;\n\t\t}\n\t\tthis._editorObs.versionId.read(reader);\n\t\tconst textModel = this._editor.getModel()!;\n\t\tconst eol = textModel.getEOL();\n\n\t\tconst textBeforeInsertion = state.text.startsWith(eol) ? '' : textModel.getValueInRange(new Range(state.lineNumber, 1, state.lineNumber, state.column));\n\t\tconst textAfterInsertion = textModel.getValueInRange(new Range(state.lineNumber, state.column, state.lineNumber, textModel.getLineLength(state.lineNumber) + 1));\n\t\tconst text = textBeforeInsertion + state.text + textAfterInsertion;\n\t\tconst lines = text.split(eol);\n\n\t\tconst renderOptions = RenderOptions.fromEditor(this._editor).withSetWidth(false).withScrollBeyondLastColumn(0);\n\t\tconst lineWidths = lines.map(line => {\n\t\t\tconst t = textModel.tokenization.tokenizeLinesAt(state.lineNumber, [line])?.[0];\n\t\t\tlet tokens: LineTokens;\n\t\t\tif (t) {\n\t\t\t\ttokens = TokenArray.fromLineTokens(t).toLineTokens(line, this._languageService.languageIdCodec);\n\t\t\t} else {\n\t\t\t\ttokens = LineTokens.createEmpty(line, this._languageService.languageIdCodec);\n\t\t\t}\n\n\t\t\treturn renderLines(new LineSource([tokens]), renderOptions, [], $('div'), true).minWidthInPx;\n\t\t});\n\n\t\t// Take the max value that we observed.\n\t\t// Reset when either the edit changes or the editor text version.\n\t\treturn Math.max(...lineWidths);\n\t});\n\n\tpublic readonly startLineOffset = this._trimVertically.map(v => v.topOffset);\n\tpublic readonly originalLines = this._state.map(s => s ?\n\t\tnew LineRange(\n\t\t\ts.lineNumber,\n\t\t\tMath.min(s.lineNumber + 2, this._editor.getModel()!.getLineCount() + 1)\n\t\t) : undefined\n\t);\n\n\tprivate readonly _overlayLayout = derived(this, (reader) => {\n\t\tthis._ghostText.read(reader);\n\t\tconst state = this._state.read(reader);\n\t\tif (!state) {\n\t\t\treturn null;\n\t\t}\n\n\t\t// Update the overlay when the position changes\n\t\tthis._editorObs.observePosition(observableValue(this, new Position(state.lineNumber, state.column)), reader.store).read(reader);\n\n\t\tconst editorLayout = this._editorObs.layoutInfo.read(reader);\n\t\tconst horizontalScrollOffset = this._editorObs.scrollLeft.read(reader);\n\t\tconst verticalScrollbarWidth = this._editorObs.layoutInfoVerticalScrollbarWidth.read(reader);\n\n\t\tconst right = editorLayout.contentLeft + this._editorMaxContentWidthInRange.read(reader) - horizontalScrollOffset;\n\t\tconst prefixLeftOffset = this._maxPrefixTrim.read(reader).prefixLeftOffset ?? 0 /* fix due to observable bug? */;\n\t\tconst left = editorLayout.contentLeft + prefixLeftOffset - horizontalScrollOffset;\n\t\tif (right <= left) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst { topOffset: topTrim, bottomOffset: bottomTrim } = this._trimVertically.read(reader);\n\n\t\tconst scrollTop = this._editorObs.scrollTop.read(reader);\n\t\tconst height = this._ghostTextView.height.read(reader) - topTrim - bottomTrim;\n\t\tconst top = this._editor.getTopForLineNumber(state.lineNumber) - scrollTop + topTrim;\n\t\tconst bottom = top + height;\n\n\t\tconst overlay = new Rect(left, top, right, bottom);\n\n\t\treturn {\n\t\t\toverlay,\n\t\t\tstartsAtContentLeft: prefixLeftOffset === 0,\n\t\t\tcontentLeft: editorLayout.contentLeft,\n\t\t\tminContentWidthRequired: prefixLeftOffset + overlay.width + verticalScrollbarWidth,\n\t\t};\n\t}).recomputeInitiallyAndOnChange(this._store);\n\n\tprivate readonly _modifiedOverlay = n.div({\n\t\tstyle: { pointerEvents: 'none', }\n\t}, derived(this, reader => {\n\t\tconst overlayLayoutObs = mapOutFalsy(this._overlayLayout).read(reader);\n\t\tif (!overlayLayoutObs) { return undefined; }\n\n\t\t// Create an overlay which hides the left hand side of the original overlay when it overflows to the left\n\t\t// such that there is a smooth transition at the edge of content left\n\t\tconst overlayHider = overlayLayoutObs.map(layoutInfo => Rect.fromLeftTopRightBottom(\n\t\t\tlayoutInfo.contentLeft - BORDER_RADIUS - BORDER_WIDTH,\n\t\t\tlayoutInfo.overlay.top,\n\t\t\tlayoutInfo.contentLeft,\n\t\t\tlayoutInfo.overlay.bottom\n\t\t)).read(reader);\n\n\t\tconst separatorWidth = this._input.map(i => i?.editorType === InlineCompletionEditorType.DiffEditor ? WIDGET_SEPARATOR_DIFF_EDITOR_WIDTH : WIDGET_SEPARATOR_WIDTH).read(reader);\n\t\tconst overlayRect = overlayLayoutObs.map(l => l.overlay.withMargin(0, BORDER_WIDTH, 0, l.startsAtContentLeft ? 0 : BORDER_WIDTH).intersectHorizontal(new OffsetRange(overlayHider.left, Number.MAX_SAFE_INTEGER)));\n\t\tconst underlayRect = overlayRect.map(rect => rect.withMargin(separatorWidth, separatorWidth));\n\n\t\tconst editorBackground = getEditorBackgroundColor(this._input.read(undefined)?.editorType ?? InlineCompletionEditorType.TextEditor);\n\t\treturn [\n\t\t\tn.div({\n\t\t\t\tclass: 'originalUnderlayInsertion',\n\t\t\t\tstyle: {\n\t\t\t\t\t...underlayRect.read(reader).toStyles(),\n\t\t\t\t\tborderRadius: BORDER_RADIUS,\n\t\t\t\t\tborder: `${BORDER_WIDTH + separatorWidth}px solid ${editorBackground}`,\n\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t}\n\t\t\t}),\n\t\t\tn.div({\n\t\t\t\tclass: 'originalOverlayInsertion',\n\t\t\t\tstyle: {\n\t\t\t\t\t...overlayRect.read(reader).toStyles(),\n\t\t\t\t\tborderRadius: BORDER_RADIUS,\n\t\t\t\t\tborder: getModifiedBorderColor(this._tabAction).map(bc => `${BORDER_WIDTH}px solid ${asCssVariable(bc)}`),\n\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\tbackgroundColor: asCssVariable(modifiedBackgroundColor),\n\t\t\t\t}\n\t\t\t}),\n\t\t\tn.div({\n\t\t\t\tclass: 'originalOverlayHiderInsertion',\n\t\t\t\tstyle: {\n\t\t\t\t\t...overlayHider.toStyles(),\n\t\t\t\t\tbackgroundColor: editorBackground,\n\t\t\t\t}\n\t\t\t})\n\t\t];\n\t})).keepUpdated(this._store);\n\n\tprivate readonly _view = n.div({\n\t\tclass: 'inline-edits-view',\n\t\tstyle: {\n\t\t\tposition: 'absolute',\n\t\t\toverflow: 'visible',\n\t\t\ttop: '0px',\n\t\t\tleft: '0px',\n\t\t\tdisplay: this._display,\n\t\t},\n\t}, [\n\t\t[this._modifiedOverlay],\n\t]).keepUpdated(this._store);\n}\n"]}
|
|
@@ -15,7 +15,7 @@ import { $, n } from '../../../../../../../base/browser/dom.js';
|
|
|
15
15
|
import { Emitter } from '../../../../../../../base/common/event.js';
|
|
16
16
|
import { Disposable, toDisposable } from '../../../../../../../base/common/lifecycle.js';
|
|
17
17
|
import { autorunDelta, constObservable, derived } from '../../../../../../../base/common/observable.js';
|
|
18
|
-
import {
|
|
18
|
+
import { scrollbarShadow } from '../../../../../../../platform/theme/common/colorRegistry.js';
|
|
19
19
|
import { asCssVariable } from '../../../../../../../platform/theme/common/colorUtils.js';
|
|
20
20
|
import { IThemeService } from '../../../../../../../platform/theme/common/themeService.js';
|
|
21
21
|
import { EditorMouseEvent } from '../../../../../../browser/editorDom.js';
|
|
@@ -27,15 +27,16 @@ import { OffsetRange } from '../../../../../../common/core/ranges/offsetRange.js
|
|
|
27
27
|
import { ILanguageService } from '../../../../../../common/languages/language.js';
|
|
28
28
|
import { LineTokens, TokenArray } from '../../../../../../common/tokens/lineTokens.js';
|
|
29
29
|
import { InlineDecoration } from '../../../../../../common/viewModel/inlineDecorations.js';
|
|
30
|
+
import { InlineCompletionEditorType } from '../../../model/provideInlineCompletions.js';
|
|
30
31
|
import { InlineEditClickEvent } from '../inlineEditsViewInterface.js';
|
|
31
|
-
import { getEditorBlendedColor, getModifiedBorderColor, getOriginalBorderColor, INLINE_EDITS_BORDER_RADIUS, modifiedChangedLineBackgroundColor, originalBackgroundColor } from '../theme.js';
|
|
32
|
+
import { getEditorBackgroundColor, getEditorBlendedColor, getModifiedBorderColor, getOriginalBorderColor, INLINE_EDITS_BORDER_RADIUS, modifiedChangedLineBackgroundColor, originalBackgroundColor } from '../theme.js';
|
|
32
33
|
import { getEditorValidOverlayRect, getPrefixTrim, mapOutFalsy, rectToProps } from '../utils/utils.js';
|
|
33
34
|
let InlineEditsLineReplacementView = class InlineEditsLineReplacementView extends Disposable {
|
|
34
|
-
constructor(_editor, _edit,
|
|
35
|
+
constructor(_editor, _edit, _editorType, _tabAction, _languageService, _themeService) {
|
|
35
36
|
super();
|
|
36
37
|
this._editor = _editor;
|
|
37
38
|
this._edit = _edit;
|
|
38
|
-
this.
|
|
39
|
+
this._editorType = _editorType;
|
|
39
40
|
this._tabAction = _tabAction;
|
|
40
41
|
this._languageService = _languageService;
|
|
41
42
|
this._themeService = _themeService;
|
|
@@ -156,7 +157,7 @@ let InlineEditsLineReplacementView = class InlineEditsLineReplacementView extend
|
|
|
156
157
|
}
|
|
157
158
|
const layoutProps = layout.read(reader);
|
|
158
159
|
const contentLeft = this._editor.layoutInfoContentLeft.read(reader);
|
|
159
|
-
const separatorWidth = this.
|
|
160
|
+
const separatorWidth = this._editorType.read(reader) === InlineCompletionEditorType.DiffEditor ? 3 : 1;
|
|
160
161
|
modifiedLineElements.lines.forEach((l, i) => {
|
|
161
162
|
l.style.width = `${layoutProps.lowerText.width}px`;
|
|
162
163
|
l.style.height = `${layoutProps.modifiedLineHeights[i]}px`;
|
|
@@ -164,6 +165,7 @@ let InlineEditsLineReplacementView = class InlineEditsLineReplacementView extend
|
|
|
164
165
|
});
|
|
165
166
|
const modifiedBorderColor = getModifiedBorderColor(this._tabAction).read(reader);
|
|
166
167
|
const originalBorderColor = getOriginalBorderColor(this._tabAction).read(reader);
|
|
168
|
+
const editorBackground = getEditorBackgroundColor(this._editorType.read(reader));
|
|
167
169
|
return [
|
|
168
170
|
n.div({
|
|
169
171
|
style: {
|
|
@@ -179,7 +181,7 @@ let InlineEditsLineReplacementView = class InlineEditsLineReplacementView extend
|
|
|
179
181
|
position: 'absolute',
|
|
180
182
|
...rectToProps(reader => layout.read(reader).background.translateX(-contentLeft).withMargin(separatorWidth)),
|
|
181
183
|
borderRadius: `${INLINE_EDITS_BORDER_RADIUS}px`,
|
|
182
|
-
border: `${separatorWidth + 1}px solid ${
|
|
184
|
+
border: `${separatorWidth + 1}px solid ${editorBackground}`,
|
|
183
185
|
boxSizing: 'border-box',
|
|
184
186
|
pointerEvents: 'none',
|
|
185
187
|
}
|
|
@@ -202,7 +204,7 @@ let InlineEditsLineReplacementView = class InlineEditsLineReplacementView extend
|
|
|
202
204
|
position: 'absolute',
|
|
203
205
|
...rectToProps(reader => layout.read(reader).lowerBackground.translateX(-contentLeft)),
|
|
204
206
|
borderRadius: `0 0 ${INLINE_EDITS_BORDER_RADIUS}px ${INLINE_EDITS_BORDER_RADIUS}px`,
|
|
205
|
-
background:
|
|
207
|
+
background: editorBackground,
|
|
206
208
|
boxShadow: `${asCssVariable(scrollbarShadow)} 0 6px 6px -6px`,
|
|
207
209
|
border: `1px solid ${asCssVariable(modifiedBorderColor)}`,
|
|
208
210
|
boxSizing: 'border-box',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsLineReplacementView.ts","vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsLineReplacementView.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;AAEhG,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,0CAA0C,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,2CAA2C,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAC;AACzF,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,OAAO,EAAe,MAAM,gDAAgD,CAAC;AACrH,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,6DAA6D,CAAC;AAChH,OAAO,EAAE,aAAa,EAAE,MAAM,0DAA0D,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,MAAM,4DAA4D,CAAC;AAE3F,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAE1E,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,aAAa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AE,CAAC;QAEtH,MAAM,gBAAgB,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,GAAG,EAAE,CAAC;QAC7D,IAAI,gBAAgB,KAAK,IAAI,IAAI,gBAAgB,IAAI,YAAY,CAAC,UAAU,EAAE,CAAC;YAC9E,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;QACtF,CAAC;IACF,CAAC;CACD,CAAA;AAjVY,8BAA8B;IA8BxC,WAAA,gBAAgB,CAAA;IAChB,WAAA,aAAa,CAAA;GA/BH,8BAA8B,CAiV1C;;AAED,SAAS,oBAAoB,CAAC,MAAe;IAC5C,MAAM,MAAM,GAAY,EAAE,CAAC;IAC3B,OAAO,MAAM,CAAC,MAAM,EAAE,CAAC;QACtB,IAAI,KAAK,GAAG,MAAM,CAAC,KAAK,EAAG,CAAC;QAC5B,IAAI,KAAK,CAAC,eAAe,KAAK,KAAK,CAAC,aAAa,EAAE,CAAC;YACnD,MAAM,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,eAAe,GAAG,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;YAC3F,KAAK,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC,eAAe,EAAE,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,eAAe,EAAE,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,4BAA4B;QAC1I,CAAC;QAED,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACpB,CAAC;IACD,OAAO,MAAM,CAAC;AAEf,CAAC","file":"inlineEditsLineReplacementView.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { $, n } from '../../../../../../../base/browser/dom.js';\nimport { Emitter } from '../../../../../../../base/common/event.js';\nimport { Disposable, toDisposable } from '../../../../../../../base/common/lifecycle.js';\nimport { autorunDelta, constObservable, derived, IObservable } from '../../../../../../../base/common/observable.js';\nimport { editorBackground, scrollbarShadow } from '../../../../../../../platform/theme/common/colorRegistry.js';\nimport { asCssVariable } from '../../../../../../../platform/theme/common/colorUtils.js';\nimport { IThemeService } from '../../../../../../../platform/theme/common/themeService.js';\nimport { IEditorMouseEvent, IViewZoneChangeAccessor } from '../../../../../../browser/editorBrowser.js';\nimport { EditorMouseEvent } from '../../../../../../browser/editorDom.js';\nimport { ObservableCodeEditor } from '../../../../../../browser/observableCodeEditor.js';\nimport { LineSource, renderLines, RenderOptions } from '../../../../../../browser/widget/diffEditor/components/diffEditorViewZones/renderLines.js';\nimport { EditorOption } from '../../../../../../common/config/editorOptions.js';\nimport { Point } from '../../../../../../common/core/2d/point.js';\nimport { Rect } from '../../../../../../common/core/2d/rect.js';\nimport { Range } from '../../../../../../common/core/range.js';\nimport { LineRange } from '../../../../../../common/core/ranges/lineRange.js';\nimport { OffsetRange } from '../../../../../../common/core/ranges/offsetRange.js';\nimport { ILanguageService } from '../../../../../../common/languages/language.js';\nimport { LineTokens, TokenArray } from '../../../../../../common/tokens/lineTokens.js';\nimport { InlineDecoration, InlineDecorationType } from '../../../../../../common/viewModel/inlineDecorations.js';\nimport { IInlineEditsView, InlineEditClickEvent, InlineEditTabAction } from '../inlineEditsViewInterface.js';\nimport { getEditorBlendedColor, getModifiedBorderColor, getOriginalBorderColor, INLINE_EDITS_BORDER_RADIUS, modifiedChangedLineBackgroundColor, originalBackgroundColor } from '../theme.js';\nimport { getEditorValidOverlayRect, getPrefixTrim, mapOutFalsy, rectToProps } from '../utils/utils.js';\n\nexport class InlineEditsLineReplacementView extends Disposable implements IInlineEditsView {\n\n\tprivate readonly _onDidClick = this._register(new Emitter<InlineEditClickEvent>());\n\treadonly onDidClick = this._onDidClick.event;\n\n\tprivate readonly _maxPrefixTrim;\n\n\tprivate readonly _modifiedLineElements;\n\n\n\tprivate readonly _layout;\n\n\tprivate readonly _viewZoneInfo;\n\n\tprivate readonly _div;\n\n\treadonly isHovered;\n\n\treadonly minEditorScrollHeight;\n\n\tconstructor(\n\t\tprivate readonly _editor: ObservableCodeEditor,\n\t\tprivate readonly _edit: IObservable<{\n\t\t\toriginalRange: LineRange;\n\t\t\tmodifiedRange: LineRange;\n\t\t\tmodifiedLines: string[];\n\t\t\treplacements: Replacement[];\n\t\t} | undefined>,\n\t\tprivate readonly _isInDiffEditor: IObservable<boolean>,\n\t\tprivate readonly _tabAction: IObservable<InlineEditTabAction>,\n\t\t@ILanguageService private readonly _languageService: ILanguageService,\n\t\t@IThemeService private readonly _themeService: IThemeService,\n\t) {\n\t\tsuper();\n\t\tthis._maxPrefixTrim = this._edit.map((e, reader) => e ? getPrefixTrim(e.replacements.flatMap(r => [r.originalRange, r.modifiedRange]), e.originalRange, e.modifiedLines, this._editor.editor, reader) : undefined);\n\t\tthis._modifiedLineElements = derived(this, reader => {\n\t\t\tconst lines = [];\n\t\t\tlet requiredWidth = 0;\n\n\t\t\tconst prefixTrim = this._maxPrefixTrim.read(reader);\n\t\t\tconst edit = this._edit.read(reader);\n\t\t\tif (!edit || !prefixTrim) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst maxPrefixTrim = prefixTrim.prefixTrim;\n\t\t\tconst modifiedBubbles = rangesToBubbleRanges(edit.replacements.map(r => r.modifiedRange)).map(r => new Range(r.startLineNumber, r.startColumn - maxPrefixTrim, r.endLineNumber, r.endColumn - maxPrefixTrim));\n\n\t\t\tconst textModel = this._editor.model.get()!;\n\t\t\tconst startLineNumber = edit.modifiedRange.startLineNumber;\n\t\t\tfor (let i = 0; i < edit.modifiedRange.length; i++) {\n\t\t\t\tconst line = document.createElement('div');\n\t\t\t\tconst lineNumber = startLineNumber + i;\n\t\t\t\tconst modLine = edit.modifiedLines[i].slice(maxPrefixTrim);\n\n\t\t\t\tconst t = textModel.tokenization.tokenizeLinesAt(lineNumber, [modLine])?.[0];\n\t\t\t\tlet tokens: LineTokens;\n\t\t\t\tif (t) {\n\t\t\t\t\ttokens = TokenArray.fromLineTokens(t).toLineTokens(modLine, this._languageService.languageIdCodec);\n\t\t\t\t} else {\n\t\t\t\t\ttokens = LineTokens.createEmpty(modLine, this._languageService.languageIdCodec);\n\t\t\t\t}\n\n\t\t\t\tconst decorations = [];\n\t\t\t\tfor (const modified of modifiedBubbles.filter(b => b.startLineNumber === lineNumber)) {\n\t\t\t\t\tconst validatedEndColumn = Math.min(modified.endColumn, modLine.length + 1);\n\t\t\t\t\tdecorations.push(new InlineDecoration(new Range(1, modified.startColumn, 1, validatedEndColumn), 'inlineCompletions-modified-bubble', InlineDecorationType.Regular));\n\t\t\t\t}\n\n\t\t\t\t// TODO: All lines should be rendered at once for one dom element\n\t\t\t\tconst result = renderLines(new LineSource([tokens]), RenderOptions.fromEditor(this._editor.editor).withSetWidth(false).withScrollBeyondLastColumn(0), decorations, line, true);\n\t\t\t\tthis._editor.getOption(EditorOption.fontInfo).read(reader); // update when font info changes\n\n\t\t\t\trequiredWidth = Math.max(requiredWidth, result.minWidthInPx);\n\n\t\t\t\tlines.push(line);\n\t\t\t}\n\n\t\t\treturn { lines, requiredWidth: requiredWidth };\n\t\t});\n\t\tthis._layout = derived(this, reader => {\n\t\t\tconst modifiedLines = this._modifiedLineElements.read(reader);\n\t\t\tconst maxPrefixTrim = this._maxPrefixTrim.read(reader);\n\t\t\tconst edit = this._edit.read(reader);\n\t\t\tif (!modifiedLines || !maxPrefixTrim || !edit) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst { prefixLeftOffset } = maxPrefixTrim;\n\t\t\tconst { requiredWidth } = modifiedLines;\n\n\t\t\tconst originalLineHeights = this._editor.observeLineHeightsForLineRange(edit.originalRange).read(reader);\n\t\t\tconst modifiedLineHeights = (() => {\n\t\t\t\tconst lineHeights = originalLineHeights.slice(0, edit.modifiedRange.length);\n\t\t\t\twhile (lineHeights.length < edit.modifiedRange.length) {\n\t\t\t\t\tlineHeights.push(originalLineHeights[originalLineHeights.length - 1]);\n\t\t\t\t}\n\t\t\t\treturn lineHeights;\n\t\t\t})();\n\n\t\t\tconst contentLeft = this._editor.layoutInfoContentLeft.read(reader);\n\t\t\tconst verticalScrollbarWidth = this._editor.layoutInfoVerticalScrollbarWidth.read(reader);\n\t\t\tconst scrollLeft = this._editor.scrollLeft.read(reader);\n\t\t\tconst scrollTop = this._editor.scrollTop.read(reader);\n\t\t\tconst editorLeftOffset = contentLeft - scrollLeft;\n\n\t\t\tconst textModel = this._editor.editor.getModel()!;\n\n\t\t\tconst originalLineWidths = edit.originalRange.mapToLineArray(line => this._editor.editor.getOffsetForColumn(line, textModel.getLineMaxColumn(line)) - prefixLeftOffset);\n\t\t\tconst maxLineWidth = Math.max(...originalLineWidths, requiredWidth);\n\n\t\t\tconst startLineNumber = edit.originalRange.startLineNumber;\n\t\t\tconst endLineNumber = edit.originalRange.endLineNumberExclusive - 1;\n\t\t\tconst topOfOriginalLines = this._editor.editor.getTopForLineNumber(startLineNumber) - scrollTop;\n\t\t\tconst bottomOfOriginalLines = this._editor.editor.getBottomForLineNumber(endLineNumber) - scrollTop;\n\n\t\t\t// Box Widget positioning\n\t\t\tconst originalLinesOverlay = Rect.fromLeftTopWidthHeight(\n\t\t\t\teditorLeftOffset + prefixLeftOffset,\n\t\t\t\ttopOfOriginalLines,\n\t\t\t\tmaxLineWidth,\n\t\t\t\tbottomOfOriginalLines - topOfOriginalLines\n\t\t\t);\n\t\t\tconst modifiedLinesOverlay = Rect.fromLeftTopWidthHeight(\n\t\t\t\toriginalLinesOverlay.left,\n\t\t\t\toriginalLinesOverlay.bottom,\n\t\t\t\toriginalLinesOverlay.width,\n\t\t\t\tmodifiedLineHeights.reduce((sum, h) => sum + h, 0)\n\t\t\t);\n\t\t\tconst background = Rect.hull([originalLinesOverlay, modifiedLinesOverlay]);\n\n\t\t\tconst lowerBackground = background.intersectVertical(new OffsetRange(originalLinesOverlay.bottom, Number.MAX_SAFE_INTEGER));\n\t\t\tconst lowerText = new Rect(lowerBackground.left, lowerBackground.top, lowerBackground.right, lowerBackground.bottom);\n\n\t\t\treturn {\n\t\t\t\toriginalLinesOverlay,\n\t\t\t\tmodifiedLinesOverlay,\n\t\t\t\tbackground,\n\t\t\t\tlowerBackground,\n\t\t\t\tlowerText,\n\t\t\t\tmodifiedLineHeights,\n\t\t\t\tminContentWidthRequired: prefixLeftOffset + maxLineWidth + verticalScrollbarWidth,\n\t\t\t};\n\t\t});\n\t\tthis._viewZoneInfo = derived<{ height: number; lineNumber: number } | undefined>(reader => {\n\t\t\tconst shouldShowViewZone = this._editor.getOption(EditorOption.inlineSuggest).map(o => o.edits.allowCodeShifting === 'always').read(reader);\n\t\t\tif (!shouldShowViewZone) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst layout = this._layout.read(reader);\n\t\t\tconst edit = this._edit.read(reader);\n\t\t\tif (!layout || !edit) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst viewZoneHeight = layout.lowerBackground.height;\n\t\t\tconst viewZoneLineNumber = edit.originalRange.endLineNumberExclusive;\n\t\t\treturn { height: viewZoneHeight, lineNumber: viewZoneLineNumber };\n\t\t});\n\t\tthis.minEditorScrollHeight = derived(this, reader => {\n\t\t\tconst layout = mapOutFalsy(this._layout).read(reader);\n\t\t\tif (!layout || this._viewZoneInfo.read(reader) !== undefined) {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\treturn layout.read(reader).lowerText.bottom + this._editor.editor.getScrollTop();\n\t\t});\n\t\tthis._div = n.div({\n\t\t\tclass: 'line-replacement',\n\t\t}, [\n\t\t\tderived(this, reader => {\n\t\t\t\tconst layout = mapOutFalsy(this._layout).read(reader);\n\t\t\t\tconst modifiedLineElements = this._modifiedLineElements.read(reader);\n\t\t\t\tif (!layout || !modifiedLineElements) {\n\t\t\t\t\treturn [];\n\t\t\t\t}\n\n\t\t\t\tconst layoutProps = layout.read(reader);\n\t\t\t\tconst contentLeft = this._editor.layoutInfoContentLeft.read(reader);\n\n\t\t\t\tconst separatorWidth = this._isInDiffEditor.read(reader) ? 3 : 1;\n\n\t\t\t\tmodifiedLineElements.lines.forEach((l, i) => {\n\t\t\t\t\tl.style.width = `${layoutProps.lowerText.width}px`;\n\t\t\t\t\tl.style.height = `${layoutProps.modifiedLineHeights[i]}px`;\n\t\t\t\t\tl.style.position = 'relative';\n\t\t\t\t});\n\n\t\t\t\tconst modifiedBorderColor = getModifiedBorderColor(this._tabAction).read(reader);\n\t\t\t\tconst originalBorderColor = getOriginalBorderColor(this._tabAction).read(reader);\n\n\t\t\t\treturn [\n\t\t\t\t\tn.div({\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t...rectToProps((r) => getEditorValidOverlayRect(this._editor).read(r)),\n\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t\t\t}\n\t\t\t\t\t}, [\n\t\t\t\t\t\tn.div({\n\t\t\t\t\t\t\tclass: 'borderAroundLineReplacement',\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\t...rectToProps(reader => layout.read(reader).background.translateX(-contentLeft).withMargin(separatorWidth)),\n\t\t\t\t\t\t\t\tborderRadius: `${INLINE_EDITS_BORDER_RADIUS}px`,\n\n\t\t\t\t\t\t\t\tborder: `${separatorWidth + 1}px solid ${asCssVariable(editorBackground)}`,\n\t\t\t\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tn.div({\n\t\t\t\t\t\t\tclass: 'originalOverlayLineReplacement',\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\t...rectToProps(reader => layout.read(reader).background.translateX(-contentLeft)),\n\t\t\t\t\t\t\t\tborderRadius: `${INLINE_EDITS_BORDER_RADIUS}px`,\n\n\t\t\t\t\t\t\t\tborder: getEditorBlendedColor(originalBorderColor, this._themeService).map(c => `1px solid ${c.toString()}`),\n\t\t\t\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\t\t\t\tbackground: asCssVariable(originalBackgroundColor),\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tn.div({\n\t\t\t\t\t\t\tclass: 'modifiedOverlayLineReplacement',\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\t...rectToProps(reader => layout.read(reader).lowerBackground.translateX(-contentLeft)),\n\t\t\t\t\t\t\t\tborderRadius: `0 0 ${INLINE_EDITS_BORDER_RADIUS}px ${INLINE_EDITS_BORDER_RADIUS}px`,\n\t\t\t\t\t\t\t\tbackground: asCssVariable(editorBackground),\n\t\t\t\t\t\t\t\tboxShadow: `${asCssVariable(scrollbarShadow)} 0 6px 6px -6px`,\n\t\t\t\t\t\t\t\tborder: `1px solid ${asCssVariable(modifiedBorderColor)}`,\n\t\t\t\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\t\tcursor: 'pointer',\n\t\t\t\t\t\t\t\tpointerEvents: 'auto',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tonmousedown: e => {\n\t\t\t\t\t\t\t\te.preventDefault(); // This prevents that the editor loses focus\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tonclick: (e) => this._onDidClick.fire(InlineEditClickEvent.create(e)),\n\t\t\t\t\t\t}, [\n\t\t\t\t\t\t\tn.div({\n\t\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\t\tposition: 'absolute', top: 0, left: 0, width: '100%', height: '100%',\n\t\t\t\t\t\t\t\t\tbackground: asCssVariable(modifiedChangedLineBackgroundColor),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tn.div({\n\t\t\t\t\t\t\tclass: 'modifiedLinesLineReplacement',\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\t\t\t\t...rectToProps(reader => layout.read(reader).lowerText.translateX(-contentLeft)),\n\t\t\t\t\t\t\t\tfontFamily: this._editor.getOption(EditorOption.fontFamily),\n\t\t\t\t\t\t\t\tfontSize: this._editor.getOption(EditorOption.fontSize),\n\t\t\t\t\t\t\t\tfontWeight: this._editor.getOption(EditorOption.fontWeight),\n\t\t\t\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t\t\t\t\twhiteSpace: 'nowrap',\n\t\t\t\t\t\t\t\tborderRadius: `0 0 ${INLINE_EDITS_BORDER_RADIUS}px ${INLINE_EDITS_BORDER_RADIUS}px`,\n\t\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, [...modifiedLineElements.lines]),\n\t\t\t\t\t])\n\t\t\t\t];\n\t\t\t})\n\t\t]).keepUpdated(this._store);\n\t\tthis.isHovered = this._editor.isTargetHovered((e) => this._isMouseOverWidget(e), this._store);\n\t\tthis._previousViewZoneInfo = undefined;\n\n\t\tthis._register(toDisposable(() => this._editor.editor.changeViewZones(accessor => this.removePreviousViewZone(accessor))));\n\n\t\tthis._register(autorunDelta(this._viewZoneInfo, ({ lastValue, newValue }) => {\n\t\t\tif (lastValue === newValue || (lastValue?.height === newValue?.height && lastValue?.lineNumber === newValue?.lineNumber)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis._editor.editor.changeViewZones((changeAccessor) => {\n\t\t\t\tthis.removePreviousViewZone(changeAccessor);\n\t\t\t\tif (!newValue) { return; }\n\t\t\t\tthis.addViewZone(newValue, changeAccessor);\n\t\t\t});\n\t\t}));\n\n\t\tthis._register(this._editor.createOverlayWidget({\n\t\t\tdomNode: this._div.element,\n\t\t\tminContentWidthInPx: derived(this, reader => {\n\t\t\t\treturn this._layout.read(reader)?.minContentWidthRequired ?? 0;\n\t\t\t}),\n\t\t\tposition: constObservable({ preference: { top: 0, left: 0 } }),\n\t\t\tallowEditorOverflow: false,\n\t\t}));\n\t}\n\n\tprivate _isMouseOverWidget(e: IEditorMouseEvent): boolean {\n\t\tconst layout = this._layout.get();\n\t\tif (!layout || !(e.event instanceof EditorMouseEvent)) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn layout.lowerBackground.containsPoint(new Point(e.event.relativePos.x, e.event.relativePos.y));\n\t}\n\n\t// View Zones\n\tprivate _previousViewZoneInfo: { height: number; lineNumber: number; id: string } | undefined;\n\n\tprivate removePreviousViewZone(changeAccessor: IViewZoneChangeAccessor) {\n\t\tif (!this._previousViewZoneInfo) {\n\t\t\treturn;\n\t\t}\n\n\t\tchangeAccessor.removeZone(this._previousViewZoneInfo.id);\n\n\t\tconst cursorLineNumber = this._editor.cursorLineNumber.get();\n\t\tif (cursorLineNumber !== null && cursorLineNumber >= this._previousViewZoneInfo.lineNumber) {\n\t\t\tthis._editor.editor.setScrollTop(this._editor.scrollTop.get() - this._previousViewZoneInfo.height);\n\t\t}\n\n\t\tthis._previousViewZoneInfo = undefined;\n\t}\n\n\tprivate addViewZone(viewZoneInfo: { height: number; lineNumber: number }, changeAccessor: IViewZoneChangeAccessor) {\n\t\tconst activeViewZone = changeAccessor.addZone({\n\t\t\tafterLineNumber: viewZoneInfo.lineNumber - 1,\n\t\t\theightInPx: viewZoneInfo.height, // move computation to layout?\n\t\t\tdomNode: $('div'),\n\t\t});\n\n\t\tthis._previousViewZoneInfo = { height: viewZoneInfo.height, lineNumber: viewZoneInfo.lineNumber, id: activeViewZone };\n\n\t\tconst cursorLineNumber = this._editor.cursorLineNumber.get();\n\t\tif (cursorLineNumber !== null && cursorLineNumber >= viewZoneInfo.lineNumber) {\n\t\t\tthis._editor.editor.setScrollTop(this._editor.scrollTop.get() + viewZoneInfo.height);\n\t\t}\n\t}\n}\n\nfunction rangesToBubbleRanges(ranges: Range[]): Range[] {\n\tconst result: Range[] = [];\n\twhile (ranges.length) {\n\t\tlet range = ranges.shift()!;\n\t\tif (range.startLineNumber !== range.endLineNumber) {\n\t\t\tranges.push(new Range(range.startLineNumber + 1, 1, range.endLineNumber, range.endColumn));\n\t\t\trange = new Range(range.startLineNumber, range.startColumn, range.startLineNumber, Number.MAX_SAFE_INTEGER); // TODO: this is not correct\n\t\t}\n\n\t\tresult.push(range);\n\t}\n\treturn result;\n\n}\n\nexport interface Replacement {\n\toriginalRange: Range;\n\tmodifiedRange: Range;\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { $, n } from '../../../../../../../base/browser/dom.js';\nimport { Emitter } from '../../../../../../../base/common/event.js';\nimport { Disposable, toDisposable } from '../../../../../../../base/common/lifecycle.js';\nimport { autorunDelta, constObservable, derived, IObservable } from '../../../../../../../base/common/observable.js';\nimport { editorBackground, scrollbarShadow } from '../../../../../../../platform/theme/common/colorRegistry.js';\nimport { asCssVariable } from '../../../../../../../platform/theme/common/colorUtils.js';\nimport { IThemeService } from '../../../../../../../platform/theme/common/themeService.js';\nimport { IEditorMouseEvent, IViewZoneChangeAccessor } from '../../../../../../browser/editorBrowser.js';\nimport { EditorMouseEvent } from '../../../../../../browser/editorDom.js';\nimport { ObservableCodeEditor } from '../../../../../../browser/observableCodeEditor.js';\nimport { LineSource, renderLines, RenderOptions } from '../../../../../../browser/widget/diffEditor/components/diffEditorViewZones/renderLines.js';\nimport { EditorOption } from '../../../../../../common/config/editorOptions.js';\nimport { Point } from '../../../../../../common/core/2d/point.js';\nimport { Rect } from '../../../../../../common/core/2d/rect.js';\nimport { Range } from '../../../../../../common/core/range.js';\nimport { LineRange } from '../../../../../../common/core/ranges/lineRange.js';\nimport { OffsetRange } from '../../../../../../common/core/ranges/offsetRange.js';\nimport { ILanguageService } from '../../../../../../common/languages/language.js';\nimport { LineTokens, TokenArray } from '../../../../../../common/tokens/lineTokens.js';\nimport { InlineDecoration, InlineDecorationType } from '../../../../../../common/viewModel/inlineDecorations.js';\nimport { IInlineEditsView, InlineEditClickEvent, InlineEditTabAction } from '../inlineEditsViewInterface.js';\nimport { getEditorBlendedColor, getModifiedBorderColor, getOriginalBorderColor, INLINE_EDITS_BORDER_RADIUS, modifiedChangedLineBackgroundColor, originalBackgroundColor } from '../theme.js';\nimport { getEditorValidOverlayRect, getPrefixTrim, mapOutFalsy, rectToProps } from '../utils/utils.js';\n\nexport class InlineEditsLineReplacementView extends Disposable implements IInlineEditsView {\n\n\tprivate readonly _onDidClick = this._register(new Emitter<InlineEditClickEvent>());\n\treadonly onDidClick = this._onDidClick.event;\n\n\tprivate readonly _maxPrefixTrim;\n\n\tprivate readonly _modifiedLineElements;\n\n\n\tprivate readonly _layout;\n\n\tprivate readonly _viewZoneInfo;\n\n\tprivate readonly _div;\n\n\treadonly isHovered;\n\n\treadonly minEditorScrollHeight;\n\n\tconstructor(\n\t\tprivate readonly _editor: ObservableCodeEditor,\n\t\tprivate readonly _edit: IObservable<{\n\t\t\toriginalRange: LineRange;\n\t\t\tmodifiedRange: LineRange;\n\t\t\tmodifiedLines: string[];\n\t\t\treplacements: Replacement[];\n\t\t} | undefined>,\n\t\tprivate readonly _isInDiffEditor: IObservable<boolean>,\n\t\tprivate readonly _tabAction: IObservable<InlineEditTabAction>,\n\t\t@ILanguageService private readonly _languageService: ILanguageService,\n\t\t@IThemeService private readonly _themeService: IThemeService,\n\t) {\n\t\tsuper();\n\t\tthis._maxPrefixTrim = this._edit.map((e, reader) => e ? getPrefixTrim(e.replacements.flatMap(r => [r.originalRange, r.modifiedRange]), e.originalRange, e.modifiedLines, this._editor.editor, reader) : undefined);\n\t\tthis._modifiedLineElements = derived(this, reader => {\n\t\t\tconst lines = [];\n\t\t\tlet requiredWidth = 0;\n\n\t\t\tconst prefixTrim = this._maxPrefixTrim.read(reader);\n\t\t\tconst edit = this._edit.read(reader);\n\t\t\tif (!edit || !prefixTrim) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst maxPrefixTrim = prefixTrim.prefixTrim;\n\t\t\tconst modifiedBubbles = rangesToBubbleRanges(edit.replacements.map(r => r.modifiedRange)).map(r => new Range(r.startLineNumber, r.startColumn - maxPrefixTrim, r.endLineNumber, r.endColumn - maxPrefixTrim));\n\n\t\t\tconst textModel = this._editor.model.get()!;\n\t\t\tconst startLineNumber = edit.modifiedRange.startLineNumber;\n\t\t\tfor (let i = 0; i < edit.modifiedRange.length; i++) {\n\t\t\t\tconst line = document.createElement('div');\n\t\t\t\tconst lineNumber = startLineNumber + i;\n\t\t\t\tconst modLine = edit.modifiedLines[i].slice(maxPrefixTrim);\n\n\t\t\t\tconst t = textModel.tokenization.tokenizeLinesAt(lineNumber, [modLine])?.[0];\n\t\t\t\tlet tokens: LineTokens;\n\t\t\t\tif (t) {\n\t\t\t\t\ttokens = TokenArray.fromLineTokens(t).toLineTokens(modLine, this._languageService.languageIdCodec);\n\t\t\t\t} else {\n\t\t\t\t\ttokens = LineTokens.createEmpty(modLine, this._languageService.languageIdCodec);\n\t\t\t\t}\n\n\t\t\t\tconst decorations = [];\n\t\t\t\tfor (const modified of modifiedBubbles.filter(b => b.startLineNumber === lineNumber)) {\n\t\t\t\t\tconst validatedEndColumn = Math.min(modified.endColumn, modLine.length + 1);\n\t\t\t\t\tdecorations.push(new InlineDecoration(new Range(1, modified.startColumn, 1, validatedEndColumn), 'inlineCompletions-modified-bubble', InlineDecorationType.Regular));\n\t\t\t\t}\n\n\t\t\t\t// TODO: All lines should be rendered at once for one dom element\n\t\t\t\tconst result = renderLines(new LineSource([tokens]), RenderOptions.fromEditor(this._editor.editor).withSetWidth(false).withScrollBeyondLastColumn(0), decorations, line, true);\n\t\t\t\tthis._editor.getOption(EditorOption.fontInfo).read(reader); // update when font info changes\n\n\t\t\t\trequiredWidth = Math.max(requiredWidth, result.minWidthInPx);\n\n\t\t\t\tlines.push(line);\n\t\t\t}\n\n\t\t\treturn { lines, requiredWidth: requiredWidth };\n\t\t});\n\t\tthis._layout = derived(this, reader => {\n\t\t\tconst modifiedLines = this._modifiedLineElements.read(reader);\n\t\t\tconst maxPrefixTrim = this._maxPrefixTrim.read(reader);\n\t\t\tconst edit = this._edit.read(reader);\n\t\t\tif (!modifiedLines || !maxPrefixTrim || !edit) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst { prefixLeftOffset } = maxPrefixTrim;\n\t\t\tconst { requiredWidth } = modifiedLines;\n\n\t\t\tconst originalLineHeights = this._editor.observeLineHeightsForLineRange(edit.originalRange).read(reader);\n\t\t\tconst modifiedLineHeights = (() => {\n\t\t\t\tconst lineHeights = originalLineHeights.slice(0, edit.modifiedRange.length);\n\t\t\t\twhile (lineHeights.length < edit.modifiedRange.length) {\n\t\t\t\t\tlineHeights.push(originalLineHeights[originalLineHeights.length - 1]);\n\t\t\t\t}\n\t\t\t\treturn lineHeights;\n\t\t\t})();\n\n\t\t\tconst contentLeft = this._editor.layoutInfoContentLeft.read(reader);\n\t\t\tconst verticalScrollbarWidth = this._editor.layoutInfoVerticalScrollbarWidth.read(reader);\n\t\t\tconst scrollLeft = this._editor.scrollLeft.read(reader);\n\t\t\tconst scrollTop = this._editor.scrollTop.read(reader);\n\t\t\tconst editorLeftOffset = contentLeft - scrollLeft;\n\n\t\t\tconst textModel = this._editor.editor.getModel()!;\n\n\t\t\tconst originalLineWidths = edit.originalRange.mapToLineArray(line => this._editor.editor.getOffsetForColumn(line, textModel.getLineMaxColumn(line)) - prefixLeftOffset);\n\t\t\tconst maxLineWidth = Math.max(...originalLineWidths, requiredWidth);\n\n\t\t\tconst startLineNumber = edit.originalRange.startLineNumber;\n\t\t\tconst endLineNumber = edit.originalRange.endLineNumberExclusive - 1;\n\t\t\tconst topOfOriginalLines = this._editor.editor.getTopForLineNumber(startLineNumber) - scrollTop;\n\t\t\tconst bottomOfOriginalLines = this._editor.editor.getBottomForLineNumber(endLineNumber) - scrollTop;\n\n\t\t\t// Box Widget positioning\n\t\t\tconst originalLinesOverlay = Rect.fromLeftTopWidthHeight(\n\t\t\t\teditorLeftOffset + prefixLeftOffset,\n\t\t\t\ttopOfOriginalLines,\n\t\t\t\tmaxLineWidth,\n\t\t\t\tbottomOfOriginalLines - topOfOriginalLines\n\t\t\t);\n\t\t\tconst modifiedLinesOverlay = Rect.fromLeftTopWidthHeight(\n\t\t\t\toriginalLinesOverlay.left,\n\t\t\t\toriginalLinesOverlay.bottom,\n\t\t\t\toriginalLinesOverlay.width,\n\t\t\t\tmodifiedLineHeights.reduce((sum, h) => sum + h, 0)\n\t\t\t);\n\t\t\tconst background = Rect.hull([originalLinesOverlay, modifiedLinesOverlay]);\n\n\t\t\tconst lowerBackground = background.intersectVertical(new OffsetRange(originalLinesOverlay.bottom, Number.MAX_SAFE_INTEGER));\n\t\t\tconst lowerText = new Rect(lowerBackground.left, lowerBackground.top, lowerBackground.right, lowerBackground.bottom);\n\n\t\t\treturn {\n\t\t\t\toriginalLinesOverlay,\n\t\t\t\tmodifiedLinesOverlay,\n\t\t\t\tbackground,\n\t\t\t\tlowerBackground,\n\t\t\t\tlowerText,\n\t\t\t\tmodifiedLineHeights,\n\t\t\t\tminContentWidthRequired: prefixLeftOffset + maxLineWidth + verticalScrollbarWidth,\n\t\t\t};\n\t\t});\n\t\tthis._viewZoneInfo = derived<{ height: number; lineNumber: number } | undefined>(reader => {\n\t\t\tconst shouldShowViewZone = this._editor.getOption(EditorOption.inlineSuggest).map(o => o.edits.allowCodeShifting === 'always').read(reader);\n\t\t\tif (!shouldShowViewZone) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst layout = this._layout.read(reader);\n\t\t\tconst edit = this._edit.read(reader);\n\t\t\tif (!layout || !edit) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst viewZoneHeight = layout.lowerBackground.height;\n\t\t\tconst viewZoneLineNumber = edit.originalRange.endLineNumberExclusive;\n\t\t\treturn { height: viewZoneHeight, lineNumber: viewZoneLineNumber };\n\t\t});\n\t\tthis.minEditorScrollHeight = derived(this, reader => {\n\t\t\tconst layout = mapOutFalsy(this._layout).read(reader);\n\t\t\tif (!layout || this._viewZoneInfo.read(reader) !== undefined) {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\treturn layout.read(reader).lowerText.bottom + this._editor.editor.getScrollTop();\n\t\t});\n\t\tthis._div = n.div({\n\t\t\tclass: 'line-replacement',\n\t\t}, [\n\t\t\tderived(this, reader => {\n\t\t\t\tconst layout = mapOutFalsy(this._layout).read(reader);\n\t\t\t\tconst modifiedLineElements = this._modifiedLineElements.read(reader);\n\t\t\t\tif (!layout || !modifiedLineElements) {\n\t\t\t\t\treturn [];\n\t\t\t\t}\n\n\t\t\t\tconst layoutProps = layout.read(reader);\n\t\t\t\tconst contentLeft = this._editor.layoutInfoContentLeft.read(reader);\n\n\t\t\t\tconst separatorWidth = this._isInDiffEditor.read(reader) ? 3 : 1;\n\n\t\t\t\tmodifiedLineElements.lines.forEach((l, i) => {\n\t\t\t\t\tl.style.width = `${layoutProps.lowerText.width}px`;\n\t\t\t\t\tl.style.height = `${layoutProps.modifiedLineHeights[i]}px`;\n\t\t\t\t\tl.style.position = 'relative';\n\t\t\t\t});\n\n\t\t\t\tconst modifiedBorderColor = getModifiedBorderColor(this._tabAction).read(reader);\n\t\t\t\tconst originalBorderColor = getOriginalBorderColor(this._tabAction).read(reader);\n\n\t\t\t\treturn [\n\t\t\t\t\tn.div({\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t...rectToProps((r) => getEditorValidOverlayRect(this._editor).read(r)),\n\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t\t\t}\n\t\t\t\t\t}, [\n\t\t\t\t\t\tn.div({\n\t\t\t\t\t\t\tclass: 'borderAroundLineReplacement',\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\t...rectToProps(reader => layout.read(reader).background.translateX(-contentLeft).withMargin(separatorWidth)),\n\t\t\t\t\t\t\t\tborderRadius: `${INLINE_EDITS_BORDER_RADIUS}px`,\n\n\t\t\t\t\t\t\t\tborder: `${separatorWidth + 1}px solid ${asCssVariable(editorBackground)}`,\n\t\t\t\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tn.div({\n\t\t\t\t\t\t\tclass: 'originalOverlayLineReplacement',\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\t...rectToProps(reader => layout.read(reader).background.translateX(-contentLeft)),\n\t\t\t\t\t\t\t\tborderRadius: `${INLINE_EDITS_BORDER_RADIUS}px`,\n\n\t\t\t\t\t\t\t\tborder: getEditorBlendedColor(originalBorderColor, this._themeService).map(c => `1px solid ${c.toString()}`),\n\t\t\t\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\t\t\t\tbackground: asCssVariable(originalBackgroundColor),\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tn.div({\n\t\t\t\t\t\t\tclass: 'modifiedOverlayLineReplacement',\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\t...rectToProps(reader => layout.read(reader).lowerBackground.translateX(-contentLeft)),\n\t\t\t\t\t\t\t\tborderRadius: `0 0 ${INLINE_EDITS_BORDER_RADIUS}px ${INLINE_EDITS_BORDER_RADIUS}px`,\n\t\t\t\t\t\t\t\tbackground: asCssVariable(editorBackground),\n\t\t\t\t\t\t\t\tboxShadow: `${asCssVariable(scrollbarShadow)} 0 6px 6px -6px`,\n\t\t\t\t\t\t\t\tborder: `1px solid ${asCssVariable(modifiedBorderColor)}`,\n\t\t\t\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\t\tcursor: 'pointer',\n\t\t\t\t\t\t\t\tpointerEvents: 'auto',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tonmousedown: e => {\n\t\t\t\t\t\t\t\te.preventDefault(); // This prevents that the editor loses focus\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tonclick: (e) => this._onDidClick.fire(InlineEditClickEvent.create(e)),\n\t\t\t\t\t\t}, [\n\t\t\t\t\t\t\tn.div({\n\t\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\t\tposition: 'absolute', top: 0, left: 0, width: '100%', height: '100%',\n\t\t\t\t\t\t\t\t\tbackground: asCssVariable(modifiedChangedLineBackgroundColor),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tn.div({\n\t\t\t\t\t\t\tclass: 'modifiedLinesLineReplacement',\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\t\t\t\t...rectToProps(reader => layout.read(reader).lowerText.translateX(-contentLeft)),\n\t\t\t\t\t\t\t\tfontFamily: this._editor.getOption(EditorOption.fontFamily),\n\t\t\t\t\t\t\t\tfontSize: this._editor.getOption(EditorOption.fontSize),\n\t\t\t\t\t\t\t\tfontWeight: this._editor.getOption(EditorOption.fontWeight),\n\t\t\t\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t\t\t\t\twhiteSpace: 'nowrap',\n\t\t\t\t\t\t\t\tborderRadius: `0 0 ${INLINE_EDITS_BORDER_RADIUS}px ${INLINE_EDITS_BORDER_RADIUS}px`,\n\t\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, [...modifiedLineElements.lines]),\n\t\t\t\t\t])\n\t\t\t\t];\n\t\t\t})\n\t\t]).keepUpdated(this._store);\n\t\tthis.isHovered = this._editor.isTargetHovered((e) => this._isMouseOverWidget(e), this._store);\n\t\tthis._previousViewZoneInfo = undefined;\n\n\t\tthis._register(toDisposable(() => this._editor.editor.changeViewZones(accessor => this.removePreviousViewZone(accessor))));\n\n\t\tthis._register(autorunDelta(this._viewZoneInfo, ({ lastValue, newValue }) => {\n\t\t\tif (lastValue === newValue || (lastValue?.height === newValue?.height && lastValue?.lineNumber === newValue?.lineNumber)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis._editor.editor.changeViewZones((changeAccessor) => {\n\t\t\t\tthis.removePreviousViewZone(changeAccessor);\n\t\t\t\tif (!newValue) { return; }\n\t\t\t\tthis.addViewZone(newValue, changeAccessor);\n\t\t\t});\n\t\t}));\n\n\t\tthis._register(this._editor.createOverlayWidget({\n\t\t\tdomNode: this._div.element,\n\t\t\tminContentWidthInPx: derived(this, reader => {\n\t\t\t\treturn this._layout.read(reader)?.minContentWidthRequired ?? 0;\n\t\t\t}),\n\t\t\tposition: constObservable({ preference: { top: 0, left: 0 } }),\n\t\t\tallowEditorOverflow: false,\n\t\t}));\n\t}\n\n\tprivate _isMouseOverWidget(e: IEditorMouseEvent): boolean {\n\t\tconst layout = this._layout.get();\n\t\tif (!layout || !(e.event instanceof EditorMouseEvent)) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn layout.lowerBackground.containsPoint(new Point(e.event.relativePos.x, e.event.relativePos.y));\n\t}\n\n\t// View Zones\n\tprivate _previousViewZoneInfo: { height: number; lineNumber: number; id: string } | undefined;\n\n\tprivate removePreviousViewZone(changeAccessor: IViewZoneChangeAccessor) {\n\t\tif (!this._previousViewZoneInfo) {\n\t\t\treturn;\n\t\t}\n\n\t\tchangeAccessor.removeZone(this._previousViewZoneInfo.id);\n\n\t\tconst cursorLineNumber = this._editor.cursorLineNumber.get();\n\t\tif (cursorLineNumber !== null && cursorLineNumber >= this._previousViewZoneInfo.lineNumber) {\n\t\t\tthis._editor.editor.setScrollTop(this._editor.scrollTop.get() - this._previousViewZoneInfo.height);\n\t\t}\n\n\t\tthis._previousViewZoneInfo = undefined;\n\t}\n\n\tprivate addViewZone(viewZoneInfo: { height: number; lineNumber: number }, changeAccessor: IViewZoneChangeAccessor) {\n\t\tconst activeViewZone = changeAccessor.addZone({\n\t\t\tafterLineNumber: viewZoneInfo.lineNumber - 1,\n\t\t\theightInPx: viewZoneInfo.height, // move computation to layout?\n\t\t\tdomNode: $('div'),\n\t\t});\n\n\t\tthis._previousViewZoneInfo = { height: viewZoneInfo.height, lineNumber: viewZoneInfo.lineNumber, id: activeViewZone };\n\n\t\tconst cursorLineNumber = this._editor.cursorLineNumber.get();\n\t\tif (cursorLineNumber !== null && cursorLineNumber >= viewZoneInfo.lineNumber) {\n\t\t\tthis._editor.editor.setScrollTop(this._editor.scrollTop.get() + viewZoneInfo.height);\n\t\t}\n\t}\n}\n\nfunction rangesToBubbleRanges(ranges: Range[]): Range[] {\n\tconst result: Range[] = [];\n\twhile (ranges.length) {\n\t\tlet range = ranges.shift()!;\n\t\tif (range.startLineNumber !== range.endLineNumber) {\n\t\t\tranges.push(new Range(range.startLineNumber + 1, 1, range.endLineNumber, range.endColumn));\n\t\t\trange = new Range(range.startLineNumber, range.startColumn, range.startLineNumber, Number.MAX_SAFE_INTEGER); // TODO: this is not correct\n\t\t}\n\n\t\tresult.push(range);\n\t}\n\treturn result;\n\n}\n\nexport interface Replacement {\n\toriginalRange: Range;\n\tmodifiedRange: Range;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsLineReplacementView.ts","vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsLineReplacementView.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;AAEhG,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,0CAA0C,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,2CAA2C,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAC;AACzF,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,OAAO,EAAe,MAAM,gDAAgD,CAAC;AACrH,OAAO,EAAE,eAAe,EAAE,MAAM,6DAA6D,CAAC;AAC9F,OAAO,EAAE,aAAa,EAAE,MAAM,0DAA0D,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,MAAM,4DAA4D,CAAC;AAE3F,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAE1E,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,2FAA2F,CAAC;AAEnJ,OAAO,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,0CAA0C,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,MAAM,wCAAwC,CAAC;AAE/D,OAAO,EAAE,WAAW,EAAE,MAAM,qDAAqD,CAAC;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,gDAAgD,CAAC;AAClF,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;AACvF,OAAO,EAAE,gBAAgB,EAAwB,MAAM,yDA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IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;QACtF,CAAC;IACF,CAAC;CACD,CAAA;AAlVY,8BAA8B;IA8BxC,WAAA,gBAAgB,CAAA;IAChB,WAAA,aAAa,CAAA;GA/BH,8BAA8B,CAkV1C;;AAED,SAAS,oBAAoB,CAAC,MAAe;IAC5C,MAAM,MAAM,GAAY,EAAE,CAAC;IAC3B,OAAO,MAAM,CAAC,MAAM,EAAE,CAAC;QACtB,IAAI,KAAK,GAAG,MAAM,CAAC,KAAK,EAAG,CAAC;QAC5B,IAAI,KAAK,CAAC,eAAe,KAAK,KAAK,CAAC,aAAa,EAAE,CAAC;YACnD,MAAM,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,eAAe,GAAG,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;YAC3F,KAAK,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC,eAAe,EAAE,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,eAAe,EAAE,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,4BAA4B;QAC1I,CAAC;QAED,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACpB,CAAC;IACD,OAAO,MAAM,CAAC;AAEf,CAAC","file":"inlineEditsLineReplacementView.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { $, n } from '../../../../../../../base/browser/dom.js';\nimport { Emitter } from '../../../../../../../base/common/event.js';\nimport { Disposable, toDisposable } from '../../../../../../../base/common/lifecycle.js';\nimport { autorunDelta, constObservable, derived, IObservable } from '../../../../../../../base/common/observable.js';\nimport { scrollbarShadow } from '../../../../../../../platform/theme/common/colorRegistry.js';\nimport { asCssVariable } from '../../../../../../../platform/theme/common/colorUtils.js';\nimport { IThemeService } from '../../../../../../../platform/theme/common/themeService.js';\nimport { IEditorMouseEvent, IViewZoneChangeAccessor } from '../../../../../../browser/editorBrowser.js';\nimport { EditorMouseEvent } from '../../../../../../browser/editorDom.js';\nimport { ObservableCodeEditor } from '../../../../../../browser/observableCodeEditor.js';\nimport { LineSource, renderLines, RenderOptions } from '../../../../../../browser/widget/diffEditor/components/diffEditorViewZones/renderLines.js';\nimport { EditorOption } from '../../../../../../common/config/editorOptions.js';\nimport { Point } from '../../../../../../common/core/2d/point.js';\nimport { Rect } from '../../../../../../common/core/2d/rect.js';\nimport { Range } from '../../../../../../common/core/range.js';\nimport { LineRange } from '../../../../../../common/core/ranges/lineRange.js';\nimport { OffsetRange } from '../../../../../../common/core/ranges/offsetRange.js';\nimport { ILanguageService } from '../../../../../../common/languages/language.js';\nimport { LineTokens, TokenArray } from '../../../../../../common/tokens/lineTokens.js';\nimport { InlineDecoration, InlineDecorationType } from '../../../../../../common/viewModel/inlineDecorations.js';\nimport { InlineCompletionEditorType } from '../../../model/provideInlineCompletions.js';\nimport { IInlineEditsView, InlineEditClickEvent, InlineEditTabAction } from '../inlineEditsViewInterface.js';\nimport { getEditorBackgroundColor, getEditorBlendedColor, getModifiedBorderColor, getOriginalBorderColor, INLINE_EDITS_BORDER_RADIUS, modifiedChangedLineBackgroundColor, originalBackgroundColor } from '../theme.js';\nimport { getEditorValidOverlayRect, getPrefixTrim, mapOutFalsy, rectToProps } from '../utils/utils.js';\n\nexport class InlineEditsLineReplacementView extends Disposable implements IInlineEditsView {\n\n\tprivate readonly _onDidClick = this._register(new Emitter<InlineEditClickEvent>());\n\treadonly onDidClick = this._onDidClick.event;\n\n\tprivate readonly _maxPrefixTrim;\n\n\tprivate readonly _modifiedLineElements;\n\n\n\tprivate readonly _layout;\n\n\tprivate readonly _viewZoneInfo;\n\n\tprivate readonly _div;\n\n\treadonly isHovered;\n\n\treadonly minEditorScrollHeight;\n\n\tconstructor(\n\t\tprivate readonly _editor: ObservableCodeEditor,\n\t\tprivate readonly _edit: IObservable<{\n\t\t\toriginalRange: LineRange;\n\t\t\tmodifiedRange: LineRange;\n\t\t\tmodifiedLines: string[];\n\t\t\treplacements: Replacement[];\n\t\t} | undefined>,\n\t\tprivate readonly _editorType: IObservable<InlineCompletionEditorType>,\n\t\tprivate readonly _tabAction: IObservable<InlineEditTabAction>,\n\t\t@ILanguageService private readonly _languageService: ILanguageService,\n\t\t@IThemeService private readonly _themeService: IThemeService,\n\t) {\n\t\tsuper();\n\t\tthis._maxPrefixTrim = this._edit.map((e, reader) => e ? getPrefixTrim(e.replacements.flatMap(r => [r.originalRange, r.modifiedRange]), e.originalRange, e.modifiedLines, this._editor.editor, reader) : undefined);\n\t\tthis._modifiedLineElements = derived(this, reader => {\n\t\t\tconst lines = [];\n\t\t\tlet requiredWidth = 0;\n\n\t\t\tconst prefixTrim = this._maxPrefixTrim.read(reader);\n\t\t\tconst edit = this._edit.read(reader);\n\t\t\tif (!edit || !prefixTrim) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst maxPrefixTrim = prefixTrim.prefixTrim;\n\t\t\tconst modifiedBubbles = rangesToBubbleRanges(edit.replacements.map(r => r.modifiedRange)).map(r => new Range(r.startLineNumber, r.startColumn - maxPrefixTrim, r.endLineNumber, r.endColumn - maxPrefixTrim));\n\n\t\t\tconst textModel = this._editor.model.get()!;\n\t\t\tconst startLineNumber = edit.modifiedRange.startLineNumber;\n\t\t\tfor (let i = 0; i < edit.modifiedRange.length; i++) {\n\t\t\t\tconst line = document.createElement('div');\n\t\t\t\tconst lineNumber = startLineNumber + i;\n\t\t\t\tconst modLine = edit.modifiedLines[i].slice(maxPrefixTrim);\n\n\t\t\t\tconst t = textModel.tokenization.tokenizeLinesAt(lineNumber, [modLine])?.[0];\n\t\t\t\tlet tokens: LineTokens;\n\t\t\t\tif (t) {\n\t\t\t\t\ttokens = TokenArray.fromLineTokens(t).toLineTokens(modLine, this._languageService.languageIdCodec);\n\t\t\t\t} else {\n\t\t\t\t\ttokens = LineTokens.createEmpty(modLine, this._languageService.languageIdCodec);\n\t\t\t\t}\n\n\t\t\t\tconst decorations = [];\n\t\t\t\tfor (const modified of modifiedBubbles.filter(b => b.startLineNumber === lineNumber)) {\n\t\t\t\t\tconst validatedEndColumn = Math.min(modified.endColumn, modLine.length + 1);\n\t\t\t\t\tdecorations.push(new InlineDecoration(new Range(1, modified.startColumn, 1, validatedEndColumn), 'inlineCompletions-modified-bubble', InlineDecorationType.Regular));\n\t\t\t\t}\n\n\t\t\t\t// TODO: All lines should be rendered at once for one dom element\n\t\t\t\tconst result = renderLines(new LineSource([tokens]), RenderOptions.fromEditor(this._editor.editor).withSetWidth(false).withScrollBeyondLastColumn(0), decorations, line, true);\n\t\t\t\tthis._editor.getOption(EditorOption.fontInfo).read(reader); // update when font info changes\n\n\t\t\t\trequiredWidth = Math.max(requiredWidth, result.minWidthInPx);\n\n\t\t\t\tlines.push(line);\n\t\t\t}\n\n\t\t\treturn { lines, requiredWidth: requiredWidth };\n\t\t});\n\t\tthis._layout = derived(this, reader => {\n\t\t\tconst modifiedLines = this._modifiedLineElements.read(reader);\n\t\t\tconst maxPrefixTrim = this._maxPrefixTrim.read(reader);\n\t\t\tconst edit = this._edit.read(reader);\n\t\t\tif (!modifiedLines || !maxPrefixTrim || !edit) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst { prefixLeftOffset } = maxPrefixTrim;\n\t\t\tconst { requiredWidth } = modifiedLines;\n\n\t\t\tconst originalLineHeights = this._editor.observeLineHeightsForLineRange(edit.originalRange).read(reader);\n\t\t\tconst modifiedLineHeights = (() => {\n\t\t\t\tconst lineHeights = originalLineHeights.slice(0, edit.modifiedRange.length);\n\t\t\t\twhile (lineHeights.length < edit.modifiedRange.length) {\n\t\t\t\t\tlineHeights.push(originalLineHeights[originalLineHeights.length - 1]);\n\t\t\t\t}\n\t\t\t\treturn lineHeights;\n\t\t\t})();\n\n\t\t\tconst contentLeft = this._editor.layoutInfoContentLeft.read(reader);\n\t\t\tconst verticalScrollbarWidth = this._editor.layoutInfoVerticalScrollbarWidth.read(reader);\n\t\t\tconst scrollLeft = this._editor.scrollLeft.read(reader);\n\t\t\tconst scrollTop = this._editor.scrollTop.read(reader);\n\t\t\tconst editorLeftOffset = contentLeft - scrollLeft;\n\n\t\t\tconst textModel = this._editor.editor.getModel()!;\n\n\t\t\tconst originalLineWidths = edit.originalRange.mapToLineArray(line => this._editor.editor.getOffsetForColumn(line, textModel.getLineMaxColumn(line)) - prefixLeftOffset);\n\t\t\tconst maxLineWidth = Math.max(...originalLineWidths, requiredWidth);\n\n\t\t\tconst startLineNumber = edit.originalRange.startLineNumber;\n\t\t\tconst endLineNumber = edit.originalRange.endLineNumberExclusive - 1;\n\t\t\tconst topOfOriginalLines = this._editor.editor.getTopForLineNumber(startLineNumber) - scrollTop;\n\t\t\tconst bottomOfOriginalLines = this._editor.editor.getBottomForLineNumber(endLineNumber) - scrollTop;\n\n\t\t\t// Box Widget positioning\n\t\t\tconst originalLinesOverlay = Rect.fromLeftTopWidthHeight(\n\t\t\t\teditorLeftOffset + prefixLeftOffset,\n\t\t\t\ttopOfOriginalLines,\n\t\t\t\tmaxLineWidth,\n\t\t\t\tbottomOfOriginalLines - topOfOriginalLines\n\t\t\t);\n\t\t\tconst modifiedLinesOverlay = Rect.fromLeftTopWidthHeight(\n\t\t\t\toriginalLinesOverlay.left,\n\t\t\t\toriginalLinesOverlay.bottom,\n\t\t\t\toriginalLinesOverlay.width,\n\t\t\t\tmodifiedLineHeights.reduce((sum, h) => sum + h, 0)\n\t\t\t);\n\t\t\tconst background = Rect.hull([originalLinesOverlay, modifiedLinesOverlay]);\n\n\t\t\tconst lowerBackground = background.intersectVertical(new OffsetRange(originalLinesOverlay.bottom, Number.MAX_SAFE_INTEGER));\n\t\t\tconst lowerText = new Rect(lowerBackground.left, lowerBackground.top, lowerBackground.right, lowerBackground.bottom);\n\n\t\t\treturn {\n\t\t\t\toriginalLinesOverlay,\n\t\t\t\tmodifiedLinesOverlay,\n\t\t\t\tbackground,\n\t\t\t\tlowerBackground,\n\t\t\t\tlowerText,\n\t\t\t\tmodifiedLineHeights,\n\t\t\t\tminContentWidthRequired: prefixLeftOffset + maxLineWidth + verticalScrollbarWidth,\n\t\t\t};\n\t\t});\n\t\tthis._viewZoneInfo = derived<{ height: number; lineNumber: number } | undefined>(reader => {\n\t\t\tconst shouldShowViewZone = this._editor.getOption(EditorOption.inlineSuggest).map(o => o.edits.allowCodeShifting === 'always').read(reader);\n\t\t\tif (!shouldShowViewZone) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst layout = this._layout.read(reader);\n\t\t\tconst edit = this._edit.read(reader);\n\t\t\tif (!layout || !edit) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst viewZoneHeight = layout.lowerBackground.height;\n\t\t\tconst viewZoneLineNumber = edit.originalRange.endLineNumberExclusive;\n\t\t\treturn { height: viewZoneHeight, lineNumber: viewZoneLineNumber };\n\t\t});\n\t\tthis.minEditorScrollHeight = derived(this, reader => {\n\t\t\tconst layout = mapOutFalsy(this._layout).read(reader);\n\t\t\tif (!layout || this._viewZoneInfo.read(reader) !== undefined) {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\treturn layout.read(reader).lowerText.bottom + this._editor.editor.getScrollTop();\n\t\t});\n\t\tthis._div = n.div({\n\t\t\tclass: 'line-replacement',\n\t\t}, [\n\t\t\tderived(this, reader => {\n\t\t\t\tconst layout = mapOutFalsy(this._layout).read(reader);\n\t\t\t\tconst modifiedLineElements = this._modifiedLineElements.read(reader);\n\t\t\t\tif (!layout || !modifiedLineElements) {\n\t\t\t\t\treturn [];\n\t\t\t\t}\n\n\t\t\t\tconst layoutProps = layout.read(reader);\n\t\t\t\tconst contentLeft = this._editor.layoutInfoContentLeft.read(reader);\n\n\t\t\t\tconst separatorWidth = this._editorType.read(reader) === InlineCompletionEditorType.DiffEditor ? 3 : 1;\n\n\t\t\t\tmodifiedLineElements.lines.forEach((l, i) => {\n\t\t\t\t\tl.style.width = `${layoutProps.lowerText.width}px`;\n\t\t\t\t\tl.style.height = `${layoutProps.modifiedLineHeights[i]}px`;\n\t\t\t\t\tl.style.position = 'relative';\n\t\t\t\t});\n\n\t\t\t\tconst modifiedBorderColor = getModifiedBorderColor(this._tabAction).read(reader);\n\t\t\t\tconst originalBorderColor = getOriginalBorderColor(this._tabAction).read(reader);\n\t\t\t\tconst editorBackground = getEditorBackgroundColor(this._editorType.read(reader));\n\n\t\t\t\treturn [\n\t\t\t\t\tn.div({\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t...rectToProps((r) => getEditorValidOverlayRect(this._editor).read(r)),\n\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t\t\t}\n\t\t\t\t\t}, [\n\t\t\t\t\t\tn.div({\n\t\t\t\t\t\t\tclass: 'borderAroundLineReplacement',\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\t...rectToProps(reader => layout.read(reader).background.translateX(-contentLeft).withMargin(separatorWidth)),\n\t\t\t\t\t\t\t\tborderRadius: `${INLINE_EDITS_BORDER_RADIUS}px`,\n\n\t\t\t\t\t\t\t\tborder: `${separatorWidth + 1}px solid ${editorBackground}`,\n\t\t\t\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tn.div({\n\t\t\t\t\t\t\tclass: 'originalOverlayLineReplacement',\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\t...rectToProps(reader => layout.read(reader).background.translateX(-contentLeft)),\n\t\t\t\t\t\t\t\tborderRadius: `${INLINE_EDITS_BORDER_RADIUS}px`,\n\n\t\t\t\t\t\t\t\tborder: getEditorBlendedColor(originalBorderColor, this._themeService).map(c => `1px solid ${c.toString()}`),\n\t\t\t\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\t\t\t\tbackground: asCssVariable(originalBackgroundColor),\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tn.div({\n\t\t\t\t\t\t\tclass: 'modifiedOverlayLineReplacement',\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\t...rectToProps(reader => layout.read(reader).lowerBackground.translateX(-contentLeft)),\n\t\t\t\t\t\t\t\tborderRadius: `0 0 ${INLINE_EDITS_BORDER_RADIUS}px ${INLINE_EDITS_BORDER_RADIUS}px`,\n\t\t\t\t\t\t\t\tbackground: editorBackground,\n\t\t\t\t\t\t\t\tboxShadow: `${asCssVariable(scrollbarShadow)} 0 6px 6px -6px`,\n\t\t\t\t\t\t\t\tborder: `1px solid ${asCssVariable(modifiedBorderColor)}`,\n\t\t\t\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\t\tcursor: 'pointer',\n\t\t\t\t\t\t\t\tpointerEvents: 'auto',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tonmousedown: e => {\n\t\t\t\t\t\t\t\te.preventDefault(); // This prevents that the editor loses focus\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tonclick: (e) => this._onDidClick.fire(InlineEditClickEvent.create(e)),\n\t\t\t\t\t\t}, [\n\t\t\t\t\t\t\tn.div({\n\t\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\t\tposition: 'absolute', top: 0, left: 0, width: '100%', height: '100%',\n\t\t\t\t\t\t\t\t\tbackground: asCssVariable(modifiedChangedLineBackgroundColor),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tn.div({\n\t\t\t\t\t\t\tclass: 'modifiedLinesLineReplacement',\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\t\t\t\t...rectToProps(reader => layout.read(reader).lowerText.translateX(-contentLeft)),\n\t\t\t\t\t\t\t\tfontFamily: this._editor.getOption(EditorOption.fontFamily),\n\t\t\t\t\t\t\t\tfontSize: this._editor.getOption(EditorOption.fontSize),\n\t\t\t\t\t\t\t\tfontWeight: this._editor.getOption(EditorOption.fontWeight),\n\t\t\t\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t\t\t\t\twhiteSpace: 'nowrap',\n\t\t\t\t\t\t\t\tborderRadius: `0 0 ${INLINE_EDITS_BORDER_RADIUS}px ${INLINE_EDITS_BORDER_RADIUS}px`,\n\t\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, [...modifiedLineElements.lines]),\n\t\t\t\t\t])\n\t\t\t\t];\n\t\t\t})\n\t\t]).keepUpdated(this._store);\n\t\tthis.isHovered = this._editor.isTargetHovered((e) => this._isMouseOverWidget(e), this._store);\n\t\tthis._previousViewZoneInfo = undefined;\n\n\t\tthis._register(toDisposable(() => this._editor.editor.changeViewZones(accessor => this.removePreviousViewZone(accessor))));\n\n\t\tthis._register(autorunDelta(this._viewZoneInfo, ({ lastValue, newValue }) => {\n\t\t\tif (lastValue === newValue || (lastValue?.height === newValue?.height && lastValue?.lineNumber === newValue?.lineNumber)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis._editor.editor.changeViewZones((changeAccessor) => {\n\t\t\t\tthis.removePreviousViewZone(changeAccessor);\n\t\t\t\tif (!newValue) { return; }\n\t\t\t\tthis.addViewZone(newValue, changeAccessor);\n\t\t\t});\n\t\t}));\n\n\t\tthis._register(this._editor.createOverlayWidget({\n\t\t\tdomNode: this._div.element,\n\t\t\tminContentWidthInPx: derived(this, reader => {\n\t\t\t\treturn this._layout.read(reader)?.minContentWidthRequired ?? 0;\n\t\t\t}),\n\t\t\tposition: constObservable({ preference: { top: 0, left: 0 } }),\n\t\t\tallowEditorOverflow: false,\n\t\t}));\n\t}\n\n\tprivate _isMouseOverWidget(e: IEditorMouseEvent): boolean {\n\t\tconst layout = this._layout.get();\n\t\tif (!layout || !(e.event instanceof EditorMouseEvent)) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn layout.lowerBackground.containsPoint(new Point(e.event.relativePos.x, e.event.relativePos.y));\n\t}\n\n\t// View Zones\n\tprivate _previousViewZoneInfo: { height: number; lineNumber: number; id: string } | undefined;\n\n\tprivate removePreviousViewZone(changeAccessor: IViewZoneChangeAccessor) {\n\t\tif (!this._previousViewZoneInfo) {\n\t\t\treturn;\n\t\t}\n\n\t\tchangeAccessor.removeZone(this._previousViewZoneInfo.id);\n\n\t\tconst cursorLineNumber = this._editor.cursorLineNumber.get();\n\t\tif (cursorLineNumber !== null && cursorLineNumber >= this._previousViewZoneInfo.lineNumber) {\n\t\t\tthis._editor.editor.setScrollTop(this._editor.scrollTop.get() - this._previousViewZoneInfo.height);\n\t\t}\n\n\t\tthis._previousViewZoneInfo = undefined;\n\t}\n\n\tprivate addViewZone(viewZoneInfo: { height: number; lineNumber: number }, changeAccessor: IViewZoneChangeAccessor) {\n\t\tconst activeViewZone = changeAccessor.addZone({\n\t\t\tafterLineNumber: viewZoneInfo.lineNumber - 1,\n\t\t\theightInPx: viewZoneInfo.height, // move computation to layout?\n\t\t\tdomNode: $('div'),\n\t\t});\n\n\t\tthis._previousViewZoneInfo = { height: viewZoneInfo.height, lineNumber: viewZoneInfo.lineNumber, id: activeViewZone };\n\n\t\tconst cursorLineNumber = this._editor.cursorLineNumber.get();\n\t\tif (cursorLineNumber !== null && cursorLineNumber >= viewZoneInfo.lineNumber) {\n\t\t\tthis._editor.editor.setScrollTop(this._editor.scrollTop.get() + viewZoneInfo.height);\n\t\t}\n\t}\n}\n\nfunction rangesToBubbleRanges(ranges: Range[]): Range[] {\n\tconst result: Range[] = [];\n\twhile (ranges.length) {\n\t\tlet range = ranges.shift()!;\n\t\tif (range.startLineNumber !== range.endLineNumber) {\n\t\t\tranges.push(new Range(range.startLineNumber + 1, 1, range.endLineNumber, range.endColumn));\n\t\t\trange = new Range(range.startLineNumber, range.startColumn, range.startLineNumber, Number.MAX_SAFE_INTEGER); // TODO: this is not correct\n\t\t}\n\n\t\tresult.push(range);\n\t}\n\treturn result;\n\n}\n\nexport interface Replacement {\n\toriginalRange: Range;\n\tmodifiedRange: Range;\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { $, n } from '../../../../../../../base/browser/dom.js';\nimport { Emitter } from '../../../../../../../base/common/event.js';\nimport { Disposable, toDisposable } from '../../../../../../../base/common/lifecycle.js';\nimport { autorunDelta, constObservable, derived, IObservable } from '../../../../../../../base/common/observable.js';\nimport { scrollbarShadow } from '../../../../../../../platform/theme/common/colorRegistry.js';\nimport { asCssVariable } from '../../../../../../../platform/theme/common/colorUtils.js';\nimport { IThemeService } from '../../../../../../../platform/theme/common/themeService.js';\nimport { IEditorMouseEvent, IViewZoneChangeAccessor } from '../../../../../../browser/editorBrowser.js';\nimport { EditorMouseEvent } from '../../../../../../browser/editorDom.js';\nimport { ObservableCodeEditor } from '../../../../../../browser/observableCodeEditor.js';\nimport { LineSource, renderLines, RenderOptions } from '../../../../../../browser/widget/diffEditor/components/diffEditorViewZones/renderLines.js';\nimport { EditorOption } from '../../../../../../common/config/editorOptions.js';\nimport { Point } from '../../../../../../common/core/2d/point.js';\nimport { Rect } from '../../../../../../common/core/2d/rect.js';\nimport { Range } from '../../../../../../common/core/range.js';\nimport { LineRange } from '../../../../../../common/core/ranges/lineRange.js';\nimport { OffsetRange } from '../../../../../../common/core/ranges/offsetRange.js';\nimport { ILanguageService } from '../../../../../../common/languages/language.js';\nimport { LineTokens, TokenArray } from '../../../../../../common/tokens/lineTokens.js';\nimport { InlineDecoration, InlineDecorationType } from '../../../../../../common/viewModel/inlineDecorations.js';\nimport { InlineCompletionEditorType } from '../../../model/provideInlineCompletions.js';\nimport { IInlineEditsView, InlineEditClickEvent, InlineEditTabAction } from '../inlineEditsViewInterface.js';\nimport { getEditorBackgroundColor, getEditorBlendedColor, getModifiedBorderColor, getOriginalBorderColor, INLINE_EDITS_BORDER_RADIUS, modifiedChangedLineBackgroundColor, originalBackgroundColor } from '../theme.js';\nimport { getEditorValidOverlayRect, getPrefixTrim, mapOutFalsy, rectToProps } from '../utils/utils.js';\n\nexport class InlineEditsLineReplacementView extends Disposable implements IInlineEditsView {\n\n\tprivate readonly _onDidClick = this._register(new Emitter<InlineEditClickEvent>());\n\treadonly onDidClick = this._onDidClick.event;\n\n\tprivate readonly _maxPrefixTrim;\n\n\tprivate readonly _modifiedLineElements;\n\n\n\tprivate readonly _layout;\n\n\tprivate readonly _viewZoneInfo;\n\n\tprivate readonly _div;\n\n\treadonly isHovered;\n\n\treadonly minEditorScrollHeight;\n\n\tconstructor(\n\t\tprivate readonly _editor: ObservableCodeEditor,\n\t\tprivate readonly _edit: IObservable<{\n\t\t\toriginalRange: LineRange;\n\t\t\tmodifiedRange: LineRange;\n\t\t\tmodifiedLines: string[];\n\t\t\treplacements: Replacement[];\n\t\t} | undefined>,\n\t\tprivate readonly _editorType: IObservable<InlineCompletionEditorType>,\n\t\tprivate readonly _tabAction: IObservable<InlineEditTabAction>,\n\t\t@ILanguageService private readonly _languageService: ILanguageService,\n\t\t@IThemeService private readonly _themeService: IThemeService,\n\t) {\n\t\tsuper();\n\t\tthis._maxPrefixTrim = this._edit.map((e, reader) => e ? getPrefixTrim(e.replacements.flatMap(r => [r.originalRange, r.modifiedRange]), e.originalRange, e.modifiedLines, this._editor.editor, reader) : undefined);\n\t\tthis._modifiedLineElements = derived(this, reader => {\n\t\t\tconst lines = [];\n\t\t\tlet requiredWidth = 0;\n\n\t\t\tconst prefixTrim = this._maxPrefixTrim.read(reader);\n\t\t\tconst edit = this._edit.read(reader);\n\t\t\tif (!edit || !prefixTrim) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst maxPrefixTrim = prefixTrim.prefixTrim;\n\t\t\tconst modifiedBubbles = rangesToBubbleRanges(edit.replacements.map(r => r.modifiedRange)).map(r => new Range(r.startLineNumber, r.startColumn - maxPrefixTrim, r.endLineNumber, r.endColumn - maxPrefixTrim));\n\n\t\t\tconst textModel = this._editor.model.get()!;\n\t\t\tconst startLineNumber = edit.modifiedRange.startLineNumber;\n\t\t\tfor (let i = 0; i < edit.modifiedRange.length; i++) {\n\t\t\t\tconst line = document.createElement('div');\n\t\t\t\tconst lineNumber = startLineNumber + i;\n\t\t\t\tconst modLine = edit.modifiedLines[i].slice(maxPrefixTrim);\n\n\t\t\t\tconst t = textModel.tokenization.tokenizeLinesAt(lineNumber, [modLine])?.[0];\n\t\t\t\tlet tokens: LineTokens;\n\t\t\t\tif (t) {\n\t\t\t\t\ttokens = TokenArray.fromLineTokens(t).toLineTokens(modLine, this._languageService.languageIdCodec);\n\t\t\t\t} else {\n\t\t\t\t\ttokens = LineTokens.createEmpty(modLine, this._languageService.languageIdCodec);\n\t\t\t\t}\n\n\t\t\t\tconst decorations = [];\n\t\t\t\tfor (const modified of modifiedBubbles.filter(b => b.startLineNumber === lineNumber)) {\n\t\t\t\t\tconst validatedEndColumn = Math.min(modified.endColumn, modLine.length + 1);\n\t\t\t\t\tdecorations.push(new InlineDecoration(new Range(1, modified.startColumn, 1, validatedEndColumn), 'inlineCompletions-modified-bubble', InlineDecorationType.Regular));\n\t\t\t\t}\n\n\t\t\t\t// TODO: All lines should be rendered at once for one dom element\n\t\t\t\tconst result = renderLines(new LineSource([tokens]), RenderOptions.fromEditor(this._editor.editor).withSetWidth(false).withScrollBeyondLastColumn(0), decorations, line, true);\n\t\t\t\tthis._editor.getOption(EditorOption.fontInfo).read(reader); // update when font info changes\n\n\t\t\t\trequiredWidth = Math.max(requiredWidth, result.minWidthInPx);\n\n\t\t\t\tlines.push(line);\n\t\t\t}\n\n\t\t\treturn { lines, requiredWidth: requiredWidth };\n\t\t});\n\t\tthis._layout = derived(this, reader => {\n\t\t\tconst modifiedLines = this._modifiedLineElements.read(reader);\n\t\t\tconst maxPrefixTrim = this._maxPrefixTrim.read(reader);\n\t\t\tconst edit = this._edit.read(reader);\n\t\t\tif (!modifiedLines || !maxPrefixTrim || !edit) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst { prefixLeftOffset } = maxPrefixTrim;\n\t\t\tconst { requiredWidth } = modifiedLines;\n\n\t\t\tconst originalLineHeights = this._editor.observeLineHeightsForLineRange(edit.originalRange).read(reader);\n\t\t\tconst modifiedLineHeights = (() => {\n\t\t\t\tconst lineHeights = originalLineHeights.slice(0, edit.modifiedRange.length);\n\t\t\t\twhile (lineHeights.length < edit.modifiedRange.length) {\n\t\t\t\t\tlineHeights.push(originalLineHeights[originalLineHeights.length - 1]);\n\t\t\t\t}\n\t\t\t\treturn lineHeights;\n\t\t\t})();\n\n\t\t\tconst contentLeft = this._editor.layoutInfoContentLeft.read(reader);\n\t\t\tconst verticalScrollbarWidth = this._editor.layoutInfoVerticalScrollbarWidth.read(reader);\n\t\t\tconst scrollLeft = this._editor.scrollLeft.read(reader);\n\t\t\tconst scrollTop = this._editor.scrollTop.read(reader);\n\t\t\tconst editorLeftOffset = contentLeft - scrollLeft;\n\n\t\t\tconst textModel = this._editor.editor.getModel()!;\n\n\t\t\tconst originalLineWidths = edit.originalRange.mapToLineArray(line => this._editor.editor.getOffsetForColumn(line, textModel.getLineMaxColumn(line)) - prefixLeftOffset);\n\t\t\tconst maxLineWidth = Math.max(...originalLineWidths, requiredWidth);\n\n\t\t\tconst startLineNumber = edit.originalRange.startLineNumber;\n\t\t\tconst endLineNumber = edit.originalRange.endLineNumberExclusive - 1;\n\t\t\tconst topOfOriginalLines = this._editor.editor.getTopForLineNumber(startLineNumber) - scrollTop;\n\t\t\tconst bottomOfOriginalLines = this._editor.editor.getBottomForLineNumber(endLineNumber) - scrollTop;\n\n\t\t\t// Box Widget positioning\n\t\t\tconst originalLinesOverlay = Rect.fromLeftTopWidthHeight(\n\t\t\t\teditorLeftOffset + prefixLeftOffset,\n\t\t\t\ttopOfOriginalLines,\n\t\t\t\tmaxLineWidth,\n\t\t\t\tbottomOfOriginalLines - topOfOriginalLines\n\t\t\t);\n\t\t\tconst modifiedLinesOverlay = Rect.fromLeftTopWidthHeight(\n\t\t\t\toriginalLinesOverlay.left,\n\t\t\t\toriginalLinesOverlay.bottom,\n\t\t\t\toriginalLinesOverlay.width,\n\t\t\t\tmodifiedLineHeights.reduce((sum, h) => sum + h, 0)\n\t\t\t);\n\t\t\tconst background = Rect.hull([originalLinesOverlay, modifiedLinesOverlay]);\n\n\t\t\tconst lowerBackground = background.intersectVertical(new OffsetRange(originalLinesOverlay.bottom, Number.MAX_SAFE_INTEGER));\n\t\t\tconst lowerText = new Rect(lowerBackground.left, lowerBackground.top, lowerBackground.right, lowerBackground.bottom);\n\n\t\t\treturn {\n\t\t\t\toriginalLinesOverlay,\n\t\t\t\tmodifiedLinesOverlay,\n\t\t\t\tbackground,\n\t\t\t\tlowerBackground,\n\t\t\t\tlowerText,\n\t\t\t\tmodifiedLineHeights,\n\t\t\t\tminContentWidthRequired: prefixLeftOffset + maxLineWidth + verticalScrollbarWidth,\n\t\t\t};\n\t\t});\n\t\tthis._viewZoneInfo = derived<{ height: number; lineNumber: number } | undefined>(reader => {\n\t\t\tconst shouldShowViewZone = this._editor.getOption(EditorOption.inlineSuggest).map(o => o.edits.allowCodeShifting === 'always').read(reader);\n\t\t\tif (!shouldShowViewZone) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst layout = this._layout.read(reader);\n\t\t\tconst edit = this._edit.read(reader);\n\t\t\tif (!layout || !edit) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst viewZoneHeight = layout.lowerBackground.height;\n\t\t\tconst viewZoneLineNumber = edit.originalRange.endLineNumberExclusive;\n\t\t\treturn { height: viewZoneHeight, lineNumber: viewZoneLineNumber };\n\t\t});\n\t\tthis.minEditorScrollHeight = derived(this, reader => {\n\t\t\tconst layout = mapOutFalsy(this._layout).read(reader);\n\t\t\tif (!layout || this._viewZoneInfo.read(reader) !== undefined) {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\treturn layout.read(reader).lowerText.bottom + this._editor.editor.getScrollTop();\n\t\t});\n\t\tthis._div = n.div({\n\t\t\tclass: 'line-replacement',\n\t\t}, [\n\t\t\tderived(this, reader => {\n\t\t\t\tconst layout = mapOutFalsy(this._layout).read(reader);\n\t\t\t\tconst modifiedLineElements = this._modifiedLineElements.read(reader);\n\t\t\t\tif (!layout || !modifiedLineElements) {\n\t\t\t\t\treturn [];\n\t\t\t\t}\n\n\t\t\t\tconst layoutProps = layout.read(reader);\n\t\t\t\tconst contentLeft = this._editor.layoutInfoContentLeft.read(reader);\n\n\t\t\t\tconst separatorWidth = this._editorType.read(reader) === InlineCompletionEditorType.DiffEditor ? 3 : 1;\n\n\t\t\t\tmodifiedLineElements.lines.forEach((l, i) => {\n\t\t\t\t\tl.style.width = `${layoutProps.lowerText.width}px`;\n\t\t\t\t\tl.style.height = `${layoutProps.modifiedLineHeights[i]}px`;\n\t\t\t\t\tl.style.position = 'relative';\n\t\t\t\t});\n\n\t\t\t\tconst modifiedBorderColor = getModifiedBorderColor(this._tabAction).read(reader);\n\t\t\t\tconst originalBorderColor = getOriginalBorderColor(this._tabAction).read(reader);\n\t\t\t\tconst editorBackground = getEditorBackgroundColor(this._editorType.read(reader));\n\n\t\t\t\treturn [\n\t\t\t\t\tn.div({\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t...rectToProps((r) => getEditorValidOverlayRect(this._editor).read(r)),\n\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t\t\t}\n\t\t\t\t\t}, [\n\t\t\t\t\t\tn.div({\n\t\t\t\t\t\t\tclass: 'borderAroundLineReplacement',\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\t...rectToProps(reader => layout.read(reader).background.translateX(-contentLeft).withMargin(separatorWidth)),\n\t\t\t\t\t\t\t\tborderRadius: `${INLINE_EDITS_BORDER_RADIUS}px`,\n\n\t\t\t\t\t\t\t\tborder: `${separatorWidth + 1}px solid ${editorBackground}`,\n\t\t\t\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tn.div({\n\t\t\t\t\t\t\tclass: 'originalOverlayLineReplacement',\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\t...rectToProps(reader => layout.read(reader).background.translateX(-contentLeft)),\n\t\t\t\t\t\t\t\tborderRadius: `${INLINE_EDITS_BORDER_RADIUS}px`,\n\n\t\t\t\t\t\t\t\tborder: getEditorBlendedColor(originalBorderColor, this._themeService).map(c => `1px solid ${c.toString()}`),\n\t\t\t\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\t\t\t\tbackground: asCssVariable(originalBackgroundColor),\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tn.div({\n\t\t\t\t\t\t\tclass: 'modifiedOverlayLineReplacement',\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\t...rectToProps(reader => layout.read(reader).lowerBackground.translateX(-contentLeft)),\n\t\t\t\t\t\t\t\tborderRadius: `0 0 ${INLINE_EDITS_BORDER_RADIUS}px ${INLINE_EDITS_BORDER_RADIUS}px`,\n\t\t\t\t\t\t\t\tbackground: editorBackground,\n\t\t\t\t\t\t\t\tboxShadow: `${asCssVariable(scrollbarShadow)} 0 6px 6px -6px`,\n\t\t\t\t\t\t\t\tborder: `1px solid ${asCssVariable(modifiedBorderColor)}`,\n\t\t\t\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\t\tcursor: 'pointer',\n\t\t\t\t\t\t\t\tpointerEvents: 'auto',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tonmousedown: e => {\n\t\t\t\t\t\t\t\te.preventDefault(); // This prevents that the editor loses focus\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tonclick: (e) => this._onDidClick.fire(InlineEditClickEvent.create(e)),\n\t\t\t\t\t\t}, [\n\t\t\t\t\t\t\tn.div({\n\t\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\t\tposition: 'absolute', top: 0, left: 0, width: '100%', height: '100%',\n\t\t\t\t\t\t\t\t\tbackground: asCssVariable(modifiedChangedLineBackgroundColor),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tn.div({\n\t\t\t\t\t\t\tclass: 'modifiedLinesLineReplacement',\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\t\t\t\t...rectToProps(reader => layout.read(reader).lowerText.translateX(-contentLeft)),\n\t\t\t\t\t\t\t\tfontFamily: this._editor.getOption(EditorOption.fontFamily),\n\t\t\t\t\t\t\t\tfontSize: this._editor.getOption(EditorOption.fontSize),\n\t\t\t\t\t\t\t\tfontWeight: this._editor.getOption(EditorOption.fontWeight),\n\t\t\t\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t\t\t\t\twhiteSpace: 'nowrap',\n\t\t\t\t\t\t\t\tborderRadius: `0 0 ${INLINE_EDITS_BORDER_RADIUS}px ${INLINE_EDITS_BORDER_RADIUS}px`,\n\t\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, [...modifiedLineElements.lines]),\n\t\t\t\t\t])\n\t\t\t\t];\n\t\t\t})\n\t\t]).keepUpdated(this._store);\n\t\tthis.isHovered = this._editor.isTargetHovered((e) => this._isMouseOverWidget(e), this._store);\n\t\tthis._previousViewZoneInfo = undefined;\n\n\t\tthis._register(toDisposable(() => this._editor.editor.changeViewZones(accessor => this.removePreviousViewZone(accessor))));\n\n\t\tthis._register(autorunDelta(this._viewZoneInfo, ({ lastValue, newValue }) => {\n\t\t\tif (lastValue === newValue || (lastValue?.height === newValue?.height && lastValue?.lineNumber === newValue?.lineNumber)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis._editor.editor.changeViewZones((changeAccessor) => {\n\t\t\t\tthis.removePreviousViewZone(changeAccessor);\n\t\t\t\tif (!newValue) { return; }\n\t\t\t\tthis.addViewZone(newValue, changeAccessor);\n\t\t\t});\n\t\t}));\n\n\t\tthis._register(this._editor.createOverlayWidget({\n\t\t\tdomNode: this._div.element,\n\t\t\tminContentWidthInPx: derived(this, reader => {\n\t\t\t\treturn this._layout.read(reader)?.minContentWidthRequired ?? 0;\n\t\t\t}),\n\t\t\tposition: constObservable({ preference: { top: 0, left: 0 } }),\n\t\t\tallowEditorOverflow: false,\n\t\t}));\n\t}\n\n\tprivate _isMouseOverWidget(e: IEditorMouseEvent): boolean {\n\t\tconst layout = this._layout.get();\n\t\tif (!layout || !(e.event instanceof EditorMouseEvent)) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn layout.lowerBackground.containsPoint(new Point(e.event.relativePos.x, e.event.relativePos.y));\n\t}\n\n\t// View Zones\n\tprivate _previousViewZoneInfo: { height: number; lineNumber: number; id: string } | undefined;\n\n\tprivate removePreviousViewZone(changeAccessor: IViewZoneChangeAccessor) {\n\t\tif (!this._previousViewZoneInfo) {\n\t\t\treturn;\n\t\t}\n\n\t\tchangeAccessor.removeZone(this._previousViewZoneInfo.id);\n\n\t\tconst cursorLineNumber = this._editor.cursorLineNumber.get();\n\t\tif (cursorLineNumber !== null && cursorLineNumber >= this._previousViewZoneInfo.lineNumber) {\n\t\t\tthis._editor.editor.setScrollTop(this._editor.scrollTop.get() - this._previousViewZoneInfo.height);\n\t\t}\n\n\t\tthis._previousViewZoneInfo = undefined;\n\t}\n\n\tprivate addViewZone(viewZoneInfo: { height: number; lineNumber: number }, changeAccessor: IViewZoneChangeAccessor) {\n\t\tconst activeViewZone = changeAccessor.addZone({\n\t\t\tafterLineNumber: viewZoneInfo.lineNumber - 1,\n\t\t\theightInPx: viewZoneInfo.height, // move computation to layout?\n\t\t\tdomNode: $('div'),\n\t\t});\n\n\t\tthis._previousViewZoneInfo = { height: viewZoneInfo.height, lineNumber: viewZoneInfo.lineNumber, id: activeViewZone };\n\n\t\tconst cursorLineNumber = this._editor.cursorLineNumber.get();\n\t\tif (cursorLineNumber !== null && cursorLineNumber >= viewZoneInfo.lineNumber) {\n\t\t\tthis._editor.editor.setScrollTop(this._editor.scrollTop.get() + viewZoneInfo.height);\n\t\t}\n\t}\n}\n\nfunction rangesToBubbleRanges(ranges: Range[]): Range[] {\n\tconst result: Range[] = [];\n\twhile (ranges.length) {\n\t\tlet range = ranges.shift()!;\n\t\tif (range.startLineNumber !== range.endLineNumber) {\n\t\t\tranges.push(new Range(range.startLineNumber + 1, 1, range.endLineNumber, range.endColumn));\n\t\t\trange = new Range(range.startLineNumber, range.startColumn, range.startLineNumber, Number.MAX_SAFE_INTEGER); // TODO: this is not correct\n\t\t}\n\n\t\tresult.push(range);\n\t}\n\treturn result;\n\n}\n\nexport interface Replacement {\n\toriginalRange: Range;\n\tmodifiedRange: Range;\n}\n"]}
|