monaco-editor-core 0.56.0-dev-20251121 → 0.56.0-dev-20251123
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/nls.keys.json +1 -1
- package/esm/nls.messages.cs.js +2 -2
- package/esm/nls.messages.de.js +2 -2
- package/esm/nls.messages.es.js +2 -2
- package/esm/nls.messages.fr.js +2 -2
- package/esm/nls.messages.it.js +2 -2
- package/esm/nls.messages.ja.js +2 -2
- package/esm/nls.messages.js +1 -1
- package/esm/nls.messages.json +1 -1
- package/esm/nls.messages.ko.js +2 -2
- package/esm/nls.messages.pl.js +2 -2
- package/esm/nls.messages.pt-br.js +2 -2
- package/esm/nls.messages.ru.js +2 -2
- package/esm/nls.messages.tr.js +2 -2
- package/esm/nls.messages.zh-cn.js +2 -2
- package/esm/nls.messages.zh-tw.js +2 -2
- package/esm/nls.metadata.json +2 -0
- package/esm/vs/base/browser/ui/codicons/codicon/codicon.ttf +0 -0
- package/esm/vs/base/browser/ui/list/rowCache.js +1 -4
- package/esm/vs/base/browser/ui/list/rowCache.js.map +1 -1
- package/esm/vs/base/browser/ui/menu/menu.js +14 -12
- package/esm/vs/base/browser/ui/menu/menu.js.map +1 -1
- package/esm/vs/base/common/map.js +8 -5
- package/esm/vs/base/common/map.js.map +1 -1
- package/esm/vs/base/common/observableInternal/observables/derivedImpl.js +1 -4
- package/esm/vs/base/common/observableInternal/observables/derivedImpl.js.map +1 -1
- package/esm/vs/base/common/worker/webWorker.js +10 -7
- package/esm/vs/base/common/worker/webWorker.js.map +1 -1
- package/esm/vs/editor/browser/services/editorWorkerService.js +1 -1
- package/esm/vs/editor/browser/services/editorWorkerService.js.map +1 -1
- package/esm/vs/editor/contrib/find/browser/findWidgetSearchHistory.js.map +1 -1
- package/esm/vs/editor/contrib/find/browser/replaceWidgetHistory.js.map +1 -1
- package/esm/vs/editor/contrib/folding/browser/folding.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/inlineEditsLongDistanceHint.js +29 -16
- 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/longDistanceHint/longDistancePreviewEditor.js +42 -5
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/longDistancePreviewEditor.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/view.css +10 -0
- package/esm/vs/editor/standalone/browser/services/standaloneWebWorkerService.js +1 -1
- package/esm/vs/editor/standalone/browser/services/standaloneWebWorkerService.js.map +1 -1
- package/esm/vs/platform/actionWidget/browser/actionWidget.css +7 -0
- package/esm/vs/platform/hover/browser/hoverService.js +17 -8
- package/esm/vs/platform/hover/browser/hoverService.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/commandsQuickAccess.js +41 -8
- package/esm/vs/platform/quickinput/browser/commandsQuickAccess.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/helpQuickAccess.js +1 -1
- package/esm/vs/platform/quickinput/browser/quickInput.js +10 -10
- package/esm/vs/platform/quickinput/browser/quickInputActions.js +5 -5
- package/esm/vs/platform/quickinput/browser/quickInputController.js +6 -6
- package/esm/vs/platform/quickinput/browser/quickInputList.js +1 -1
- package/esm/vs/platform/quickinput/browser/quickInputUtils.js +1 -1
- package/esm/vs/platform/quickinput/browser/tree/quickInputTreeAccessibilityProvider.js +1 -1
- package/esm/vs/platform/quickinput/browser/tree/quickInputTreeController.js +8 -0
- package/esm/vs/platform/quickinput/browser/tree/quickInputTreeController.js.map +1 -1
- package/esm/vs/platform/theme/common/colorUtils.js +2 -2
- package/esm/vs/platform/theme/common/colors/baseColors.js +17 -17
- package/esm/vs/platform/theme/common/colors/chartsColors.js +8 -8
- package/esm/vs/platform/theme/common/colors/editorColors.js +95 -95
- package/esm/vs/platform/theme/common/colors/inputColors.js +47 -47
- package/esm/vs/platform/theme/common/colors/listColors.js +36 -36
- package/esm/vs/platform/theme/common/colors/menuColors.js +7 -7
- package/esm/vs/platform/theme/common/colors/minimapColors.js +11 -11
- package/esm/vs/platform/theme/common/colors/miscColors.js +16 -16
- package/esm/vs/platform/theme/common/colors/quickpickColors.js +9 -9
- package/esm/vs/platform/theme/common/colors/searchColors.js +3 -3
- package/esm/vs/platform/theme/common/iconRegistry.js +6 -6
- package/esm/vs/platform/undoRedo/common/undoRedoService.js +20 -20
- package/esm/vs/platform/webWorker/browser/webWorkerDescriptor.js.map +1 -1
- package/esm/vs/platform/workspace/common/workspace.js +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/longDistanceHint/inlineEditsLongDistanceHint.ts","vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/inlineEditsLongDistanceHint.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;gGAGgG;AAChG,OAAO,EAAa,CAAC,EAAyC,MAAM,6CAA6C,CAAC;AAClH,OAAO,EAAE,KAAK,EAAE,MAAM,8CAA8C,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,kDAAkD,CAAC;AAC9E,OAAO,EAAe,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mDAAmD,CAAC;AAC5J,OAAO,EAAE,qBAAqB,EAAE,MAAM,wEAAwE,CAAC;AAE/G,OAAO,EAAE,oBAAoB,EAAE,MAAM,sDAAsD,CAAC;AAC5F,OAAO,EAAE,IAAI,EAAE,MAAM,6CAA6C,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,8CAA8C,CAAC;AAExE,OAAO,EAAoB,mBAAmB,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GAAG,IAAI,WAAW,CAAC,qBAAqB,EAAE,qBAAqB,GAAG,WAAW,CAAC,CAAC;IACjG,IAAI,YAAY,CAAC,aAAa,CAAC,oBAAoB,CAAC,EAAE,CAAC;QACtD,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,CAAC;IACrD,CAAC;IACD,IAAI,oBAAoB,CAAC,MAAM,GAAG,WAAW,EAAE,CAAC;QAC/C,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,CAAC,KAAK,EAAE,CAAC;IAC1D,CAAC;IACD,IAAI,oBAAoB,CAAC,YAAY,GAAG,YAAY,CAAC,YAAY,EAAE,CAAC;QACnE,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,CAAC,YAAY,GAAG,WAAW,EAAE,CAAC;IAC/E,CAAC;IACD,IAAI,oBAAoB,CAAC,KAAK,GAAG,YAAY,CAAC,KAAK,EAAE,CAAC;QACrD,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,CAAC,KAAK,EAAE,CAAC;IAC1D,CAAC;IACD,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,CAAC;AACrD,CAAC","file":"inlineEditsLongDistanceHint.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 { ChildNode, n, ObserverNode, ObserverNodeWithElement } from '../../../../../../../../base/browser/dom.js';\nimport { Event } from '../../../../../../../../base/common/event.js';\nimport { Disposable } from '../../../../../../../../base/common/lifecycle.js';\nimport { IObservable, autorun, constObservable, debouncedObservable2, derived, derivedDisposable } from '../../../../../../../../base/common/observable.js';\nimport { IInstantiationService } from '../../../../../../../../platform/instantiation/common/instantiation.js';\nimport { ICodeEditor } from '../../../../../../../browser/editorBrowser.js';\nimport { observableCodeEditor } from '../../../../../../../browser/observableCodeEditor.js';\nimport { Rect } from '../../../../../../../common/core/2d/rect.js';\nimport { Position } from '../../../../../../../common/core/position.js';\nimport { ITextModel } from '../../../../../../../common/model.js';\nimport { IInlineEditsView, InlineEditTabAction } from '../../inlineEditsViewInterface.js';\nimport { InlineEditWithChanges } from '../../inlineEditWithChanges.js';\nimport { getContentSizeOfLines, rectToProps } from '../../utils/utils.js';\nimport { DetailedLineRangeMapping } from '../../../../../../../common/diff/rangeMapping.js';\nimport { OffsetRange } from '../../../../../../../common/core/ranges/offsetRange.js';\nimport { LineRange } from '../../../../../../../common/core/ranges/lineRange.js';\nimport { HideUnchangedRegionsFeature } from '../../../../../../../browser/widget/diffEditor/features/hideUnchangedRegionsFeature.js';\nimport { Codicon } from '../../../../../../../../base/common/codicons.js';\nimport { renderIcon } from '../../../../../../../../base/browser/ui/iconLabel/iconLabels.js';\nimport { SymbolKinds } from '../../../../../../../common/languages.js';\nimport { debugLogRects, debugView } from '../debugVisualization.js';\nimport { distributeFlexBoxLayout } from '../../utils/flexBoxLayout.js';\nimport { Point } from '../../../../../../../common/core/2d/point.js';\nimport { Size2D } from '../../../../../../../common/core/2d/size.js';\nimport { getMaxTowerHeightInAvailableArea } from '../../utils/towersLayout.js';\nimport { IThemeService } from '../../../../../../../../platform/theme/common/themeService.js';\nimport { getEditorBlendedColor, inlineEditIndicatorPrimaryBackground, inlineEditIndicatorSecondaryBackground, inlineEditIndicatorsuccessfulBackground } from '../../theme.js';\nimport { asCssVariable, descriptionForeground, editorBackground } from '../../../../../../../../platform/theme/common/colorRegistry.js';\nimport { ILongDistancePreviewProps, LongDistancePreviewEditor } from './longDistancePreviewEditor.js';\nimport { InlineSuggestionGutterMenuData, SimpleInlineSuggestModel } from '../../components/gutterIndicatorView.js';\n\nconst BORDER_RADIUS = 4;\nconst MAX_WIDGET_WIDTH = 400;\nconst MIN_WIDGET_WIDTH = 200;\n\nexport class InlineEditsLongDistanceHint extends Disposable implements IInlineEditsView {\n\n\tprivate readonly _editorObs;\n\treadonly onDidClick = Event.None;\n\tprivate _viewWithElement: ObserverNodeWithElement<HTMLDivElement> | undefined = undefined;\n\n\tprivate readonly _previewEditor;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tprivate readonly _viewState: IObservable<ILongDistanceViewState | undefined>,\n\t\tprivate readonly _previewTextModel: ITextModel,\n\t\tprivate readonly _tabAction: IObservable<InlineEditTabAction>,\n\t\t@IInstantiationService private readonly _instantiationService: IInstantiationService,\n\t\t@IThemeService private readonly _themeService: IThemeService,\n\t) {\n\t\tsuper();\n\n\t\tthis._styles = this._tabAction.map((v, reader) => {\n\t\t\tlet border;\n\t\t\tswitch (v) {\n\t\t\t\tcase InlineEditTabAction.Inactive: border = inlineEditIndicatorSecondaryBackground; break;\n\t\t\t\tcase InlineEditTabAction.Jump: border = inlineEditIndicatorPrimaryBackground; break;\n\t\t\t\tcase InlineEditTabAction.Accept: border = inlineEditIndicatorsuccessfulBackground; break;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tborder: getEditorBlendedColor(border, this._themeService).read(reader).toString(),\n\t\t\t\tbackground: asCssVariable(editorBackground)\n\t\t\t};\n\t\t});\n\n\t\tthis._editorObs = observableCodeEditor(this._editor);\n\n\t\tthis._previewEditor = this._register(\n\t\t\tthis._instantiationService.createInstance(\n\t\t\t\tLongDistancePreviewEditor,\n\t\t\t\tthis._previewTextModel,\n\t\t\t\tderived(reader => {\n\t\t\t\t\tconst viewState = this._viewState.read(reader);\n\t\t\t\t\tif (!viewState) {\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdiff: viewState.diff,\n\t\t\t\t\t\tmodel: viewState.model,\n\t\t\t\t\t\tsuggestInfo: viewState.suggestInfo,\n\t\t\t\t\t} satisfies ILongDistancePreviewProps;\n\t\t\t\t}),\n\t\t\t\tthis._editor,\n\t\t\t\tthis._tabAction,\n\t\t\t)\n\t\t);\n\n\t\tthis._viewWithElement = this._view.keepUpdated(this._store);\n\t\tthis._register(this._editorObs.createOverlayWidget({\n\t\t\tdomNode: this._viewWithElement.element,\n\t\t\tposition: constObservable(null),\n\t\t\tallowEditorOverflow: false,\n\t\t\tminContentWidthInPx: constObservable(0),\n\t\t}));\n\n\t\tthis._widgetContent.get().keepUpdated(this._store);\n\n\t\tthis._register(autorun(reader => {\n\t\t\tconst layoutInfo = this._previewEditorLayoutInfo.read(reader);\n\t\t\tif (!layoutInfo) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis._previewEditor.layout(layoutInfo.codeEditorSize.toDimension(), layoutInfo.desiredPreviewEditorScrollLeft);\n\t\t}));\n\n\t\tthis._isVisibleDelayed.recomputeInitiallyAndOnChange(this._store);\n\t}\n\n\tprivate readonly _styles;\n\n\tpublic get isHovered() { return this._widgetContent.get().didMouseMoveDuringHover; }\n\n\tprivate readonly _hintTextPosition = derived(this, (reader) => {\n\t\tconst viewState = this._viewState.read(reader);\n\t\treturn viewState ? new Position(viewState.hint.lineNumber, Number.MAX_SAFE_INTEGER) : null;\n\t});\n\n\tprivate readonly _lineSizesAroundHintPosition = derived(this, (reader) => {\n\t\tconst viewState = this._viewState.read(reader);\n\t\tconst p = this._hintTextPosition.read(reader);\n\t\tif (!viewState || !p) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst model = this._editorObs.model.read(reader);\n\t\tif (!model) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst range = LineRange.ofLength(p.lineNumber, 1).addMargin(5, 5).intersect(LineRange.ofLength(1, model.getLineCount()));\n\n\t\tif (!range) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst sizes = getContentSizeOfLines(this._editorObs, range, reader);\n\t\tconst top = this._editorObs.observeTopForLineNumber(range.startLineNumber).read(reader);\n\n\t\treturn {\n\t\t\tlineRange: range,\n\t\t\ttop: top,\n\t\t\tsizes: sizes,\n\t\t};\n\t});\n\n\tprivate readonly _isVisibleDelayed = debouncedObservable2(\n\t\tderived(this, reader => this._viewState.read(reader)?.hint.isVisible),\n\t\t(lastValue, newValue) => lastValue === true && newValue === false ? 200 : 0,\n\t);\n\n\tprivate readonly _previewEditorLayoutInfo = derived(this, (reader) => {\n\t\tconst viewState = this._viewState.read(reader);\n\n\t\tif (!viewState || !this._isVisibleDelayed.read(reader)) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst lineSizes = this._lineSizesAroundHintPosition.read(reader);\n\t\tif (!lineSizes) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst editorScrollTop = this._editorObs.scrollTop.read(reader);\n\t\tconst editorScrollLeft = this._editorObs.scrollLeft.read(reader);\n\t\tconst editorLayout = this._editorObs.layoutInfo.read(reader);\n\n\t\tconst previewContentHeight = this._previewEditor.contentHeight.read(reader);\n\t\tconst previewEditorContentLayout = this._previewEditor.horizontalContentRangeInPreviewEditorToShow.read(reader);\n\n\t\tif (!previewContentHeight || !previewEditorContentLayout) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// const debugRects = stackSizesDown(new Point(editorLayout.contentLeft, lineSizes.top - scrollTop), lineSizes.sizes);\n\n\t\tconst editorTrueContentWidth = editorLayout.contentWidth - editorLayout.verticalScrollbarWidth;\n\t\tconst editorTrueContentRight = editorLayout.contentLeft + editorTrueContentWidth;\n\n\t\t// drawEditorWidths(this._editor, reader);\n\n\t\tconst c = this._editorObs.cursorLineNumber.read(reader);\n\t\tif (!c) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst availableSpaceSizes = lineSizes.sizes.map((s, idx) => {\n\t\t\tconst lineNumber = lineSizes.lineRange.startLineNumber + idx;\n\t\t\tlet linePaddingLeft = 20;\n\t\t\tif (lineNumber === viewState.hint.lineNumber) {\n\t\t\t\tlinePaddingLeft = 100;\n\t\t\t}\n\t\t\treturn new Size2D(Math.max(0, editorTrueContentWidth - s.width - linePaddingLeft), s.height);\n\t\t});\n\n\t\tconst showRects = false;\n\t\tif (showRects) {\n\t\t\tconst rects2 = stackSizesDown(new Point(editorTrueContentRight, lineSizes.top - editorScrollTop), availableSpaceSizes, 'right');\n\t\t\tdebugView(debugLogRects({ ...rects2 }, this._editor.getDomNode()!), reader);\n\t\t}\n\n\t\tconst availableSpaceHeightPrefixSums = getSums(availableSpaceSizes, s => s.height);\n\t\tconst availableSpaceSizesTransposed = availableSpaceSizes.map(s => s.transpose());\n\n\t\tconst previewEditorMargin = 2;\n\t\tconst widgetPadding = 2;\n\t\tconst lowerBarHeight = 20;\n\t\tconst widgetBorder = 1;\n\n\t\tconst extraGutterMarginToAvoidScrollBar = 2;\n\t\tconst previewEditorHeight = previewContentHeight! + extraGutterMarginToAvoidScrollBar;\n\n\t\tfunction getWidgetVerticalOutline(lineNumber: number): OffsetRange {\n\t\t\tconst sizeIdx = lineNumber - lineSizes!.lineRange.startLineNumber;\n\t\t\tconst top = lineSizes!.top + availableSpaceHeightPrefixSums[sizeIdx];\n\t\t\tconst editorRange = OffsetRange.ofStartAndLength(top, previewEditorHeight);\n\t\t\tconst verticalWidgetRange = editorRange.withMargin(previewEditorMargin + widgetPadding + widgetBorder).withMargin(0, lowerBarHeight);\n\t\t\treturn verticalWidgetRange;\n\t\t}\n\n\t\tlet possibleWidgetOutline = findFirstMinimzeDistance(lineSizes.lineRange.addMargin(-1, -1), viewState.hint.lineNumber, lineNumber => {\n\t\t\tconst verticalWidgetRange = getWidgetVerticalOutline(lineNumber);\n\t\t\tconst maxWidth = getMaxTowerHeightInAvailableArea(verticalWidgetRange.delta(-lineSizes.top), availableSpaceSizesTransposed);\n\t\t\tif (maxWidth < MIN_WIDGET_WIDTH) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tconst horizontalWidgetRange = OffsetRange.ofStartAndLength(editorTrueContentRight - maxWidth, maxWidth);\n\t\t\treturn { horizontalWidgetRange, verticalWidgetRange };\n\t\t});\n\t\tif (!possibleWidgetOutline) {\n\t\t\tpossibleWidgetOutline = {\n\t\t\t\thorizontalWidgetRange: OffsetRange.ofStartAndLength(editorTrueContentRight - MAX_WIDGET_WIDTH, MAX_WIDGET_WIDTH),\n\t\t\t\tverticalWidgetRange: getWidgetVerticalOutline(viewState.hint.lineNumber + 2).delta(10),\n\t\t\t};\n\t\t}\n\n\t\tif (!possibleWidgetOutline) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst rectAvailableSpace = Rect.fromRanges(\n\t\t\tpossibleWidgetOutline.horizontalWidgetRange,\n\t\t\tpossibleWidgetOutline.verticalWidgetRange\n\t\t).translateX(-editorScrollLeft).translateY(-editorScrollTop);\n\n\t\tconst showAvailableSpace = false;\n\t\tif (showAvailableSpace) {\n\t\t\tdebugView(debugLogRects({ rectAvailableSpace }, this._editor.getDomNode()!), reader);\n\t\t}\n\n\t\tconst maxWidgetWidth = Math.min(MAX_WIDGET_WIDTH, previewEditorContentLayout.maxEditorWidth + previewEditorMargin + widgetPadding);\n\n\t\tconst layout = distributeFlexBoxLayout(rectAvailableSpace.width, {\n\t\t\tspaceBefore: { min: 0, max: 10, priority: 1 },\n\t\t\tcontent: { min: 50, rules: [{ max: 150, priority: 2 }, { max: maxWidgetWidth, priority: 1 }] },\n\t\t\tspaceAfter: { min: 20 },\n\t\t});\n\n\t\tif (!layout) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst ranges = lengthsToOffsetRanges([layout.spaceBefore, layout.content, layout.spaceAfter], rectAvailableSpace.left);\n\t\tconst spaceBeforeRect = rectAvailableSpace.withHorizontalRange(ranges[0]);\n\t\tconst widgetRect = rectAvailableSpace.withHorizontalRange(ranges[1]);\n\t\tconst spaceAfterRect = rectAvailableSpace.withHorizontalRange(ranges[2]);\n\n\t\tconst showRects2 = false;\n\t\tif (showRects2) {\n\t\t\tdebugView(debugLogRects({ spaceBeforeRect, widgetRect, spaceAfterRect }, this._editor.getDomNode()!), reader);\n\t\t}\n\n\t\tconst previewEditorRect = widgetRect.withMargin(-widgetPadding - widgetBorder - previewEditorMargin).withMargin(0, 0, -lowerBarHeight, 0);\n\n\t\tconst showEditorRect = false;\n\t\tif (showEditorRect) {\n\t\t\tdebugView(debugLogRects({ previewEditorRect }, this._editor.getDomNode()!), reader);\n\t\t}\n\n\t\tconst previewEditorContentWidth = previewEditorRect.width - previewEditorContentLayout.nonContentWidth;\n\t\tconst maxPrefferedRangeLength = previewEditorContentWidth * 0.8;\n\t\tconst preferredRangeToReveal = previewEditorContentLayout.preferredRangeToReveal.intersect(OffsetRange.ofStartAndLength(\n\t\t\tpreviewEditorContentLayout.preferredRangeToReveal.start,\n\t\t\tmaxPrefferedRangeLength\n\t\t)) ?? previewEditorContentLayout.preferredRangeToReveal;\n\t\tconst desiredPreviewEditorScrollLeft = scrollToReveal(previewEditorContentLayout.indentationEnd, previewEditorContentWidth, preferredRangeToReveal);\n\n\t\treturn {\n\t\t\tcodeEditorSize: previewEditorRect.getSize(),\n\t\t\tcodeScrollLeft: editorScrollLeft,\n\t\t\tcontentLeft: editorLayout.contentLeft,\n\n\t\t\twidgetRect,\n\n\t\t\tpreviewEditorMargin,\n\t\t\twidgetPadding,\n\t\t\twidgetBorder,\n\n\t\t\tlowerBarHeight,\n\n\t\t\tdesiredPreviewEditorScrollLeft: desiredPreviewEditorScrollLeft.newScrollPosition,\n\t\t};\n\t});\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: derived(this, reader => !!this._previewEditorLayoutInfo.read(reader) ? 'block' : 'none'),\n\t\t},\n\t}, [\n\t\tderived(this, _reader => [this._widgetContent]),\n\t]);\n\n\tprivate readonly _widgetContent = derived(this, reader => // TODO how to not use derived but not move into constructor?\n\t\tn.div({\n\t\t\tstyle: {\n\t\t\t\tposition: 'absolute',\n\t\t\t\toverflow: 'hidden',\n\t\t\t\tcursor: 'pointer',\n\t\t\t\tbackground: 'var(--vscode-editorWidget-background)',\n\t\t\t\tpadding: this._previewEditorLayoutInfo.map(i => i?.widgetPadding),\n\t\t\t\tboxSizing: 'border-box',\n\t\t\t\tborderRadius: BORDER_RADIUS,\n\t\t\t\tborder: derived(reader => `${this._previewEditorLayoutInfo.read(reader)?.widgetBorder}px solid ${this._styles.read(reader).border}`),\n\t\t\t\tdisplay: 'flex',\n\t\t\t\tflexDirection: 'column',\n\t\t\t\topacity: derived(reader => this._viewState.read(reader)?.hint.isVisible ? '1' : '0'),\n\t\t\t\ttransition: 'opacity 200ms ease-in-out',\n\t\t\t\t...rectToProps(reader => this._previewEditorLayoutInfo.read(reader)?.widgetRect)\n\t\t\t},\n\t\t\tonmousedown: e => {\n\t\t\t\te.preventDefault(); // This prevents that the editor loses focus\n\t\t\t},\n\t\t\tonclick: () => {\n\t\t\t\tthis._viewState.read(undefined)?.model.jump();\n\t\t\t}\n\t\t}, [\n\t\t\tn.div({\n\t\t\t\tclass: ['editorContainer'],\n\t\t\t\tstyle: {\n\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\tpadding: this._previewEditorLayoutInfo.map(i => i?.previewEditorMargin),\n\t\t\t\t\tbackground: 'var(--vscode-editor-background)',\n\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t},\n\t\t\t}, [\n\t\t\t\tderived(this, r => this._previewEditor.element), // --\n\t\t\t]),\n\t\t\tn.div({ class: 'bar', style: { color: asCssVariable(descriptionForeground), pointerEvents: 'none', margin: '0 4px', height: this._previewEditorLayoutInfo.map(i => i?.lowerBarHeight), display: 'flex', justifyContent: 'space-between', alignItems: 'center' } }, [\n\t\t\t\tderived(this, reader => {\n\t\t\t\t\tconst children: (HTMLElement | ObserverNode<HTMLDivElement>)[] = [];\n\t\t\t\t\tconst viewState = this._viewState.read(reader);\n\t\t\t\t\tif (!viewState) {\n\t\t\t\t\t\treturn children;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Outline Element\n\t\t\t\t\tconst source = this._originalOutlineSource.read(reader);\n\t\t\t\t\tconst outlineItems = source?.getAt(viewState.edit.lineEdit.lineRange.startLineNumber, reader).slice(0, 1) ?? [];\n\t\t\t\t\tconst outlineElements: ChildNode[] = [];\n\t\t\t\t\tif (outlineItems.length > 0) {\n\t\t\t\t\t\tfor (let i = 0; i < outlineItems.length; i++) {\n\t\t\t\t\t\t\tconst item = outlineItems[i];\n\t\t\t\t\t\t\tconst icon = SymbolKinds.toIcon(item.kind);\n\t\t\t\t\t\t\toutlineElements.push(n.div({\n\t\t\t\t\t\t\t\tclass: 'breadcrumb-item',\n\t\t\t\t\t\t\t\tstyle: { display: 'flex', alignItems: 'center', flex: '1 1 auto', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' },\n\t\t\t\t\t\t\t}, [\n\t\t\t\t\t\t\t\trenderIcon(icon),\n\t\t\t\t\t\t\t\t'\\u00a0',\n\t\t\t\t\t\t\t\titem.name,\n\t\t\t\t\t\t\t\t...(i === outlineItems.length - 1\n\t\t\t\t\t\t\t\t\t? []\n\t\t\t\t\t\t\t\t\t: [renderIcon(Codicon.chevronRight)]\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}\n\t\t\t\t\tchildren.push(n.div({ class: 'outline-elements' }, outlineElements));\n\n\t\t\t\t\t// Show Edit Direction\n\t\t\t\t\tconst arrowIcon = isEditBelowHint(viewState) ? Codicon.arrowDown : Codicon.arrowUp;\n\t\t\t\t\tchildren.push(n.div({\n\t\t\t\t\t\tclass: 'go-to-label',\n\t\t\t\t\t\tstyle: { display: 'flex', alignItems: 'center', flex: '0 0 auto', marginLeft: '14px' },\n\t\t\t\t\t}, [\n\t\t\t\t\t\t'Go To Edit',\n\t\t\t\t\t\t'\\u00a0',\n\t\t\t\t\t\trenderIcon(arrowIcon),\n\t\t\t\t\t]));\n\n\t\t\t\t\treturn children;\n\t\t\t\t})\n\t\t\t]),\n\t\t])\n\t);\n\n\tprivate readonly _originalOutlineSource = derivedDisposable(this, (reader) => {\n\t\tconst m = this._editorObs.model.read(reader);\n\t\tconst factory = HideUnchangedRegionsFeature._breadcrumbsSourceFactory.read(reader);\n\t\treturn (!m || !factory) ? undefined : factory(m, this._instantiationService);\n\t});\n}\n\nexport interface ILongDistanceHint {\n\tlineNumber: number;\n\tisVisible: boolean;\n}\n\nexport interface ILongDistanceViewState {\n\thint: ILongDistanceHint;\n\tnewTextLineCount: number;\n\tedit: InlineEditWithChanges;\n\tdiff: DetailedLineRangeMapping[];\n\n\tmodel: SimpleInlineSuggestModel;\n\tsuggestInfo: InlineSuggestionGutterMenuData;\n}\n\nfunction lengthsToOffsetRanges(lengths: number[], initialOffset = 0): OffsetRange[] {\n\tconst result: OffsetRange[] = [];\n\tlet offset = initialOffset;\n\tfor (const length of lengths) {\n\t\tresult.push(new OffsetRange(offset, offset + length));\n\t\toffset += length;\n\t}\n\treturn result;\n}\n\nfunction stackSizesDown(at: Point, sizes: Size2D[], alignment: 'left' | 'right' = 'left'): Rect[] {\n\tconst rects: Rect[] = [];\n\tlet offset = 0;\n\tfor (const s of sizes) {\n\t\trects.push(\n\t\t\tRect.fromLeftTopWidthHeight(\n\t\t\t\tat.x + (alignment === 'left' ? 0 : -s.width),\n\t\t\t\tat.y + offset,\n\t\t\t\ts.width,\n\t\t\t\ts.height\n\t\t\t)\n\t\t);\n\t\toffset += s.height;\n\t}\n\treturn rects;\n}\n\nfunction findFirstMinimzeDistance<T>(range: LineRange, targetLine: number, predicate: (lineNumber: number) => T | undefined): T | undefined {\n\tfor (let offset = 0; ; offset++) {\n\t\tconst down = targetLine + offset;\n\t\tif (down <= range.endLineNumberExclusive) {\n\t\t\tconst result = predicate(down);\n\t\t\tif (result !== undefined) {\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\t\tconst up = targetLine - offset;\n\t\tif (up >= range.startLineNumber) {\n\t\t\tconst result = predicate(up);\n\t\t\tif (result !== undefined) {\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\t\tif (up < range.startLineNumber && down > range.endLineNumberExclusive) {\n\t\t\treturn undefined;\n\t\t}\n\t}\n}\n\nfunction getSums<T>(array: T[], fn: (item: T) => number): number[] {\n\tconst result: number[] = [0];\n\tlet sum = 0;\n\tfor (const item of array) {\n\t\tsum += fn(item);\n\t\tresult.push(sum);\n\t}\n\treturn result;\n}\n\nfunction isEditBelowHint(viewState: ILongDistanceViewState): boolean {\n\tconst hintLineNumber = viewState.hint.lineNumber;\n\tconst editStartLineNumber = viewState.diff[0]?.original.startLineNumber;\n\treturn hintLineNumber < editStartLineNumber;\n}\n\n\n/**\n * Changes the scroll position as little as possible just to reveal the given range in the window.\n*/\nexport function scrollToReveal(currentScrollPosition: number, windowWidth: number, contentRangeToReveal: OffsetRange): { newScrollPosition: number } {\n\tconst visibleRange = new OffsetRange(currentScrollPosition, currentScrollPosition + windowWidth);\n\tif (visibleRange.containsRange(contentRangeToReveal)) {\n\t\treturn { newScrollPosition: currentScrollPosition };\n\t}\n\tif (contentRangeToReveal.length > windowWidth) {\n\t\treturn { newScrollPosition: contentRangeToReveal.start };\n\t}\n\tif (contentRangeToReveal.endExclusive > visibleRange.endExclusive) {\n\t\treturn { newScrollPosition: contentRangeToReveal.endExclusive - windowWidth };\n\t}\n\tif (contentRangeToReveal.start < visibleRange.start) {\n\t\treturn { newScrollPosition: contentRangeToReveal.start };\n\t}\n\treturn { newScrollPosition: currentScrollPosition };\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 { ChildNode, n, ObserverNode, ObserverNodeWithElement } from '../../../../../../../../base/browser/dom.js';\nimport { Event } from '../../../../../../../../base/common/event.js';\nimport { Disposable } from '../../../../../../../../base/common/lifecycle.js';\nimport { IObservable, autorun, constObservable, debouncedObservable2, derived, derivedDisposable } from '../../../../../../../../base/common/observable.js';\nimport { IInstantiationService } from '../../../../../../../../platform/instantiation/common/instantiation.js';\nimport { ICodeEditor } from '../../../../../../../browser/editorBrowser.js';\nimport { observableCodeEditor } from '../../../../../../../browser/observableCodeEditor.js';\nimport { Rect } from '../../../../../../../common/core/2d/rect.js';\nimport { Position } from '../../../../../../../common/core/position.js';\nimport { ITextModel } from '../../../../../../../common/model.js';\nimport { IInlineEditsView, InlineEditTabAction } from '../../inlineEditsViewInterface.js';\nimport { InlineEditWithChanges } from '../../inlineEditWithChanges.js';\nimport { getContentSizeOfLines, rectToProps } from '../../utils/utils.js';\nimport { DetailedLineRangeMapping } from '../../../../../../../common/diff/rangeMapping.js';\nimport { OffsetRange } from '../../../../../../../common/core/ranges/offsetRange.js';\nimport { LineRange } from '../../../../../../../common/core/ranges/lineRange.js';\nimport { HideUnchangedRegionsFeature } from '../../../../../../../browser/widget/diffEditor/features/hideUnchangedRegionsFeature.js';\nimport { Codicon } from '../../../../../../../../base/common/codicons.js';\nimport { renderIcon } from '../../../../../../../../base/browser/ui/iconLabel/iconLabels.js';\nimport { SymbolKinds } from '../../../../../../../common/languages.js';\nimport { debugLogRects, debugView } from '../debugVisualization.js';\nimport { distributeFlexBoxLayout } from '../../utils/flexBoxLayout.js';\nimport { Point } from '../../../../../../../common/core/2d/point.js';\nimport { Size2D } from '../../../../../../../common/core/2d/size.js';\nimport { getMaxTowerHeightInAvailableArea } from '../../utils/towersLayout.js';\nimport { IThemeService } from '../../../../../../../../platform/theme/common/themeService.js';\nimport { getEditorBlendedColor, inlineEditIndicatorPrimaryBackground, inlineEditIndicatorSecondaryBackground, inlineEditIndicatorsuccessfulBackground } from '../../theme.js';\nimport { asCssVariable, descriptionForeground, editorBackground } from '../../../../../../../../platform/theme/common/colorRegistry.js';\nimport { ILongDistancePreviewProps, LongDistancePreviewEditor } from './longDistancePreviewEditor.js';\nimport { InlineSuggestionGutterMenuData, SimpleInlineSuggestModel } from '../../components/gutterIndicatorView.js';\n\nconst BORDER_RADIUS = 4;\nconst MAX_WIDGET_WIDTH = 400;\nconst MIN_WIDGET_WIDTH = 200;\n\nexport class InlineEditsLongDistanceHint extends Disposable implements IInlineEditsView {\n\n\tprivate readonly _editorObs;\n\treadonly onDidClick = Event.None;\n\tprivate _viewWithElement: ObserverNodeWithElement<HTMLDivElement> | undefined = undefined;\n\n\tprivate readonly _previewEditor;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tprivate readonly _viewState: IObservable<ILongDistanceViewState | undefined>,\n\t\tprivate readonly _previewTextModel: ITextModel,\n\t\tprivate readonly _tabAction: IObservable<InlineEditTabAction>,\n\t\t@IInstantiationService private readonly _instantiationService: IInstantiationService,\n\t\t@IThemeService private readonly _themeService: IThemeService,\n\t) {\n\t\tsuper();\n\n\t\tthis._styles = this._tabAction.map((v, reader) => {\n\t\t\tlet border;\n\t\t\tswitch (v) {\n\t\t\t\tcase InlineEditTabAction.Inactive: border = inlineEditIndicatorSecondaryBackground; break;\n\t\t\t\tcase InlineEditTabAction.Jump: border = inlineEditIndicatorPrimaryBackground; break;\n\t\t\t\tcase InlineEditTabAction.Accept: border = inlineEditIndicatorsuccessfulBackground; break;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tborder: getEditorBlendedColor(border, this._themeService).read(reader).toString(),\n\t\t\t\tbackground: asCssVariable(editorBackground)\n\t\t\t};\n\t\t});\n\n\t\tthis._editorObs = observableCodeEditor(this._editor);\n\n\t\tthis._previewEditor = this._register(\n\t\t\tthis._instantiationService.createInstance(\n\t\t\t\tLongDistancePreviewEditor,\n\t\t\t\tthis._previewTextModel,\n\t\t\t\tderived(reader => {\n\t\t\t\t\tconst viewState = this._viewState.read(reader);\n\t\t\t\t\tif (!viewState) {\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdiff: viewState.diff,\n\t\t\t\t\t\tmodel: viewState.model,\n\t\t\t\t\t\tsuggestInfo: viewState.suggestInfo,\n\t\t\t\t\t} satisfies ILongDistancePreviewProps;\n\t\t\t\t}),\n\t\t\t\tthis._editor,\n\t\t\t\tthis._tabAction,\n\t\t\t)\n\t\t);\n\n\t\tthis._viewWithElement = this._view.keepUpdated(this._store);\n\t\tthis._register(this._editorObs.createOverlayWidget({\n\t\t\tdomNode: this._viewWithElement.element,\n\t\t\tposition: constObservable(null),\n\t\t\tallowEditorOverflow: false,\n\t\t\tminContentWidthInPx: constObservable(0),\n\t\t}));\n\n\t\tthis._widgetContent.get().keepUpdated(this._store);\n\n\t\tthis._register(autorun(reader => {\n\t\t\tconst layoutInfo = this._previewEditorLayoutInfo.read(reader);\n\t\t\tif (!layoutInfo) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis._previewEditor.layout(layoutInfo.codeEditorSize.toDimension(), layoutInfo.desiredPreviewEditorScrollLeft);\n\t\t}));\n\n\t\tthis._isVisibleDelayed.recomputeInitiallyAndOnChange(this._store);\n\t}\n\n\tprivate readonly _styles;\n\n\tpublic get isHovered() { return this._widgetContent.get().didMouseMoveDuringHover; }\n\n\tprivate readonly _hintTextPosition = derived(this, (reader) => {\n\t\tconst viewState = this._viewState.read(reader);\n\t\treturn viewState ? new Position(viewState.hint.lineNumber, Number.MAX_SAFE_INTEGER) : null;\n\t});\n\n\tprivate readonly _lineSizesAroundHintPosition = derived(this, (reader) => {\n\t\tconst viewState = this._viewState.read(reader);\n\t\tconst p = this._hintTextPosition.read(reader);\n\t\tif (!viewState || !p) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst model = this._editorObs.model.read(reader);\n\t\tif (!model) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst range = LineRange.ofLength(p.lineNumber, 1).addMargin(5, 5).intersect(LineRange.ofLength(1, model.getLineCount()));\n\n\t\tif (!range) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst sizes = getContentSizeOfLines(this._editorObs, range, reader);\n\t\tconst top = this._editorObs.observeTopForLineNumber(range.startLineNumber).read(reader);\n\n\t\treturn {\n\t\t\tlineRange: range,\n\t\t\ttop: top,\n\t\t\tsizes: sizes,\n\t\t};\n\t});\n\n\tprivate readonly _isVisibleDelayed = debouncedObservable2(\n\t\tderived(this, reader => this._viewState.read(reader)?.hint.isVisible),\n\t\t(lastValue, newValue) => lastValue === true && newValue === false ? 200 : 0,\n\t);\n\n\tprivate readonly _previewEditorLayoutInfo = derived(this, (reader) => {\n\t\tconst viewState = this._viewState.read(reader);\n\n\t\tif (!viewState || !this._isVisibleDelayed.read(reader)) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst lineSizes = this._lineSizesAroundHintPosition.read(reader);\n\t\tif (!lineSizes) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst editorScrollTop = this._editorObs.scrollTop.read(reader);\n\t\tconst editorScrollLeft = this._editorObs.scrollLeft.read(reader);\n\t\tconst editorLayout = this._editorObs.layoutInfo.read(reader);\n\n\t\tconst previewContentHeight = this._previewEditor.contentHeight.read(reader);\n\t\tconst previewEditorContentLayout = this._previewEditor.horizontalContentRangeInPreviewEditorToShow.read(reader);\n\n\t\tif (!previewContentHeight || !previewEditorContentLayout) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// const debugRects = stackSizesDown(new Point(editorLayout.contentLeft, lineSizes.top - scrollTop), lineSizes.sizes);\n\n\t\tconst editorTrueContentWidth = editorLayout.contentWidth - editorLayout.verticalScrollbarWidth;\n\t\tconst editorTrueContentRight = editorLayout.contentLeft + editorTrueContentWidth;\n\n\t\t// drawEditorWidths(this._editor, reader);\n\n\t\tconst c = this._editorObs.cursorLineNumber.read(reader);\n\t\tif (!c) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst availableSpaceSizes = lineSizes.sizes.map((s, idx) => {\n\t\t\tconst lineNumber = lineSizes.lineRange.startLineNumber + idx;\n\t\t\tlet linePaddingLeft = 20;\n\t\t\tif (lineNumber === viewState.hint.lineNumber) {\n\t\t\t\tlinePaddingLeft = 100;\n\t\t\t}\n\t\t\treturn new Size2D(Math.max(0, editorTrueContentWidth - s.width - linePaddingLeft), s.height);\n\t\t});\n\n\t\tconst showRects = false;\n\t\tif (showRects) {\n\t\t\tconst rects2 = stackSizesDown(new Point(editorTrueContentRight, lineSizes.top - editorScrollTop), availableSpaceSizes, 'right');\n\t\t\tdebugView(debugLogRects({ ...rects2 }, this._editor.getDomNode()!), reader);\n\t\t}\n\n\t\tconst availableSpaceHeightPrefixSums = getSums(availableSpaceSizes, s => s.height);\n\t\tconst availableSpaceSizesTransposed = availableSpaceSizes.map(s => s.transpose());\n\n\t\tconst previewEditorMargin = 2;\n\t\tconst widgetPadding = 2;\n\t\tconst lowerBarHeight = 20;\n\t\tconst widgetBorder = 1;\n\n\t\tconst extraGutterMarginToAvoidScrollBar = 2;\n\t\tconst previewEditorHeight = previewContentHeight! + extraGutterMarginToAvoidScrollBar;\n\n\t\tfunction getWidgetVerticalOutline(lineNumber: number): OffsetRange {\n\t\t\tconst sizeIdx = lineNumber - lineSizes!.lineRange.startLineNumber;\n\t\t\tconst top = lineSizes!.top + availableSpaceHeightPrefixSums[sizeIdx];\n\t\t\tconst editorRange = OffsetRange.ofStartAndLength(top, previewEditorHeight);\n\t\t\tconst verticalWidgetRange = editorRange.withMargin(previewEditorMargin + widgetPadding + widgetBorder).withMargin(0, lowerBarHeight);\n\t\t\treturn verticalWidgetRange;\n\t\t}\n\n\t\tlet possibleWidgetOutline = findFirstMinimzeDistance(lineSizes.lineRange.addMargin(-1, -1), viewState.hint.lineNumber, lineNumber => {\n\t\t\tconst verticalWidgetRange = getWidgetVerticalOutline(lineNumber);\n\t\t\tconst maxWidth = getMaxTowerHeightInAvailableArea(verticalWidgetRange.delta(-lineSizes.top), availableSpaceSizesTransposed);\n\t\t\tif (maxWidth < MIN_WIDGET_WIDTH) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tconst horizontalWidgetRange = OffsetRange.ofStartAndLength(editorTrueContentRight - maxWidth, maxWidth);\n\t\t\treturn { horizontalWidgetRange, verticalWidgetRange };\n\t\t});\n\t\tif (!possibleWidgetOutline) {\n\t\t\tpossibleWidgetOutline = {\n\t\t\t\thorizontalWidgetRange: OffsetRange.ofStartAndLength(editorTrueContentRight - MAX_WIDGET_WIDTH, MAX_WIDGET_WIDTH),\n\t\t\t\tverticalWidgetRange: getWidgetVerticalOutline(viewState.hint.lineNumber + 2).delta(10),\n\t\t\t};\n\t\t}\n\n\t\tif (!possibleWidgetOutline) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst rectAvailableSpace = Rect.fromRanges(\n\t\t\tpossibleWidgetOutline.horizontalWidgetRange,\n\t\t\tpossibleWidgetOutline.verticalWidgetRange\n\t\t).translateX(-editorScrollLeft).translateY(-editorScrollTop);\n\n\t\tconst showAvailableSpace = false;\n\t\tif (showAvailableSpace) {\n\t\t\tdebugView(debugLogRects({ rectAvailableSpace }, this._editor.getDomNode()!), reader);\n\t\t}\n\n\t\tconst maxWidgetWidth = Math.min(MAX_WIDGET_WIDTH, previewEditorContentLayout.maxEditorWidth + previewEditorMargin + widgetPadding);\n\n\t\tconst layout = distributeFlexBoxLayout(rectAvailableSpace.width, {\n\t\t\tspaceBefore: { min: 0, max: 10, priority: 1 },\n\t\t\tcontent: { min: 50, rules: [{ max: 150, priority: 2 }, { max: maxWidgetWidth, priority: 1 }] },\n\t\t\tspaceAfter: { min: 20 },\n\t\t});\n\n\t\tif (!layout) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst ranges = lengthsToOffsetRanges([layout.spaceBefore, layout.content, layout.spaceAfter], rectAvailableSpace.left);\n\t\tconst spaceBeforeRect = rectAvailableSpace.withHorizontalRange(ranges[0]);\n\t\tconst widgetRect = rectAvailableSpace.withHorizontalRange(ranges[1]);\n\t\tconst spaceAfterRect = rectAvailableSpace.withHorizontalRange(ranges[2]);\n\n\t\tconst showRects2 = false;\n\t\tif (showRects2) {\n\t\t\tdebugView(debugLogRects({ spaceBeforeRect, widgetRect, spaceAfterRect }, this._editor.getDomNode()!), reader);\n\t\t}\n\n\t\tconst previewEditorRect = widgetRect.withMargin(-widgetPadding - widgetBorder - previewEditorMargin).withMargin(0, 0, -lowerBarHeight, 0);\n\n\t\tconst showEditorRect = false;\n\t\tif (showEditorRect) {\n\t\t\tdebugView(debugLogRects({ previewEditorRect }, this._editor.getDomNode()!), reader);\n\t\t}\n\n\t\tconst previewEditorContentWidth = previewEditorRect.width - previewEditorContentLayout.nonContentWidth;\n\t\tconst maxPrefferedRangeLength = previewEditorContentWidth * 0.8;\n\t\tconst preferredRangeToReveal = previewEditorContentLayout.preferredRangeToReveal.intersect(OffsetRange.ofStartAndLength(\n\t\t\tpreviewEditorContentLayout.preferredRangeToReveal.start,\n\t\t\tmaxPrefferedRangeLength\n\t\t)) ?? previewEditorContentLayout.preferredRangeToReveal;\n\t\tconst desiredPreviewEditorScrollLeft = scrollToReveal(previewEditorContentLayout.indentationEnd, previewEditorContentWidth, preferredRangeToReveal);\n\n\t\treturn {\n\t\t\tcodeEditorSize: previewEditorRect.getSize(),\n\t\t\tcodeScrollLeft: editorScrollLeft,\n\t\t\tcontentLeft: editorLayout.contentLeft,\n\n\t\t\twidgetRect,\n\n\t\t\tpreviewEditorMargin,\n\t\t\twidgetPadding,\n\t\t\twidgetBorder,\n\n\t\t\tlowerBarHeight,\n\n\t\t\tdesiredPreviewEditorScrollLeft: desiredPreviewEditorScrollLeft.newScrollPosition,\n\t\t};\n\t});\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: derived(this, reader => !!this._previewEditorLayoutInfo.read(reader) ? 'block' : 'none'),\n\t\t},\n\t}, [\n\t\tderived(this, _reader => [this._widgetContent]),\n\t]);\n\n\tprivate readonly _widgetContent = derived(this, reader => // TODO how to not use derived but not move into constructor?\n\t\tn.div({\n\t\t\tstyle: {\n\t\t\t\tposition: 'absolute',\n\t\t\t\toverflow: 'hidden',\n\t\t\t\tcursor: 'pointer',\n\t\t\t\tbackground: 'var(--vscode-editorWidget-background)',\n\t\t\t\tpadding: this._previewEditorLayoutInfo.map(i => i?.widgetPadding),\n\t\t\t\tboxSizing: 'border-box',\n\t\t\t\tborderRadius: BORDER_RADIUS,\n\t\t\t\tborder: derived(reader => `${this._previewEditorLayoutInfo.read(reader)?.widgetBorder}px solid ${this._styles.read(reader).border}`),\n\t\t\t\tdisplay: 'flex',\n\t\t\t\tflexDirection: 'column',\n\t\t\t\topacity: derived(reader => this._viewState.read(reader)?.hint.isVisible ? '1' : '0'),\n\t\t\t\ttransition: 'opacity 200ms ease-in-out',\n\t\t\t\t...rectToProps(reader => this._previewEditorLayoutInfo.read(reader)?.widgetRect)\n\t\t\t},\n\t\t\tonmousedown: e => {\n\t\t\t\te.preventDefault(); // This prevents that the editor loses focus\n\t\t\t},\n\t\t\tonclick: () => {\n\t\t\t\tthis._viewState.read(undefined)?.model.jump();\n\t\t\t}\n\t\t}, [\n\t\t\tn.div({\n\t\t\t\tclass: ['editorContainer'],\n\t\t\t\tstyle: {\n\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\tpadding: this._previewEditorLayoutInfo.map(i => i?.previewEditorMargin),\n\t\t\t\t\tbackground: 'var(--vscode-editor-background)',\n\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t},\n\t\t\t}, [\n\t\t\t\tderived(this, r => this._previewEditor.element), // --\n\t\t\t]),\n\t\t\tn.div({ class: 'bar', style: { color: asCssVariable(descriptionForeground), pointerEvents: 'none', margin: '0 4px', height: this._previewEditorLayoutInfo.map(i => i?.lowerBarHeight), display: 'flex', justifyContent: 'space-between', alignItems: 'center' } }, [\n\t\t\t\tderived(this, reader => {\n\t\t\t\t\tconst children: (HTMLElement | ObserverNode<HTMLDivElement>)[] = [];\n\t\t\t\t\tconst viewState = this._viewState.read(reader);\n\t\t\t\t\tif (!viewState) {\n\t\t\t\t\t\treturn children;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Outline Element\n\t\t\t\t\tconst source = this._originalOutlineSource.read(reader);\n\t\t\t\t\tconst outlineItems = source?.getAt(viewState.edit.lineEdit.lineRange.startLineNumber, reader).slice(0, 1) ?? [];\n\t\t\t\t\tconst outlineElements: ChildNode[] = [];\n\t\t\t\t\tif (outlineItems.length > 0) {\n\t\t\t\t\t\tfor (let i = 0; i < outlineItems.length; i++) {\n\t\t\t\t\t\t\tconst item = outlineItems[i];\n\t\t\t\t\t\t\tconst icon = SymbolKinds.toIcon(item.kind);\n\t\t\t\t\t\t\toutlineElements.push(n.div({\n\t\t\t\t\t\t\t\tclass: 'breadcrumb-item',\n\t\t\t\t\t\t\t\tstyle: { display: 'flex', alignItems: 'center', flex: '1 1 auto', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' },\n\t\t\t\t\t\t\t}, [\n\t\t\t\t\t\t\t\trenderIcon(icon),\n\t\t\t\t\t\t\t\t'\\u00a0',\n\t\t\t\t\t\t\t\titem.name,\n\t\t\t\t\t\t\t\t...(i === outlineItems.length - 1\n\t\t\t\t\t\t\t\t\t? []\n\t\t\t\t\t\t\t\t\t: [renderIcon(Codicon.chevronRight)]\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}\n\t\t\t\t\tchildren.push(n.div({ class: 'outline-elements' }, outlineElements));\n\n\t\t\t\t\t// Show Edit Direction\n\t\t\t\t\tconst arrowIcon = isEditBelowHint(viewState) ? Codicon.arrowDown : Codicon.arrowUp;\n\t\t\t\t\tchildren.push(n.div({\n\t\t\t\t\t\tclass: 'go-to-label',\n\t\t\t\t\t\tstyle: { display: 'flex', alignItems: 'center', flex: '0 0 auto', marginLeft: '14px' },\n\t\t\t\t\t}, [\n\t\t\t\t\t\t'Go To Edit',\n\t\t\t\t\t\t'\\u00a0',\n\t\t\t\t\t\trenderIcon(arrowIcon),\n\t\t\t\t\t]));\n\n\t\t\t\t\treturn children;\n\t\t\t\t})\n\t\t\t]),\n\t\t])\n\t);\n\n\tprivate readonly _originalOutlineSource = derivedDisposable(this, (reader) => {\n\t\tconst m = this._editorObs.model.read(reader);\n\t\tconst factory = HideUnchangedRegionsFeature._breadcrumbsSourceFactory.read(reader);\n\t\treturn (!m || !factory) ? undefined : factory(m, this._instantiationService);\n\t});\n}\n\nexport interface ILongDistanceHint {\n\tlineNumber: number;\n\tisVisible: boolean;\n}\n\nexport interface ILongDistanceViewState {\n\thint: ILongDistanceHint;\n\tnewTextLineCount: number;\n\tedit: InlineEditWithChanges;\n\tdiff: DetailedLineRangeMapping[];\n\n\tmodel: SimpleInlineSuggestModel;\n\tsuggestInfo: InlineSuggestionGutterMenuData;\n}\n\nfunction lengthsToOffsetRanges(lengths: number[], initialOffset = 0): OffsetRange[] {\n\tconst result: OffsetRange[] = [];\n\tlet offset = initialOffset;\n\tfor (const length of lengths) {\n\t\tresult.push(new OffsetRange(offset, offset + length));\n\t\toffset += length;\n\t}\n\treturn result;\n}\n\nfunction stackSizesDown(at: Point, sizes: Size2D[], alignment: 'left' | 'right' = 'left'): Rect[] {\n\tconst rects: Rect[] = [];\n\tlet offset = 0;\n\tfor (const s of sizes) {\n\t\trects.push(\n\t\t\tRect.fromLeftTopWidthHeight(\n\t\t\t\tat.x + (alignment === 'left' ? 0 : -s.width),\n\t\t\t\tat.y + offset,\n\t\t\t\ts.width,\n\t\t\t\ts.height\n\t\t\t)\n\t\t);\n\t\toffset += s.height;\n\t}\n\treturn rects;\n}\n\nfunction findFirstMinimzeDistance<T>(range: LineRange, targetLine: number, predicate: (lineNumber: number) => T | undefined): T | undefined {\n\tfor (let offset = 0; ; offset++) {\n\t\tconst down = targetLine + offset;\n\t\tif (down <= range.endLineNumberExclusive) {\n\t\t\tconst result = predicate(down);\n\t\t\tif (result !== undefined) {\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\t\tconst up = targetLine - offset;\n\t\tif (up >= range.startLineNumber) {\n\t\t\tconst result = predicate(up);\n\t\t\tif (result !== undefined) {\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\t\tif (up < range.startLineNumber && down > range.endLineNumberExclusive) {\n\t\t\treturn undefined;\n\t\t}\n\t}\n}\n\nfunction getSums<T>(array: T[], fn: (item: T) => number): number[] {\n\tconst result: number[] = [0];\n\tlet sum = 0;\n\tfor (const item of array) {\n\t\tsum += fn(item);\n\t\tresult.push(sum);\n\t}\n\treturn result;\n}\n\nfunction isEditBelowHint(viewState: ILongDistanceViewState): boolean {\n\tconst hintLineNumber = viewState.hint.lineNumber;\n\tconst editStartLineNumber = viewState.diff[0]?.original.startLineNumber;\n\treturn hintLineNumber < editStartLineNumber;\n}\n\n\n/**\n * Changes the scroll position as little as possible just to reveal the given range in the window.\n*/\nexport function scrollToReveal(currentScrollPosition: number, windowWidth: number, contentRangeToReveal: OffsetRange): { newScrollPosition: number } {\n\tconst visibleRange = new OffsetRange(currentScrollPosition, currentScrollPosition + windowWidth);\n\tif (visibleRange.containsRange(contentRangeToReveal)) {\n\t\treturn { newScrollPosition: currentScrollPosition };\n\t}\n\tif (contentRangeToReveal.length > windowWidth) {\n\t\treturn { newScrollPosition: contentRangeToReveal.start };\n\t}\n\tif (contentRangeToReveal.endExclusive > visibleRange.endExclusive) {\n\t\treturn { newScrollPosition: contentRangeToReveal.endExclusive - windowWidth };\n\t}\n\tif (contentRangeToReveal.start < visibleRange.start) {\n\t\treturn { newScrollPosition: contentRangeToReveal.start };\n\t}\n\treturn { newScrollPosition: currentScrollPosition };\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/longDistanceHint/inlineEditsLongDistanceHint.ts","vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/inlineEditsLongDistanceHint.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;gGAGgG;AAChG,OAAO,EAAa,CAAC,EAAyC,MAAM,6CAA6C,CAAC;AAClH,OAAO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C,EAAE,QAAQ,CAAC,eAAe,CAAC;IACxE,OAAO,cAAc,GAAG,mBAAmB,CAAC;AAC7C,CAAC;AAGD;;EAEE;AACF,MAAM,UAAU,cAAc,CAAC,qBAA6B,EAAE,WAAmB,EAAE,oBAAiC;IACnH,MAAM,YAAY,GAAG,IAAI,WAAW,CAAC,qBAAqB,EAAE,qBAAqB,GAAG,WAAW,CAAC,CAAC;IACjG,IAAI,YAAY,CAAC,aAAa,CAAC,oBAAoB,CAAC,EAAE,CAAC;QACtD,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,CAAC;IACrD,CAAC;IACD,IAAI,oBAAoB,CAAC,MAAM,GAAG,WAAW,EAAE,CAAC;QAC/C,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,CAAC,KAAK,EAAE,CAAC;IAC1D,CAAC;IACD,IAAI,oBAAoB,CAAC,YAAY,GAAG,YAAY,CAAC,YAAY,EAAE,CAAC;QACnE,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,CAAC,YAAY,GAAG,WAAW,EAAE,CAAC;IAC/E,CAAC;IACD,IAAI,oBAAoB,CAAC,KAAK,GAAG,YAAY,CAAC,KAAK,EAAE,CAAC;QACrD,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,CAAC,KAAK,EAAE,CAAC;IAC1D,CAAC;IACD,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,CAAC;AACrD,CAAC","file":"inlineEditsLongDistanceHint.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 { ChildNode, n, ObserverNode, ObserverNodeWithElement } from '../../../../../../../../base/browser/dom.js';\nimport { Event } from '../../../../../../../../base/common/event.js';\nimport { Disposable } from '../../../../../../../../base/common/lifecycle.js';\nimport { IObservable, autorun, constObservable, debouncedObservable2, derived, derivedDisposable } from '../../../../../../../../base/common/observable.js';\nimport { IInstantiationService } from '../../../../../../../../platform/instantiation/common/instantiation.js';\nimport { ICodeEditor } from '../../../../../../../browser/editorBrowser.js';\nimport { observableCodeEditor } from '../../../../../../../browser/observableCodeEditor.js';\nimport { Rect } from '../../../../../../../common/core/2d/rect.js';\nimport { Position } from '../../../../../../../common/core/position.js';\nimport { ITextModel } from '../../../../../../../common/model.js';\nimport { IInlineEditsView, InlineEditTabAction } from '../../inlineEditsViewInterface.js';\nimport { InlineEditWithChanges } from '../../inlineEditWithChanges.js';\nimport { getContentSizeOfLines, rectToProps } from '../../utils/utils.js';\nimport { DetailedLineRangeMapping } from '../../../../../../../common/diff/rangeMapping.js';\nimport { OffsetRange } from '../../../../../../../common/core/ranges/offsetRange.js';\nimport { LineRange } from '../../../../../../../common/core/ranges/lineRange.js';\nimport { HideUnchangedRegionsFeature } from '../../../../../../../browser/widget/diffEditor/features/hideUnchangedRegionsFeature.js';\nimport { Codicon } from '../../../../../../../../base/common/codicons.js';\nimport { renderIcon } from '../../../../../../../../base/browser/ui/iconLabel/iconLabels.js';\nimport { SymbolKinds } from '../../../../../../../common/languages.js';\nimport { debugLogRects, debugView } from '../debugVisualization.js';\nimport { distributeFlexBoxLayout } from '../../utils/flexBoxLayout.js';\nimport { Point } from '../../../../../../../common/core/2d/point.js';\nimport { Size2D } from '../../../../../../../common/core/2d/size.js';\nimport { getMaxTowerHeightInAvailableArea } from '../../utils/towersLayout.js';\nimport { IThemeService } from '../../../../../../../../platform/theme/common/themeService.js';\nimport { IKeybindingService } from '../../../../../../../../platform/keybinding/common/keybinding.js';\nimport { getEditorBlendedColor, inlineEditIndicatorPrimaryBackground, inlineEditIndicatorSecondaryBackground, inlineEditIndicatorsuccessfulBackground } from '../../theme.js';\nimport { asCssVariable, descriptionForeground, editorBackground, editorWidgetBackground } from '../../../../../../../../platform/theme/common/colorRegistry.js';\nimport { ILongDistancePreviewProps, LongDistancePreviewEditor } from './longDistancePreviewEditor.js';\nimport { InlineSuggestionGutterMenuData, SimpleInlineSuggestModel } from '../../components/gutterIndicatorView.js';\nimport { jumpToNextInlineEditId } from '../../../../controller/commandIds.js';\n\nconst BORDER_RADIUS = 4;\nconst MAX_WIDGET_WIDTH = { EMPTY_SPACE: 425, OVERLAY: 375 };\nconst MIN_WIDGET_WIDTH = 250;\n\nexport class InlineEditsLongDistanceHint extends Disposable implements IInlineEditsView {\n\n\tprivate readonly _editorObs;\n\treadonly onDidClick = Event.None;\n\tprivate _viewWithElement: ObserverNodeWithElement<HTMLDivElement> | undefined = undefined;\n\n\tprivate readonly _previewEditor;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tprivate readonly _viewState: IObservable<ILongDistanceViewState | undefined>,\n\t\tprivate readonly _previewTextModel: ITextModel,\n\t\tprivate readonly _tabAction: IObservable<InlineEditTabAction>,\n\t\t@IInstantiationService private readonly _instantiationService: IInstantiationService,\n\t\t@IThemeService private readonly _themeService: IThemeService,\n\t\t@IKeybindingService private readonly _keybindingService: IKeybindingService,\n\t) {\n\t\tsuper();\n\n\t\tthis._styles = this._tabAction.map((v, reader) => {\n\t\t\tlet border;\n\t\t\tswitch (v) {\n\t\t\t\tcase InlineEditTabAction.Inactive: border = inlineEditIndicatorSecondaryBackground; break;\n\t\t\t\tcase InlineEditTabAction.Jump: border = inlineEditIndicatorPrimaryBackground; break;\n\t\t\t\tcase InlineEditTabAction.Accept: border = inlineEditIndicatorsuccessfulBackground; break;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tborder: getEditorBlendedColor(border, this._themeService).read(reader).toString(),\n\t\t\t\tbackground: asCssVariable(editorBackground)\n\t\t\t};\n\t\t});\n\n\t\tthis._editorObs = observableCodeEditor(this._editor);\n\n\t\tthis._previewEditor = this._register(\n\t\t\tthis._instantiationService.createInstance(\n\t\t\t\tLongDistancePreviewEditor,\n\t\t\t\tthis._previewTextModel,\n\t\t\t\tderived(reader => {\n\t\t\t\t\tconst viewState = this._viewState.read(reader);\n\t\t\t\t\tif (!viewState) {\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdiff: viewState.diff,\n\t\t\t\t\t\tmodel: viewState.model,\n\t\t\t\t\t\tsuggestInfo: viewState.suggestInfo,\n\t\t\t\t\t} satisfies ILongDistancePreviewProps;\n\t\t\t\t}),\n\t\t\t\tthis._editor,\n\t\t\t\tthis._tabAction,\n\t\t\t)\n\t\t);\n\n\t\tthis._viewWithElement = this._view.keepUpdated(this._store);\n\t\tthis._register(this._editorObs.createOverlayWidget({\n\t\t\tdomNode: this._viewWithElement.element,\n\t\t\tposition: constObservable(null),\n\t\t\tallowEditorOverflow: false,\n\t\t\tminContentWidthInPx: constObservable(0),\n\t\t}));\n\n\t\tthis._widgetContent.get().keepUpdated(this._store);\n\n\t\tthis._register(autorun(reader => {\n\t\t\tconst layoutInfo = this._previewEditorLayoutInfo.read(reader);\n\t\t\tif (!layoutInfo) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis._previewEditor.layout(layoutInfo.codeEditorSize.toDimension(), layoutInfo.desiredPreviewEditorScrollLeft);\n\t\t}));\n\n\t\tthis._isVisibleDelayed.recomputeInitiallyAndOnChange(this._store);\n\t}\n\n\tprivate readonly _styles;\n\n\tpublic get isHovered() { return this._widgetContent.get().didMouseMoveDuringHover; }\n\n\tprivate readonly _hintTextPosition = derived(this, (reader) => {\n\t\tconst viewState = this._viewState.read(reader);\n\t\treturn viewState ? new Position(viewState.hint.lineNumber, Number.MAX_SAFE_INTEGER) : null;\n\t});\n\n\tprivate readonly _lineSizesAroundHintPosition = derived(this, (reader) => {\n\t\tconst viewState = this._viewState.read(reader);\n\t\tconst p = this._hintTextPosition.read(reader);\n\t\tif (!viewState || !p) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst model = this._editorObs.model.read(reader);\n\t\tif (!model) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst range = LineRange.ofLength(p.lineNumber, 1).addMargin(5, 5).intersect(LineRange.ofLength(1, model.getLineCount()));\n\n\t\tif (!range) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst sizes = getContentSizeOfLines(this._editorObs, range, reader);\n\t\tconst top = this._editorObs.observeTopForLineNumber(range.startLineNumber).read(reader);\n\n\t\treturn {\n\t\t\tlineRange: range,\n\t\t\ttop: top,\n\t\t\tsizes: sizes,\n\t\t};\n\t});\n\n\tprivate readonly _isVisibleDelayed = debouncedObservable2(\n\t\tderived(this, reader => this._viewState.read(reader)?.hint.isVisible),\n\t\t(lastValue, newValue) => lastValue === true && newValue === false ? 200 : 0,\n\t);\n\n\tprivate readonly _previewEditorLayoutInfo = derived(this, (reader) => {\n\t\tconst viewState = this._viewState.read(reader);\n\n\t\tif (!viewState || !this._isVisibleDelayed.read(reader)) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst lineSizes = this._lineSizesAroundHintPosition.read(reader);\n\t\tif (!lineSizes) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst editorScrollTop = this._editorObs.scrollTop.read(reader);\n\t\tconst editorScrollLeft = this._editorObs.scrollLeft.read(reader);\n\t\tconst editorLayout = this._editorObs.layoutInfo.read(reader);\n\n\t\tconst previewContentHeight = this._previewEditor.contentHeight.read(reader);\n\t\tconst previewEditorContentLayout = this._previewEditor.horizontalContentRangeInPreviewEditorToShow.read(reader);\n\n\t\tif (!previewContentHeight || !previewEditorContentLayout) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// const debugRects = stackSizesDown(new Point(editorLayout.contentLeft, lineSizes.top - scrollTop), lineSizes.sizes);\n\n\t\tconst editorTrueContentWidth = editorLayout.contentWidth - editorLayout.verticalScrollbarWidth;\n\t\tconst editorTrueContentRight = editorLayout.contentLeft + editorTrueContentWidth;\n\n\t\t// drawEditorWidths(this._editor, reader);\n\n\t\tconst c = this._editorObs.cursorLineNumber.read(reader);\n\t\tif (!c) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst availableSpaceSizes = lineSizes.sizes.map((s, idx) => {\n\t\t\tconst lineNumber = lineSizes.lineRange.startLineNumber + idx;\n\t\t\tlet linePaddingLeft = 20;\n\t\t\tif (lineNumber === viewState.hint.lineNumber) {\n\t\t\t\tlinePaddingLeft = 40;\n\t\t\t}\n\t\t\treturn new Size2D(Math.max(0, editorTrueContentWidth - s.width - linePaddingLeft), s.height);\n\t\t});\n\n\t\tconst showRects = false;\n\t\tif (showRects) {\n\t\t\tconst rects2 = stackSizesDown(new Point(editorTrueContentRight, lineSizes.top - editorScrollTop), availableSpaceSizes, 'right');\n\t\t\tdebugView(debugLogRects({ ...rects2 }, this._editor.getDomNode()!), reader);\n\t\t}\n\n\t\tconst availableSpaceHeightPrefixSums = getSums(availableSpaceSizes, s => s.height);\n\t\tconst availableSpaceSizesTransposed = availableSpaceSizes.map(s => s.transpose());\n\n\t\tconst previewEditorMargin = 2;\n\t\tconst widgetPadding = 2;\n\t\tconst lowerBarHeight = 20;\n\t\tconst widgetBorder = 1;\n\n\t\tconst extraGutterMarginToAvoidScrollBar = 2;\n\t\tconst previewEditorHeight = previewContentHeight! + extraGutterMarginToAvoidScrollBar;\n\n\t\tfunction getWidgetVerticalOutline(lineNumber: number): OffsetRange {\n\t\t\tconst sizeIdx = lineNumber - lineSizes!.lineRange.startLineNumber;\n\t\t\tconst top = lineSizes!.top + availableSpaceHeightPrefixSums[sizeIdx];\n\t\t\tconst editorRange = OffsetRange.ofStartAndLength(top, previewEditorHeight);\n\t\t\tconst verticalWidgetRange = editorRange.withMargin(previewEditorMargin + widgetPadding + widgetBorder).withMargin(0, lowerBarHeight);\n\t\t\treturn verticalWidgetRange;\n\t\t}\n\n\t\tlet possibleWidgetOutline = findFirstMinimzeDistance(lineSizes.lineRange.addMargin(-1, -1), viewState.hint.lineNumber, lineNumber => {\n\t\t\tconst verticalWidgetRange = getWidgetVerticalOutline(lineNumber);\n\t\t\tconst maxWidth = getMaxTowerHeightInAvailableArea(verticalWidgetRange.delta(-lineSizes.top), availableSpaceSizesTransposed);\n\t\t\tif (maxWidth < MIN_WIDGET_WIDTH) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tconst horizontalWidgetRange = OffsetRange.ofStartAndLength(editorTrueContentRight - maxWidth, maxWidth);\n\t\t\treturn { horizontalWidgetRange, verticalWidgetRange };\n\t\t});\n\n\t\tlet position: 'overlay' | 'empty-space' = 'empty-space';\n\t\tif (!possibleWidgetOutline) {\n\t\t\tposition = 'overlay';\n\t\t\tconst maxAvailableWidth = Math.min(editorLayout.width - editorLayout.contentLeft, MAX_WIDGET_WIDTH.OVERLAY);\n\t\t\tpossibleWidgetOutline = {\n\t\t\t\thorizontalWidgetRange: OffsetRange.ofStartAndLength(editorTrueContentRight - maxAvailableWidth, maxAvailableWidth),\n\t\t\t\tverticalWidgetRange: getWidgetVerticalOutline(viewState.hint.lineNumber + 2).delta(10),\n\t\t\t};\n\t\t}\n\n\t\tif (!possibleWidgetOutline) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst rectAvailableSpace = Rect.fromRanges(\n\t\t\tpossibleWidgetOutline.horizontalWidgetRange,\n\t\t\tpossibleWidgetOutline.verticalWidgetRange\n\t\t).translateX(-editorScrollLeft).translateY(-editorScrollTop);\n\n\t\tconst showAvailableSpace = false;\n\t\tif (showAvailableSpace) {\n\t\t\tdebugView(debugLogRects({ rectAvailableSpace }, this._editor.getDomNode()!), reader);\n\t\t}\n\n\t\tconst maxWidgetWidth = Math.min(position === 'overlay' ? MAX_WIDGET_WIDTH.OVERLAY : MAX_WIDGET_WIDTH.EMPTY_SPACE, previewEditorContentLayout.maxEditorWidth + previewEditorMargin + widgetPadding);\n\n\t\tconst layout = distributeFlexBoxLayout(rectAvailableSpace.width, {\n\t\t\tspaceBefore: { min: 0, max: 10, priority: 1 },\n\t\t\tcontent: { min: 50, rules: [{ max: 150, priority: 2 }, { max: maxWidgetWidth, priority: 1 }] },\n\t\t\tspaceAfter: { min: 10 },\n\t\t});\n\n\t\tif (!layout) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst ranges = lengthsToOffsetRanges([layout.spaceBefore, layout.content, layout.spaceAfter], rectAvailableSpace.left);\n\t\tconst spaceBeforeRect = rectAvailableSpace.withHorizontalRange(ranges[0]);\n\t\tconst widgetRect = rectAvailableSpace.withHorizontalRange(ranges[1]);\n\t\tconst spaceAfterRect = rectAvailableSpace.withHorizontalRange(ranges[2]);\n\n\t\tconst showRects2 = false;\n\t\tif (showRects2) {\n\t\t\tdebugView(debugLogRects({ spaceBeforeRect, widgetRect, spaceAfterRect }, this._editor.getDomNode()!), reader);\n\t\t}\n\n\t\tconst previewEditorRect = widgetRect.withMargin(-widgetPadding - widgetBorder - previewEditorMargin).withMargin(0, 0, -lowerBarHeight, 0);\n\n\t\tconst showEditorRect = false;\n\t\tif (showEditorRect) {\n\t\t\tdebugView(debugLogRects({ previewEditorRect }, this._editor.getDomNode()!), reader);\n\t\t}\n\n\t\tconst previewEditorContentWidth = previewEditorRect.width - previewEditorContentLayout.nonContentWidth;\n\t\tconst maxPrefferedRangeLength = previewEditorContentWidth * 0.8;\n\t\tconst preferredRangeToReveal = previewEditorContentLayout.preferredRangeToReveal.intersect(OffsetRange.ofStartAndLength(\n\t\t\tpreviewEditorContentLayout.preferredRangeToReveal.start,\n\t\t\tmaxPrefferedRangeLength\n\t\t)) ?? previewEditorContentLayout.preferredRangeToReveal;\n\t\tconst desiredPreviewEditorScrollLeft = scrollToReveal(previewEditorContentLayout.indentationEnd, previewEditorContentWidth, preferredRangeToReveal);\n\n\t\treturn {\n\t\t\tcodeEditorSize: previewEditorRect.getSize(),\n\t\t\tcodeScrollLeft: editorScrollLeft,\n\t\t\tcontentLeft: editorLayout.contentLeft,\n\n\t\t\twidgetRect,\n\n\t\t\tpreviewEditorMargin,\n\t\t\twidgetPadding,\n\t\t\twidgetBorder,\n\n\t\t\tlowerBarHeight,\n\n\t\t\tdesiredPreviewEditorScrollLeft: desiredPreviewEditorScrollLeft.newScrollPosition,\n\t\t};\n\t});\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: derived(this, reader => !!this._previewEditorLayoutInfo.read(reader) ? 'block' : 'none'),\n\t\t},\n\t}, [\n\t\tderived(this, _reader => [this._widgetContent]),\n\t]);\n\n\tprivate readonly _widgetContent = derived(this, reader => // TODO@hediet: remove when n.div lazily creates previewEditor.element node\n\t\tn.div({\n\t\t\tclass: 'inline-edits-long-distance-hint-widget',\n\t\t\tstyle: {\n\t\t\t\tposition: 'absolute',\n\t\t\t\toverflow: 'hidden',\n\t\t\t\tcursor: 'pointer',\n\t\t\t\tbackground: asCssVariable(editorWidgetBackground),\n\t\t\t\tpadding: this._previewEditorLayoutInfo.map(i => i?.widgetPadding),\n\t\t\t\tboxSizing: 'border-box',\n\t\t\t\tborderRadius: BORDER_RADIUS,\n\t\t\t\tborder: derived(reader => `${this._previewEditorLayoutInfo.read(reader)?.widgetBorder}px solid ${this._styles.read(reader).border}`),\n\t\t\t\tdisplay: 'flex',\n\t\t\t\tflexDirection: 'column',\n\t\t\t\topacity: derived(reader => this._viewState.read(reader)?.hint.isVisible ? '1' : '0'),\n\t\t\t\ttransition: 'opacity 200ms ease-in-out',\n\t\t\t\t...rectToProps(reader => this._previewEditorLayoutInfo.read(reader)?.widgetRect)\n\t\t\t},\n\t\t\tonmousedown: e => {\n\t\t\t\te.preventDefault(); // This prevents that the editor loses focus\n\t\t\t},\n\t\t\tonclick: () => {\n\t\t\t\tthis._viewState.read(undefined)?.model.jump();\n\t\t\t}\n\t\t}, [\n\t\t\tn.div({\n\t\t\t\tclass: ['editorContainer'],\n\t\t\t\tstyle: {\n\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\tpadding: this._previewEditorLayoutInfo.map(i => i?.previewEditorMargin),\n\t\t\t\t\tbackground: asCssVariable(editorBackground),\n\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t},\n\t\t\t}, [\n\t\t\t\tderived(this, r => this._previewEditor.element), // --\n\t\t\t]),\n\t\t\tn.div({ class: 'bar', style: { color: asCssVariable(descriptionForeground), pointerEvents: 'none', margin: '0 4px', height: this._previewEditorLayoutInfo.map(i => i?.lowerBarHeight), display: 'flex', justifyContent: 'space-between', alignItems: 'center' } }, [\n\t\t\t\tderived(this, reader => {\n\t\t\t\t\tconst children: (HTMLElement | ObserverNode<HTMLDivElement>)[] = [];\n\t\t\t\t\tconst viewState = this._viewState.read(reader);\n\t\t\t\t\tif (!viewState) {\n\t\t\t\t\t\treturn children;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Outline Element\n\t\t\t\t\tconst source = this._originalOutlineSource.read(reader);\n\t\t\t\t\tconst outlineItems = source?.getAt(viewState.edit.lineEdit.lineRange.startLineNumber, reader).slice(0, 1) ?? [];\n\t\t\t\t\tconst outlineElements: ChildNode[] = [];\n\t\t\t\t\tif (outlineItems.length > 0) {\n\t\t\t\t\t\tfor (let i = 0; i < outlineItems.length; i++) {\n\t\t\t\t\t\t\tconst item = outlineItems[i];\n\t\t\t\t\t\t\tconst icon = SymbolKinds.toIcon(item.kind);\n\t\t\t\t\t\t\toutlineElements.push(n.div({\n\t\t\t\t\t\t\t\tclass: 'breadcrumb-item',\n\t\t\t\t\t\t\t\tstyle: { display: 'flex', alignItems: 'center', flex: '1 1 auto', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' },\n\t\t\t\t\t\t\t}, [\n\t\t\t\t\t\t\t\trenderIcon(icon),\n\t\t\t\t\t\t\t\t'\\u00a0',\n\t\t\t\t\t\t\t\titem.name,\n\t\t\t\t\t\t\t\t...(i === outlineItems.length - 1\n\t\t\t\t\t\t\t\t\t? []\n\t\t\t\t\t\t\t\t\t: [renderIcon(Codicon.chevronRight)]\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}\n\t\t\t\t\tchildren.push(n.div({ class: 'outline-elements', style: { overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' } }, outlineElements));\n\n\t\t\t\t\t// Show Edit Direction\n\t\t\t\t\tconst arrowIcon = isEditBelowHint(viewState) ? Codicon.arrowDown : Codicon.arrowUp;\n\t\t\t\t\tconst keybinding = this._keybindingService.lookupKeybinding(jumpToNextInlineEditId);\n\t\t\t\t\tlet label = 'Go to suggestion';\n\t\t\t\t\tif (keybinding && keybinding.getLabel() === 'Tab') {\n\t\t\t\t\t\tlabel = 'Tab to suggestion';\n\t\t\t\t\t}\n\t\t\t\t\tchildren.push(n.div({\n\t\t\t\t\t\tclass: 'go-to-label',\n\t\t\t\t\t\tstyle: { position: 'relative', display: 'flex', alignItems: 'center', flex: '0 0 auto', paddingLeft: '6px' },\n\t\t\t\t\t}, [\n\t\t\t\t\t\tlabel,\n\t\t\t\t\t\t'\\u00a0',\n\t\t\t\t\t\trenderIcon(arrowIcon),\n\t\t\t\t\t]));\n\n\t\t\t\t\treturn children;\n\t\t\t\t})\n\t\t\t]),\n\t\t])\n\t);\n\n\tprivate readonly _originalOutlineSource = derivedDisposable(this, (reader) => {\n\t\tconst m = this._editorObs.model.read(reader);\n\t\tconst factory = HideUnchangedRegionsFeature._breadcrumbsSourceFactory.read(reader);\n\t\treturn (!m || !factory) ? undefined : factory(m, this._instantiationService);\n\t});\n}\n\nexport interface ILongDistanceHint {\n\tlineNumber: number;\n\tisVisible: boolean;\n}\n\nexport interface ILongDistanceViewState {\n\thint: ILongDistanceHint;\n\tnewTextLineCount: number;\n\tedit: InlineEditWithChanges;\n\tdiff: DetailedLineRangeMapping[];\n\n\tmodel: SimpleInlineSuggestModel;\n\tsuggestInfo: InlineSuggestionGutterMenuData;\n}\n\nfunction lengthsToOffsetRanges(lengths: number[], initialOffset = 0): OffsetRange[] {\n\tconst result: OffsetRange[] = [];\n\tlet offset = initialOffset;\n\tfor (const length of lengths) {\n\t\tresult.push(new OffsetRange(offset, offset + length));\n\t\toffset += length;\n\t}\n\treturn result;\n}\n\nfunction stackSizesDown(at: Point, sizes: Size2D[], alignment: 'left' | 'right' = 'left'): Rect[] {\n\tconst rects: Rect[] = [];\n\tlet offset = 0;\n\tfor (const s of sizes) {\n\t\trects.push(\n\t\t\tRect.fromLeftTopWidthHeight(\n\t\t\t\tat.x + (alignment === 'left' ? 0 : -s.width),\n\t\t\t\tat.y + offset,\n\t\t\t\ts.width,\n\t\t\t\ts.height\n\t\t\t)\n\t\t);\n\t\toffset += s.height;\n\t}\n\treturn rects;\n}\n\nfunction findFirstMinimzeDistance<T>(range: LineRange, targetLine: number, predicate: (lineNumber: number) => T | undefined): T | undefined {\n\tfor (let offset = 0; ; offset++) {\n\t\tconst down = targetLine + offset;\n\t\tif (down <= range.endLineNumberExclusive) {\n\t\t\tconst result = predicate(down);\n\t\t\tif (result !== undefined) {\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\t\tconst up = targetLine - offset;\n\t\tif (up >= range.startLineNumber) {\n\t\t\tconst result = predicate(up);\n\t\t\tif (result !== undefined) {\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\t\tif (up < range.startLineNumber && down > range.endLineNumberExclusive) {\n\t\t\treturn undefined;\n\t\t}\n\t}\n}\n\nfunction getSums<T>(array: T[], fn: (item: T) => number): number[] {\n\tconst result: number[] = [0];\n\tlet sum = 0;\n\tfor (const item of array) {\n\t\tsum += fn(item);\n\t\tresult.push(sum);\n\t}\n\treturn result;\n}\n\nfunction isEditBelowHint(viewState: ILongDistanceViewState): boolean {\n\tconst hintLineNumber = viewState.hint.lineNumber;\n\tconst editStartLineNumber = viewState.diff[0]?.original.startLineNumber;\n\treturn hintLineNumber < editStartLineNumber;\n}\n\n\n/**\n * Changes the scroll position as little as possible just to reveal the given range in the window.\n*/\nexport function scrollToReveal(currentScrollPosition: number, windowWidth: number, contentRangeToReveal: OffsetRange): { newScrollPosition: number } {\n\tconst visibleRange = new OffsetRange(currentScrollPosition, currentScrollPosition + windowWidth);\n\tif (visibleRange.containsRange(contentRangeToReveal)) {\n\t\treturn { newScrollPosition: currentScrollPosition };\n\t}\n\tif (contentRangeToReveal.length > windowWidth) {\n\t\treturn { newScrollPosition: contentRangeToReveal.start };\n\t}\n\tif (contentRangeToReveal.endExclusive > visibleRange.endExclusive) {\n\t\treturn { newScrollPosition: contentRangeToReveal.endExclusive - windowWidth };\n\t}\n\tif (contentRangeToReveal.start < visibleRange.start) {\n\t\treturn { newScrollPosition: contentRangeToReveal.start };\n\t}\n\treturn { newScrollPosition: currentScrollPosition };\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 { ChildNode, n, ObserverNode, ObserverNodeWithElement } from '../../../../../../../../base/browser/dom.js';\nimport { Event } from '../../../../../../../../base/common/event.js';\nimport { Disposable } from '../../../../../../../../base/common/lifecycle.js';\nimport { IObservable, autorun, constObservable, debouncedObservable2, derived, derivedDisposable } from '../../../../../../../../base/common/observable.js';\nimport { IInstantiationService } from '../../../../../../../../platform/instantiation/common/instantiation.js';\nimport { ICodeEditor } from '../../../../../../../browser/editorBrowser.js';\nimport { observableCodeEditor } from '../../../../../../../browser/observableCodeEditor.js';\nimport { Rect } from '../../../../../../../common/core/2d/rect.js';\nimport { Position } from '../../../../../../../common/core/position.js';\nimport { ITextModel } from '../../../../../../../common/model.js';\nimport { IInlineEditsView, InlineEditTabAction } from '../../inlineEditsViewInterface.js';\nimport { InlineEditWithChanges } from '../../inlineEditWithChanges.js';\nimport { getContentSizeOfLines, rectToProps } from '../../utils/utils.js';\nimport { DetailedLineRangeMapping } from '../../../../../../../common/diff/rangeMapping.js';\nimport { OffsetRange } from '../../../../../../../common/core/ranges/offsetRange.js';\nimport { LineRange } from '../../../../../../../common/core/ranges/lineRange.js';\nimport { HideUnchangedRegionsFeature } from '../../../../../../../browser/widget/diffEditor/features/hideUnchangedRegionsFeature.js';\nimport { Codicon } from '../../../../../../../../base/common/codicons.js';\nimport { renderIcon } from '../../../../../../../../base/browser/ui/iconLabel/iconLabels.js';\nimport { SymbolKinds } from '../../../../../../../common/languages.js';\nimport { debugLogRects, debugView } from '../debugVisualization.js';\nimport { distributeFlexBoxLayout } from '../../utils/flexBoxLayout.js';\nimport { Point } from '../../../../../../../common/core/2d/point.js';\nimport { Size2D } from '../../../../../../../common/core/2d/size.js';\nimport { getMaxTowerHeightInAvailableArea } from '../../utils/towersLayout.js';\nimport { IThemeService } from '../../../../../../../../platform/theme/common/themeService.js';\nimport { IKeybindingService } from '../../../../../../../../platform/keybinding/common/keybinding.js';\nimport { getEditorBlendedColor, inlineEditIndicatorPrimaryBackground, inlineEditIndicatorSecondaryBackground, inlineEditIndicatorsuccessfulBackground } from '../../theme.js';\nimport { asCssVariable, descriptionForeground, editorBackground, editorWidgetBackground } from '../../../../../../../../platform/theme/common/colorRegistry.js';\nimport { ILongDistancePreviewProps, LongDistancePreviewEditor } from './longDistancePreviewEditor.js';\nimport { InlineSuggestionGutterMenuData, SimpleInlineSuggestModel } from '../../components/gutterIndicatorView.js';\nimport { jumpToNextInlineEditId } from '../../../../controller/commandIds.js';\n\nconst BORDER_RADIUS = 4;\nconst MAX_WIDGET_WIDTH = { EMPTY_SPACE: 425, OVERLAY: 375 };\nconst MIN_WIDGET_WIDTH = 250;\n\nexport class InlineEditsLongDistanceHint extends Disposable implements IInlineEditsView {\n\n\tprivate readonly _editorObs;\n\treadonly onDidClick = Event.None;\n\tprivate _viewWithElement: ObserverNodeWithElement<HTMLDivElement> | undefined = undefined;\n\n\tprivate readonly _previewEditor;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tprivate readonly _viewState: IObservable<ILongDistanceViewState | undefined>,\n\t\tprivate readonly _previewTextModel: ITextModel,\n\t\tprivate readonly _tabAction: IObservable<InlineEditTabAction>,\n\t\t@IInstantiationService private readonly _instantiationService: IInstantiationService,\n\t\t@IThemeService private readonly _themeService: IThemeService,\n\t\t@IKeybindingService private readonly _keybindingService: IKeybindingService,\n\t) {\n\t\tsuper();\n\n\t\tthis._styles = this._tabAction.map((v, reader) => {\n\t\t\tlet border;\n\t\t\tswitch (v) {\n\t\t\t\tcase InlineEditTabAction.Inactive: border = inlineEditIndicatorSecondaryBackground; break;\n\t\t\t\tcase InlineEditTabAction.Jump: border = inlineEditIndicatorPrimaryBackground; break;\n\t\t\t\tcase InlineEditTabAction.Accept: border = inlineEditIndicatorsuccessfulBackground; break;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tborder: getEditorBlendedColor(border, this._themeService).read(reader).toString(),\n\t\t\t\tbackground: asCssVariable(editorBackground)\n\t\t\t};\n\t\t});\n\n\t\tthis._editorObs = observableCodeEditor(this._editor);\n\n\t\tthis._previewEditor = this._register(\n\t\t\tthis._instantiationService.createInstance(\n\t\t\t\tLongDistancePreviewEditor,\n\t\t\t\tthis._previewTextModel,\n\t\t\t\tderived(reader => {\n\t\t\t\t\tconst viewState = this._viewState.read(reader);\n\t\t\t\t\tif (!viewState) {\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdiff: viewState.diff,\n\t\t\t\t\t\tmodel: viewState.model,\n\t\t\t\t\t\tsuggestInfo: viewState.suggestInfo,\n\t\t\t\t\t} satisfies ILongDistancePreviewProps;\n\t\t\t\t}),\n\t\t\t\tthis._editor,\n\t\t\t\tthis._tabAction,\n\t\t\t)\n\t\t);\n\n\t\tthis._viewWithElement = this._view.keepUpdated(this._store);\n\t\tthis._register(this._editorObs.createOverlayWidget({\n\t\t\tdomNode: this._viewWithElement.element,\n\t\t\tposition: constObservable(null),\n\t\t\tallowEditorOverflow: false,\n\t\t\tminContentWidthInPx: constObservable(0),\n\t\t}));\n\n\t\tthis._widgetContent.get().keepUpdated(this._store);\n\n\t\tthis._register(autorun(reader => {\n\t\t\tconst layoutInfo = this._previewEditorLayoutInfo.read(reader);\n\t\t\tif (!layoutInfo) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis._previewEditor.layout(layoutInfo.codeEditorSize.toDimension(), layoutInfo.desiredPreviewEditorScrollLeft);\n\t\t}));\n\n\t\tthis._isVisibleDelayed.recomputeInitiallyAndOnChange(this._store);\n\t}\n\n\tprivate readonly _styles;\n\n\tpublic get isHovered() { return this._widgetContent.get().didMouseMoveDuringHover; }\n\n\tprivate readonly _hintTextPosition = derived(this, (reader) => {\n\t\tconst viewState = this._viewState.read(reader);\n\t\treturn viewState ? new Position(viewState.hint.lineNumber, Number.MAX_SAFE_INTEGER) : null;\n\t});\n\n\tprivate readonly _lineSizesAroundHintPosition = derived(this, (reader) => {\n\t\tconst viewState = this._viewState.read(reader);\n\t\tconst p = this._hintTextPosition.read(reader);\n\t\tif (!viewState || !p) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst model = this._editorObs.model.read(reader);\n\t\tif (!model) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst range = LineRange.ofLength(p.lineNumber, 1).addMargin(5, 5).intersect(LineRange.ofLength(1, model.getLineCount()));\n\n\t\tif (!range) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst sizes = getContentSizeOfLines(this._editorObs, range, reader);\n\t\tconst top = this._editorObs.observeTopForLineNumber(range.startLineNumber).read(reader);\n\n\t\treturn {\n\t\t\tlineRange: range,\n\t\t\ttop: top,\n\t\t\tsizes: sizes,\n\t\t};\n\t});\n\n\tprivate readonly _isVisibleDelayed = debouncedObservable2(\n\t\tderived(this, reader => this._viewState.read(reader)?.hint.isVisible),\n\t\t(lastValue, newValue) => lastValue === true && newValue === false ? 200 : 0,\n\t);\n\n\tprivate readonly _previewEditorLayoutInfo = derived(this, (reader) => {\n\t\tconst viewState = this._viewState.read(reader);\n\n\t\tif (!viewState || !this._isVisibleDelayed.read(reader)) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst lineSizes = this._lineSizesAroundHintPosition.read(reader);\n\t\tif (!lineSizes) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst editorScrollTop = this._editorObs.scrollTop.read(reader);\n\t\tconst editorScrollLeft = this._editorObs.scrollLeft.read(reader);\n\t\tconst editorLayout = this._editorObs.layoutInfo.read(reader);\n\n\t\tconst previewContentHeight = this._previewEditor.contentHeight.read(reader);\n\t\tconst previewEditorContentLayout = this._previewEditor.horizontalContentRangeInPreviewEditorToShow.read(reader);\n\n\t\tif (!previewContentHeight || !previewEditorContentLayout) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// const debugRects = stackSizesDown(new Point(editorLayout.contentLeft, lineSizes.top - scrollTop), lineSizes.sizes);\n\n\t\tconst editorTrueContentWidth = editorLayout.contentWidth - editorLayout.verticalScrollbarWidth;\n\t\tconst editorTrueContentRight = editorLayout.contentLeft + editorTrueContentWidth;\n\n\t\t// drawEditorWidths(this._editor, reader);\n\n\t\tconst c = this._editorObs.cursorLineNumber.read(reader);\n\t\tif (!c) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst availableSpaceSizes = lineSizes.sizes.map((s, idx) => {\n\t\t\tconst lineNumber = lineSizes.lineRange.startLineNumber + idx;\n\t\t\tlet linePaddingLeft = 20;\n\t\t\tif (lineNumber === viewState.hint.lineNumber) {\n\t\t\t\tlinePaddingLeft = 40;\n\t\t\t}\n\t\t\treturn new Size2D(Math.max(0, editorTrueContentWidth - s.width - linePaddingLeft), s.height);\n\t\t});\n\n\t\tconst showRects = false;\n\t\tif (showRects) {\n\t\t\tconst rects2 = stackSizesDown(new Point(editorTrueContentRight, lineSizes.top - editorScrollTop), availableSpaceSizes, 'right');\n\t\t\tdebugView(debugLogRects({ ...rects2 }, this._editor.getDomNode()!), reader);\n\t\t}\n\n\t\tconst availableSpaceHeightPrefixSums = getSums(availableSpaceSizes, s => s.height);\n\t\tconst availableSpaceSizesTransposed = availableSpaceSizes.map(s => s.transpose());\n\n\t\tconst previewEditorMargin = 2;\n\t\tconst widgetPadding = 2;\n\t\tconst lowerBarHeight = 20;\n\t\tconst widgetBorder = 1;\n\n\t\tconst extraGutterMarginToAvoidScrollBar = 2;\n\t\tconst previewEditorHeight = previewContentHeight! + extraGutterMarginToAvoidScrollBar;\n\n\t\tfunction getWidgetVerticalOutline(lineNumber: number): OffsetRange {\n\t\t\tconst sizeIdx = lineNumber - lineSizes!.lineRange.startLineNumber;\n\t\t\tconst top = lineSizes!.top + availableSpaceHeightPrefixSums[sizeIdx];\n\t\t\tconst editorRange = OffsetRange.ofStartAndLength(top, previewEditorHeight);\n\t\t\tconst verticalWidgetRange = editorRange.withMargin(previewEditorMargin + widgetPadding + widgetBorder).withMargin(0, lowerBarHeight);\n\t\t\treturn verticalWidgetRange;\n\t\t}\n\n\t\tlet possibleWidgetOutline = findFirstMinimzeDistance(lineSizes.lineRange.addMargin(-1, -1), viewState.hint.lineNumber, lineNumber => {\n\t\t\tconst verticalWidgetRange = getWidgetVerticalOutline(lineNumber);\n\t\t\tconst maxWidth = getMaxTowerHeightInAvailableArea(verticalWidgetRange.delta(-lineSizes.top), availableSpaceSizesTransposed);\n\t\t\tif (maxWidth < MIN_WIDGET_WIDTH) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tconst horizontalWidgetRange = OffsetRange.ofStartAndLength(editorTrueContentRight - maxWidth, maxWidth);\n\t\t\treturn { horizontalWidgetRange, verticalWidgetRange };\n\t\t});\n\n\t\tlet position: 'overlay' | 'empty-space' = 'empty-space';\n\t\tif (!possibleWidgetOutline) {\n\t\t\tposition = 'overlay';\n\t\t\tconst maxAvailableWidth = Math.min(editorLayout.width - editorLayout.contentLeft, MAX_WIDGET_WIDTH.OVERLAY);\n\t\t\tpossibleWidgetOutline = {\n\t\t\t\thorizontalWidgetRange: OffsetRange.ofStartAndLength(editorTrueContentRight - maxAvailableWidth, maxAvailableWidth),\n\t\t\t\tverticalWidgetRange: getWidgetVerticalOutline(viewState.hint.lineNumber + 2).delta(10),\n\t\t\t};\n\t\t}\n\n\t\tif (!possibleWidgetOutline) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst rectAvailableSpace = Rect.fromRanges(\n\t\t\tpossibleWidgetOutline.horizontalWidgetRange,\n\t\t\tpossibleWidgetOutline.verticalWidgetRange\n\t\t).translateX(-editorScrollLeft).translateY(-editorScrollTop);\n\n\t\tconst showAvailableSpace = false;\n\t\tif (showAvailableSpace) {\n\t\t\tdebugView(debugLogRects({ rectAvailableSpace }, this._editor.getDomNode()!), reader);\n\t\t}\n\n\t\tconst maxWidgetWidth = Math.min(position === 'overlay' ? MAX_WIDGET_WIDTH.OVERLAY : MAX_WIDGET_WIDTH.EMPTY_SPACE, previewEditorContentLayout.maxEditorWidth + previewEditorMargin + widgetPadding);\n\n\t\tconst layout = distributeFlexBoxLayout(rectAvailableSpace.width, {\n\t\t\tspaceBefore: { min: 0, max: 10, priority: 1 },\n\t\t\tcontent: { min: 50, rules: [{ max: 150, priority: 2 }, { max: maxWidgetWidth, priority: 1 }] },\n\t\t\tspaceAfter: { min: 10 },\n\t\t});\n\n\t\tif (!layout) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst ranges = lengthsToOffsetRanges([layout.spaceBefore, layout.content, layout.spaceAfter], rectAvailableSpace.left);\n\t\tconst spaceBeforeRect = rectAvailableSpace.withHorizontalRange(ranges[0]);\n\t\tconst widgetRect = rectAvailableSpace.withHorizontalRange(ranges[1]);\n\t\tconst spaceAfterRect = rectAvailableSpace.withHorizontalRange(ranges[2]);\n\n\t\tconst showRects2 = false;\n\t\tif (showRects2) {\n\t\t\tdebugView(debugLogRects({ spaceBeforeRect, widgetRect, spaceAfterRect }, this._editor.getDomNode()!), reader);\n\t\t}\n\n\t\tconst previewEditorRect = widgetRect.withMargin(-widgetPadding - widgetBorder - previewEditorMargin).withMargin(0, 0, -lowerBarHeight, 0);\n\n\t\tconst showEditorRect = false;\n\t\tif (showEditorRect) {\n\t\t\tdebugView(debugLogRects({ previewEditorRect }, this._editor.getDomNode()!), reader);\n\t\t}\n\n\t\tconst previewEditorContentWidth = previewEditorRect.width - previewEditorContentLayout.nonContentWidth;\n\t\tconst maxPrefferedRangeLength = previewEditorContentWidth * 0.8;\n\t\tconst preferredRangeToReveal = previewEditorContentLayout.preferredRangeToReveal.intersect(OffsetRange.ofStartAndLength(\n\t\t\tpreviewEditorContentLayout.preferredRangeToReveal.start,\n\t\t\tmaxPrefferedRangeLength\n\t\t)) ?? previewEditorContentLayout.preferredRangeToReveal;\n\t\tconst desiredPreviewEditorScrollLeft = scrollToReveal(previewEditorContentLayout.indentationEnd, previewEditorContentWidth, preferredRangeToReveal);\n\n\t\treturn {\n\t\t\tcodeEditorSize: previewEditorRect.getSize(),\n\t\t\tcodeScrollLeft: editorScrollLeft,\n\t\t\tcontentLeft: editorLayout.contentLeft,\n\n\t\t\twidgetRect,\n\n\t\t\tpreviewEditorMargin,\n\t\t\twidgetPadding,\n\t\t\twidgetBorder,\n\n\t\t\tlowerBarHeight,\n\n\t\t\tdesiredPreviewEditorScrollLeft: desiredPreviewEditorScrollLeft.newScrollPosition,\n\t\t};\n\t});\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: derived(this, reader => !!this._previewEditorLayoutInfo.read(reader) ? 'block' : 'none'),\n\t\t},\n\t}, [\n\t\tderived(this, _reader => [this._widgetContent]),\n\t]);\n\n\tprivate readonly _widgetContent = derived(this, reader => // TODO@hediet: remove when n.div lazily creates previewEditor.element node\n\t\tn.div({\n\t\t\tclass: 'inline-edits-long-distance-hint-widget',\n\t\t\tstyle: {\n\t\t\t\tposition: 'absolute',\n\t\t\t\toverflow: 'hidden',\n\t\t\t\tcursor: 'pointer',\n\t\t\t\tbackground: asCssVariable(editorWidgetBackground),\n\t\t\t\tpadding: this._previewEditorLayoutInfo.map(i => i?.widgetPadding),\n\t\t\t\tboxSizing: 'border-box',\n\t\t\t\tborderRadius: BORDER_RADIUS,\n\t\t\t\tborder: derived(reader => `${this._previewEditorLayoutInfo.read(reader)?.widgetBorder}px solid ${this._styles.read(reader).border}`),\n\t\t\t\tdisplay: 'flex',\n\t\t\t\tflexDirection: 'column',\n\t\t\t\topacity: derived(reader => this._viewState.read(reader)?.hint.isVisible ? '1' : '0'),\n\t\t\t\ttransition: 'opacity 200ms ease-in-out',\n\t\t\t\t...rectToProps(reader => this._previewEditorLayoutInfo.read(reader)?.widgetRect)\n\t\t\t},\n\t\t\tonmousedown: e => {\n\t\t\t\te.preventDefault(); // This prevents that the editor loses focus\n\t\t\t},\n\t\t\tonclick: () => {\n\t\t\t\tthis._viewState.read(undefined)?.model.jump();\n\t\t\t}\n\t\t}, [\n\t\t\tn.div({\n\t\t\t\tclass: ['editorContainer'],\n\t\t\t\tstyle: {\n\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\tpadding: this._previewEditorLayoutInfo.map(i => i?.previewEditorMargin),\n\t\t\t\t\tbackground: asCssVariable(editorBackground),\n\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t},\n\t\t\t}, [\n\t\t\t\tderived(this, r => this._previewEditor.element), // --\n\t\t\t]),\n\t\t\tn.div({ class: 'bar', style: { color: asCssVariable(descriptionForeground), pointerEvents: 'none', margin: '0 4px', height: this._previewEditorLayoutInfo.map(i => i?.lowerBarHeight), display: 'flex', justifyContent: 'space-between', alignItems: 'center' } }, [\n\t\t\t\tderived(this, reader => {\n\t\t\t\t\tconst children: (HTMLElement | ObserverNode<HTMLDivElement>)[] = [];\n\t\t\t\t\tconst viewState = this._viewState.read(reader);\n\t\t\t\t\tif (!viewState) {\n\t\t\t\t\t\treturn children;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Outline Element\n\t\t\t\t\tconst source = this._originalOutlineSource.read(reader);\n\t\t\t\t\tconst outlineItems = source?.getAt(viewState.edit.lineEdit.lineRange.startLineNumber, reader).slice(0, 1) ?? [];\n\t\t\t\t\tconst outlineElements: ChildNode[] = [];\n\t\t\t\t\tif (outlineItems.length > 0) {\n\t\t\t\t\t\tfor (let i = 0; i < outlineItems.length; i++) {\n\t\t\t\t\t\t\tconst item = outlineItems[i];\n\t\t\t\t\t\t\tconst icon = SymbolKinds.toIcon(item.kind);\n\t\t\t\t\t\t\toutlineElements.push(n.div({\n\t\t\t\t\t\t\t\tclass: 'breadcrumb-item',\n\t\t\t\t\t\t\t\tstyle: { display: 'flex', alignItems: 'center', flex: '1 1 auto', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' },\n\t\t\t\t\t\t\t}, [\n\t\t\t\t\t\t\t\trenderIcon(icon),\n\t\t\t\t\t\t\t\t'\\u00a0',\n\t\t\t\t\t\t\t\titem.name,\n\t\t\t\t\t\t\t\t...(i === outlineItems.length - 1\n\t\t\t\t\t\t\t\t\t? []\n\t\t\t\t\t\t\t\t\t: [renderIcon(Codicon.chevronRight)]\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}\n\t\t\t\t\tchildren.push(n.div({ class: 'outline-elements', style: { overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' } }, outlineElements));\n\n\t\t\t\t\t// Show Edit Direction\n\t\t\t\t\tconst arrowIcon = isEditBelowHint(viewState) ? Codicon.arrowDown : Codicon.arrowUp;\n\t\t\t\t\tconst keybinding = this._keybindingService.lookupKeybinding(jumpToNextInlineEditId);\n\t\t\t\t\tlet label = 'Go to suggestion';\n\t\t\t\t\tif (keybinding && keybinding.getLabel() === 'Tab') {\n\t\t\t\t\t\tlabel = 'Tab to suggestion';\n\t\t\t\t\t}\n\t\t\t\t\tchildren.push(n.div({\n\t\t\t\t\t\tclass: 'go-to-label',\n\t\t\t\t\t\tstyle: { position: 'relative', display: 'flex', alignItems: 'center', flex: '0 0 auto', paddingLeft: '6px' },\n\t\t\t\t\t}, [\n\t\t\t\t\t\tlabel,\n\t\t\t\t\t\t'\\u00a0',\n\t\t\t\t\t\trenderIcon(arrowIcon),\n\t\t\t\t\t]));\n\n\t\t\t\t\treturn children;\n\t\t\t\t})\n\t\t\t]),\n\t\t])\n\t);\n\n\tprivate readonly _originalOutlineSource = derivedDisposable(this, (reader) => {\n\t\tconst m = this._editorObs.model.read(reader);\n\t\tconst factory = HideUnchangedRegionsFeature._breadcrumbsSourceFactory.read(reader);\n\t\treturn (!m || !factory) ? undefined : factory(m, this._instantiationService);\n\t});\n}\n\nexport interface ILongDistanceHint {\n\tlineNumber: number;\n\tisVisible: boolean;\n}\n\nexport interface ILongDistanceViewState {\n\thint: ILongDistanceHint;\n\tnewTextLineCount: number;\n\tedit: InlineEditWithChanges;\n\tdiff: DetailedLineRangeMapping[];\n\n\tmodel: SimpleInlineSuggestModel;\n\tsuggestInfo: InlineSuggestionGutterMenuData;\n}\n\nfunction lengthsToOffsetRanges(lengths: number[], initialOffset = 0): OffsetRange[] {\n\tconst result: OffsetRange[] = [];\n\tlet offset = initialOffset;\n\tfor (const length of lengths) {\n\t\tresult.push(new OffsetRange(offset, offset + length));\n\t\toffset += length;\n\t}\n\treturn result;\n}\n\nfunction stackSizesDown(at: Point, sizes: Size2D[], alignment: 'left' | 'right' = 'left'): Rect[] {\n\tconst rects: Rect[] = [];\n\tlet offset = 0;\n\tfor (const s of sizes) {\n\t\trects.push(\n\t\t\tRect.fromLeftTopWidthHeight(\n\t\t\t\tat.x + (alignment === 'left' ? 0 : -s.width),\n\t\t\t\tat.y + offset,\n\t\t\t\ts.width,\n\t\t\t\ts.height\n\t\t\t)\n\t\t);\n\t\toffset += s.height;\n\t}\n\treturn rects;\n}\n\nfunction findFirstMinimzeDistance<T>(range: LineRange, targetLine: number, predicate: (lineNumber: number) => T | undefined): T | undefined {\n\tfor (let offset = 0; ; offset++) {\n\t\tconst down = targetLine + offset;\n\t\tif (down <= range.endLineNumberExclusive) {\n\t\t\tconst result = predicate(down);\n\t\t\tif (result !== undefined) {\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\t\tconst up = targetLine - offset;\n\t\tif (up >= range.startLineNumber) {\n\t\t\tconst result = predicate(up);\n\t\t\tif (result !== undefined) {\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\t\tif (up < range.startLineNumber && down > range.endLineNumberExclusive) {\n\t\t\treturn undefined;\n\t\t}\n\t}\n}\n\nfunction getSums<T>(array: T[], fn: (item: T) => number): number[] {\n\tconst result: number[] = [0];\n\tlet sum = 0;\n\tfor (const item of array) {\n\t\tsum += fn(item);\n\t\tresult.push(sum);\n\t}\n\treturn result;\n}\n\nfunction isEditBelowHint(viewState: ILongDistanceViewState): boolean {\n\tconst hintLineNumber = viewState.hint.lineNumber;\n\tconst editStartLineNumber = viewState.diff[0]?.original.startLineNumber;\n\treturn hintLineNumber < editStartLineNumber;\n}\n\n\n/**\n * Changes the scroll position as little as possible just to reveal the given range in the window.\n*/\nexport function scrollToReveal(currentScrollPosition: number, windowWidth: number, contentRangeToReveal: OffsetRange): { newScrollPosition: number } {\n\tconst visibleRange = new OffsetRange(currentScrollPosition, currentScrollPosition + windowWidth);\n\tif (visibleRange.containsRange(contentRangeToReveal)) {\n\t\treturn { newScrollPosition: currentScrollPosition };\n\t}\n\tif (contentRangeToReveal.length > windowWidth) {\n\t\treturn { newScrollPosition: contentRangeToReveal.start };\n\t}\n\tif (contentRangeToReveal.endExclusive > visibleRange.endExclusive) {\n\t\treturn { newScrollPosition: contentRangeToReveal.endExclusive - windowWidth };\n\t}\n\tif (contentRangeToReveal.start < visibleRange.start) {\n\t\treturn { newScrollPosition: contentRangeToReveal.start };\n\t}\n\treturn { newScrollPosition: currentScrollPosition };\n}\n"]}
|
|
@@ -159,6 +159,16 @@ let LongDistancePreviewEditor = class LongDistancePreviewEditor extends Disposab
|
|
|
159
159
|
const decorations = this._editorDecorations.read(reader);
|
|
160
160
|
return (state?.mode === 'original' ? decorations?.originalDecorations : decorations?.modifiedDecorations) ?? [];
|
|
161
161
|
})));
|
|
162
|
+
// Mirror the cursor position. Allows the gutter arrow to point in the correct direction.
|
|
163
|
+
this._register(autorun((reader) => {
|
|
164
|
+
if (!this._properties.read(reader)) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
const cursorPosition = this._parentEditorObs.cursorPosition.read(reader);
|
|
168
|
+
if (cursorPosition) {
|
|
169
|
+
this.previewEditor.setPosition(this._previewTextModel.validatePosition(cursorPosition), 'longDistanceHintPreview');
|
|
170
|
+
}
|
|
171
|
+
}));
|
|
162
172
|
this._register(autorun(reader => {
|
|
163
173
|
const state = this._properties.read(reader);
|
|
164
174
|
if (!state) {
|
|
@@ -227,11 +237,11 @@ let LongDistancePreviewEditor = class LongDistancePreviewEditor extends Disposab
|
|
|
227
237
|
}
|
|
228
238
|
const firstCharacterChange = state.mode === 'modified' ? diff[0].innerChanges[0].modifiedRange : diff[0].innerChanges[0].originalRange;
|
|
229
239
|
// find the horizontal range we want to show.
|
|
230
|
-
|
|
231
|
-
const left = this._previewEditorObs.getLeftOfPosition(
|
|
232
|
-
const right = this._previewEditorObs.getLeftOfPosition(
|
|
233
|
-
const indentCol = editor.getModel().getLineFirstNonWhitespaceColumn(
|
|
234
|
-
const indentationEnd = this._previewEditorObs.getLeftOfPosition(new Position(
|
|
240
|
+
const preferredRange = growUntilVariableBoundaries(editor.getModel(), firstCharacterChange, 5);
|
|
241
|
+
const left = this._previewEditorObs.getLeftOfPosition(preferredRange.getStartPosition(), reader);
|
|
242
|
+
const right = this._previewEditorObs.getLeftOfPosition(preferredRange.getEndPosition(), reader);
|
|
243
|
+
const indentCol = editor.getModel().getLineFirstNonWhitespaceColumn(preferredRange.startLineNumber);
|
|
244
|
+
const indentationEnd = this._previewEditorObs.getLeftOfPosition(new Position(preferredRange.startLineNumber, indentCol), reader);
|
|
235
245
|
const preferredRangeToReveal = new OffsetRange(left, right);
|
|
236
246
|
return {
|
|
237
247
|
indentationEnd,
|
|
@@ -250,4 +260,31 @@ LongDistancePreviewEditor = __decorate([
|
|
|
250
260
|
__param(4, IInstantiationService)
|
|
251
261
|
], LongDistancePreviewEditor);
|
|
252
262
|
export { LongDistancePreviewEditor };
|
|
263
|
+
/*
|
|
264
|
+
* Grows the range on each ends until it includes a none-variable-name character
|
|
265
|
+
* or the next character would be a whitespace character
|
|
266
|
+
* or the maxGrow limit is reached
|
|
267
|
+
*/
|
|
268
|
+
function growUntilVariableBoundaries(textModel, range, maxGrow) {
|
|
269
|
+
const startPosition = range.getStartPosition();
|
|
270
|
+
const endPosition = range.getEndPosition();
|
|
271
|
+
const line = textModel.getLineContent(startPosition.lineNumber);
|
|
272
|
+
function isVariableNameCharacter(col) {
|
|
273
|
+
const char = line.charAt(col - 1);
|
|
274
|
+
return (/[a-zA-Z0-9_]/).test(char);
|
|
275
|
+
}
|
|
276
|
+
function isWhitespace(col) {
|
|
277
|
+
const char = line.charAt(col - 1);
|
|
278
|
+
return char === ' ' || char === '\t';
|
|
279
|
+
}
|
|
280
|
+
let startColumn = startPosition.column;
|
|
281
|
+
while (startColumn > 1 && isVariableNameCharacter(startColumn) && !isWhitespace(startColumn - 1) && startPosition.column - startColumn < maxGrow) {
|
|
282
|
+
startColumn--;
|
|
283
|
+
}
|
|
284
|
+
let endColumn = endPosition.column - 1;
|
|
285
|
+
while (endColumn <= line.length && isVariableNameCharacter(endColumn) && !isWhitespace(endColumn + 1) && endColumn - endPosition.column < maxGrow) {
|
|
286
|
+
endColumn++;
|
|
287
|
+
}
|
|
288
|
+
return new Range(startPosition.lineNumber, startPosition.column, endPosition.lineNumber, endColumn + 1);
|
|
289
|
+
}
|
|
253
290
|
//# sourceMappingURL=longDistancePreviewEditor.js.map
|
|
@@ -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/longDistanceHint/longDistancePreviewEditor.ts","vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/longDistancePreviewEditor.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;AAEhG,OAAO,EAAE,CAAC,EAAE,MAAM,6CAA6C,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,kDAAkD,CAAC;AAC9E,OAAO,EAAe,OAAO,EAAE,eAAe,EAAW,OAAO,EAAE,eAAe,EAAE,MAAM,mDAAmD,CAAC;AAC7I,OAAO,EAAE,qBAAqB,EAAE,MAAM,wEAAwE,CAAC;AAE/G,OAAO,EAAwB,oBAAoB,EAAE,MAAM,sDAAsD,CAAC;AAClH,OAAO,EAAE,wBAAwB,EAAE,MAAM,4EAA4E,CAAC;AAEtH,OAAO,EAAE,QAAQ,EAAE,MAAM,8CAA8C,CAAC;AACxE,OAAO,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,sDAAsD,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,MAAM,wDAAwD,CAAC;AAGrF,OAAO,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AACxF,OAAO,EAAE,2BAA2B,EAAE,MAAM,uDAAuD,CAAC;AACpG,OAAO,EAAE,0BAA0B,EAAE,8BAA8B,EAA4D,MAAM,yCAAyC,CAAC;AAE/K,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAQnE,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,UAAU;IASxD,YACkB,iBAA6B,EAC7B,WAA+D,EAC/D,aAA0B,EAC1B,UAA4C,EACtC,qBAA6D;QAEpF,KAAK,EAAE,CAAC;QANS,sBAAiB,GAAjB,iBAAiB,CAAY;QAC7B,gBAAW,GAAX,WAAW,CAAoD;QAC/D,kBAAa,GAAb,aAAa,CAAa;QAC1B,eAAU,G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B,CAAC,IAAI,QAAQ,CAAC,oBAAoB,CAAC,eAAe,EAAE,SAAS,CAAC,EAAE,MAAM,CAAC,CAAC;QAEvI,MAAM,sBAAsB,GAAG,IAAI,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAE5D,OAAO;YACN,cAAc;YACd,sBAAsB;YACtB,cAAc,EAAE,gBAAgB,GAAG,CAAC,CAAC,WAAW;YAChD,YAAY,EAAE,gBAAgB;YAC9B,eAAe,EAAE,CAAC,CAAC,WAAW,EAAE,oCAAoC;SACpE,CAAC;IACH,CAAC;IAEM,MAAM,CAAC,SAAqB,EAAE,8BAAsC;QAC1E,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACrC,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,aAAa,CAAC,8BAA8B,CAAC,CAAC;IAC7E,CAAC;CAuED,CAAA;AAjRY,yBAAyB;IAcnC,WAAA,qBAAqB,CAAA;GAdX,yBAAyB,CAiRrC","file":"longDistancePreviewEditor.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { n } from '../../../../../../../../base/browser/dom.js';\nimport { Disposable } from '../../../../../../../../base/common/lifecycle.js';\nimport { IObservable, derived, constObservable, IReader, autorun, observableValue } from '../../../../../../../../base/common/observable.js';\nimport { IInstantiationService } from '../../../../../../../../platform/instantiation/common/instantiation.js';\nimport { ICodeEditor } from '../../../../../../../browser/editorBrowser.js';\nimport { ObservableCodeEditor, observableCodeEditor } from '../../../../../../../browser/observableCodeEditor.js';\nimport { EmbeddedCodeEditorWidget } from '../../../../../../../browser/widget/codeEditor/embeddedCodeEditorWidget.js';\nimport { IDimension } from '../../../../../../../common/core/2d/dimension.js';\nimport { Position } from '../../../../../../../common/core/position.js';\nimport { Range } from '../../../../../../../common/core/range.js';\nimport { LineRange } from '../../../../../../../common/core/ranges/lineRange.js';\nimport { OffsetRange } from '../../../../../../../common/core/ranges/offsetRange.js';\nimport { DetailedLineRangeMapping } from '../../../../../../../common/diff/rangeMapping.js';\nimport { IModelDeltaDecoration, ITextModel } from '../../../../../../../common/model.js';\nimport { ModelDecorationOptions } from '../../../../../../../common/model/textModel.js';\nimport { InlineCompletionContextKeys } from '../../../../controller/inlineCompletionContextKeys.js';\nimport { InlineEditsGutterIndicator, InlineEditsGutterIndicatorData, InlineSuggestionGutterMenuData, SimpleInlineSuggestModel } from '../../components/gutterIndicatorView.js';\nimport { InlineEditTabAction } from '../../inlineEditsViewInterface.js';\nimport { classNames, maxContentWidthInRange } from '../../utils/utils.js';\n\nexport interface ILongDistancePreviewProps {\n\tdiff: DetailedLineRangeMapping[];\n\tmodel: SimpleInlineSuggestModel;\n\tsuggestInfo: InlineSuggestionGutterMenuData;\n}\n\nexport class LongDistancePreviewEditor extends Disposable {\n\tpublic readonly previewEditor;\n\tprivate readonly _previewEditorObs;\n\n\tprivate readonly _previewRef = n.ref<HTMLDivElement>();\n\tpublic readonly element = n.div({ class: 'preview', style: { /*pointerEvents: 'none'*/ }, ref: this._previewRef });\n\n\tprivate _parentEditorObs: ObservableCodeEditor;\n\n\tconstructor(\n\t\tprivate readonly _previewTextModel: ITextModel,\n\t\tprivate readonly _properties: IObservable<ILongDistancePreviewProps | undefined>,\n\t\tprivate readonly _parentEditor: ICodeEditor,\n\t\tprivate readonly _tabAction: IObservable<InlineEditTabAction>,\n\t\t@IInstantiationService private readonly _instantiationService: IInstantiationService,\n\t) {\n\t\tsuper();\n\n\t\tthis.previewEditor = this._register(this._createPreviewEditor());\n\t\tthis._parentEditorObs = observableCodeEditor(this._parentEditor);\n\n\t\tthis._register(autorun(reader => {\n\t\t\tthis.previewEditor.setModel(this._state.read(reader)?.textModel || null);\n\t\t}));\n\n\t\tthis._previewEditorObs = observableCodeEditor(this.previewEditor);\n\t\tthis._register(this._previewEditorObs.setDecorations(derived(reader => {\n\t\t\tconst state = this._state.read(reader);\n\t\t\tconst decorations = this._editorDecorations.read(reader);\n\t\t\treturn (state?.mode === 'original' ? decorations?.originalDecorations : decorations?.modifiedDecorations) ?? [];\n\t\t})));\n\n\t\tthis._register(autorun(reader => {\n\t\t\tconst state = this._properties.read(reader);\n\t\t\tif (!state) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Ensure there is enough space to the left of the line number for the gutter indicator to fits.\n\t\t\tconst lineNumberDigets = state.diff[0].modified.startLineNumber.toString().length;\n\t\t\tthis.previewEditor.updateOptions({ lineNumbersMinChars: lineNumberDigets + 1 });\n\t\t}));\n\n\t\tthis._register(this._instantiationService.createInstance(\n\t\t\tInlineEditsGutterIndicator,\n\t\t\tthis._previewEditorObs,\n\t\t\tderived(reader => {\n\t\t\t\tconst state = this._properties.read(reader);\n\t\t\t\tif (!state) { return undefined; }\n\t\t\t\treturn new InlineEditsGutterIndicatorData(\n\t\t\t\t\tstate.suggestInfo,\n\t\t\t\t\tLineRange.ofLength(state.diff[0].original.startLineNumber, 1),\n\t\t\t\t\tstate.model,\n\t\t\t\t);\n\t\t\t}),\n\t\t\tthis._tabAction,\n\t\t\tconstObservable(0),\n\t\t\tconstObservable(false),\n\t\t\tobservableValue(this, false),\n\t\t));\n\n\t\tthis.updatePreviewEditorEffect.recomputeInitiallyAndOnChange(this._store);\n\t}\n\n\tprivate readonly _state = derived(this, reader => {\n\t\tconst props = this._properties.read(reader);\n\t\tif (!props) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif (props.diff[0].innerChanges?.every(c => c.modifiedRange.isEmpty())) {\n\t\t\treturn {\n\t\t\t\tdiff: props.diff,\n\t\t\t\tvisibleLineRange: LineRange.ofLength(props.diff[0].original.startLineNumber, 1),\n\t\t\t\ttextModel: this._parentEditorObs.model.read(reader),\n\t\t\t\tmode: 'original' as const,\n\t\t\t};\n\t\t} else {\n\t\t\treturn {\n\t\t\t\tdiff: props.diff,\n\t\t\t\tvisibleLineRange: LineRange.ofLength(props.diff[0].modified.startLineNumber, 1),\n\t\t\t\ttextModel: this._previewTextModel,\n\t\t\t\tmode: 'modified' as const,\n\t\t\t};\n\t\t}\n\t});\n\n\tprivate _createPreviewEditor() {\n\t\treturn this._instantiationService.createInstance(\n\t\t\tEmbeddedCodeEditorWidget,\n\t\t\tthis._previewRef.element,\n\t\t\t{\n\t\t\t\tglyphMargin: false,\n\t\t\t\tlineNumbers: 'on',\n\t\t\t\tminimap: { enabled: false },\n\t\t\t\tguides: {\n\t\t\t\t\tindentation: false,\n\t\t\t\t\tbracketPairs: false,\n\t\t\t\t\tbracketPairsHorizontal: false,\n\t\t\t\t\thighlightActiveIndentation: false,\n\t\t\t\t},\n\n\t\t\t\trulers: [],\n\t\t\t\tpadding: { top: 0, bottom: 0 },\n\t\t\t\t//folding: false,\n\t\t\t\tselectOnLineNumbers: false,\n\t\t\t\tselectionHighlight: false,\n\t\t\t\tcolumnSelection: false,\n\t\t\t\toverviewRulerBorder: false,\n\t\t\t\toverviewRulerLanes: 0,\n\t\t\t\t//lineDecorationsWidth: 0,\n\t\t\t\t//lineNumbersMinChars: 0,\n\t\t\t\trevealHorizontalRightPadding: 0,\n\t\t\t\tbracketPairColorization: { enabled: true, independentColorPoolPerBracketType: false },\n\t\t\t\tscrollBeyondLastLine: false,\n\t\t\t\tscrollbar: {\n\t\t\t\t\tvertical: 'hidden',\n\t\t\t\t\thorizontal: 'hidden',\n\t\t\t\t\thandleMouseWheel: false,\n\t\t\t\t},\n\t\t\t\treadOnly: true,\n\t\t\t\twordWrap: 'off',\n\t\t\t\twordWrapOverride1: 'off',\n\t\t\t\twordWrapOverride2: 'off',\n\t\t\t},\n\t\t\t{\n\t\t\t\tcontextKeyValues: {\n\t\t\t\t\t[InlineCompletionContextKeys.inInlineEditsPreviewEditor.key]: true,\n\t\t\t\t},\n\t\t\t\tcontributions: [],\n\t\t\t},\n\t\t\tthis._parentEditor\n\t\t);\n\t}\n\n\tpublic readonly updatePreviewEditorEffect = derived(this, reader => {\n\t\t// this._widgetContent.readEffect(reader);\n\t\tthis._previewEditorObs.model.read(reader); // update when the model is set\n\n\t\tconst range = this._state.read(reader)?.visibleLineRange;\n\t\tif (!range) {\n\t\t\treturn;\n\t\t}\n\t\tconst hiddenAreas: Range[] = [];\n\t\tif (range.startLineNumber > 1) {\n\t\t\thiddenAreas.push(new Range(1, 1, range.startLineNumber - 1, 1));\n\t\t}\n\t\tif (range.endLineNumberExclusive < this._previewTextModel.getLineCount() + 1) {\n\t\t\thiddenAreas.push(new Range(range.endLineNumberExclusive, 1, this._previewTextModel.getLineCount() + 1, 1));\n\t\t}\n\t\tthis.previewEditor.setHiddenAreas(hiddenAreas, undefined, true);\n\t});\n\n\tpublic readonly horizontalContentRangeInPreviewEditorToShow = derived(this, reader => {\n\t\treturn this._getHorizontalContentRangeInPreviewEditorToShow(this.previewEditor, this._properties.read(reader)?.diff ?? [], reader);\n\t});\n\n\tpublic readonly contentHeight = derived(this, (reader) => {\n\t\tconst viewState = this._properties.read(reader);\n\t\tif (!viewState) {\n\t\t\treturn constObservable(null);\n\t\t}\n\n\t\tconst previewEditorHeight = this._previewEditorObs.observeLineHeightForLine(viewState.diff[0].modified.startLineNumber);\n\t\treturn previewEditorHeight;\n\t}).flatten();\n\n\tprivate _getHorizontalContentRangeInPreviewEditorToShow(editor: ICodeEditor, diff: DetailedLineRangeMapping[], reader: IReader) {\n\n\t\tconst r = LineRange.ofLength(diff[0].modified.startLineNumber, 1);\n\t\tconst l = this._previewEditorObs.layoutInfo.read(reader);\n\t\tconst trueContentWidth = maxContentWidthInRange(this._previewEditorObs, r, reader);\n\n\t\tconst state = this._state.read(reader);\n\t\tif (!state || !diff[0].innerChanges) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst firstCharacterChange = state.mode === 'modified' ? diff[0].innerChanges[0].modifiedRange : diff[0].innerChanges[0].originalRange;\n\n\n\t\t// find the horizontal range we want to show.\n\t\t// use 5 characters before the first change, at most 1 indentation\n\t\tconst left = this._previewEditorObs.getLeftOfPosition(firstCharacterChange.getStartPosition(), reader);\n\t\tconst right = this._previewEditorObs.getLeftOfPosition(firstCharacterChange.getEndPosition(), reader);\n\n\t\tconst indentCol = editor.getModel()!.getLineFirstNonWhitespaceColumn(firstCharacterChange.startLineNumber);\n\t\tconst indentationEnd = this._previewEditorObs.getLeftOfPosition(new Position(firstCharacterChange.startLineNumber, indentCol), reader);\n\n\t\tconst preferredRangeToReveal = new OffsetRange(left, right);\n\n\t\treturn {\n\t\t\tindentationEnd,\n\t\t\tpreferredRangeToReveal,\n\t\t\tmaxEditorWidth: trueContentWidth + l.contentLeft,\n\t\t\tcontentWidth: trueContentWidth,\n\t\t\tnonContentWidth: l.contentLeft, // Width of area that is not content\n\t\t};\n\t}\n\n\tpublic layout(dimension: IDimension, desiredPreviewEditorScrollLeft: number): void {\n\t\tthis.previewEditor.layout(dimension);\n\t\tthis._previewEditorObs.editor.setScrollLeft(desiredPreviewEditorScrollLeft);\n\t}\n\n\tprivate readonly _editorDecorations = derived(this, reader => {\n\t\tconst diff2 = this._state.read(reader);\n\t\tif (!diff2) { return undefined; }\n\n\t\tconst diff = {\n\t\t\tmode: 'insertionInline' as const,\n\t\t\tdiff: diff2.diff,\n\t\t};\n\t\tconst originalDecorations: IModelDeltaDecoration[] = [];\n\t\tconst modifiedDecorations: IModelDeltaDecoration[] = [];\n\n\t\tconst diffWholeLineDeleteDecoration = ModelDecorationOptions.register({\n\t\t\tclassName: 'inlineCompletions-char-delete',\n\t\t\tdescription: 'char-delete',\n\t\t\tisWholeLine: false,\n\t\t\tzIndex: 1, // be on top of diff background decoration\n\t\t});\n\n\t\tconst diffWholeLineAddDecoration = ModelDecorationOptions.register({\n\t\t\tclassName: 'inlineCompletions-char-insert',\n\t\t\tdescription: 'char-insert',\n\t\t\tisWholeLine: true,\n\t\t});\n\n\t\tconst diffAddDecoration = ModelDecorationOptions.register({\n\t\t\tclassName: 'inlineCompletions-char-insert',\n\t\t\tdescription: 'char-insert',\n\t\t\tshouldFillLineOnLineBreak: true,\n\t\t});\n\n\t\tconst hideEmptyInnerDecorations = true; // diff.mode === 'lineReplacement';\n\t\tfor (const m of diff.diff) {\n\t\t\tif (m.modified.isEmpty || m.original.isEmpty) {\n\t\t\t\tif (!m.original.isEmpty) {\n\t\t\t\t\toriginalDecorations.push({ range: m.original.toInclusiveRange()!, options: diffWholeLineDeleteDecoration });\n\t\t\t\t}\n\t\t\t\tif (!m.modified.isEmpty) {\n\t\t\t\t\tmodifiedDecorations.push({ range: m.modified.toInclusiveRange()!, options: diffWholeLineAddDecoration });\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor (const i of m.innerChanges || []) {\n\t\t\t\t\t// Don't show empty markers outside the line range\n\t\t\t\t\tif (m.original.contains(i.originalRange.startLineNumber) && !(hideEmptyInnerDecorations && i.originalRange.isEmpty())) {\n\t\t\t\t\t\toriginalDecorations.push({\n\t\t\t\t\t\t\trange: i.originalRange,\n\t\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\t\tdescription: 'char-delete',\n\t\t\t\t\t\t\t\tshouldFillLineOnLineBreak: false,\n\t\t\t\t\t\t\t\tclassName: classNames(\n\t\t\t\t\t\t\t\t\t'inlineCompletions-char-delete',\n\t\t\t\t\t\t\t\t\t// i.originalRange.isSingleLine() && diff.mode === 'insertionInline' && 'single-line-inline',\n\t\t\t\t\t\t\t\t\ti.originalRange.isEmpty() && 'empty',\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tzIndex: 1\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tif (m.modified.contains(i.modifiedRange.startLineNumber)) {\n\t\t\t\t\t\tmodifiedDecorations.push({\n\t\t\t\t\t\t\trange: i.modifiedRange,\n\t\t\t\t\t\t\toptions: diffAddDecoration\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn { originalDecorations, modifiedDecorations };\n\t});\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { n } from '../../../../../../../../base/browser/dom.js';\nimport { Disposable } from '../../../../../../../../base/common/lifecycle.js';\nimport { IObservable, derived, constObservable, IReader, autorun, observableValue } from '../../../../../../../../base/common/observable.js';\nimport { IInstantiationService } from '../../../../../../../../platform/instantiation/common/instantiation.js';\nimport { ICodeEditor } from '../../../../../../../browser/editorBrowser.js';\nimport { ObservableCodeEditor, observableCodeEditor } from '../../../../../../../browser/observableCodeEditor.js';\nimport { EmbeddedCodeEditorWidget } from '../../../../../../../browser/widget/codeEditor/embeddedCodeEditorWidget.js';\nimport { IDimension } from '../../../../../../../common/core/2d/dimension.js';\nimport { Position } from '../../../../../../../common/core/position.js';\nimport { Range } from '../../../../../../../common/core/range.js';\nimport { LineRange } from '../../../../../../../common/core/ranges/lineRange.js';\nimport { OffsetRange } from '../../../../../../../common/core/ranges/offsetRange.js';\nimport { DetailedLineRangeMapping } from '../../../../../../../common/diff/rangeMapping.js';\nimport { IModelDeltaDecoration, ITextModel } from '../../../../../../../common/model.js';\nimport { ModelDecorationOptions } from '../../../../../../../common/model/textModel.js';\nimport { InlineCompletionContextKeys } from '../../../../controller/inlineCompletionContextKeys.js';\nimport { InlineEditsGutterIndicator, InlineEditsGutterIndicatorData, InlineSuggestionGutterMenuData, SimpleInlineSuggestModel } from '../../components/gutterIndicatorView.js';\nimport { InlineEditTabAction } from '../../inlineEditsViewInterface.js';\nimport { classNames, maxContentWidthInRange } from '../../utils/utils.js';\n\nexport interface ILongDistancePreviewProps {\n\tdiff: DetailedLineRangeMapping[];\n\tmodel: SimpleInlineSuggestModel;\n\tsuggestInfo: InlineSuggestionGutterMenuData;\n}\n\nexport class LongDistancePreviewEditor extends Disposable {\n\tpublic readonly previewEditor;\n\tprivate readonly _previewEditorObs;\n\n\tprivate readonly _previewRef = n.ref<HTMLDivElement>();\n\tpublic readonly element = n.div({ class: 'preview', style: { /*pointerEvents: 'none'*/ }, ref: this._previewRef });\n\n\tprivate _parentEditorObs: ObservableCodeEditor;\n\n\tconstructor(\n\t\tprivate readonly _previewTextModel: ITextModel,\n\t\tprivate readonly _properties: IObservable<ILongDistancePreviewProps | undefined>,\n\t\tprivate readonly _parentEditor: ICodeEditor,\n\t\tprivate readonly _tabAction: IObservable<InlineEditTabAction>,\n\t\t@IInstantiationService private readonly _instantiationService: IInstantiationService,\n\t) {\n\t\tsuper();\n\n\t\tthis.previewEditor = this._register(this._createPreviewEditor());\n\t\tthis._parentEditorObs = observableCodeEditor(this._parentEditor);\n\n\t\tthis._register(autorun(reader => {\n\t\t\tthis.previewEditor.setModel(this._state.read(reader)?.textModel || null);\n\t\t}));\n\n\t\tthis._previewEditorObs = observableCodeEditor(this.previewEditor);\n\t\tthis._register(this._previewEditorObs.setDecorations(derived(reader => {\n\t\t\tconst state = this._state.read(reader);\n\t\t\tconst decorations = this._editorDecorations.read(reader);\n\t\t\treturn (state?.mode === 'original' ? decorations?.originalDecorations : decorations?.modifiedDecorations) ?? [];\n\t\t})));\n\n\t\tthis._register(autorun(reader => {\n\t\t\tconst state = this._properties.read(reader);\n\t\t\tif (!state) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Ensure there is enough space to the left of the line number for the gutter indicator to fits.\n\t\t\tconst lineNumberDigets = state.diff[0].modified.startLineNumber.toString().length;\n\t\t\tthis.previewEditor.updateOptions({ lineNumbersMinChars: lineNumberDigets + 1 });\n\t\t}));\n\n\t\tthis._register(this._instantiationService.createInstance(\n\t\t\tInlineEditsGutterIndicator,\n\t\t\tthis._previewEditorObs,\n\t\t\tderived(reader => {\n\t\t\t\tconst state = this._properties.read(reader);\n\t\t\t\tif (!state) { return undefined; }\n\t\t\t\treturn new InlineEditsGutterIndicatorData(\n\t\t\t\t\tstate.suggestInfo,\n\t\t\t\t\tLineRange.ofLength(state.diff[0].original.startLineNumber, 1),\n\t\t\t\t\tstate.model,\n\t\t\t\t);\n\t\t\t}),\n\t\t\tthis._tabAction,\n\t\t\tconstObservable(0),\n\t\t\tconstObservable(false),\n\t\t\tobservableValue(this, false),\n\t\t));\n\n\t\tthis.updatePreviewEditorEffect.recomputeInitiallyAndOnChange(this._store);\n\t}\n\n\tprivate readonly _state = derived(this, reader => {\n\t\tconst props = this._properties.read(reader);\n\t\tif (!props) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif (props.diff[0].innerChanges?.every(c => c.modifiedRange.isEmpty())) {\n\t\t\treturn {\n\t\t\t\tdiff: props.diff,\n\t\t\t\tvisibleLineRange: LineRange.ofLength(props.diff[0].original.startLineNumber, 1),\n\t\t\t\ttextModel: this._parentEditorObs.model.read(reader),\n\t\t\t\tmode: 'original' as const,\n\t\t\t};\n\t\t} else {\n\t\t\treturn {\n\t\t\t\tdiff: props.diff,\n\t\t\t\tvisibleLineRange: LineRange.ofLength(props.diff[0].modified.startLineNumber, 1),\n\t\t\t\ttextModel: this._previewTextModel,\n\t\t\t\tmode: 'modified' as const,\n\t\t\t};\n\t\t}\n\t});\n\n\tprivate _createPreviewEditor() {\n\t\treturn this._instantiationService.createInstance(\n\t\t\tEmbeddedCodeEditorWidget,\n\t\t\tthis._previewRef.element,\n\t\t\t{\n\t\t\t\tglyphMargin: false,\n\t\t\t\tlineNumbers: 'on',\n\t\t\t\tminimap: { enabled: false },\n\t\t\t\tguides: {\n\t\t\t\t\tindentation: false,\n\t\t\t\t\tbracketPairs: false,\n\t\t\t\t\tbracketPairsHorizontal: false,\n\t\t\t\t\thighlightActiveIndentation: false,\n\t\t\t\t},\n\n\t\t\t\trulers: [],\n\t\t\t\tpadding: { top: 0, bottom: 0 },\n\t\t\t\t//folding: false,\n\t\t\t\tselectOnLineNumbers: false,\n\t\t\t\tselectionHighlight: false,\n\t\t\t\tcolumnSelection: false,\n\t\t\t\toverviewRulerBorder: false,\n\t\t\t\toverviewRulerLanes: 0,\n\t\t\t\t//lineDecorationsWidth: 0,\n\t\t\t\t//lineNumbersMinChars: 0,\n\t\t\t\trevealHorizontalRightPadding: 0,\n\t\t\t\tbracketPairColorization: { enabled: true, independentColorPoolPerBracketType: false },\n\t\t\t\tscrollBeyondLastLine: false,\n\t\t\t\tscrollbar: {\n\t\t\t\t\tvertical: 'hidden',\n\t\t\t\t\thorizontal: 'hidden',\n\t\t\t\t\thandleMouseWheel: false,\n\t\t\t\t},\n\t\t\t\treadOnly: true,\n\t\t\t\twordWrap: 'off',\n\t\t\t\twordWrapOverride1: 'off',\n\t\t\t\twordWrapOverride2: 'off',\n\t\t\t},\n\t\t\t{\n\t\t\t\tcontextKeyValues: {\n\t\t\t\t\t[InlineCompletionContextKeys.inInlineEditsPreviewEditor.key]: true,\n\t\t\t\t},\n\t\t\t\tcontributions: [],\n\t\t\t},\n\t\t\tthis._parentEditor\n\t\t);\n\t}\n\n\tpublic readonly updatePreviewEditorEffect = derived(this, reader => {\n\t\t// this._widgetContent.readEffect(reader);\n\t\tthis._previewEditorObs.model.read(reader); // update when the model is set\n\n\t\tconst range = this._state.read(reader)?.visibleLineRange;\n\t\tif (!range) {\n\t\t\treturn;\n\t\t}\n\t\tconst hiddenAreas: Range[] = [];\n\t\tif (range.startLineNumber > 1) {\n\t\t\thiddenAreas.push(new Range(1, 1, range.startLineNumber - 1, 1));\n\t\t}\n\t\tif (range.endLineNumberExclusive < this._previewTextModel.getLineCount() + 1) {\n\t\t\thiddenAreas.push(new Range(range.endLineNumberExclusive, 1, this._previewTextModel.getLineCount() + 1, 1));\n\t\t}\n\t\tthis.previewEditor.setHiddenAreas(hiddenAreas, undefined, true);\n\t});\n\n\tpublic readonly horizontalContentRangeInPreviewEditorToShow = derived(this, reader => {\n\t\treturn this._getHorizontalContentRangeInPreviewEditorToShow(this.previewEditor, this._properties.read(reader)?.diff ?? [], reader);\n\t});\n\n\tpublic readonly contentHeight = derived(this, (reader) => {\n\t\tconst viewState = this._properties.read(reader);\n\t\tif (!viewState) {\n\t\t\treturn constObservable(null);\n\t\t}\n\n\t\tconst previewEditorHeight = this._previewEditorObs.observeLineHeightForLine(viewState.diff[0].modified.startLineNumber);\n\t\treturn previewEditorHeight;\n\t}).flatten();\n\n\tprivate _getHorizontalContentRangeInPreviewEditorToShow(editor: ICodeEditor, diff: DetailedLineRangeMapping[], reader: IReader) {\n\n\t\tconst r = LineRange.ofLength(diff[0].modified.startLineNumber, 1);\n\t\tconst l = this._previewEditorObs.layoutInfo.read(reader);\n\t\tconst trueContentWidth = maxContentWidthInRange(this._previewEditorObs, r, reader);\n\n\t\tconst state = this._state.read(reader);\n\t\tif (!state || !diff[0].innerChanges) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst firstCharacterChange = state.mode === 'modified' ? diff[0].innerChanges[0].modifiedRange : diff[0].innerChanges[0].originalRange;\n\n\n\t\t// find the horizontal range we want to show.\n\t\t// use 5 characters before the first change, at most 1 indentation\n\t\tconst left = this._previewEditorObs.getLeftOfPosition(firstCharacterChange.getStartPosition(), reader);\n\t\tconst right = this._previewEditorObs.getLeftOfPosition(firstCharacterChange.getEndPosition(), reader);\n\n\t\tconst indentCol = editor.getModel()!.getLineFirstNonWhitespaceColumn(firstCharacterChange.startLineNumber);\n\t\tconst indentationEnd = this._previewEditorObs.getLeftOfPosition(new Position(firstCharacterChange.startLineNumber, indentCol), reader);\n\n\t\tconst preferredRangeToReveal = new OffsetRange(left, right);\n\n\t\treturn {\n\t\t\tindentationEnd,\n\t\t\tpreferredRangeToReveal,\n\t\t\tmaxEditorWidth: trueContentWidth + l.contentLeft,\n\t\t\tcontentWidth: trueContentWidth,\n\t\t\tnonContentWidth: l.contentLeft, // Width of area that is not content\n\t\t};\n\t}\n\n\tpublic layout(dimension: IDimension, desiredPreviewEditorScrollLeft: number): void {\n\t\tthis.previewEditor.layout(dimension);\n\t\tthis._previewEditorObs.editor.setScrollLeft(desiredPreviewEditorScrollLeft);\n\t}\n\n\tprivate readonly _editorDecorations = derived(this, reader => {\n\t\tconst diff2 = this._state.read(reader);\n\t\tif (!diff2) { return undefined; }\n\n\t\tconst diff = {\n\t\t\tmode: 'insertionInline' as const,\n\t\t\tdiff: diff2.diff,\n\t\t};\n\t\tconst originalDecorations: IModelDeltaDecoration[] = [];\n\t\tconst modifiedDecorations: IModelDeltaDecoration[] = [];\n\n\t\tconst diffWholeLineDeleteDecoration = ModelDecorationOptions.register({\n\t\t\tclassName: 'inlineCompletions-char-delete',\n\t\t\tdescription: 'char-delete',\n\t\t\tisWholeLine: false,\n\t\t\tzIndex: 1, // be on top of diff background decoration\n\t\t});\n\n\t\tconst diffWholeLineAddDecoration = ModelDecorationOptions.register({\n\t\t\tclassName: 'inlineCompletions-char-insert',\n\t\t\tdescription: 'char-insert',\n\t\t\tisWholeLine: true,\n\t\t});\n\n\t\tconst diffAddDecoration = ModelDecorationOptions.register({\n\t\t\tclassName: 'inlineCompletions-char-insert',\n\t\t\tdescription: 'char-insert',\n\t\t\tshouldFillLineOnLineBreak: true,\n\t\t});\n\n\t\tconst hideEmptyInnerDecorations = true; // diff.mode === 'lineReplacement';\n\t\tfor (const m of diff.diff) {\n\t\t\tif (m.modified.isEmpty || m.original.isEmpty) {\n\t\t\t\tif (!m.original.isEmpty) {\n\t\t\t\t\toriginalDecorations.push({ range: m.original.toInclusiveRange()!, options: diffWholeLineDeleteDecoration });\n\t\t\t\t}\n\t\t\t\tif (!m.modified.isEmpty) {\n\t\t\t\t\tmodifiedDecorations.push({ range: m.modified.toInclusiveRange()!, options: diffWholeLineAddDecoration });\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor (const i of m.innerChanges || []) {\n\t\t\t\t\t// Don't show empty markers outside the line range\n\t\t\t\t\tif (m.original.contains(i.originalRange.startLineNumber) && !(hideEmptyInnerDecorations && i.originalRange.isEmpty())) {\n\t\t\t\t\t\toriginalDecorations.push({\n\t\t\t\t\t\t\trange: i.originalRange,\n\t\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\t\tdescription: 'char-delete',\n\t\t\t\t\t\t\t\tshouldFillLineOnLineBreak: false,\n\t\t\t\t\t\t\t\tclassName: classNames(\n\t\t\t\t\t\t\t\t\t'inlineCompletions-char-delete',\n\t\t\t\t\t\t\t\t\t// i.originalRange.isSingleLine() && diff.mode === 'insertionInline' && 'single-line-inline',\n\t\t\t\t\t\t\t\t\ti.originalRange.isEmpty() && 'empty',\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tzIndex: 1\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tif (m.modified.contains(i.modifiedRange.startLineNumber)) {\n\t\t\t\t\t\tmodifiedDecorations.push({\n\t\t\t\t\t\t\trange: i.modifiedRange,\n\t\t\t\t\t\t\toptions: diffAddDecoration\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn { originalDecorations, modifiedDecorations };\n\t});\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/longDistancePreviewEditor.ts","vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/longDistancePreviewEditor.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;AAEhG,OAAO,EAAE,CAAC,EAAE,MAAM,6CAA6C,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,kDAAkD,CAAC;AAC9E,OAAO,EAAe,OAAO,EAAE,eAAe,EAAW,OAAO,EAAE,eAAe,EAAE,MAAM,mDAAmD,CAAC;AAC7I,OAAO,EAAE,qBAAqB,EAAE,MAAM,wEAAwE,CAAC;AAE/G,OAAO,EAAwB,oBAAoB,EAAE,MAAM,sDAAsD,CAA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C,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;QAClC,OAAO,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,IAAI,CAAC;IACtC,CAAC;IAED,IAAI,WAAW,GAAG,aAAa,CAAC,MAAM,CAAC;IACvC,OAAO,WAAW,GAAG,CAAC,IAAI,uBAAuB,CAAC,WAAW,CAAC,IAAI,CAAC,YAAY,CAAC,WAAW,GAAG,CAAC,CAAC,IAAI,aAAa,CAAC,MAAM,GAAG,WAAW,GAAG,OAAO,EAAE,CAAC;QAClJ,WAAW,EAAE,CAAC;IACf,CAAC;IAED,IAAI,SAAS,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC;IACvC,OAAO,SAAS,IAAI,IAAI,CAAC,MAAM,IAAI,uBAAuB,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,SAAS,GAAG,CAAC,CAAC,IAAI,SAAS,GAAG,WAAW,CAAC,MAAM,GAAG,OAAO,EAAE,CAAC;QACnJ,SAAS,EAAE,CAAC;IACb,CAAC;IAED,OAAO,IAAI,KAAK,CAAC,aAAa,CAAC,UAAU,EAAE,aAAa,CAAC,MAAM,EAAE,WAAW,CAAC,UAAU,EAAE,SAAS,GAAG,CAAC,CAAC,CAAC;AACzG,CAAC","file":"longDistancePreviewEditor.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { n } from '../../../../../../../../base/browser/dom.js';\nimport { Disposable } from '../../../../../../../../base/common/lifecycle.js';\nimport { IObservable, derived, constObservable, IReader, autorun, observableValue } from '../../../../../../../../base/common/observable.js';\nimport { IInstantiationService } from '../../../../../../../../platform/instantiation/common/instantiation.js';\nimport { ICodeEditor } from '../../../../../../../browser/editorBrowser.js';\nimport { ObservableCodeEditor, observableCodeEditor } from '../../../../../../../browser/observableCodeEditor.js';\nimport { EmbeddedCodeEditorWidget } from '../../../../../../../browser/widget/codeEditor/embeddedCodeEditorWidget.js';\nimport { IDimension } from '../../../../../../../common/core/2d/dimension.js';\nimport { Position } from '../../../../../../../common/core/position.js';\nimport { Range } from '../../../../../../../common/core/range.js';\nimport { LineRange } from '../../../../../../../common/core/ranges/lineRange.js';\nimport { OffsetRange } from '../../../../../../../common/core/ranges/offsetRange.js';\nimport { DetailedLineRangeMapping } from '../../../../../../../common/diff/rangeMapping.js';\nimport { IModelDeltaDecoration, ITextModel } from '../../../../../../../common/model.js';\nimport { ModelDecorationOptions } from '../../../../../../../common/model/textModel.js';\nimport { InlineCompletionContextKeys } from '../../../../controller/inlineCompletionContextKeys.js';\nimport { InlineEditsGutterIndicator, InlineEditsGutterIndicatorData, InlineSuggestionGutterMenuData, SimpleInlineSuggestModel } from '../../components/gutterIndicatorView.js';\nimport { InlineEditTabAction } from '../../inlineEditsViewInterface.js';\nimport { classNames, maxContentWidthInRange } from '../../utils/utils.js';\n\nexport interface ILongDistancePreviewProps {\n\tdiff: DetailedLineRangeMapping[];\n\tmodel: SimpleInlineSuggestModel;\n\tsuggestInfo: InlineSuggestionGutterMenuData;\n}\n\nexport class LongDistancePreviewEditor extends Disposable {\n\tpublic readonly previewEditor;\n\tprivate readonly _previewEditorObs;\n\n\tprivate readonly _previewRef = n.ref<HTMLDivElement>();\n\tpublic readonly element = n.div({ class: 'preview', style: { /*pointerEvents: 'none'*/ }, ref: this._previewRef });\n\n\tprivate _parentEditorObs: ObservableCodeEditor;\n\n\tconstructor(\n\t\tprivate readonly _previewTextModel: ITextModel,\n\t\tprivate readonly _properties: IObservable<ILongDistancePreviewProps | undefined>,\n\t\tprivate readonly _parentEditor: ICodeEditor,\n\t\tprivate readonly _tabAction: IObservable<InlineEditTabAction>,\n\t\t@IInstantiationService private readonly _instantiationService: IInstantiationService,\n\t) {\n\t\tsuper();\n\n\t\tthis.previewEditor = this._register(this._createPreviewEditor());\n\t\tthis._parentEditorObs = observableCodeEditor(this._parentEditor);\n\n\t\tthis._register(autorun(reader => {\n\t\t\tthis.previewEditor.setModel(this._state.read(reader)?.textModel || null);\n\t\t}));\n\n\t\tthis._previewEditorObs = observableCodeEditor(this.previewEditor);\n\t\tthis._register(this._previewEditorObs.setDecorations(derived(reader => {\n\t\t\tconst state = this._state.read(reader);\n\t\t\tconst decorations = this._editorDecorations.read(reader);\n\t\t\treturn (state?.mode === 'original' ? decorations?.originalDecorations : decorations?.modifiedDecorations) ?? [];\n\t\t})));\n\n\t\t// Mirror the cursor position. Allows the gutter arrow to point in the correct direction.\n\t\tthis._register(autorun((reader) => {\n\t\t\tif (!this._properties.read(reader)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst cursorPosition = this._parentEditorObs.cursorPosition.read(reader);\n\t\t\tif (cursorPosition) {\n\t\t\t\tthis.previewEditor.setPosition(this._previewTextModel.validatePosition(cursorPosition), 'longDistanceHintPreview');\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(autorun(reader => {\n\t\t\tconst state = this._properties.read(reader);\n\t\t\tif (!state) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Ensure there is enough space to the left of the line number for the gutter indicator to fits.\n\t\t\tconst lineNumberDigets = state.diff[0].modified.startLineNumber.toString().length;\n\t\t\tthis.previewEditor.updateOptions({ lineNumbersMinChars: lineNumberDigets + 1 });\n\t\t}));\n\n\t\tthis._register(this._instantiationService.createInstance(\n\t\t\tInlineEditsGutterIndicator,\n\t\t\tthis._previewEditorObs,\n\t\t\tderived(reader => {\n\t\t\t\tconst state = this._properties.read(reader);\n\t\t\t\tif (!state) { return undefined; }\n\t\t\t\treturn new InlineEditsGutterIndicatorData(\n\t\t\t\t\tstate.suggestInfo,\n\t\t\t\t\tLineRange.ofLength(state.diff[0].original.startLineNumber, 1),\n\t\t\t\t\tstate.model,\n\t\t\t\t);\n\t\t\t}),\n\t\t\tthis._tabAction,\n\t\t\tconstObservable(0),\n\t\t\tconstObservable(false),\n\t\t\tobservableValue(this, false),\n\t\t));\n\n\t\tthis.updatePreviewEditorEffect.recomputeInitiallyAndOnChange(this._store);\n\t}\n\n\tprivate readonly _state = derived(this, reader => {\n\t\tconst props = this._properties.read(reader);\n\t\tif (!props) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif (props.diff[0].innerChanges?.every(c => c.modifiedRange.isEmpty())) {\n\t\t\treturn {\n\t\t\t\tdiff: props.diff,\n\t\t\t\tvisibleLineRange: LineRange.ofLength(props.diff[0].original.startLineNumber, 1),\n\t\t\t\ttextModel: this._parentEditorObs.model.read(reader),\n\t\t\t\tmode: 'original' as const,\n\t\t\t};\n\t\t} else {\n\t\t\treturn {\n\t\t\t\tdiff: props.diff,\n\t\t\t\tvisibleLineRange: LineRange.ofLength(props.diff[0].modified.startLineNumber, 1),\n\t\t\t\ttextModel: this._previewTextModel,\n\t\t\t\tmode: 'modified' as const,\n\t\t\t};\n\t\t}\n\t});\n\n\tprivate _createPreviewEditor() {\n\t\treturn this._instantiationService.createInstance(\n\t\t\tEmbeddedCodeEditorWidget,\n\t\t\tthis._previewRef.element,\n\t\t\t{\n\t\t\t\tglyphMargin: false,\n\t\t\t\tlineNumbers: 'on',\n\t\t\t\tminimap: { enabled: false },\n\t\t\t\tguides: {\n\t\t\t\t\tindentation: false,\n\t\t\t\t\tbracketPairs: false,\n\t\t\t\t\tbracketPairsHorizontal: false,\n\t\t\t\t\thighlightActiveIndentation: false,\n\t\t\t\t},\n\n\t\t\t\trulers: [],\n\t\t\t\tpadding: { top: 0, bottom: 0 },\n\t\t\t\t//folding: false,\n\t\t\t\tselectOnLineNumbers: false,\n\t\t\t\tselectionHighlight: false,\n\t\t\t\tcolumnSelection: false,\n\t\t\t\toverviewRulerBorder: false,\n\t\t\t\toverviewRulerLanes: 0,\n\t\t\t\t//lineDecorationsWidth: 0,\n\t\t\t\t//lineNumbersMinChars: 0,\n\t\t\t\trevealHorizontalRightPadding: 0,\n\t\t\t\tbracketPairColorization: { enabled: true, independentColorPoolPerBracketType: false },\n\t\t\t\tscrollBeyondLastLine: false,\n\t\t\t\tscrollbar: {\n\t\t\t\t\tvertical: 'hidden',\n\t\t\t\t\thorizontal: 'hidden',\n\t\t\t\t\thandleMouseWheel: false,\n\t\t\t\t},\n\t\t\t\treadOnly: true,\n\t\t\t\twordWrap: 'off',\n\t\t\t\twordWrapOverride1: 'off',\n\t\t\t\twordWrapOverride2: 'off',\n\t\t\t},\n\t\t\t{\n\t\t\t\tcontextKeyValues: {\n\t\t\t\t\t[InlineCompletionContextKeys.inInlineEditsPreviewEditor.key]: true,\n\t\t\t\t},\n\t\t\t\tcontributions: [],\n\t\t\t},\n\t\t\tthis._parentEditor\n\t\t);\n\t}\n\n\tpublic readonly updatePreviewEditorEffect = derived(this, reader => {\n\t\t// this._widgetContent.readEffect(reader);\n\t\tthis._previewEditorObs.model.read(reader); // update when the model is set\n\n\t\tconst range = this._state.read(reader)?.visibleLineRange;\n\t\tif (!range) {\n\t\t\treturn;\n\t\t}\n\t\tconst hiddenAreas: Range[] = [];\n\t\tif (range.startLineNumber > 1) {\n\t\t\thiddenAreas.push(new Range(1, 1, range.startLineNumber - 1, 1));\n\t\t}\n\t\tif (range.endLineNumberExclusive < this._previewTextModel.getLineCount() + 1) {\n\t\t\thiddenAreas.push(new Range(range.endLineNumberExclusive, 1, this._previewTextModel.getLineCount() + 1, 1));\n\t\t}\n\t\tthis.previewEditor.setHiddenAreas(hiddenAreas, undefined, true);\n\t});\n\n\tpublic readonly horizontalContentRangeInPreviewEditorToShow = derived(this, reader => {\n\t\treturn this._getHorizontalContentRangeInPreviewEditorToShow(this.previewEditor, this._properties.read(reader)?.diff ?? [], reader);\n\t});\n\n\tpublic readonly contentHeight = derived(this, (reader) => {\n\t\tconst viewState = this._properties.read(reader);\n\t\tif (!viewState) {\n\t\t\treturn constObservable(null);\n\t\t}\n\n\t\tconst previewEditorHeight = this._previewEditorObs.observeLineHeightForLine(viewState.diff[0].modified.startLineNumber);\n\t\treturn previewEditorHeight;\n\t}).flatten();\n\n\tprivate _getHorizontalContentRangeInPreviewEditorToShow(editor: ICodeEditor, diff: DetailedLineRangeMapping[], reader: IReader) {\n\n\t\tconst r = LineRange.ofLength(diff[0].modified.startLineNumber, 1);\n\t\tconst l = this._previewEditorObs.layoutInfo.read(reader);\n\t\tconst trueContentWidth = maxContentWidthInRange(this._previewEditorObs, r, reader);\n\n\t\tconst state = this._state.read(reader);\n\t\tif (!state || !diff[0].innerChanges) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst firstCharacterChange = state.mode === 'modified' ? diff[0].innerChanges[0].modifiedRange : diff[0].innerChanges[0].originalRange;\n\n\t\t// find the horizontal range we want to show.\n\t\tconst preferredRange = growUntilVariableBoundaries(editor.getModel()!, firstCharacterChange, 5);\n\t\tconst left = this._previewEditorObs.getLeftOfPosition(preferredRange.getStartPosition(), reader);\n\t\tconst right = this._previewEditorObs.getLeftOfPosition(preferredRange.getEndPosition(), reader);\n\n\t\tconst indentCol = editor.getModel()!.getLineFirstNonWhitespaceColumn(preferredRange.startLineNumber);\n\t\tconst indentationEnd = this._previewEditorObs.getLeftOfPosition(new Position(preferredRange.startLineNumber, indentCol), reader);\n\n\t\tconst preferredRangeToReveal = new OffsetRange(left, right);\n\n\t\treturn {\n\t\t\tindentationEnd,\n\t\t\tpreferredRangeToReveal,\n\t\t\tmaxEditorWidth: trueContentWidth + l.contentLeft,\n\t\t\tcontentWidth: trueContentWidth,\n\t\t\tnonContentWidth: l.contentLeft, // Width of area that is not content\n\t\t};\n\t}\n\n\tpublic layout(dimension: IDimension, desiredPreviewEditorScrollLeft: number): void {\n\t\tthis.previewEditor.layout(dimension);\n\t\tthis._previewEditorObs.editor.setScrollLeft(desiredPreviewEditorScrollLeft);\n\t}\n\n\tprivate readonly _editorDecorations = derived(this, reader => {\n\t\tconst diff2 = this._state.read(reader);\n\t\tif (!diff2) { return undefined; }\n\n\t\tconst diff = {\n\t\t\tmode: 'insertionInline' as const,\n\t\t\tdiff: diff2.diff,\n\t\t};\n\t\tconst originalDecorations: IModelDeltaDecoration[] = [];\n\t\tconst modifiedDecorations: IModelDeltaDecoration[] = [];\n\n\t\tconst diffWholeLineDeleteDecoration = ModelDecorationOptions.register({\n\t\t\tclassName: 'inlineCompletions-char-delete',\n\t\t\tdescription: 'char-delete',\n\t\t\tisWholeLine: false,\n\t\t\tzIndex: 1, // be on top of diff background decoration\n\t\t});\n\n\t\tconst diffWholeLineAddDecoration = ModelDecorationOptions.register({\n\t\t\tclassName: 'inlineCompletions-char-insert',\n\t\t\tdescription: 'char-insert',\n\t\t\tisWholeLine: true,\n\t\t});\n\n\t\tconst diffAddDecoration = ModelDecorationOptions.register({\n\t\t\tclassName: 'inlineCompletions-char-insert',\n\t\t\tdescription: 'char-insert',\n\t\t\tshouldFillLineOnLineBreak: true,\n\t\t});\n\n\t\tconst hideEmptyInnerDecorations = true; // diff.mode === 'lineReplacement';\n\t\tfor (const m of diff.diff) {\n\t\t\tif (m.modified.isEmpty || m.original.isEmpty) {\n\t\t\t\tif (!m.original.isEmpty) {\n\t\t\t\t\toriginalDecorations.push({ range: m.original.toInclusiveRange()!, options: diffWholeLineDeleteDecoration });\n\t\t\t\t}\n\t\t\t\tif (!m.modified.isEmpty) {\n\t\t\t\t\tmodifiedDecorations.push({ range: m.modified.toInclusiveRange()!, options: diffWholeLineAddDecoration });\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor (const i of m.innerChanges || []) {\n\t\t\t\t\t// Don't show empty markers outside the line range\n\t\t\t\t\tif (m.original.contains(i.originalRange.startLineNumber) && !(hideEmptyInnerDecorations && i.originalRange.isEmpty())) {\n\t\t\t\t\t\toriginalDecorations.push({\n\t\t\t\t\t\t\trange: i.originalRange,\n\t\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\t\tdescription: 'char-delete',\n\t\t\t\t\t\t\t\tshouldFillLineOnLineBreak: false,\n\t\t\t\t\t\t\t\tclassName: classNames(\n\t\t\t\t\t\t\t\t\t'inlineCompletions-char-delete',\n\t\t\t\t\t\t\t\t\t// i.originalRange.isSingleLine() && diff.mode === 'insertionInline' && 'single-line-inline',\n\t\t\t\t\t\t\t\t\ti.originalRange.isEmpty() && 'empty',\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tzIndex: 1\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tif (m.modified.contains(i.modifiedRange.startLineNumber)) {\n\t\t\t\t\t\tmodifiedDecorations.push({\n\t\t\t\t\t\t\trange: i.modifiedRange,\n\t\t\t\t\t\t\toptions: diffAddDecoration\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn { originalDecorations, modifiedDecorations };\n\t});\n}\n\n/*\n * Grows the range on each ends until it includes a none-variable-name character\n * or the next character would be a whitespace character\n * or the maxGrow limit is reached\n */\nfunction growUntilVariableBoundaries(textModel: ITextModel, range: Range, maxGrow: number): Range {\n\tconst startPosition = range.getStartPosition();\n\tconst endPosition = range.getEndPosition();\n\tconst line = textModel.getLineContent(startPosition.lineNumber);\n\n\tfunction isVariableNameCharacter(col: number): boolean {\n\t\tconst char = line.charAt(col - 1);\n\t\treturn (/[a-zA-Z0-9_]/).test(char);\n\t}\n\n\tfunction isWhitespace(col: number): boolean {\n\t\tconst char = line.charAt(col - 1);\n\t\treturn char === ' ' || char === '\\t';\n\t}\n\n\tlet startColumn = startPosition.column;\n\twhile (startColumn > 1 && isVariableNameCharacter(startColumn) && !isWhitespace(startColumn - 1) && startPosition.column - startColumn < maxGrow) {\n\t\tstartColumn--;\n\t}\n\n\tlet endColumn = endPosition.column - 1;\n\twhile (endColumn <= line.length && isVariableNameCharacter(endColumn) && !isWhitespace(endColumn + 1) && endColumn - endPosition.column < maxGrow) {\n\t\tendColumn++;\n\t}\n\n\treturn new Range(startPosition.lineNumber, startPosition.column, endPosition.lineNumber, endColumn + 1);\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { n } from '../../../../../../../../base/browser/dom.js';\nimport { Disposable } from '../../../../../../../../base/common/lifecycle.js';\nimport { IObservable, derived, constObservable, IReader, autorun, observableValue } from '../../../../../../../../base/common/observable.js';\nimport { IInstantiationService } from '../../../../../../../../platform/instantiation/common/instantiation.js';\nimport { ICodeEditor } from '../../../../../../../browser/editorBrowser.js';\nimport { ObservableCodeEditor, observableCodeEditor } from '../../../../../../../browser/observableCodeEditor.js';\nimport { EmbeddedCodeEditorWidget } from '../../../../../../../browser/widget/codeEditor/embeddedCodeEditorWidget.js';\nimport { IDimension } from '../../../../../../../common/core/2d/dimension.js';\nimport { Position } from '../../../../../../../common/core/position.js';\nimport { Range } from '../../../../../../../common/core/range.js';\nimport { LineRange } from '../../../../../../../common/core/ranges/lineRange.js';\nimport { OffsetRange } from '../../../../../../../common/core/ranges/offsetRange.js';\nimport { DetailedLineRangeMapping } from '../../../../../../../common/diff/rangeMapping.js';\nimport { IModelDeltaDecoration, ITextModel } from '../../../../../../../common/model.js';\nimport { ModelDecorationOptions } from '../../../../../../../common/model/textModel.js';\nimport { InlineCompletionContextKeys } from '../../../../controller/inlineCompletionContextKeys.js';\nimport { InlineEditsGutterIndicator, InlineEditsGutterIndicatorData, InlineSuggestionGutterMenuData, SimpleInlineSuggestModel } from '../../components/gutterIndicatorView.js';\nimport { InlineEditTabAction } from '../../inlineEditsViewInterface.js';\nimport { classNames, maxContentWidthInRange } from '../../utils/utils.js';\n\nexport interface ILongDistancePreviewProps {\n\tdiff: DetailedLineRangeMapping[];\n\tmodel: SimpleInlineSuggestModel;\n\tsuggestInfo: InlineSuggestionGutterMenuData;\n}\n\nexport class LongDistancePreviewEditor extends Disposable {\n\tpublic readonly previewEditor;\n\tprivate readonly _previewEditorObs;\n\n\tprivate readonly _previewRef = n.ref<HTMLDivElement>();\n\tpublic readonly element = n.div({ class: 'preview', style: { /*pointerEvents: 'none'*/ }, ref: this._previewRef });\n\n\tprivate _parentEditorObs: ObservableCodeEditor;\n\n\tconstructor(\n\t\tprivate readonly _previewTextModel: ITextModel,\n\t\tprivate readonly _properties: IObservable<ILongDistancePreviewProps | undefined>,\n\t\tprivate readonly _parentEditor: ICodeEditor,\n\t\tprivate readonly _tabAction: IObservable<InlineEditTabAction>,\n\t\t@IInstantiationService private readonly _instantiationService: IInstantiationService,\n\t) {\n\t\tsuper();\n\n\t\tthis.previewEditor = this._register(this._createPreviewEditor());\n\t\tthis._parentEditorObs = observableCodeEditor(this._parentEditor);\n\n\t\tthis._register(autorun(reader => {\n\t\t\tthis.previewEditor.setModel(this._state.read(reader)?.textModel || null);\n\t\t}));\n\n\t\tthis._previewEditorObs = observableCodeEditor(this.previewEditor);\n\t\tthis._register(this._previewEditorObs.setDecorations(derived(reader => {\n\t\t\tconst state = this._state.read(reader);\n\t\t\tconst decorations = this._editorDecorations.read(reader);\n\t\t\treturn (state?.mode === 'original' ? decorations?.originalDecorations : decorations?.modifiedDecorations) ?? [];\n\t\t})));\n\n\t\t// Mirror the cursor position. Allows the gutter arrow to point in the correct direction.\n\t\tthis._register(autorun((reader) => {\n\t\t\tif (!this._properties.read(reader)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst cursorPosition = this._parentEditorObs.cursorPosition.read(reader);\n\t\t\tif (cursorPosition) {\n\t\t\t\tthis.previewEditor.setPosition(this._previewTextModel.validatePosition(cursorPosition), 'longDistanceHintPreview');\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(autorun(reader => {\n\t\t\tconst state = this._properties.read(reader);\n\t\t\tif (!state) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Ensure there is enough space to the left of the line number for the gutter indicator to fits.\n\t\t\tconst lineNumberDigets = state.diff[0].modified.startLineNumber.toString().length;\n\t\t\tthis.previewEditor.updateOptions({ lineNumbersMinChars: lineNumberDigets + 1 });\n\t\t}));\n\n\t\tthis._register(this._instantiationService.createInstance(\n\t\t\tInlineEditsGutterIndicator,\n\t\t\tthis._previewEditorObs,\n\t\t\tderived(reader => {\n\t\t\t\tconst state = this._properties.read(reader);\n\t\t\t\tif (!state) { return undefined; }\n\t\t\t\treturn new InlineEditsGutterIndicatorData(\n\t\t\t\t\tstate.suggestInfo,\n\t\t\t\t\tLineRange.ofLength(state.diff[0].original.startLineNumber, 1),\n\t\t\t\t\tstate.model,\n\t\t\t\t);\n\t\t\t}),\n\t\t\tthis._tabAction,\n\t\t\tconstObservable(0),\n\t\t\tconstObservable(false),\n\t\t\tobservableValue(this, false),\n\t\t));\n\n\t\tthis.updatePreviewEditorEffect.recomputeInitiallyAndOnChange(this._store);\n\t}\n\n\tprivate readonly _state = derived(this, reader => {\n\t\tconst props = this._properties.read(reader);\n\t\tif (!props) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif (props.diff[0].innerChanges?.every(c => c.modifiedRange.isEmpty())) {\n\t\t\treturn {\n\t\t\t\tdiff: props.diff,\n\t\t\t\tvisibleLineRange: LineRange.ofLength(props.diff[0].original.startLineNumber, 1),\n\t\t\t\ttextModel: this._parentEditorObs.model.read(reader),\n\t\t\t\tmode: 'original' as const,\n\t\t\t};\n\t\t} else {\n\t\t\treturn {\n\t\t\t\tdiff: props.diff,\n\t\t\t\tvisibleLineRange: LineRange.ofLength(props.diff[0].modified.startLineNumber, 1),\n\t\t\t\ttextModel: this._previewTextModel,\n\t\t\t\tmode: 'modified' as const,\n\t\t\t};\n\t\t}\n\t});\n\n\tprivate _createPreviewEditor() {\n\t\treturn this._instantiationService.createInstance(\n\t\t\tEmbeddedCodeEditorWidget,\n\t\t\tthis._previewRef.element,\n\t\t\t{\n\t\t\t\tglyphMargin: false,\n\t\t\t\tlineNumbers: 'on',\n\t\t\t\tminimap: { enabled: false },\n\t\t\t\tguides: {\n\t\t\t\t\tindentation: false,\n\t\t\t\t\tbracketPairs: false,\n\t\t\t\t\tbracketPairsHorizontal: false,\n\t\t\t\t\thighlightActiveIndentation: false,\n\t\t\t\t},\n\n\t\t\t\trulers: [],\n\t\t\t\tpadding: { top: 0, bottom: 0 },\n\t\t\t\t//folding: false,\n\t\t\t\tselectOnLineNumbers: false,\n\t\t\t\tselectionHighlight: false,\n\t\t\t\tcolumnSelection: false,\n\t\t\t\toverviewRulerBorder: false,\n\t\t\t\toverviewRulerLanes: 0,\n\t\t\t\t//lineDecorationsWidth: 0,\n\t\t\t\t//lineNumbersMinChars: 0,\n\t\t\t\trevealHorizontalRightPadding: 0,\n\t\t\t\tbracketPairColorization: { enabled: true, independentColorPoolPerBracketType: false },\n\t\t\t\tscrollBeyondLastLine: false,\n\t\t\t\tscrollbar: {\n\t\t\t\t\tvertical: 'hidden',\n\t\t\t\t\thorizontal: 'hidden',\n\t\t\t\t\thandleMouseWheel: false,\n\t\t\t\t},\n\t\t\t\treadOnly: true,\n\t\t\t\twordWrap: 'off',\n\t\t\t\twordWrapOverride1: 'off',\n\t\t\t\twordWrapOverride2: 'off',\n\t\t\t},\n\t\t\t{\n\t\t\t\tcontextKeyValues: {\n\t\t\t\t\t[InlineCompletionContextKeys.inInlineEditsPreviewEditor.key]: true,\n\t\t\t\t},\n\t\t\t\tcontributions: [],\n\t\t\t},\n\t\t\tthis._parentEditor\n\t\t);\n\t}\n\n\tpublic readonly updatePreviewEditorEffect = derived(this, reader => {\n\t\t// this._widgetContent.readEffect(reader);\n\t\tthis._previewEditorObs.model.read(reader); // update when the model is set\n\n\t\tconst range = this._state.read(reader)?.visibleLineRange;\n\t\tif (!range) {\n\t\t\treturn;\n\t\t}\n\t\tconst hiddenAreas: Range[] = [];\n\t\tif (range.startLineNumber > 1) {\n\t\t\thiddenAreas.push(new Range(1, 1, range.startLineNumber - 1, 1));\n\t\t}\n\t\tif (range.endLineNumberExclusive < this._previewTextModel.getLineCount() + 1) {\n\t\t\thiddenAreas.push(new Range(range.endLineNumberExclusive, 1, this._previewTextModel.getLineCount() + 1, 1));\n\t\t}\n\t\tthis.previewEditor.setHiddenAreas(hiddenAreas, undefined, true);\n\t});\n\n\tpublic readonly horizontalContentRangeInPreviewEditorToShow = derived(this, reader => {\n\t\treturn this._getHorizontalContentRangeInPreviewEditorToShow(this.previewEditor, this._properties.read(reader)?.diff ?? [], reader);\n\t});\n\n\tpublic readonly contentHeight = derived(this, (reader) => {\n\t\tconst viewState = this._properties.read(reader);\n\t\tif (!viewState) {\n\t\t\treturn constObservable(null);\n\t\t}\n\n\t\tconst previewEditorHeight = this._previewEditorObs.observeLineHeightForLine(viewState.diff[0].modified.startLineNumber);\n\t\treturn previewEditorHeight;\n\t}).flatten();\n\n\tprivate _getHorizontalContentRangeInPreviewEditorToShow(editor: ICodeEditor, diff: DetailedLineRangeMapping[], reader: IReader) {\n\n\t\tconst r = LineRange.ofLength(diff[0].modified.startLineNumber, 1);\n\t\tconst l = this._previewEditorObs.layoutInfo.read(reader);\n\t\tconst trueContentWidth = maxContentWidthInRange(this._previewEditorObs, r, reader);\n\n\t\tconst state = this._state.read(reader);\n\t\tif (!state || !diff[0].innerChanges) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst firstCharacterChange = state.mode === 'modified' ? diff[0].innerChanges[0].modifiedRange : diff[0].innerChanges[0].originalRange;\n\n\t\t// find the horizontal range we want to show.\n\t\tconst preferredRange = growUntilVariableBoundaries(editor.getModel()!, firstCharacterChange, 5);\n\t\tconst left = this._previewEditorObs.getLeftOfPosition(preferredRange.getStartPosition(), reader);\n\t\tconst right = this._previewEditorObs.getLeftOfPosition(preferredRange.getEndPosition(), reader);\n\n\t\tconst indentCol = editor.getModel()!.getLineFirstNonWhitespaceColumn(preferredRange.startLineNumber);\n\t\tconst indentationEnd = this._previewEditorObs.getLeftOfPosition(new Position(preferredRange.startLineNumber, indentCol), reader);\n\n\t\tconst preferredRangeToReveal = new OffsetRange(left, right);\n\n\t\treturn {\n\t\t\tindentationEnd,\n\t\t\tpreferredRangeToReveal,\n\t\t\tmaxEditorWidth: trueContentWidth + l.contentLeft,\n\t\t\tcontentWidth: trueContentWidth,\n\t\t\tnonContentWidth: l.contentLeft, // Width of area that is not content\n\t\t};\n\t}\n\n\tpublic layout(dimension: IDimension, desiredPreviewEditorScrollLeft: number): void {\n\t\tthis.previewEditor.layout(dimension);\n\t\tthis._previewEditorObs.editor.setScrollLeft(desiredPreviewEditorScrollLeft);\n\t}\n\n\tprivate readonly _editorDecorations = derived(this, reader => {\n\t\tconst diff2 = this._state.read(reader);\n\t\tif (!diff2) { return undefined; }\n\n\t\tconst diff = {\n\t\t\tmode: 'insertionInline' as const,\n\t\t\tdiff: diff2.diff,\n\t\t};\n\t\tconst originalDecorations: IModelDeltaDecoration[] = [];\n\t\tconst modifiedDecorations: IModelDeltaDecoration[] = [];\n\n\t\tconst diffWholeLineDeleteDecoration = ModelDecorationOptions.register({\n\t\t\tclassName: 'inlineCompletions-char-delete',\n\t\t\tdescription: 'char-delete',\n\t\t\tisWholeLine: false,\n\t\t\tzIndex: 1, // be on top of diff background decoration\n\t\t});\n\n\t\tconst diffWholeLineAddDecoration = ModelDecorationOptions.register({\n\t\t\tclassName: 'inlineCompletions-char-insert',\n\t\t\tdescription: 'char-insert',\n\t\t\tisWholeLine: true,\n\t\t});\n\n\t\tconst diffAddDecoration = ModelDecorationOptions.register({\n\t\t\tclassName: 'inlineCompletions-char-insert',\n\t\t\tdescription: 'char-insert',\n\t\t\tshouldFillLineOnLineBreak: true,\n\t\t});\n\n\t\tconst hideEmptyInnerDecorations = true; // diff.mode === 'lineReplacement';\n\t\tfor (const m of diff.diff) {\n\t\t\tif (m.modified.isEmpty || m.original.isEmpty) {\n\t\t\t\tif (!m.original.isEmpty) {\n\t\t\t\t\toriginalDecorations.push({ range: m.original.toInclusiveRange()!, options: diffWholeLineDeleteDecoration });\n\t\t\t\t}\n\t\t\t\tif (!m.modified.isEmpty) {\n\t\t\t\t\tmodifiedDecorations.push({ range: m.modified.toInclusiveRange()!, options: diffWholeLineAddDecoration });\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor (const i of m.innerChanges || []) {\n\t\t\t\t\t// Don't show empty markers outside the line range\n\t\t\t\t\tif (m.original.contains(i.originalRange.startLineNumber) && !(hideEmptyInnerDecorations && i.originalRange.isEmpty())) {\n\t\t\t\t\t\toriginalDecorations.push({\n\t\t\t\t\t\t\trange: i.originalRange,\n\t\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\t\tdescription: 'char-delete',\n\t\t\t\t\t\t\t\tshouldFillLineOnLineBreak: false,\n\t\t\t\t\t\t\t\tclassName: classNames(\n\t\t\t\t\t\t\t\t\t'inlineCompletions-char-delete',\n\t\t\t\t\t\t\t\t\t// i.originalRange.isSingleLine() && diff.mode === 'insertionInline' && 'single-line-inline',\n\t\t\t\t\t\t\t\t\ti.originalRange.isEmpty() && 'empty',\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tzIndex: 1\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tif (m.modified.contains(i.modifiedRange.startLineNumber)) {\n\t\t\t\t\t\tmodifiedDecorations.push({\n\t\t\t\t\t\t\trange: i.modifiedRange,\n\t\t\t\t\t\t\toptions: diffAddDecoration\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn { originalDecorations, modifiedDecorations };\n\t});\n}\n\n/*\n * Grows the range on each ends until it includes a none-variable-name character\n * or the next character would be a whitespace character\n * or the maxGrow limit is reached\n */\nfunction growUntilVariableBoundaries(textModel: ITextModel, range: Range, maxGrow: number): Range {\n\tconst startPosition = range.getStartPosition();\n\tconst endPosition = range.getEndPosition();\n\tconst line = textModel.getLineContent(startPosition.lineNumber);\n\n\tfunction isVariableNameCharacter(col: number): boolean {\n\t\tconst char = line.charAt(col - 1);\n\t\treturn (/[a-zA-Z0-9_]/).test(char);\n\t}\n\n\tfunction isWhitespace(col: number): boolean {\n\t\tconst char = line.charAt(col - 1);\n\t\treturn char === ' ' || char === '\\t';\n\t}\n\n\tlet startColumn = startPosition.column;\n\twhile (startColumn > 1 && isVariableNameCharacter(startColumn) && !isWhitespace(startColumn - 1) && startPosition.column - startColumn < maxGrow) {\n\t\tstartColumn--;\n\t}\n\n\tlet endColumn = endPosition.column - 1;\n\twhile (endColumn <= line.length && isVariableNameCharacter(endColumn) && !isWhitespace(endColumn + 1) && endColumn - endPosition.column < maxGrow) {\n\t\tendColumn++;\n\t}\n\n\treturn new Range(startPosition.lineNumber, startPosition.column, endPosition.lineNumber, endColumn + 1);\n}\n"]}
|
|
@@ -217,3 +217,13 @@
|
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
|
+
|
|
221
|
+
.go-to-label::before {
|
|
222
|
+
content: '';
|
|
223
|
+
position: absolute;
|
|
224
|
+
left: -12px;
|
|
225
|
+
top: 0;
|
|
226
|
+
width: 12px;
|
|
227
|
+
height: 100%;
|
|
228
|
+
background: linear-gradient(to left, var(--vscode-editorWidget-background) 0, transparent 12px);
|
|
229
|
+
}
|
|
@@ -29,7 +29,7 @@ export class StandaloneWebWorkerService extends WebWorkerService {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
if (!descriptor.esmModuleLocationBundler) {
|
|
32
|
-
throw new Error(`You must define a function MonacoEnvironment.getWorkerUrl or MonacoEnvironment.getWorker`);
|
|
32
|
+
throw new Error(`You must define a function MonacoEnvironment.getWorkerUrl or MonacoEnvironment.getWorker for the worker label: ${descriptor.label}`);
|
|
33
33
|
}
|
|
34
34
|
const url = typeof descriptor.esmModuleLocationBundler === 'function' ? descriptor.esmModuleLocationBundler() : descriptor.esmModuleLocationBundler;
|
|
35
35
|
const urlStr = url.toString();
|