monaco-editor-core 0.55.0-dev-20251030 → 0.55.0-dev-20251101
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 +15 -13
- package/esm/vs/base/browser/ui/codicons/codicon/codicon.ttf +0 -0
- package/esm/vs/base/browser/ui/toolbar/toolbar.css +1 -5
- package/esm/vs/base/browser/ui/toolbar/toolbar.js +4 -25
- package/esm/vs/base/browser/ui/toolbar/toolbar.js.map +1 -1
- package/esm/vs/base/common/observableInternal/observables/derived.js.map +1 -1
- package/esm/vs/editor/common/tokens/sparseMultilineTokens.js +4 -0
- package/esm/vs/editor/common/tokens/sparseMultilineTokens.js.map +1 -1
- package/esm/vs/editor/common/tokens/sparseTokensStore.js +7 -1
- package/esm/vs/editor/common/tokens/sparseTokensStore.js.map +1 -1
- package/esm/vs/editor/contrib/gotoSymbol/browser/peek/referencesWidget.css +2 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsLineReplacementView.js +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsLineReplacementView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/utils/utils.js +10 -7
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/utils/utils.js.map +1 -1
- package/esm/vs/editor/contrib/quickAccess/browser/gotoLineQuickAccess.js +74 -70
- package/esm/vs/editor/contrib/quickAccess/browser/gotoLineQuickAccess.js.map +1 -1
- package/esm/vs/editor/contrib/quickAccess/browser/gotoSymbolQuickAccess.js +32 -32
- package/esm/vs/editor/contrib/readOnlyMessage/browser/contribution.js +2 -2
- package/esm/vs/editor/contrib/rename/browser/rename.js +11 -11
- package/esm/vs/editor/contrib/rename/browser/renameWidget.js +7 -7
- package/esm/vs/editor/contrib/smartSelect/browser/smartSelect.js +4 -4
- package/esm/vs/editor/contrib/snippet/browser/snippetController2.js +4 -4
- package/esm/vs/editor/contrib/snippet/browser/snippetVariables.js +4 -4
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollActions.js +11 -11
- package/esm/vs/editor/contrib/suggest/browser/suggest.js +8 -8
- package/esm/vs/editor/contrib/suggest/browser/suggestController.js +10 -10
- package/esm/vs/editor/contrib/suggest/browser/suggestWidget.js +17 -17
- package/esm/vs/editor/contrib/suggest/browser/suggestWidgetDetails.js +2 -2
- package/esm/vs/editor/contrib/suggest/browser/suggestWidgetRenderer.js +2 -2
- package/esm/vs/editor/contrib/suggest/browser/wordContextKey.js +1 -1
- package/esm/vs/editor/contrib/symbolIcons/browser/symbolIcons.js +33 -33
- package/esm/vs/editor/contrib/toggleTabFocusMode/browser/toggleTabFocusMode.js +4 -4
- package/esm/vs/editor/contrib/tokenization/browser/tokenization.js +1 -1
- package/esm/vs/editor/contrib/unicodeHighlighter/browser/bannerController.js +1 -1
- package/esm/vs/editor/contrib/unicodeHighlighter/browser/unicodeHighlighter.js +24 -24
- package/esm/vs/editor/contrib/unusualLineTerminators/browser/unusualLineTerminators.js +5 -5
- package/esm/vs/editor/contrib/wordHighlighter/browser/highlightDecorations.js +9 -9
- package/esm/vs/editor/contrib/wordHighlighter/browser/wordHighlighter.js +3 -3
- package/esm/vs/editor/contrib/wordOperations/browser/wordOperations.js +1 -1
- package/esm/vs/platform/accessibilitySignal/browser/accessibilitySignalService.js +62 -62
- package/esm/vs/platform/action/common/actionCommonCategories.js +6 -6
- package/esm/vs/platform/actionWidget/browser/actionList.js +4 -4
- package/esm/vs/platform/actionWidget/browser/actionWidget.js +7 -7
- package/esm/vs/platform/actions/browser/menuEntryActionViewItem.js +5 -5
- package/esm/vs/platform/actions/browser/toolbar.js +2 -2
- package/esm/vs/platform/actions/common/actions.js +3 -1
- package/esm/vs/platform/actions/common/actions.js.map +1 -1
- package/esm/vs/platform/actions/common/menuService.js +2 -2
- package/esm/vs/platform/configuration/common/configurationRegistry.js +10 -10
- package/esm/vs/platform/contextkey/browser/contextKeyService.js +1 -1
- package/esm/vs/platform/contextkey/common/contextkey.js +9 -9
- package/esm/vs/platform/contextkey/common/contextkeys.js +9 -9
- package/esm/vs/platform/contextkey/common/scanner.js +5 -5
- package/esm/vs/platform/history/browser/contextScopedHistoryWidget.js +1 -1
- package/esm/vs/platform/hover/browser/hoverService.js +9 -3
- package/esm/vs/platform/hover/browser/hoverService.js.map +1 -1
- package/esm/vs/platform/hover/browser/hoverWidget.js +1 -1
- package/esm/vs/platform/hover/browser/updatableHoverWidget.js +1 -1
- package/esm/vs/platform/keybinding/common/abstractKeybindingService.js +4 -4
- package/esm/vs/platform/list/browser/listService.js +27 -27
- package/esm/vs/platform/markers/common/markerService.js +2 -2
- package/esm/vs/platform/markers/common/markers.js +6 -6
- package/esm/vs/platform/quickinput/browser/commandsQuickAccess.js +7 -7
- 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 +6 -6
- package/esm/vs/platform/quickinput/browser/quickInputActions.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/quickInputController.js +6 -6
- package/esm/vs/platform/quickinput/browser/quickInputList.js +1 -1
- package/esm/vs/platform/quickinput/browser/quickInputUtils.js +1 -1
- package/esm/vs/platform/quickinput/browser/tree/quickInputTreeAccessibilityProvider.js +1 -1
- package/esm/vs/platform/theme/common/colorUtils.js +2 -2
- package/esm/vs/platform/theme/common/colors/baseColors.js +17 -17
- package/esm/vs/platform/theme/common/colors/chartsColors.js +8 -8
- package/esm/vs/platform/theme/common/colors/editorColors.js +95 -95
- package/esm/vs/platform/theme/common/colors/inputColors.js +47 -47
- package/esm/vs/platform/theme/common/colors/listColors.js +36 -36
- package/esm/vs/platform/theme/common/colors/menuColors.js +7 -7
- package/esm/vs/platform/theme/common/colors/minimapColors.js +11 -11
- package/esm/vs/platform/theme/common/colors/miscColors.js +16 -16
- package/esm/vs/platform/theme/common/colors/quickpickColors.js +9 -9
- package/esm/vs/platform/theme/common/colors/searchColors.js +3 -3
- package/esm/vs/platform/theme/common/iconRegistry.js +6 -6
- package/esm/vs/platform/undoRedo/common/undoRedoService.js +20 -20
- package/esm/vs/platform/workspace/common/workspace.js +1 -1
- package/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/inlineEditsLineReplacementView.ts","vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsLineReplacementView.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;AAEhG,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,0CAA0C,CAAC;AAC3E,OAAO,EAAe,kBAAkB,EAAE,MAAM,iDAAiD,CAAC;AAClG,OAAO,EAAE,OAAO,EAAE,MAAM,2CAA2C,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAC;AACzF,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,OAAO,EAAe,MAAM,gDAAgD,CAAC;AACrH,OAAO,EAAE,gBAAgB,EAAE,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/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 { $, getWindow, n } from '../../../../../../../base/browser/dom.js';\nimport { IMouseEvent, StandardMouseEvent } from '../../../../../../../base/browser/mouseEvent.js';\nimport { Emitter } from '../../../../../../../base/common/event.js';\nimport { Disposable, toDisposable } from '../../../../../../../base/common/lifecycle.js';\nimport { autorunDelta, constObservable, derived, IObservable } from '../../../../../../../base/common/observable.js';\nimport { editorBackground, scrollbarShadow } from '../../../../../../../platform/theme/common/colorRegistry.js';\nimport { asCssVariable } from '../../../../../../../platform/theme/common/colorUtils.js';\nimport { IThemeService } from '../../../../../../../platform/theme/common/themeService.js';\nimport { IEditorMouseEvent, IViewZoneChangeAccessor } from '../../../../../../browser/editorBrowser.js';\nimport { EditorMouseEvent } from '../../../../../../browser/editorDom.js';\nimport { ObservableCodeEditor } from '../../../../../../browser/observableCodeEditor.js';\nimport { LineSource, renderLines, RenderOptions } from '../../../../../../browser/widget/diffEditor/components/diffEditorViewZones/renderLines.js';\nimport { EditorOption } from '../../../../../../common/config/editorOptions.js';\nimport { Point } from '../../../../../../common/core/2d/point.js';\nimport { Rect } from '../../../../../../common/core/2d/rect.js';\nimport { Range } from '../../../../../../common/core/range.js';\nimport { LineRange } from '../../../../../../common/core/ranges/lineRange.js';\nimport { OffsetRange } from '../../../../../../common/core/ranges/offsetRange.js';\nimport { ILanguageService } from '../../../../../../common/languages/language.js';\nimport { LineTokens, TokenArray } from '../../../../../../common/tokens/lineTokens.js';\nimport { InlineDecoration, InlineDecorationType } from '../../../../../../common/viewModel/inlineDecorations.js';\nimport { IInlineEditsView, InlineEditTabAction } from '../inlineEditsViewInterface.js';\nimport { getEditorBlendedColor, getModifiedBorderColor, getOriginalBorderColor, modifiedChangedLineBackgroundColor, originalBackgroundColor } from '../theme.js';\nimport { getEditorValidOverlayRect, getPrefixTrim, mapOutFalsy, rectToProps } from '../utils/utils.js';\n\nexport class InlineEditsLineReplacementView extends Disposable implements IInlineEditsView {\n\n\tprivate readonly _onDidClick;\n\treadonly onDidClick;\n\n\tprivate readonly _maxPrefixTrim;\n\n\tprivate readonly _modifiedLineElements;\n\n\n\tprivate readonly _layout;\n\n\tprivate readonly _viewZoneInfo;\n\n\tprivate readonly _div;\n\n\treadonly isHovered;\n\n\treadonly minEditorScrollHeight;\n\n\tconstructor(\n\t\tprivate readonly _editor: ObservableCodeEditor,\n\t\tprivate readonly _edit: IObservable<{\n\t\t\toriginalRange: LineRange;\n\t\t\tmodifiedRange: LineRange;\n\t\t\tmodifiedLines: string[];\n\t\t\treplacements: Replacement[];\n\t\t} | undefined>,\n\t\tprivate readonly _isInDiffEditor: IObservable<boolean>,\n\t\tprivate readonly _tabAction: IObservable<InlineEditTabAction>,\n\t\t@ILanguageService private readonly _languageService: ILanguageService,\n\t\t@IThemeService private readonly _themeService: IThemeService,\n\t) {\n\t\tsuper();\n\t\tthis._onDidClick = this._register(new Emitter<IMouseEvent>());\n\t\tthis.onDidClick = this._onDidClick.event;\n\t\tthis._maxPrefixTrim = this._edit.map(e => e ? getPrefixTrim(e.replacements.flatMap(r => [r.originalRange, r.modifiedRange]), e.originalRange, e.modifiedLines, this._editor.editor) : undefined);\n\t\tthis._modifiedLineElements = derived(this, reader => {\n\t\t\tconst lines = [];\n\t\t\tlet requiredWidth = 0;\n\n\t\t\tconst prefixTrim = this._maxPrefixTrim.read(reader);\n\t\t\tconst edit = this._edit.read(reader);\n\t\t\tif (!edit || !prefixTrim) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst maxPrefixTrim = prefixTrim.prefixTrim;\n\t\t\tconst modifiedBubbles = rangesToBubbleRanges(edit.replacements.map(r => r.modifiedRange)).map(r => new Range(r.startLineNumber, r.startColumn - maxPrefixTrim, r.endLineNumber, r.endColumn - maxPrefixTrim));\n\n\t\t\tconst textModel = this._editor.model.get()!;\n\t\t\tconst startLineNumber = edit.modifiedRange.startLineNumber;\n\t\t\tfor (let i = 0; i < edit.modifiedRange.length; i++) {\n\t\t\t\tconst line = document.createElement('div');\n\t\t\t\tconst lineNumber = startLineNumber + i;\n\t\t\t\tconst modLine = edit.modifiedLines[i].slice(maxPrefixTrim);\n\n\t\t\t\tconst t = textModel.tokenization.tokenizeLinesAt(lineNumber, [modLine])?.[0];\n\t\t\t\tlet tokens: LineTokens;\n\t\t\t\tif (t) {\n\t\t\t\t\ttokens = TokenArray.fromLineTokens(t).toLineTokens(modLine, this._languageService.languageIdCodec);\n\t\t\t\t} else {\n\t\t\t\t\ttokens = LineTokens.createEmpty(modLine, this._languageService.languageIdCodec);\n\t\t\t\t}\n\n\t\t\t\tconst decorations = [];\n\t\t\t\tfor (const modified of modifiedBubbles.filter(b => b.startLineNumber === lineNumber)) {\n\t\t\t\t\tconst validatedEndColumn = Math.min(modified.endColumn, modLine.length + 1);\n\t\t\t\t\tdecorations.push(new InlineDecoration(new Range(1, modified.startColumn, 1, validatedEndColumn), 'inlineCompletions-modified-bubble', InlineDecorationType.Regular));\n\t\t\t\t}\n\n\t\t\t\t// TODO: All lines should be rendered at once for one dom element\n\t\t\t\tconst result = renderLines(new LineSource([tokens]), RenderOptions.fromEditor(this._editor.editor).withSetWidth(false).withScrollBeyondLastColumn(0), decorations, line, true);\n\t\t\t\tthis._editor.getOption(EditorOption.fontInfo).read(reader); // update when font info changes\n\n\t\t\t\trequiredWidth = Math.max(requiredWidth, result.minWidthInPx);\n\n\t\t\t\tlines.push(line);\n\t\t\t}\n\n\t\t\treturn { lines, requiredWidth: requiredWidth };\n\t\t});\n\t\tthis._layout = derived(this, reader => {\n\t\t\tconst modifiedLines = this._modifiedLineElements.read(reader);\n\t\t\tconst maxPrefixTrim = this._maxPrefixTrim.read(reader);\n\t\t\tconst edit = this._edit.read(reader);\n\t\t\tif (!modifiedLines || !maxPrefixTrim || !edit) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst { prefixLeftOffset } = maxPrefixTrim;\n\t\t\tconst { requiredWidth } = modifiedLines;\n\n\t\t\tconst originalLineHeights = this._editor.observeLineHeightsForLineRange(edit.originalRange).read(reader);\n\t\t\tconst modifiedLineHeights = (() => {\n\t\t\t\tconst lineHeights = originalLineHeights.slice(0, edit.modifiedRange.length);\n\t\t\t\twhile (lineHeights.length < edit.modifiedRange.length) {\n\t\t\t\t\tlineHeights.push(originalLineHeights[originalLineHeights.length - 1]);\n\t\t\t\t}\n\t\t\t\treturn lineHeights;\n\t\t\t})();\n\n\t\t\tconst contentLeft = this._editor.layoutInfoContentLeft.read(reader);\n\t\t\tconst verticalScrollbarWidth = this._editor.layoutInfoVerticalScrollbarWidth.read(reader);\n\t\t\tconst scrollLeft = this._editor.scrollLeft.read(reader);\n\t\t\tconst scrollTop = this._editor.scrollTop.read(reader);\n\t\t\tconst editorLeftOffset = contentLeft - scrollLeft;\n\n\t\t\tconst textModel = this._editor.editor.getModel()!;\n\n\t\t\tconst originalLineWidths = edit.originalRange.mapToLineArray(line => this._editor.editor.getOffsetForColumn(line, textModel.getLineMaxColumn(line)) - prefixLeftOffset);\n\t\t\tconst maxLineWidth = Math.max(...originalLineWidths, requiredWidth);\n\n\t\t\tconst startLineNumber = edit.originalRange.startLineNumber;\n\t\t\tconst endLineNumber = edit.originalRange.endLineNumberExclusive - 1;\n\t\t\tconst topOfOriginalLines = this._editor.editor.getTopForLineNumber(startLineNumber) - scrollTop;\n\t\t\tconst bottomOfOriginalLines = this._editor.editor.getBottomForLineNumber(endLineNumber) - scrollTop;\n\n\t\t\t// Box Widget positioning\n\t\t\tconst originalLinesOverlay = Rect.fromLeftTopWidthHeight(\n\t\t\t\teditorLeftOffset + prefixLeftOffset,\n\t\t\t\ttopOfOriginalLines,\n\t\t\t\tmaxLineWidth,\n\t\t\t\tbottomOfOriginalLines - topOfOriginalLines\n\t\t\t);\n\t\t\tconst modifiedLinesOverlay = Rect.fromLeftTopWidthHeight(\n\t\t\t\toriginalLinesOverlay.left,\n\t\t\t\toriginalLinesOverlay.bottom,\n\t\t\t\toriginalLinesOverlay.width,\n\t\t\t\tmodifiedLineHeights.reduce((sum, h) => sum + h, 0)\n\t\t\t);\n\t\t\tconst background = Rect.hull([originalLinesOverlay, modifiedLinesOverlay]);\n\n\t\t\tconst lowerBackground = background.intersectVertical(new OffsetRange(originalLinesOverlay.bottom, Number.MAX_SAFE_INTEGER));\n\t\t\tconst lowerText = new Rect(lowerBackground.left, lowerBackground.top, lowerBackground.right, lowerBackground.bottom);\n\n\t\t\treturn {\n\t\t\t\toriginalLinesOverlay,\n\t\t\t\tmodifiedLinesOverlay,\n\t\t\t\tbackground,\n\t\t\t\tlowerBackground,\n\t\t\t\tlowerText,\n\t\t\t\tmodifiedLineHeights,\n\t\t\t\tminContentWidthRequired: prefixLeftOffset + maxLineWidth + verticalScrollbarWidth,\n\t\t\t};\n\t\t});\n\t\tthis._viewZoneInfo = derived<{ height: number; lineNumber: number } | undefined>(reader => {\n\t\t\tconst shouldShowViewZone = this._editor.getOption(EditorOption.inlineSuggest).map(o => o.edits.allowCodeShifting === 'always').read(reader);\n\t\t\tif (!shouldShowViewZone) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst layout = this._layout.read(reader);\n\t\t\tconst edit = this._edit.read(reader);\n\t\t\tif (!layout || !edit) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst viewZoneHeight = layout.lowerBackground.height;\n\t\t\tconst viewZoneLineNumber = edit.originalRange.endLineNumberExclusive;\n\t\t\treturn { height: viewZoneHeight, lineNumber: viewZoneLineNumber };\n\t\t});\n\t\tthis.minEditorScrollHeight = derived(this, reader => {\n\t\t\tconst layout = mapOutFalsy(this._layout).read(reader);\n\t\t\tif (!layout || this._viewZoneInfo.read(reader) !== undefined) {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\treturn layout.read(reader).lowerText.bottom + this._editor.editor.getScrollTop();\n\t\t});\n\t\tthis._div = n.div({\n\t\t\tclass: 'line-replacement',\n\t\t}, [\n\t\t\tderived(this, reader => {\n\t\t\t\tconst layout = mapOutFalsy(this._layout).read(reader);\n\t\t\t\tconst modifiedLineElements = this._modifiedLineElements.read(reader);\n\t\t\t\tif (!layout || !modifiedLineElements) {\n\t\t\t\t\treturn [];\n\t\t\t\t}\n\n\t\t\t\tconst layoutProps = layout.read(reader);\n\t\t\t\tconst contentLeft = this._editor.layoutInfoContentLeft.read(reader);\n\n\t\t\t\tconst separatorWidth = this._isInDiffEditor.read(reader) ? 3 : 1;\n\n\t\t\t\tmodifiedLineElements.lines.forEach((l, i) => {\n\t\t\t\t\tl.style.width = `${layoutProps.lowerText.width}px`;\n\t\t\t\t\tl.style.height = `${layoutProps.modifiedLineHeights[i]}px`;\n\t\t\t\t\tl.style.position = 'relative';\n\t\t\t\t});\n\n\t\t\t\tconst modifiedBorderColor = getModifiedBorderColor(this._tabAction).read(reader);\n\t\t\t\tconst originalBorderColor = getOriginalBorderColor(this._tabAction).read(reader);\n\n\t\t\t\treturn [\n\t\t\t\t\tn.div({\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t...rectToProps((r) => getEditorValidOverlayRect(this._editor).read(r)),\n\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t\t\t}\n\t\t\t\t\t}, [\n\t\t\t\t\t\tn.div({\n\t\t\t\t\t\t\tclass: 'borderAroundLineReplacement',\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\t...rectToProps(reader => layout.read(reader).background.translateX(-contentLeft).withMargin(separatorWidth)),\n\t\t\t\t\t\t\t\tborderRadius: '4px',\n\n\t\t\t\t\t\t\t\tborder: `${separatorWidth + 1}px solid ${asCssVariable(editorBackground)}`,\n\t\t\t\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tn.div({\n\t\t\t\t\t\t\tclass: 'originalOverlayLineReplacement',\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\t...rectToProps(reader => layout.read(reader).background.translateX(-contentLeft)),\n\t\t\t\t\t\t\t\tborderRadius: '4px',\n\n\t\t\t\t\t\t\t\tborder: getEditorBlendedColor(originalBorderColor, this._themeService).map(c => `1px solid ${c.toString()}`),\n\t\t\t\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\t\t\t\tbackground: asCssVariable(originalBackgroundColor),\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tn.div({\n\t\t\t\t\t\t\tclass: 'modifiedOverlayLineReplacement',\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\t...rectToProps(reader => layout.read(reader).lowerBackground.translateX(-contentLeft)),\n\t\t\t\t\t\t\t\tborderRadius: '0 0 4px 4px',\n\t\t\t\t\t\t\t\tbackground: asCssVariable(editorBackground),\n\t\t\t\t\t\t\t\tboxShadow: `${asCssVariable(scrollbarShadow)} 0 6px 6px -6px`,\n\t\t\t\t\t\t\t\tborder: `1px solid ${asCssVariable(modifiedBorderColor)}`,\n\t\t\t\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\t\tcursor: 'pointer',\n\t\t\t\t\t\t\t\tpointerEvents: 'auto',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tonmousedown: e => {\n\t\t\t\t\t\t\t\te.preventDefault(); // This prevents that the editor loses focus\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tonclick: (e) => this._onDidClick.fire(new StandardMouseEvent(getWindow(e), e)),\n\t\t\t\t\t\t}, [\n\t\t\t\t\t\t\tn.div({\n\t\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\t\tposition: 'absolute', top: 0, left: 0, width: '100%', height: '100%',\n\t\t\t\t\t\t\t\t\tbackground: asCssVariable(modifiedChangedLineBackgroundColor),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tn.div({\n\t\t\t\t\t\t\tclass: 'modifiedLinesLineReplacement',\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\t\t\t\t...rectToProps(reader => layout.read(reader).lowerText.translateX(-contentLeft)),\n\t\t\t\t\t\t\t\tfontFamily: this._editor.getOption(EditorOption.fontFamily),\n\t\t\t\t\t\t\t\tfontSize: this._editor.getOption(EditorOption.fontSize),\n\t\t\t\t\t\t\t\tfontWeight: this._editor.getOption(EditorOption.fontWeight),\n\t\t\t\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t\t\t\t\twhiteSpace: 'nowrap',\n\t\t\t\t\t\t\t\tborderRadius: '0 0 4px 4px',\n\t\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, [...modifiedLineElements.lines]),\n\t\t\t\t\t])\n\t\t\t\t];\n\t\t\t})\n\t\t]).keepUpdated(this._store);\n\t\tthis.isHovered = this._editor.isTargetHovered((e) => this._isMouseOverWidget(e), this._store);\n\t\tthis._previousViewZoneInfo = undefined;\n\n\t\tthis._register(toDisposable(() => this._editor.editor.changeViewZones(accessor => this.removePreviousViewZone(accessor))));\n\n\t\tthis._register(autorunDelta(this._viewZoneInfo, ({ lastValue, newValue }) => {\n\t\t\tif (lastValue === newValue || (lastValue?.height === newValue?.height && lastValue?.lineNumber === newValue?.lineNumber)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis._editor.editor.changeViewZones((changeAccessor) => {\n\t\t\t\tthis.removePreviousViewZone(changeAccessor);\n\t\t\t\tif (!newValue) { return; }\n\t\t\t\tthis.addViewZone(newValue, changeAccessor);\n\t\t\t});\n\t\t}));\n\n\t\tthis._register(this._editor.createOverlayWidget({\n\t\t\tdomNode: this._div.element,\n\t\t\tminContentWidthInPx: derived(this, reader => {\n\t\t\t\treturn this._layout.read(reader)?.minContentWidthRequired ?? 0;\n\t\t\t}),\n\t\t\tposition: constObservable({ preference: { top: 0, left: 0 } }),\n\t\t\tallowEditorOverflow: false,\n\t\t}));\n\t}\n\n\tprivate _isMouseOverWidget(e: IEditorMouseEvent): boolean {\n\t\tconst layout = this._layout.get();\n\t\tif (!layout || !(e.event instanceof EditorMouseEvent)) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn layout.lowerBackground.containsPoint(new Point(e.event.relativePos.x, e.event.relativePos.y));\n\t}\n\n\t// View Zones\n\tprivate _previousViewZoneInfo: { height: number; lineNumber: number; id: string } | undefined;\n\n\tprivate removePreviousViewZone(changeAccessor: IViewZoneChangeAccessor) {\n\t\tif (!this._previousViewZoneInfo) {\n\t\t\treturn;\n\t\t}\n\n\t\tchangeAccessor.removeZone(this._previousViewZoneInfo.id);\n\n\t\tconst cursorLineNumber = this._editor.cursorLineNumber.get();\n\t\tif (cursorLineNumber !== null && cursorLineNumber >= this._previousViewZoneInfo.lineNumber) {\n\t\t\tthis._editor.editor.setScrollTop(this._editor.scrollTop.get() - this._previousViewZoneInfo.height);\n\t\t}\n\n\t\tthis._previousViewZoneInfo = undefined;\n\t}\n\n\tprivate addViewZone(viewZoneInfo: { height: number; lineNumber: number }, changeAccessor: IViewZoneChangeAccessor) {\n\t\tconst activeViewZone = changeAccessor.addZone({\n\t\t\tafterLineNumber: viewZoneInfo.lineNumber - 1,\n\t\t\theightInPx: viewZoneInfo.height, // move computation to layout?\n\t\t\tdomNode: $('div'),\n\t\t});\n\n\t\tthis._previousViewZoneInfo = { height: viewZoneInfo.height, lineNumber: viewZoneInfo.lineNumber, id: activeViewZone };\n\n\t\tconst cursorLineNumber = this._editor.cursorLineNumber.get();\n\t\tif (cursorLineNumber !== null && cursorLineNumber >= viewZoneInfo.lineNumber) {\n\t\t\tthis._editor.editor.setScrollTop(this._editor.scrollTop.get() + viewZoneInfo.height);\n\t\t}\n\t}\n}\n\nfunction rangesToBubbleRanges(ranges: Range[]): Range[] {\n\tconst result: Range[] = [];\n\twhile (ranges.length) {\n\t\tlet range = ranges.shift()!;\n\t\tif (range.startLineNumber !== range.endLineNumber) {\n\t\t\tranges.push(new Range(range.startLineNumber + 1, 1, range.endLineNumber, range.endColumn));\n\t\t\trange = new Range(range.startLineNumber, range.startColumn, range.startLineNumber, Number.MAX_SAFE_INTEGER); // TODO: this is not correct\n\t\t}\n\n\t\tresult.push(range);\n\t}\n\treturn result;\n\n}\n\nexport interface Replacement {\n\toriginalRange: Range;\n\tmodifiedRange: Range;\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { $, getWindow, n } from '../../../../../../../base/browser/dom.js';\nimport { IMouseEvent, StandardMouseEvent } from '../../../../../../../base/browser/mouseEvent.js';\nimport { Emitter } from '../../../../../../../base/common/event.js';\nimport { Disposable, toDisposable } from '../../../../../../../base/common/lifecycle.js';\nimport { autorunDelta, constObservable, derived, IObservable } from '../../../../../../../base/common/observable.js';\nimport { editorBackground, scrollbarShadow } from '../../../../../../../platform/theme/common/colorRegistry.js';\nimport { asCssVariable } from '../../../../../../../platform/theme/common/colorUtils.js';\nimport { IThemeService } from '../../../../../../../platform/theme/common/themeService.js';\nimport { IEditorMouseEvent, IViewZoneChangeAccessor } from '../../../../../../browser/editorBrowser.js';\nimport { EditorMouseEvent } from '../../../../../../browser/editorDom.js';\nimport { ObservableCodeEditor } from '../../../../../../browser/observableCodeEditor.js';\nimport { LineSource, renderLines, RenderOptions } from '../../../../../../browser/widget/diffEditor/components/diffEditorViewZones/renderLines.js';\nimport { EditorOption } from '../../../../../../common/config/editorOptions.js';\nimport { Point } from '../../../../../../common/core/2d/point.js';\nimport { Rect } from '../../../../../../common/core/2d/rect.js';\nimport { Range } from '../../../../../../common/core/range.js';\nimport { LineRange } from '../../../../../../common/core/ranges/lineRange.js';\nimport { OffsetRange } from '../../../../../../common/core/ranges/offsetRange.js';\nimport { ILanguageService } from '../../../../../../common/languages/language.js';\nimport { LineTokens, TokenArray } from '../../../../../../common/tokens/lineTokens.js';\nimport { InlineDecoration, InlineDecorationType } from '../../../../../../common/viewModel/inlineDecorations.js';\nimport { IInlineEditsView, InlineEditTabAction } from '../inlineEditsViewInterface.js';\nimport { getEditorBlendedColor, getModifiedBorderColor, getOriginalBorderColor, modifiedChangedLineBackgroundColor, originalBackgroundColor } from '../theme.js';\nimport { getEditorValidOverlayRect, getPrefixTrim, mapOutFalsy, rectToProps } from '../utils/utils.js';\n\nexport class InlineEditsLineReplacementView extends Disposable implements IInlineEditsView {\n\n\tprivate readonly _onDidClick;\n\treadonly onDidClick;\n\n\tprivate readonly _maxPrefixTrim;\n\n\tprivate readonly _modifiedLineElements;\n\n\n\tprivate readonly _layout;\n\n\tprivate readonly _viewZoneInfo;\n\n\tprivate readonly _div;\n\n\treadonly isHovered;\n\n\treadonly minEditorScrollHeight;\n\n\tconstructor(\n\t\tprivate readonly _editor: ObservableCodeEditor,\n\t\tprivate readonly _edit: IObservable<{\n\t\t\toriginalRange: LineRange;\n\t\t\tmodifiedRange: LineRange;\n\t\t\tmodifiedLines: string[];\n\t\t\treplacements: Replacement[];\n\t\t} | undefined>,\n\t\tprivate readonly _isInDiffEditor: IObservable<boolean>,\n\t\tprivate readonly _tabAction: IObservable<InlineEditTabAction>,\n\t\t@ILanguageService private readonly _languageService: ILanguageService,\n\t\t@IThemeService private readonly _themeService: IThemeService,\n\t) {\n\t\tsuper();\n\t\tthis._onDidClick = this._register(new Emitter<IMouseEvent>());\n\t\tthis.onDidClick = this._onDidClick.event;\n\t\tthis._maxPrefixTrim = this._edit.map(e => e ? getPrefixTrim(e.replacements.flatMap(r => [r.originalRange, r.modifiedRange]), e.originalRange, e.modifiedLines, this._editor.editor) : undefined);\n\t\tthis._modifiedLineElements = derived(this, reader => {\n\t\t\tconst lines = [];\n\t\t\tlet requiredWidth = 0;\n\n\t\t\tconst prefixTrim = this._maxPrefixTrim.read(reader);\n\t\t\tconst edit = this._edit.read(reader);\n\t\t\tif (!edit || !prefixTrim) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst maxPrefixTrim = prefixTrim.prefixTrim;\n\t\t\tconst modifiedBubbles = rangesToBubbleRanges(edit.replacements.map(r => r.modifiedRange)).map(r => new Range(r.startLineNumber, r.startColumn - maxPrefixTrim, r.endLineNumber, r.endColumn - maxPrefixTrim));\n\n\t\t\tconst textModel = this._editor.model.get()!;\n\t\t\tconst startLineNumber = edit.modifiedRange.startLineNumber;\n\t\t\tfor (let i = 0; i < edit.modifiedRange.length; i++) {\n\t\t\t\tconst line = document.createElement('div');\n\t\t\t\tconst lineNumber = startLineNumber + i;\n\t\t\t\tconst modLine = edit.modifiedLines[i].slice(maxPrefixTrim);\n\n\t\t\t\tconst t = textModel.tokenization.tokenizeLinesAt(lineNumber, [modLine])?.[0];\n\t\t\t\tlet tokens: LineTokens;\n\t\t\t\tif (t) {\n\t\t\t\t\ttokens = TokenArray.fromLineTokens(t).toLineTokens(modLine, this._languageService.languageIdCodec);\n\t\t\t\t} else {\n\t\t\t\t\ttokens = LineTokens.createEmpty(modLine, this._languageService.languageIdCodec);\n\t\t\t\t}\n\n\t\t\t\tconst decorations = [];\n\t\t\t\tfor (const modified of modifiedBubbles.filter(b => b.startLineNumber === lineNumber)) {\n\t\t\t\t\tconst validatedEndColumn = Math.min(modified.endColumn, modLine.length + 1);\n\t\t\t\t\tdecorations.push(new InlineDecoration(new Range(1, modified.startColumn, 1, validatedEndColumn), 'inlineCompletions-modified-bubble', InlineDecorationType.Regular));\n\t\t\t\t}\n\n\t\t\t\t// TODO: All lines should be rendered at once for one dom element\n\t\t\t\tconst result = renderLines(new LineSource([tokens]), RenderOptions.fromEditor(this._editor.editor).withSetWidth(false).withScrollBeyondLastColumn(0), decorations, line, true);\n\t\t\t\tthis._editor.getOption(EditorOption.fontInfo).read(reader); // update when font info changes\n\n\t\t\t\trequiredWidth = Math.max(requiredWidth, result.minWidthInPx);\n\n\t\t\t\tlines.push(line);\n\t\t\t}\n\n\t\t\treturn { lines, requiredWidth: requiredWidth };\n\t\t});\n\t\tthis._layout = derived(this, reader => {\n\t\t\tconst modifiedLines = this._modifiedLineElements.read(reader);\n\t\t\tconst maxPrefixTrim = this._maxPrefixTrim.read(reader);\n\t\t\tconst edit = this._edit.read(reader);\n\t\t\tif (!modifiedLines || !maxPrefixTrim || !edit) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst { prefixLeftOffset } = maxPrefixTrim;\n\t\t\tconst { requiredWidth } = modifiedLines;\n\n\t\t\tconst originalLineHeights = this._editor.observeLineHeightsForLineRange(edit.originalRange).read(reader);\n\t\t\tconst modifiedLineHeights = (() => {\n\t\t\t\tconst lineHeights = originalLineHeights.slice(0, edit.modifiedRange.length);\n\t\t\t\twhile (lineHeights.length < edit.modifiedRange.length) {\n\t\t\t\t\tlineHeights.push(originalLineHeights[originalLineHeights.length - 1]);\n\t\t\t\t}\n\t\t\t\treturn lineHeights;\n\t\t\t})();\n\n\t\t\tconst contentLeft = this._editor.layoutInfoContentLeft.read(reader);\n\t\t\tconst verticalScrollbarWidth = this._editor.layoutInfoVerticalScrollbarWidth.read(reader);\n\t\t\tconst scrollLeft = this._editor.scrollLeft.read(reader);\n\t\t\tconst scrollTop = this._editor.scrollTop.read(reader);\n\t\t\tconst editorLeftOffset = contentLeft - scrollLeft;\n\n\t\t\tconst textModel = this._editor.editor.getModel()!;\n\n\t\t\tconst originalLineWidths = edit.originalRange.mapToLineArray(line => this._editor.editor.getOffsetForColumn(line, textModel.getLineMaxColumn(line)) - prefixLeftOffset);\n\t\t\tconst maxLineWidth = Math.max(...originalLineWidths, requiredWidth);\n\n\t\t\tconst startLineNumber = edit.originalRange.startLineNumber;\n\t\t\tconst endLineNumber = edit.originalRange.endLineNumberExclusive - 1;\n\t\t\tconst topOfOriginalLines = this._editor.editor.getTopForLineNumber(startLineNumber) - scrollTop;\n\t\t\tconst bottomOfOriginalLines = this._editor.editor.getBottomForLineNumber(endLineNumber) - scrollTop;\n\n\t\t\t// Box Widget positioning\n\t\t\tconst originalLinesOverlay = Rect.fromLeftTopWidthHeight(\n\t\t\t\teditorLeftOffset + prefixLeftOffset,\n\t\t\t\ttopOfOriginalLines,\n\t\t\t\tmaxLineWidth,\n\t\t\t\tbottomOfOriginalLines - topOfOriginalLines\n\t\t\t);\n\t\t\tconst modifiedLinesOverlay = Rect.fromLeftTopWidthHeight(\n\t\t\t\toriginalLinesOverlay.left,\n\t\t\t\toriginalLinesOverlay.bottom,\n\t\t\t\toriginalLinesOverlay.width,\n\t\t\t\tmodifiedLineHeights.reduce((sum, h) => sum + h, 0)\n\t\t\t);\n\t\t\tconst background = Rect.hull([originalLinesOverlay, modifiedLinesOverlay]);\n\n\t\t\tconst lowerBackground = background.intersectVertical(new OffsetRange(originalLinesOverlay.bottom, Number.MAX_SAFE_INTEGER));\n\t\t\tconst lowerText = new Rect(lowerBackground.left, lowerBackground.top, lowerBackground.right, lowerBackground.bottom);\n\n\t\t\treturn {\n\t\t\t\toriginalLinesOverlay,\n\t\t\t\tmodifiedLinesOverlay,\n\t\t\t\tbackground,\n\t\t\t\tlowerBackground,\n\t\t\t\tlowerText,\n\t\t\t\tmodifiedLineHeights,\n\t\t\t\tminContentWidthRequired: prefixLeftOffset + maxLineWidth + verticalScrollbarWidth,\n\t\t\t};\n\t\t});\n\t\tthis._viewZoneInfo = derived<{ height: number; lineNumber: number } | undefined>(reader => {\n\t\t\tconst shouldShowViewZone = this._editor.getOption(EditorOption.inlineSuggest).map(o => o.edits.allowCodeShifting === 'always').read(reader);\n\t\t\tif (!shouldShowViewZone) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst layout = this._layout.read(reader);\n\t\t\tconst edit = this._edit.read(reader);\n\t\t\tif (!layout || !edit) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst viewZoneHeight = layout.lowerBackground.height;\n\t\t\tconst viewZoneLineNumber = edit.originalRange.endLineNumberExclusive;\n\t\t\treturn { height: viewZoneHeight, lineNumber: viewZoneLineNumber };\n\t\t});\n\t\tthis.minEditorScrollHeight = derived(this, reader => {\n\t\t\tconst layout = mapOutFalsy(this._layout).read(reader);\n\t\t\tif (!layout || this._viewZoneInfo.read(reader) !== undefined) {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\treturn layout.read(reader).lowerText.bottom + this._editor.editor.getScrollTop();\n\t\t});\n\t\tthis._div = n.div({\n\t\t\tclass: 'line-replacement',\n\t\t}, [\n\t\t\tderived(this, reader => {\n\t\t\t\tconst layout = mapOutFalsy(this._layout).read(reader);\n\t\t\t\tconst modifiedLineElements = this._modifiedLineElements.read(reader);\n\t\t\t\tif (!layout || !modifiedLineElements) {\n\t\t\t\t\treturn [];\n\t\t\t\t}\n\n\t\t\t\tconst layoutProps = layout.read(reader);\n\t\t\t\tconst contentLeft = this._editor.layoutInfoContentLeft.read(reader);\n\n\t\t\t\tconst separatorWidth = this._isInDiffEditor.read(reader) ? 3 : 1;\n\n\t\t\t\tmodifiedLineElements.lines.forEach((l, i) => {\n\t\t\t\t\tl.style.width = `${layoutProps.lowerText.width}px`;\n\t\t\t\t\tl.style.height = `${layoutProps.modifiedLineHeights[i]}px`;\n\t\t\t\t\tl.style.position = 'relative';\n\t\t\t\t});\n\n\t\t\t\tconst modifiedBorderColor = getModifiedBorderColor(this._tabAction).read(reader);\n\t\t\t\tconst originalBorderColor = getOriginalBorderColor(this._tabAction).read(reader);\n\n\t\t\t\treturn [\n\t\t\t\t\tn.div({\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t...rectToProps((r) => getEditorValidOverlayRect(this._editor).read(r)),\n\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t\t\t}\n\t\t\t\t\t}, [\n\t\t\t\t\t\tn.div({\n\t\t\t\t\t\t\tclass: 'borderAroundLineReplacement',\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\t...rectToProps(reader => layout.read(reader).background.translateX(-contentLeft).withMargin(separatorWidth)),\n\t\t\t\t\t\t\t\tborderRadius: '4px',\n\n\t\t\t\t\t\t\t\tborder: `${separatorWidth + 1}px solid ${asCssVariable(editorBackground)}`,\n\t\t\t\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tn.div({\n\t\t\t\t\t\t\tclass: 'originalOverlayLineReplacement',\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\t...rectToProps(reader => layout.read(reader).background.translateX(-contentLeft)),\n\t\t\t\t\t\t\t\tborderRadius: '4px',\n\n\t\t\t\t\t\t\t\tborder: getEditorBlendedColor(originalBorderColor, this._themeService).map(c => `1px solid ${c.toString()}`),\n\t\t\t\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\t\t\t\tbackground: asCssVariable(originalBackgroundColor),\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tn.div({\n\t\t\t\t\t\t\tclass: 'modifiedOverlayLineReplacement',\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\t...rectToProps(reader => layout.read(reader).lowerBackground.translateX(-contentLeft)),\n\t\t\t\t\t\t\t\tborderRadius: '0 0 4px 4px',\n\t\t\t\t\t\t\t\tbackground: asCssVariable(editorBackground),\n\t\t\t\t\t\t\t\tboxShadow: `${asCssVariable(scrollbarShadow)} 0 6px 6px -6px`,\n\t\t\t\t\t\t\t\tborder: `1px solid ${asCssVariable(modifiedBorderColor)}`,\n\t\t\t\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\t\tcursor: 'pointer',\n\t\t\t\t\t\t\t\tpointerEvents: 'auto',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tonmousedown: e => {\n\t\t\t\t\t\t\t\te.preventDefault(); // This prevents that the editor loses focus\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tonclick: (e) => this._onDidClick.fire(new StandardMouseEvent(getWindow(e), e)),\n\t\t\t\t\t\t}, [\n\t\t\t\t\t\t\tn.div({\n\t\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\t\tposition: 'absolute', top: 0, left: 0, width: '100%', height: '100%',\n\t\t\t\t\t\t\t\t\tbackground: asCssVariable(modifiedChangedLineBackgroundColor),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tn.div({\n\t\t\t\t\t\t\tclass: 'modifiedLinesLineReplacement',\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\t\t\t\t...rectToProps(reader => layout.read(reader).lowerText.translateX(-contentLeft)),\n\t\t\t\t\t\t\t\tfontFamily: this._editor.getOption(EditorOption.fontFamily),\n\t\t\t\t\t\t\t\tfontSize: this._editor.getOption(EditorOption.fontSize),\n\t\t\t\t\t\t\t\tfontWeight: this._editor.getOption(EditorOption.fontWeight),\n\t\t\t\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t\t\t\t\twhiteSpace: 'nowrap',\n\t\t\t\t\t\t\t\tborderRadius: '0 0 4px 4px',\n\t\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, [...modifiedLineElements.lines]),\n\t\t\t\t\t])\n\t\t\t\t];\n\t\t\t})\n\t\t]).keepUpdated(this._store);\n\t\tthis.isHovered = this._editor.isTargetHovered((e) => this._isMouseOverWidget(e), this._store);\n\t\tthis._previousViewZoneInfo = undefined;\n\n\t\tthis._register(toDisposable(() => this._editor.editor.changeViewZones(accessor => this.removePreviousViewZone(accessor))));\n\n\t\tthis._register(autorunDelta(this._viewZoneInfo, ({ lastValue, newValue }) => {\n\t\t\tif (lastValue === newValue || (lastValue?.height === newValue?.height && lastValue?.lineNumber === newValue?.lineNumber)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis._editor.editor.changeViewZones((changeAccessor) => {\n\t\t\t\tthis.removePreviousViewZone(changeAccessor);\n\t\t\t\tif (!newValue) { return; }\n\t\t\t\tthis.addViewZone(newValue, changeAccessor);\n\t\t\t});\n\t\t}));\n\n\t\tthis._register(this._editor.createOverlayWidget({\n\t\t\tdomNode: this._div.element,\n\t\t\tminContentWidthInPx: derived(this, reader => {\n\t\t\t\treturn this._layout.read(reader)?.minContentWidthRequired ?? 0;\n\t\t\t}),\n\t\t\tposition: constObservable({ preference: { top: 0, left: 0 } }),\n\t\t\tallowEditorOverflow: false,\n\t\t}));\n\t}\n\n\tprivate _isMouseOverWidget(e: IEditorMouseEvent): boolean {\n\t\tconst layout = this._layout.get();\n\t\tif (!layout || !(e.event instanceof EditorMouseEvent)) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn layout.lowerBackground.containsPoint(new Point(e.event.relativePos.x, e.event.relativePos.y));\n\t}\n\n\t// View Zones\n\tprivate _previousViewZoneInfo: { height: number; lineNumber: number; id: string } | undefined;\n\n\tprivate removePreviousViewZone(changeAccessor: IViewZoneChangeAccessor) {\n\t\tif (!this._previousViewZoneInfo) {\n\t\t\treturn;\n\t\t}\n\n\t\tchangeAccessor.removeZone(this._previousViewZoneInfo.id);\n\n\t\tconst cursorLineNumber = this._editor.cursorLineNumber.get();\n\t\tif (cursorLineNumber !== null && cursorLineNumber >= this._previousViewZoneInfo.lineNumber) {\n\t\t\tthis._editor.editor.setScrollTop(this._editor.scrollTop.get() - this._previousViewZoneInfo.height);\n\t\t}\n\n\t\tthis._previousViewZoneInfo = undefined;\n\t}\n\n\tprivate addViewZone(viewZoneInfo: { height: number; lineNumber: number }, changeAccessor: IViewZoneChangeAccessor) {\n\t\tconst activeViewZone = changeAccessor.addZone({\n\t\t\tafterLineNumber: viewZoneInfo.lineNumber - 1,\n\t\t\theightInPx: viewZoneInfo.height, // move computation to layout?\n\t\t\tdomNode: $('div'),\n\t\t});\n\n\t\tthis._previousViewZoneInfo = { height: viewZoneInfo.height, lineNumber: viewZoneInfo.lineNumber, id: activeViewZone };\n\n\t\tconst cursorLineNumber = this._editor.cursorLineNumber.get();\n\t\tif (cursorLineNumber !== null && cursorLineNumber >= viewZoneInfo.lineNumber) {\n\t\t\tthis._editor.editor.setScrollTop(this._editor.scrollTop.get() + viewZoneInfo.height);\n\t\t}\n\t}\n}\n\nfunction rangesToBubbleRanges(ranges: Range[]): Range[] {\n\tconst result: Range[] = [];\n\twhile (ranges.length) {\n\t\tlet range = ranges.shift()!;\n\t\tif (range.startLineNumber !== range.endLineNumber) {\n\t\t\tranges.push(new Range(range.startLineNumber + 1, 1, range.endLineNumber, range.endColumn));\n\t\t\trange = new Range(range.startLineNumber, range.startColumn, range.startLineNumber, Number.MAX_SAFE_INTEGER); // TODO: this is not correct\n\t\t}\n\n\t\tresult.push(range);\n\t}\n\treturn result;\n\n}\n\nexport interface Replacement {\n\toriginalRange: Range;\n\tmodifiedRange: Range;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsLineReplacementView.ts","vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsLineReplacementView.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;AAEhG,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,0CAA0C,CAAC;AAC3E,OAAO,EAAe,kBAAkB,EAAE,MAAM,iDAAiD,CAAC;AAClG,OAAO,EAAE,OAAO,EAAE,MAAM,2CAA2C,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAC;AACzF,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,OAAO,EAAe,MAAM,gDAAgD,CAAC;AACrH,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,6DAA6D,CAAC;AAChH,OAAO,EAAE,aAAa,EAAE,MAAM,0DAA0D,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,MAAM,4DAA4D,CAAC;AAE3F,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAE1E,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,2FAA2F,CAAC;AAEnJ,OAAO,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,0CAA0C,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,MAAM,wCAAwC,CAAC;AAE/D,OAAO,EAAE,WAAW,EAAE,MAAM,qDAAqD,CAAC;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,gDAAgD,CAAC;AAClF,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;AACvF,OAAO,EAAE,gBAAgB,EAAwB,MAAM,yDAAyD,CAAC;AAEjH,OAAO,EAAE,qBAAqB,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M,EAAE,CAAC;QACtB,IAAI,KAAK,GAAG,MAAM,CAAC,KAAK,EAAG,CAAC;QAC5B,IAAI,KAAK,CAAC,eAAe,KAAK,KAAK,CAAC,aAAa,EAAE,CAAC;YACnD,MAAM,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,eAAe,GAAG,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;YAC3F,KAAK,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC,eAAe,EAAE,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,eAAe,EAAE,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,4BAA4B;QAC1I,CAAC;QAED,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACpB,CAAC;IACD,OAAO,MAAM,CAAC;AAEf,CAAC","file":"inlineEditsLineReplacementView.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { $, getWindow, n } from '../../../../../../../base/browser/dom.js';\nimport { IMouseEvent, StandardMouseEvent } from '../../../../../../../base/browser/mouseEvent.js';\nimport { Emitter } from '../../../../../../../base/common/event.js';\nimport { Disposable, toDisposable } from '../../../../../../../base/common/lifecycle.js';\nimport { autorunDelta, constObservable, derived, IObservable } from '../../../../../../../base/common/observable.js';\nimport { editorBackground, scrollbarShadow } from '../../../../../../../platform/theme/common/colorRegistry.js';\nimport { asCssVariable } from '../../../../../../../platform/theme/common/colorUtils.js';\nimport { IThemeService } from '../../../../../../../platform/theme/common/themeService.js';\nimport { IEditorMouseEvent, IViewZoneChangeAccessor } from '../../../../../../browser/editorBrowser.js';\nimport { EditorMouseEvent } from '../../../../../../browser/editorDom.js';\nimport { ObservableCodeEditor } from '../../../../../../browser/observableCodeEditor.js';\nimport { LineSource, renderLines, RenderOptions } from '../../../../../../browser/widget/diffEditor/components/diffEditorViewZones/renderLines.js';\nimport { EditorOption } from '../../../../../../common/config/editorOptions.js';\nimport { Point } from '../../../../../../common/core/2d/point.js';\nimport { Rect } from '../../../../../../common/core/2d/rect.js';\nimport { Range } from '../../../../../../common/core/range.js';\nimport { LineRange } from '../../../../../../common/core/ranges/lineRange.js';\nimport { OffsetRange } from '../../../../../../common/core/ranges/offsetRange.js';\nimport { ILanguageService } from '../../../../../../common/languages/language.js';\nimport { LineTokens, TokenArray } from '../../../../../../common/tokens/lineTokens.js';\nimport { InlineDecoration, InlineDecorationType } from '../../../../../../common/viewModel/inlineDecorations.js';\nimport { IInlineEditsView, InlineEditTabAction } from '../inlineEditsViewInterface.js';\nimport { getEditorBlendedColor, getModifiedBorderColor, getOriginalBorderColor, modifiedChangedLineBackgroundColor, originalBackgroundColor } from '../theme.js';\nimport { getEditorValidOverlayRect, getPrefixTrim, mapOutFalsy, rectToProps } from '../utils/utils.js';\n\nexport class InlineEditsLineReplacementView extends Disposable implements IInlineEditsView {\n\n\tprivate readonly _onDidClick;\n\treadonly onDidClick;\n\n\tprivate readonly _maxPrefixTrim;\n\n\tprivate readonly _modifiedLineElements;\n\n\n\tprivate readonly _layout;\n\n\tprivate readonly _viewZoneInfo;\n\n\tprivate readonly _div;\n\n\treadonly isHovered;\n\n\treadonly minEditorScrollHeight;\n\n\tconstructor(\n\t\tprivate readonly _editor: ObservableCodeEditor,\n\t\tprivate readonly _edit: IObservable<{\n\t\t\toriginalRange: LineRange;\n\t\t\tmodifiedRange: LineRange;\n\t\t\tmodifiedLines: string[];\n\t\t\treplacements: Replacement[];\n\t\t} | undefined>,\n\t\tprivate readonly _isInDiffEditor: IObservable<boolean>,\n\t\tprivate readonly _tabAction: IObservable<InlineEditTabAction>,\n\t\t@ILanguageService private readonly _languageService: ILanguageService,\n\t\t@IThemeService private readonly _themeService: IThemeService,\n\t) {\n\t\tsuper();\n\t\tthis._onDidClick = this._register(new Emitter<IMouseEvent>());\n\t\tthis.onDidClick = this._onDidClick.event;\n\t\tthis._maxPrefixTrim = this._edit.map((e, reader) => e ? getPrefixTrim(e.replacements.flatMap(r => [r.originalRange, r.modifiedRange]), e.originalRange, e.modifiedLines, this._editor.editor, reader) : undefined);\n\t\tthis._modifiedLineElements = derived(this, reader => {\n\t\t\tconst lines = [];\n\t\t\tlet requiredWidth = 0;\n\n\t\t\tconst prefixTrim = this._maxPrefixTrim.read(reader);\n\t\t\tconst edit = this._edit.read(reader);\n\t\t\tif (!edit || !prefixTrim) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst maxPrefixTrim = prefixTrim.prefixTrim;\n\t\t\tconst modifiedBubbles = rangesToBubbleRanges(edit.replacements.map(r => r.modifiedRange)).map(r => new Range(r.startLineNumber, r.startColumn - maxPrefixTrim, r.endLineNumber, r.endColumn - maxPrefixTrim));\n\n\t\t\tconst textModel = this._editor.model.get()!;\n\t\t\tconst startLineNumber = edit.modifiedRange.startLineNumber;\n\t\t\tfor (let i = 0; i < edit.modifiedRange.length; i++) {\n\t\t\t\tconst line = document.createElement('div');\n\t\t\t\tconst lineNumber = startLineNumber + i;\n\t\t\t\tconst modLine = edit.modifiedLines[i].slice(maxPrefixTrim);\n\n\t\t\t\tconst t = textModel.tokenization.tokenizeLinesAt(lineNumber, [modLine])?.[0];\n\t\t\t\tlet tokens: LineTokens;\n\t\t\t\tif (t) {\n\t\t\t\t\ttokens = TokenArray.fromLineTokens(t).toLineTokens(modLine, this._languageService.languageIdCodec);\n\t\t\t\t} else {\n\t\t\t\t\ttokens = LineTokens.createEmpty(modLine, this._languageService.languageIdCodec);\n\t\t\t\t}\n\n\t\t\t\tconst decorations = [];\n\t\t\t\tfor (const modified of modifiedBubbles.filter(b => b.startLineNumber === lineNumber)) {\n\t\t\t\t\tconst validatedEndColumn = Math.min(modified.endColumn, modLine.length + 1);\n\t\t\t\t\tdecorations.push(new InlineDecoration(new Range(1, modified.startColumn, 1, validatedEndColumn), 'inlineCompletions-modified-bubble', InlineDecorationType.Regular));\n\t\t\t\t}\n\n\t\t\t\t// TODO: All lines should be rendered at once for one dom element\n\t\t\t\tconst result = renderLines(new LineSource([tokens]), RenderOptions.fromEditor(this._editor.editor).withSetWidth(false).withScrollBeyondLastColumn(0), decorations, line, true);\n\t\t\t\tthis._editor.getOption(EditorOption.fontInfo).read(reader); // update when font info changes\n\n\t\t\t\trequiredWidth = Math.max(requiredWidth, result.minWidthInPx);\n\n\t\t\t\tlines.push(line);\n\t\t\t}\n\n\t\t\treturn { lines, requiredWidth: requiredWidth };\n\t\t});\n\t\tthis._layout = derived(this, reader => {\n\t\t\tconst modifiedLines = this._modifiedLineElements.read(reader);\n\t\t\tconst maxPrefixTrim = this._maxPrefixTrim.read(reader);\n\t\t\tconst edit = this._edit.read(reader);\n\t\t\tif (!modifiedLines || !maxPrefixTrim || !edit) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst { prefixLeftOffset } = maxPrefixTrim;\n\t\t\tconst { requiredWidth } = modifiedLines;\n\n\t\t\tconst originalLineHeights = this._editor.observeLineHeightsForLineRange(edit.originalRange).read(reader);\n\t\t\tconst modifiedLineHeights = (() => {\n\t\t\t\tconst lineHeights = originalLineHeights.slice(0, edit.modifiedRange.length);\n\t\t\t\twhile (lineHeights.length < edit.modifiedRange.length) {\n\t\t\t\t\tlineHeights.push(originalLineHeights[originalLineHeights.length - 1]);\n\t\t\t\t}\n\t\t\t\treturn lineHeights;\n\t\t\t})();\n\n\t\t\tconst contentLeft = this._editor.layoutInfoContentLeft.read(reader);\n\t\t\tconst verticalScrollbarWidth = this._editor.layoutInfoVerticalScrollbarWidth.read(reader);\n\t\t\tconst scrollLeft = this._editor.scrollLeft.read(reader);\n\t\t\tconst scrollTop = this._editor.scrollTop.read(reader);\n\t\t\tconst editorLeftOffset = contentLeft - scrollLeft;\n\n\t\t\tconst textModel = this._editor.editor.getModel()!;\n\n\t\t\tconst originalLineWidths = edit.originalRange.mapToLineArray(line => this._editor.editor.getOffsetForColumn(line, textModel.getLineMaxColumn(line)) - prefixLeftOffset);\n\t\t\tconst maxLineWidth = Math.max(...originalLineWidths, requiredWidth);\n\n\t\t\tconst startLineNumber = edit.originalRange.startLineNumber;\n\t\t\tconst endLineNumber = edit.originalRange.endLineNumberExclusive - 1;\n\t\t\tconst topOfOriginalLines = this._editor.editor.getTopForLineNumber(startLineNumber) - scrollTop;\n\t\t\tconst bottomOfOriginalLines = this._editor.editor.getBottomForLineNumber(endLineNumber) - scrollTop;\n\n\t\t\t// Box Widget positioning\n\t\t\tconst originalLinesOverlay = Rect.fromLeftTopWidthHeight(\n\t\t\t\teditorLeftOffset + prefixLeftOffset,\n\t\t\t\ttopOfOriginalLines,\n\t\t\t\tmaxLineWidth,\n\t\t\t\tbottomOfOriginalLines - topOfOriginalLines\n\t\t\t);\n\t\t\tconst modifiedLinesOverlay = Rect.fromLeftTopWidthHeight(\n\t\t\t\toriginalLinesOverlay.left,\n\t\t\t\toriginalLinesOverlay.bottom,\n\t\t\t\toriginalLinesOverlay.width,\n\t\t\t\tmodifiedLineHeights.reduce((sum, h) => sum + h, 0)\n\t\t\t);\n\t\t\tconst background = Rect.hull([originalLinesOverlay, modifiedLinesOverlay]);\n\n\t\t\tconst lowerBackground = background.intersectVertical(new OffsetRange(originalLinesOverlay.bottom, Number.MAX_SAFE_INTEGER));\n\t\t\tconst lowerText = new Rect(lowerBackground.left, lowerBackground.top, lowerBackground.right, lowerBackground.bottom);\n\n\t\t\treturn {\n\t\t\t\toriginalLinesOverlay,\n\t\t\t\tmodifiedLinesOverlay,\n\t\t\t\tbackground,\n\t\t\t\tlowerBackground,\n\t\t\t\tlowerText,\n\t\t\t\tmodifiedLineHeights,\n\t\t\t\tminContentWidthRequired: prefixLeftOffset + maxLineWidth + verticalScrollbarWidth,\n\t\t\t};\n\t\t});\n\t\tthis._viewZoneInfo = derived<{ height: number; lineNumber: number } | undefined>(reader => {\n\t\t\tconst shouldShowViewZone = this._editor.getOption(EditorOption.inlineSuggest).map(o => o.edits.allowCodeShifting === 'always').read(reader);\n\t\t\tif (!shouldShowViewZone) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst layout = this._layout.read(reader);\n\t\t\tconst edit = this._edit.read(reader);\n\t\t\tif (!layout || !edit) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst viewZoneHeight = layout.lowerBackground.height;\n\t\t\tconst viewZoneLineNumber = edit.originalRange.endLineNumberExclusive;\n\t\t\treturn { height: viewZoneHeight, lineNumber: viewZoneLineNumber };\n\t\t});\n\t\tthis.minEditorScrollHeight = derived(this, reader => {\n\t\t\tconst layout = mapOutFalsy(this._layout).read(reader);\n\t\t\tif (!layout || this._viewZoneInfo.read(reader) !== undefined) {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\treturn layout.read(reader).lowerText.bottom + this._editor.editor.getScrollTop();\n\t\t});\n\t\tthis._div = n.div({\n\t\t\tclass: 'line-replacement',\n\t\t}, [\n\t\t\tderived(this, reader => {\n\t\t\t\tconst layout = mapOutFalsy(this._layout).read(reader);\n\t\t\t\tconst modifiedLineElements = this._modifiedLineElements.read(reader);\n\t\t\t\tif (!layout || !modifiedLineElements) {\n\t\t\t\t\treturn [];\n\t\t\t\t}\n\n\t\t\t\tconst layoutProps = layout.read(reader);\n\t\t\t\tconst contentLeft = this._editor.layoutInfoContentLeft.read(reader);\n\n\t\t\t\tconst separatorWidth = this._isInDiffEditor.read(reader) ? 3 : 1;\n\n\t\t\t\tmodifiedLineElements.lines.forEach((l, i) => {\n\t\t\t\t\tl.style.width = `${layoutProps.lowerText.width}px`;\n\t\t\t\t\tl.style.height = `${layoutProps.modifiedLineHeights[i]}px`;\n\t\t\t\t\tl.style.position = 'relative';\n\t\t\t\t});\n\n\t\t\t\tconst modifiedBorderColor = getModifiedBorderColor(this._tabAction).read(reader);\n\t\t\t\tconst originalBorderColor = getOriginalBorderColor(this._tabAction).read(reader);\n\n\t\t\t\treturn [\n\t\t\t\t\tn.div({\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t...rectToProps((r) => getEditorValidOverlayRect(this._editor).read(r)),\n\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t\t\t}\n\t\t\t\t\t}, [\n\t\t\t\t\t\tn.div({\n\t\t\t\t\t\t\tclass: 'borderAroundLineReplacement',\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\t...rectToProps(reader => layout.read(reader).background.translateX(-contentLeft).withMargin(separatorWidth)),\n\t\t\t\t\t\t\t\tborderRadius: '4px',\n\n\t\t\t\t\t\t\t\tborder: `${separatorWidth + 1}px solid ${asCssVariable(editorBackground)}`,\n\t\t\t\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tn.div({\n\t\t\t\t\t\t\tclass: 'originalOverlayLineReplacement',\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\t...rectToProps(reader => layout.read(reader).background.translateX(-contentLeft)),\n\t\t\t\t\t\t\t\tborderRadius: '4px',\n\n\t\t\t\t\t\t\t\tborder: getEditorBlendedColor(originalBorderColor, this._themeService).map(c => `1px solid ${c.toString()}`),\n\t\t\t\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\t\t\t\tbackground: asCssVariable(originalBackgroundColor),\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tn.div({\n\t\t\t\t\t\t\tclass: 'modifiedOverlayLineReplacement',\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\t...rectToProps(reader => layout.read(reader).lowerBackground.translateX(-contentLeft)),\n\t\t\t\t\t\t\t\tborderRadius: '0 0 4px 4px',\n\t\t\t\t\t\t\t\tbackground: asCssVariable(editorBackground),\n\t\t\t\t\t\t\t\tboxShadow: `${asCssVariable(scrollbarShadow)} 0 6px 6px -6px`,\n\t\t\t\t\t\t\t\tborder: `1px solid ${asCssVariable(modifiedBorderColor)}`,\n\t\t\t\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\t\tcursor: 'pointer',\n\t\t\t\t\t\t\t\tpointerEvents: 'auto',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tonmousedown: e => {\n\t\t\t\t\t\t\t\te.preventDefault(); // This prevents that the editor loses focus\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tonclick: (e) => this._onDidClick.fire(new StandardMouseEvent(getWindow(e), e)),\n\t\t\t\t\t\t}, [\n\t\t\t\t\t\t\tn.div({\n\t\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\t\tposition: 'absolute', top: 0, left: 0, width: '100%', height: '100%',\n\t\t\t\t\t\t\t\t\tbackground: asCssVariable(modifiedChangedLineBackgroundColor),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tn.div({\n\t\t\t\t\t\t\tclass: 'modifiedLinesLineReplacement',\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\t\t\t\t...rectToProps(reader => layout.read(reader).lowerText.translateX(-contentLeft)),\n\t\t\t\t\t\t\t\tfontFamily: this._editor.getOption(EditorOption.fontFamily),\n\t\t\t\t\t\t\t\tfontSize: this._editor.getOption(EditorOption.fontSize),\n\t\t\t\t\t\t\t\tfontWeight: this._editor.getOption(EditorOption.fontWeight),\n\t\t\t\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t\t\t\t\twhiteSpace: 'nowrap',\n\t\t\t\t\t\t\t\tborderRadius: '0 0 4px 4px',\n\t\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, [...modifiedLineElements.lines]),\n\t\t\t\t\t])\n\t\t\t\t];\n\t\t\t})\n\t\t]).keepUpdated(this._store);\n\t\tthis.isHovered = this._editor.isTargetHovered((e) => this._isMouseOverWidget(e), this._store);\n\t\tthis._previousViewZoneInfo = undefined;\n\n\t\tthis._register(toDisposable(() => this._editor.editor.changeViewZones(accessor => this.removePreviousViewZone(accessor))));\n\n\t\tthis._register(autorunDelta(this._viewZoneInfo, ({ lastValue, newValue }) => {\n\t\t\tif (lastValue === newValue || (lastValue?.height === newValue?.height && lastValue?.lineNumber === newValue?.lineNumber)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis._editor.editor.changeViewZones((changeAccessor) => {\n\t\t\t\tthis.removePreviousViewZone(changeAccessor);\n\t\t\t\tif (!newValue) { return; }\n\t\t\t\tthis.addViewZone(newValue, changeAccessor);\n\t\t\t});\n\t\t}));\n\n\t\tthis._register(this._editor.createOverlayWidget({\n\t\t\tdomNode: this._div.element,\n\t\t\tminContentWidthInPx: derived(this, reader => {\n\t\t\t\treturn this._layout.read(reader)?.minContentWidthRequired ?? 0;\n\t\t\t}),\n\t\t\tposition: constObservable({ preference: { top: 0, left: 0 } }),\n\t\t\tallowEditorOverflow: false,\n\t\t}));\n\t}\n\n\tprivate _isMouseOverWidget(e: IEditorMouseEvent): boolean {\n\t\tconst layout = this._layout.get();\n\t\tif (!layout || !(e.event instanceof EditorMouseEvent)) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn layout.lowerBackground.containsPoint(new Point(e.event.relativePos.x, e.event.relativePos.y));\n\t}\n\n\t// View Zones\n\tprivate _previousViewZoneInfo: { height: number; lineNumber: number; id: string } | undefined;\n\n\tprivate removePreviousViewZone(changeAccessor: IViewZoneChangeAccessor) {\n\t\tif (!this._previousViewZoneInfo) {\n\t\t\treturn;\n\t\t}\n\n\t\tchangeAccessor.removeZone(this._previousViewZoneInfo.id);\n\n\t\tconst cursorLineNumber = this._editor.cursorLineNumber.get();\n\t\tif (cursorLineNumber !== null && cursorLineNumber >= this._previousViewZoneInfo.lineNumber) {\n\t\t\tthis._editor.editor.setScrollTop(this._editor.scrollTop.get() - this._previousViewZoneInfo.height);\n\t\t}\n\n\t\tthis._previousViewZoneInfo = undefined;\n\t}\n\n\tprivate addViewZone(viewZoneInfo: { height: number; lineNumber: number }, changeAccessor: IViewZoneChangeAccessor) {\n\t\tconst activeViewZone = changeAccessor.addZone({\n\t\t\tafterLineNumber: viewZoneInfo.lineNumber - 1,\n\t\t\theightInPx: viewZoneInfo.height, // move computation to layout?\n\t\t\tdomNode: $('div'),\n\t\t});\n\n\t\tthis._previousViewZoneInfo = { height: viewZoneInfo.height, lineNumber: viewZoneInfo.lineNumber, id: activeViewZone };\n\n\t\tconst cursorLineNumber = this._editor.cursorLineNumber.get();\n\t\tif (cursorLineNumber !== null && cursorLineNumber >= viewZoneInfo.lineNumber) {\n\t\t\tthis._editor.editor.setScrollTop(this._editor.scrollTop.get() + viewZoneInfo.height);\n\t\t}\n\t}\n}\n\nfunction rangesToBubbleRanges(ranges: Range[]): Range[] {\n\tconst result: Range[] = [];\n\twhile (ranges.length) {\n\t\tlet range = ranges.shift()!;\n\t\tif (range.startLineNumber !== range.endLineNumber) {\n\t\t\tranges.push(new Range(range.startLineNumber + 1, 1, range.endLineNumber, range.endColumn));\n\t\t\trange = new Range(range.startLineNumber, range.startColumn, range.startLineNumber, Number.MAX_SAFE_INTEGER); // TODO: this is not correct\n\t\t}\n\n\t\tresult.push(range);\n\t}\n\treturn result;\n\n}\n\nexport interface Replacement {\n\toriginalRange: Range;\n\tmodifiedRange: Range;\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { $, getWindow, n } from '../../../../../../../base/browser/dom.js';\nimport { IMouseEvent, StandardMouseEvent } from '../../../../../../../base/browser/mouseEvent.js';\nimport { Emitter } from '../../../../../../../base/common/event.js';\nimport { Disposable, toDisposable } from '../../../../../../../base/common/lifecycle.js';\nimport { autorunDelta, constObservable, derived, IObservable } from '../../../../../../../base/common/observable.js';\nimport { editorBackground, scrollbarShadow } from '../../../../../../../platform/theme/common/colorRegistry.js';\nimport { asCssVariable } from '../../../../../../../platform/theme/common/colorUtils.js';\nimport { IThemeService } from '../../../../../../../platform/theme/common/themeService.js';\nimport { IEditorMouseEvent, IViewZoneChangeAccessor } from '../../../../../../browser/editorBrowser.js';\nimport { EditorMouseEvent } from '../../../../../../browser/editorDom.js';\nimport { ObservableCodeEditor } from '../../../../../../browser/observableCodeEditor.js';\nimport { LineSource, renderLines, RenderOptions } from '../../../../../../browser/widget/diffEditor/components/diffEditorViewZones/renderLines.js';\nimport { EditorOption } from '../../../../../../common/config/editorOptions.js';\nimport { Point } from '../../../../../../common/core/2d/point.js';\nimport { Rect } from '../../../../../../common/core/2d/rect.js';\nimport { Range } from '../../../../../../common/core/range.js';\nimport { LineRange } from '../../../../../../common/core/ranges/lineRange.js';\nimport { OffsetRange } from '../../../../../../common/core/ranges/offsetRange.js';\nimport { ILanguageService } from '../../../../../../common/languages/language.js';\nimport { LineTokens, TokenArray } from '../../../../../../common/tokens/lineTokens.js';\nimport { InlineDecoration, InlineDecorationType } from '../../../../../../common/viewModel/inlineDecorations.js';\nimport { IInlineEditsView, InlineEditTabAction } from '../inlineEditsViewInterface.js';\nimport { getEditorBlendedColor, getModifiedBorderColor, getOriginalBorderColor, modifiedChangedLineBackgroundColor, originalBackgroundColor } from '../theme.js';\nimport { getEditorValidOverlayRect, getPrefixTrim, mapOutFalsy, rectToProps } from '../utils/utils.js';\n\nexport class InlineEditsLineReplacementView extends Disposable implements IInlineEditsView {\n\n\tprivate readonly _onDidClick;\n\treadonly onDidClick;\n\n\tprivate readonly _maxPrefixTrim;\n\n\tprivate readonly _modifiedLineElements;\n\n\n\tprivate readonly _layout;\n\n\tprivate readonly _viewZoneInfo;\n\n\tprivate readonly _div;\n\n\treadonly isHovered;\n\n\treadonly minEditorScrollHeight;\n\n\tconstructor(\n\t\tprivate readonly _editor: ObservableCodeEditor,\n\t\tprivate readonly _edit: IObservable<{\n\t\t\toriginalRange: LineRange;\n\t\t\tmodifiedRange: LineRange;\n\t\t\tmodifiedLines: string[];\n\t\t\treplacements: Replacement[];\n\t\t} | undefined>,\n\t\tprivate readonly _isInDiffEditor: IObservable<boolean>,\n\t\tprivate readonly _tabAction: IObservable<InlineEditTabAction>,\n\t\t@ILanguageService private readonly _languageService: ILanguageService,\n\t\t@IThemeService private readonly _themeService: IThemeService,\n\t) {\n\t\tsuper();\n\t\tthis._onDidClick = this._register(new Emitter<IMouseEvent>());\n\t\tthis.onDidClick = this._onDidClick.event;\n\t\tthis._maxPrefixTrim = this._edit.map((e, reader) => e ? getPrefixTrim(e.replacements.flatMap(r => [r.originalRange, r.modifiedRange]), e.originalRange, e.modifiedLines, this._editor.editor, reader) : undefined);\n\t\tthis._modifiedLineElements = derived(this, reader => {\n\t\t\tconst lines = [];\n\t\t\tlet requiredWidth = 0;\n\n\t\t\tconst prefixTrim = this._maxPrefixTrim.read(reader);\n\t\t\tconst edit = this._edit.read(reader);\n\t\t\tif (!edit || !prefixTrim) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst maxPrefixTrim = prefixTrim.prefixTrim;\n\t\t\tconst modifiedBubbles = rangesToBubbleRanges(edit.replacements.map(r => r.modifiedRange)).map(r => new Range(r.startLineNumber, r.startColumn - maxPrefixTrim, r.endLineNumber, r.endColumn - maxPrefixTrim));\n\n\t\t\tconst textModel = this._editor.model.get()!;\n\t\t\tconst startLineNumber = edit.modifiedRange.startLineNumber;\n\t\t\tfor (let i = 0; i < edit.modifiedRange.length; i++) {\n\t\t\t\tconst line = document.createElement('div');\n\t\t\t\tconst lineNumber = startLineNumber + i;\n\t\t\t\tconst modLine = edit.modifiedLines[i].slice(maxPrefixTrim);\n\n\t\t\t\tconst t = textModel.tokenization.tokenizeLinesAt(lineNumber, [modLine])?.[0];\n\t\t\t\tlet tokens: LineTokens;\n\t\t\t\tif (t) {\n\t\t\t\t\ttokens = TokenArray.fromLineTokens(t).toLineTokens(modLine, this._languageService.languageIdCodec);\n\t\t\t\t} else {\n\t\t\t\t\ttokens = LineTokens.createEmpty(modLine, this._languageService.languageIdCodec);\n\t\t\t\t}\n\n\t\t\t\tconst decorations = [];\n\t\t\t\tfor (const modified of modifiedBubbles.filter(b => b.startLineNumber === lineNumber)) {\n\t\t\t\t\tconst validatedEndColumn = Math.min(modified.endColumn, modLine.length + 1);\n\t\t\t\t\tdecorations.push(new InlineDecoration(new Range(1, modified.startColumn, 1, validatedEndColumn), 'inlineCompletions-modified-bubble', InlineDecorationType.Regular));\n\t\t\t\t}\n\n\t\t\t\t// TODO: All lines should be rendered at once for one dom element\n\t\t\t\tconst result = renderLines(new LineSource([tokens]), RenderOptions.fromEditor(this._editor.editor).withSetWidth(false).withScrollBeyondLastColumn(0), decorations, line, true);\n\t\t\t\tthis._editor.getOption(EditorOption.fontInfo).read(reader); // update when font info changes\n\n\t\t\t\trequiredWidth = Math.max(requiredWidth, result.minWidthInPx);\n\n\t\t\t\tlines.push(line);\n\t\t\t}\n\n\t\t\treturn { lines, requiredWidth: requiredWidth };\n\t\t});\n\t\tthis._layout = derived(this, reader => {\n\t\t\tconst modifiedLines = this._modifiedLineElements.read(reader);\n\t\t\tconst maxPrefixTrim = this._maxPrefixTrim.read(reader);\n\t\t\tconst edit = this._edit.read(reader);\n\t\t\tif (!modifiedLines || !maxPrefixTrim || !edit) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst { prefixLeftOffset } = maxPrefixTrim;\n\t\t\tconst { requiredWidth } = modifiedLines;\n\n\t\t\tconst originalLineHeights = this._editor.observeLineHeightsForLineRange(edit.originalRange).read(reader);\n\t\t\tconst modifiedLineHeights = (() => {\n\t\t\t\tconst lineHeights = originalLineHeights.slice(0, edit.modifiedRange.length);\n\t\t\t\twhile (lineHeights.length < edit.modifiedRange.length) {\n\t\t\t\t\tlineHeights.push(originalLineHeights[originalLineHeights.length - 1]);\n\t\t\t\t}\n\t\t\t\treturn lineHeights;\n\t\t\t})();\n\n\t\t\tconst contentLeft = this._editor.layoutInfoContentLeft.read(reader);\n\t\t\tconst verticalScrollbarWidth = this._editor.layoutInfoVerticalScrollbarWidth.read(reader);\n\t\t\tconst scrollLeft = this._editor.scrollLeft.read(reader);\n\t\t\tconst scrollTop = this._editor.scrollTop.read(reader);\n\t\t\tconst editorLeftOffset = contentLeft - scrollLeft;\n\n\t\t\tconst textModel = this._editor.editor.getModel()!;\n\n\t\t\tconst originalLineWidths = edit.originalRange.mapToLineArray(line => this._editor.editor.getOffsetForColumn(line, textModel.getLineMaxColumn(line)) - prefixLeftOffset);\n\t\t\tconst maxLineWidth = Math.max(...originalLineWidths, requiredWidth);\n\n\t\t\tconst startLineNumber = edit.originalRange.startLineNumber;\n\t\t\tconst endLineNumber = edit.originalRange.endLineNumberExclusive - 1;\n\t\t\tconst topOfOriginalLines = this._editor.editor.getTopForLineNumber(startLineNumber) - scrollTop;\n\t\t\tconst bottomOfOriginalLines = this._editor.editor.getBottomForLineNumber(endLineNumber) - scrollTop;\n\n\t\t\t// Box Widget positioning\n\t\t\tconst originalLinesOverlay = Rect.fromLeftTopWidthHeight(\n\t\t\t\teditorLeftOffset + prefixLeftOffset,\n\t\t\t\ttopOfOriginalLines,\n\t\t\t\tmaxLineWidth,\n\t\t\t\tbottomOfOriginalLines - topOfOriginalLines\n\t\t\t);\n\t\t\tconst modifiedLinesOverlay = Rect.fromLeftTopWidthHeight(\n\t\t\t\toriginalLinesOverlay.left,\n\t\t\t\toriginalLinesOverlay.bottom,\n\t\t\t\toriginalLinesOverlay.width,\n\t\t\t\tmodifiedLineHeights.reduce((sum, h) => sum + h, 0)\n\t\t\t);\n\t\t\tconst background = Rect.hull([originalLinesOverlay, modifiedLinesOverlay]);\n\n\t\t\tconst lowerBackground = background.intersectVertical(new OffsetRange(originalLinesOverlay.bottom, Number.MAX_SAFE_INTEGER));\n\t\t\tconst lowerText = new Rect(lowerBackground.left, lowerBackground.top, lowerBackground.right, lowerBackground.bottom);\n\n\t\t\treturn {\n\t\t\t\toriginalLinesOverlay,\n\t\t\t\tmodifiedLinesOverlay,\n\t\t\t\tbackground,\n\t\t\t\tlowerBackground,\n\t\t\t\tlowerText,\n\t\t\t\tmodifiedLineHeights,\n\t\t\t\tminContentWidthRequired: prefixLeftOffset + maxLineWidth + verticalScrollbarWidth,\n\t\t\t};\n\t\t});\n\t\tthis._viewZoneInfo = derived<{ height: number; lineNumber: number } | undefined>(reader => {\n\t\t\tconst shouldShowViewZone = this._editor.getOption(EditorOption.inlineSuggest).map(o => o.edits.allowCodeShifting === 'always').read(reader);\n\t\t\tif (!shouldShowViewZone) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst layout = this._layout.read(reader);\n\t\t\tconst edit = this._edit.read(reader);\n\t\t\tif (!layout || !edit) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst viewZoneHeight = layout.lowerBackground.height;\n\t\t\tconst viewZoneLineNumber = edit.originalRange.endLineNumberExclusive;\n\t\t\treturn { height: viewZoneHeight, lineNumber: viewZoneLineNumber };\n\t\t});\n\t\tthis.minEditorScrollHeight = derived(this, reader => {\n\t\t\tconst layout = mapOutFalsy(this._layout).read(reader);\n\t\t\tif (!layout || this._viewZoneInfo.read(reader) !== undefined) {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\treturn layout.read(reader).lowerText.bottom + this._editor.editor.getScrollTop();\n\t\t});\n\t\tthis._div = n.div({\n\t\t\tclass: 'line-replacement',\n\t\t}, [\n\t\t\tderived(this, reader => {\n\t\t\t\tconst layout = mapOutFalsy(this._layout).read(reader);\n\t\t\t\tconst modifiedLineElements = this._modifiedLineElements.read(reader);\n\t\t\t\tif (!layout || !modifiedLineElements) {\n\t\t\t\t\treturn [];\n\t\t\t\t}\n\n\t\t\t\tconst layoutProps = layout.read(reader);\n\t\t\t\tconst contentLeft = this._editor.layoutInfoContentLeft.read(reader);\n\n\t\t\t\tconst separatorWidth = this._isInDiffEditor.read(reader) ? 3 : 1;\n\n\t\t\t\tmodifiedLineElements.lines.forEach((l, i) => {\n\t\t\t\t\tl.style.width = `${layoutProps.lowerText.width}px`;\n\t\t\t\t\tl.style.height = `${layoutProps.modifiedLineHeights[i]}px`;\n\t\t\t\t\tl.style.position = 'relative';\n\t\t\t\t});\n\n\t\t\t\tconst modifiedBorderColor = getModifiedBorderColor(this._tabAction).read(reader);\n\t\t\t\tconst originalBorderColor = getOriginalBorderColor(this._tabAction).read(reader);\n\n\t\t\t\treturn [\n\t\t\t\t\tn.div({\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t...rectToProps((r) => getEditorValidOverlayRect(this._editor).read(r)),\n\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t\t\t}\n\t\t\t\t\t}, [\n\t\t\t\t\t\tn.div({\n\t\t\t\t\t\t\tclass: 'borderAroundLineReplacement',\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\t...rectToProps(reader => layout.read(reader).background.translateX(-contentLeft).withMargin(separatorWidth)),\n\t\t\t\t\t\t\t\tborderRadius: '4px',\n\n\t\t\t\t\t\t\t\tborder: `${separatorWidth + 1}px solid ${asCssVariable(editorBackground)}`,\n\t\t\t\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tn.div({\n\t\t\t\t\t\t\tclass: 'originalOverlayLineReplacement',\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\t...rectToProps(reader => layout.read(reader).background.translateX(-contentLeft)),\n\t\t\t\t\t\t\t\tborderRadius: '4px',\n\n\t\t\t\t\t\t\t\tborder: getEditorBlendedColor(originalBorderColor, this._themeService).map(c => `1px solid ${c.toString()}`),\n\t\t\t\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\t\t\t\tbackground: asCssVariable(originalBackgroundColor),\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tn.div({\n\t\t\t\t\t\t\tclass: 'modifiedOverlayLineReplacement',\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\t...rectToProps(reader => layout.read(reader).lowerBackground.translateX(-contentLeft)),\n\t\t\t\t\t\t\t\tborderRadius: '0 0 4px 4px',\n\t\t\t\t\t\t\t\tbackground: asCssVariable(editorBackground),\n\t\t\t\t\t\t\t\tboxShadow: `${asCssVariable(scrollbarShadow)} 0 6px 6px -6px`,\n\t\t\t\t\t\t\t\tborder: `1px solid ${asCssVariable(modifiedBorderColor)}`,\n\t\t\t\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\t\tcursor: 'pointer',\n\t\t\t\t\t\t\t\tpointerEvents: 'auto',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tonmousedown: e => {\n\t\t\t\t\t\t\t\te.preventDefault(); // This prevents that the editor loses focus\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tonclick: (e) => this._onDidClick.fire(new StandardMouseEvent(getWindow(e), e)),\n\t\t\t\t\t\t}, [\n\t\t\t\t\t\t\tn.div({\n\t\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\t\tposition: 'absolute', top: 0, left: 0, width: '100%', height: '100%',\n\t\t\t\t\t\t\t\t\tbackground: asCssVariable(modifiedChangedLineBackgroundColor),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tn.div({\n\t\t\t\t\t\t\tclass: 'modifiedLinesLineReplacement',\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\t\t\t\t...rectToProps(reader => layout.read(reader).lowerText.translateX(-contentLeft)),\n\t\t\t\t\t\t\t\tfontFamily: this._editor.getOption(EditorOption.fontFamily),\n\t\t\t\t\t\t\t\tfontSize: this._editor.getOption(EditorOption.fontSize),\n\t\t\t\t\t\t\t\tfontWeight: this._editor.getOption(EditorOption.fontWeight),\n\t\t\t\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t\t\t\t\twhiteSpace: 'nowrap',\n\t\t\t\t\t\t\t\tborderRadius: '0 0 4px 4px',\n\t\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, [...modifiedLineElements.lines]),\n\t\t\t\t\t])\n\t\t\t\t];\n\t\t\t})\n\t\t]).keepUpdated(this._store);\n\t\tthis.isHovered = this._editor.isTargetHovered((e) => this._isMouseOverWidget(e), this._store);\n\t\tthis._previousViewZoneInfo = undefined;\n\n\t\tthis._register(toDisposable(() => this._editor.editor.changeViewZones(accessor => this.removePreviousViewZone(accessor))));\n\n\t\tthis._register(autorunDelta(this._viewZoneInfo, ({ lastValue, newValue }) => {\n\t\t\tif (lastValue === newValue || (lastValue?.height === newValue?.height && lastValue?.lineNumber === newValue?.lineNumber)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis._editor.editor.changeViewZones((changeAccessor) => {\n\t\t\t\tthis.removePreviousViewZone(changeAccessor);\n\t\t\t\tif (!newValue) { return; }\n\t\t\t\tthis.addViewZone(newValue, changeAccessor);\n\t\t\t});\n\t\t}));\n\n\t\tthis._register(this._editor.createOverlayWidget({\n\t\t\tdomNode: this._div.element,\n\t\t\tminContentWidthInPx: derived(this, reader => {\n\t\t\t\treturn this._layout.read(reader)?.minContentWidthRequired ?? 0;\n\t\t\t}),\n\t\t\tposition: constObservable({ preference: { top: 0, left: 0 } }),\n\t\t\tallowEditorOverflow: false,\n\t\t}));\n\t}\n\n\tprivate _isMouseOverWidget(e: IEditorMouseEvent): boolean {\n\t\tconst layout = this._layout.get();\n\t\tif (!layout || !(e.event instanceof EditorMouseEvent)) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn layout.lowerBackground.containsPoint(new Point(e.event.relativePos.x, e.event.relativePos.y));\n\t}\n\n\t// View Zones\n\tprivate _previousViewZoneInfo: { height: number; lineNumber: number; id: string } | undefined;\n\n\tprivate removePreviousViewZone(changeAccessor: IViewZoneChangeAccessor) {\n\t\tif (!this._previousViewZoneInfo) {\n\t\t\treturn;\n\t\t}\n\n\t\tchangeAccessor.removeZone(this._previousViewZoneInfo.id);\n\n\t\tconst cursorLineNumber = this._editor.cursorLineNumber.get();\n\t\tif (cursorLineNumber !== null && cursorLineNumber >= this._previousViewZoneInfo.lineNumber) {\n\t\t\tthis._editor.editor.setScrollTop(this._editor.scrollTop.get() - this._previousViewZoneInfo.height);\n\t\t}\n\n\t\tthis._previousViewZoneInfo = undefined;\n\t}\n\n\tprivate addViewZone(viewZoneInfo: { height: number; lineNumber: number }, changeAccessor: IViewZoneChangeAccessor) {\n\t\tconst activeViewZone = changeAccessor.addZone({\n\t\t\tafterLineNumber: viewZoneInfo.lineNumber - 1,\n\t\t\theightInPx: viewZoneInfo.height, // move computation to layout?\n\t\t\tdomNode: $('div'),\n\t\t});\n\n\t\tthis._previousViewZoneInfo = { height: viewZoneInfo.height, lineNumber: viewZoneInfo.lineNumber, id: activeViewZone };\n\n\t\tconst cursorLineNumber = this._editor.cursorLineNumber.get();\n\t\tif (cursorLineNumber !== null && cursorLineNumber >= viewZoneInfo.lineNumber) {\n\t\t\tthis._editor.editor.setScrollTop(this._editor.scrollTop.get() + viewZoneInfo.height);\n\t\t}\n\t}\n}\n\nfunction rangesToBubbleRanges(ranges: Range[]): Range[] {\n\tconst result: Range[] = [];\n\twhile (ranges.length) {\n\t\tlet range = ranges.shift()!;\n\t\tif (range.startLineNumber !== range.endLineNumber) {\n\t\t\tranges.push(new Range(range.startLineNumber + 1, 1, range.endLineNumber, range.endColumn));\n\t\t\trange = new Range(range.startLineNumber, range.startColumn, range.startLineNumber, Number.MAX_SAFE_INTEGER); // TODO: this is not correct\n\t\t}\n\n\t\tresult.push(range);\n\t}\n\treturn result;\n\n}\n\nexport interface Replacement {\n\toriginalRange: Range;\n\tmodifiedRange: Range;\n}\n"]}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { numberComparator } from '../../../../../../../base/common/arrays.js';
|
|
2
2
|
import { findFirstMin } from '../../../../../../../base/common/arraysFind.js';
|
|
3
|
-
import { derived, derivedObservableWithCache, derivedOpts } from '../../../../../../../base/common/observable.js';
|
|
3
|
+
import { DebugLocation, derived, derivedObservableWithCache, derivedOpts } from '../../../../../../../base/common/observable.js';
|
|
4
4
|
import { splitLines } from '../../../../../../../base/common/strings.js';
|
|
5
|
+
import { observableCodeEditor } from '../../../../../../browser/observableCodeEditor.js';
|
|
5
6
|
import { Rect } from '../../../../../../common/core/2d/rect.js';
|
|
6
7
|
import { OffsetRange } from '../../../../../../common/core/ranges/offsetRange.js';
|
|
7
8
|
import { Position } from '../../../../../../common/core/position.js';
|
|
@@ -47,7 +48,7 @@ export function getOffsetForPos(editor, pos, reader) {
|
|
|
47
48
|
const lineContentWidth = editor.editor.getOffsetForColumn(pos.lineNumber, pos.column);
|
|
48
49
|
return lineContentWidth;
|
|
49
50
|
}
|
|
50
|
-
export function getPrefixTrim(diffRanges, originalLinesRange, modifiedLines, editor) {
|
|
51
|
+
export function getPrefixTrim(diffRanges, originalLinesRange, modifiedLines, editor, reader = undefined) {
|
|
51
52
|
const textModel = editor.getModel();
|
|
52
53
|
if (!textModel) {
|
|
53
54
|
return { prefixTrim: 0, prefixLeftOffset: 0 };
|
|
@@ -60,6 +61,8 @@ export function getPrefixTrim(diffRanges, originalLinesRange, modifiedLines, edi
|
|
|
60
61
|
const startLineIndent = textModel.getLineIndentColumn(originalLinesRange.startLineNumber);
|
|
61
62
|
if (startLineIndent >= prefixTrim + 1) {
|
|
62
63
|
// We can use the editor to get the offset
|
|
64
|
+
// TODO go through other usages of getOffsetForColumn and come up with a robust reactive solution to read it
|
|
65
|
+
observableCodeEditor(editor).scrollTop.read(reader); // getOffsetForColumn requires the line number to be visible. This might change on scroll top.
|
|
63
66
|
prefixLeftOffset = editor.getOffsetForColumn(originalLinesRange.startLineNumber, prefixTrim + 1);
|
|
64
67
|
}
|
|
65
68
|
else if (modifiedLines.length > 0) {
|
|
@@ -190,12 +193,12 @@ export function mapOutFalsy(obs) {
|
|
|
190
193
|
return nonUndefinedObs;
|
|
191
194
|
});
|
|
192
195
|
}
|
|
193
|
-
export function rectToProps(fn) {
|
|
196
|
+
export function rectToProps(fn, debugLocation = DebugLocation.ofCaller()) {
|
|
194
197
|
return {
|
|
195
|
-
left: derived({ name: 'editor.validOverlay.left' }, reader => /** @description left */ fn(reader).left),
|
|
196
|
-
top: derived({ name: 'editor.validOverlay.top' }, reader => /** @description top */ fn(reader).top),
|
|
197
|
-
width: derived({ name: 'editor.validOverlay.width' }, reader => /** @description width */ fn(reader).right - fn(reader).left),
|
|
198
|
-
height: derived({ name: 'editor.validOverlay.height' }, reader => /** @description height */ fn(reader).bottom - fn(reader).top),
|
|
198
|
+
left: derived({ name: 'editor.validOverlay.left' }, reader => /** @description left */ fn(reader).left, debugLocation),
|
|
199
|
+
top: derived({ name: 'editor.validOverlay.top' }, reader => /** @description top */ fn(reader).top, debugLocation),
|
|
200
|
+
width: derived({ name: 'editor.validOverlay.width' }, reader => /** @description width */ fn(reader).right - fn(reader).left, debugLocation),
|
|
201
|
+
height: derived({ name: 'editor.validOverlay.height' }, reader => /** @description height */ fn(reader).bottom - fn(reader).top, debugLocation),
|
|
199
202
|
};
|
|
200
203
|
}
|
|
201
204
|
//# sourceMappingURL=utils.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/utils/utils.ts","vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/utils/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,gDAAgD,CAAC;AAC9E,OAAO,EAAE,OAAO,EAAE,0BAA0B,EAAE,WAAW,EAAwB,MAAM,gDAAgD,CAAC;AACxI,OAAO,EAAE,UAAU,EAAE,MAAM,6CAA6C,CAAC;AAIzE,OAAO,EAAE,IAAI,EAAE,MAAM,0CAA0C,CAAC;AAGhE,OAAO,EAAE,WAAW,EAAE,MAAM,qDAAqD,CAAC;AAClF,OAAO,EAAE,QAAQ,EAAE,MAAM,2CAA2C,CAAC;AACrE,OAAO,EAAE,KAAK,EAAE,MAAM,wCAAwC,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,iDAAiD,CAAC;AAC5F,OAAO,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAC;AAE7E,OAAO,EAAE,YAAY,EAAE,MAAM,6CAA6C,CAAC;AAE3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;AAEhF,MAAM,UAAU,sBAAsB,CAAC,MAA4B,EAAE,KAAgB,EAAE,MAA2B;IACjH,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC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AAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC7B,IAAI,CAAC,GAAG,EAAE,CAAC;YACV,OAAO,SAAqB,CAAC;QAC9B,CAAC;QAED,OAAO,eAA8C,CAAC;IACvD,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,EAA6B;IACxD,OAAO;QACN,IAAI,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,0BAA0B,EAAE,EAAE,MAAM,CAAC,EAAE,CAAC,wBAAwB,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC;QACvG,GAAG,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,yBAAyB,EAAE,EAAE,MAAM,CAAC,EAAE,CAAC,uBAAuB,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC;QACnG,KAAK,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,2BAA2B,EAAE,EAAE,MAAM,CAAC,EAAE,CAAC,yBAAyB,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC;QAC7H,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,4BAA4B,EAAE,EAAE,MAAM,CAAC,EAAE,CAAC,0BAA0B,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC;KAChI,CAAC;AACH,CAAC","file":"utils.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["\nimport { numberComparator } from '../../../../../../../base/common/arrays.js';\nimport { findFirstMin } from '../../../../../../../base/common/arraysFind.js';\nimport { derived, derivedObservableWithCache, derivedOpts, IObservable, IReader } from '../../../../../../../base/common/observable.js';\nimport { splitLines } from '../../../../../../../base/common/strings.js';\nimport { ICodeEditor } from '../../../../../../browser/editorBrowser.js';\nimport { ObservableCodeEditor } from '../../../../../../browser/observableCodeEditor.js';\nimport { Point } from '../../../../../../common/core/2d/point.js';\nimport { Rect } from '../../../../../../common/core/2d/rect.js';\nimport { EditorOption } from '../../../../../../common/config/editorOptions.js';\nimport { LineRange } from '../../../../../../common/core/ranges/lineRange.js';\nimport { OffsetRange } from '../../../../../../common/core/ranges/offsetRange.js';\nimport { Position } from '../../../../../../common/core/position.js';\nimport { Range } from '../../../../../../common/core/range.js';\nimport { TextReplacement, TextEdit } from '../../../../../../common/core/edits/textEdit.js';\nimport { RangeMapping } from '../../../../../../common/diff/rangeMapping.js';\nimport { ITextModel } from '../../../../../../common/model.js';\nimport { indentOfLine } from '../../../../../../common/model/textModel.js';\nimport { CharCode } from '../../../../../../../base/common/charCode.js';\nimport { BugIndicatingError } from '../../../../../../../base/common/errors.js';\n\nexport function maxContentWidthInRange(editor: ObservableCodeEditor, range: LineRange, reader: IReader | undefined): number {\n\teditor.layoutInfo.read(reader);\n\teditor.value.read(reader);\n\n\tconst model = editor.model.read(reader);\n\tif (!model) { return 0; }\n\tlet maxContentWidth = 0;\n\n\teditor.scrollTop.read(reader);\n\tfor (let i = range.startLineNumber; i < range.endLineNumberExclusive; i++) {\n\t\tconst column = model.getLineMaxColumn(i);\n\t\tlet lineContentWidth = editor.editor.getOffsetForColumn(i, column);\n\t\tif (lineContentWidth === -1) {\n\t\t\t// approximation\n\t\t\tconst typicalHalfwidthCharacterWidth = editor.editor.getOption(EditorOption.fontInfo).typicalHalfwidthCharacterWidth;\n\t\t\tconst approximation = column * typicalHalfwidthCharacterWidth;\n\t\t\tlineContentWidth = approximation;\n\t\t}\n\t\tmaxContentWidth = Math.max(maxContentWidth, lineContentWidth);\n\t}\n\tconst lines = range.mapToLineArray(l => model.getLineContent(l));\n\n\tif (maxContentWidth < 5 && lines.some(l => l.length > 0) && model.uri.scheme !== 'file') {\n\t\tconsole.error('unexpected width');\n\t}\n\treturn maxContentWidth;\n}\n\nexport function getOffsetForPos(editor: ObservableCodeEditor, pos: Position, reader: IReader): number {\n\teditor.layoutInfo.read(reader);\n\teditor.value.read(reader);\n\n\tconst model = editor.model.read(reader);\n\tif (!model) { return 0; }\n\n\teditor.scrollTop.read(reader);\n\tconst lineContentWidth = editor.editor.getOffsetForColumn(pos.lineNumber, pos.column);\n\n\treturn lineContentWidth;\n}\n\nexport function getPrefixTrim(diffRanges: Range[], originalLinesRange: LineRange, modifiedLines: string[], editor: ICodeEditor): { prefixTrim: number; prefixLeftOffset: number } {\n\tconst textModel = editor.getModel();\n\tif (!textModel) {\n\t\treturn { prefixTrim: 0, prefixLeftOffset: 0 };\n\t}\n\n\tconst replacementStart = diffRanges.map(r => r.isSingleLine() ? r.startColumn - 1 : 0);\n\tconst originalIndents = originalLinesRange.mapToLineArray(line => indentOfLine(textModel.getLineContent(line)));\n\tconst modifiedIndents = modifiedLines.filter(line => line !== '').map(line => indentOfLine(line));\n\tconst prefixTrim = Math.min(...replacementStart, ...originalIndents, ...modifiedIndents);\n\n\tlet prefixLeftOffset;\n\tconst startLineIndent = textModel.getLineIndentColumn(originalLinesRange.startLineNumber);\n\tif (startLineIndent >= prefixTrim + 1) {\n\t\t// We can use the editor to get the offset\n\t\tprefixLeftOffset = editor.getOffsetForColumn(originalLinesRange.startLineNumber, prefixTrim + 1);\n\t} else if (modifiedLines.length > 0) {\n\t\t// Content is not in the editor, we can use the content width to calculate the offset\n\t\tprefixLeftOffset = getContentRenderWidth(modifiedLines[0].slice(0, prefixTrim), editor, textModel);\n\t} else {\n\t\t// unable to approximate the offset\n\t\treturn { prefixTrim: 0, prefixLeftOffset: 0 };\n\t}\n\n\treturn { prefixTrim, prefixLeftOffset };\n}\n\nexport function getContentRenderWidth(content: string, editor: ICodeEditor, textModel: ITextModel) {\n\tconst w = editor.getOption(EditorOption.fontInfo).typicalHalfwidthCharacterWidth;\n\tconst tabSize = textModel.getOptions().tabSize * w;\n\n\tconst numTabs = content.split('\\t').length - 1;\n\tconst numNoneTabs = content.length - numTabs;\n\treturn numNoneTabs * w + numTabs * tabSize;\n}\n\nexport function getEditorValidOverlayRect(editor: ObservableCodeEditor): IObservable<Rect> {\n\tconst contentLeft = editor.layoutInfoContentLeft;\n\n\tconst width = derived({ name: 'editor.validOverlay.width' }, r => {\n\t\tconst hasMinimapOnTheRight = editor.layoutInfoMinimap.read(r).minimapLeft !== 0;\n\t\tconst editorWidth = editor.layoutInfoWidth.read(r) - contentLeft.read(r);\n\n\t\tif (hasMinimapOnTheRight) {\n\t\t\tconst minimapAndScrollbarWidth = editor.layoutInfoMinimap.read(r).minimapWidth + editor.layoutInfoVerticalScrollbarWidth.read(r);\n\t\t\treturn editorWidth - minimapAndScrollbarWidth;\n\t\t}\n\n\t\treturn editorWidth;\n\t});\n\n\tconst height = derived({ name: 'editor.validOverlay.height' }, r => editor.layoutInfoHeight.read(r) + editor.contentHeight.read(r));\n\n\treturn derived({ name: 'editor.validOverlay' }, r => Rect.fromLeftTopWidthHeight(contentLeft.read(r), 0, width.read(r), height.read(r)));\n}\nexport function applyEditToModifiedRangeMappings(rangeMapping: RangeMapping[], edit: TextEdit): RangeMapping[] {\n\tconst updatedMappings: RangeMapping[] = [];\n\tfor (const m of rangeMapping) {\n\t\tconst updatedRange = edit.mapRange(m.modifiedRange);\n\t\tupdatedMappings.push(new RangeMapping(m.originalRange, updatedRange));\n\t}\n\treturn updatedMappings;\n}\n\n\nexport function classNames(...classes: (string | false | undefined | null)[]) {\n\treturn classes.filter(c => typeof c === 'string').join(' ');\n}\n\nfunction offsetRangeToRange(columnOffsetRange: OffsetRange, startPos: Position): Range {\n\treturn new Range(\n\t\tstartPos.lineNumber,\n\t\tstartPos.column + columnOffsetRange.start,\n\t\tstartPos.lineNumber,\n\t\tstartPos.column + columnOffsetRange.endExclusive,\n\t);\n}\n\n/**\n * Calculates the indentation size (in spaces) of a given line,\n * interpreting tabs as the specified tab size.\n */\nfunction getIndentationSize(line: string, tabSize: number): number {\n\tlet currentSize = 0;\n\tloop: for (let i = 0, len = line.length; i < len; i++) {\n\t\tswitch (line.charCodeAt(i)) {\n\t\t\tcase CharCode.Tab: currentSize += tabSize; break;\n\t\t\tcase CharCode.Space: currentSize++; break;\n\t\t\tdefault: break loop;\n\t\t}\n\t}\n\t// if currentSize % tabSize !== 0,\n\t// then there are spaces which are not part of the indentation\n\treturn currentSize - (currentSize % tabSize);\n}\n\n/**\n * Calculates the number of characters at the start of a line that correspond to a given indentation size,\n * taking into account both tabs and spaces.\n */\nfunction indentSizeToIndentLength(line: string, indentSize: number, tabSize: number): number {\n\tlet remainingSize = indentSize - (indentSize % tabSize);\n\tlet i = 0;\n\tfor (; i < line.length; i++) {\n\t\tif (remainingSize === 0) {\n\t\t\tbreak;\n\t\t}\n\t\tswitch (line.charCodeAt(i)) {\n\t\t\tcase CharCode.Tab: remainingSize -= tabSize; break;\n\t\t\tcase CharCode.Space: remainingSize--; break;\n\t\t\tdefault: throw new BugIndicatingError('Unexpected character found while calculating indent length');\n\t\t}\n\t}\n\treturn i;\n}\n\nexport function createReindentEdit(text: string, range: LineRange, tabSize: number): TextEdit {\n\tconst newLines = splitLines(text);\n\tconst edits: TextReplacement[] = [];\n\tconst minIndentSize = findFirstMin(range.mapToLineArray(l => getIndentationSize(newLines[l - 1], tabSize)), numberComparator)!;\n\trange.forEach(lineNumber => {\n\t\tconst indentLength = indentSizeToIndentLength(newLines[lineNumber - 1], minIndentSize, tabSize);\n\t\tedits.push(new TextReplacement(offsetRangeToRange(new OffsetRange(0, indentLength), new Position(lineNumber, 1)), ''));\n\t});\n\treturn new TextEdit(edits);\n}\n\nexport class PathBuilder {\n\tprivate _data: string = '';\n\n\tpublic moveTo(point: Point): this {\n\t\tthis._data += `M ${point.x} ${point.y} `;\n\t\treturn this;\n\t}\n\n\tpublic lineTo(point: Point): this {\n\t\tthis._data += `L ${point.x} ${point.y} `;\n\t\treturn this;\n\t}\n\n\tpublic build(): string {\n\t\treturn this._data;\n\t}\n}\n\ntype RemoveFalsy<T> = T extends false | undefined | null ? never : T;\ntype Falsy<T> = T extends false | undefined | null ? T : never;\n\nexport function mapOutFalsy<T>(obs: IObservable<T>): IObservable<IObservable<RemoveFalsy<T>> | Falsy<T>> {\n\tconst nonUndefinedObs = derivedObservableWithCache<T | undefined | null | false>(undefined, (reader, lastValue) => obs.read(reader) || lastValue);\n\n\treturn derivedOpts({\n\t\tdebugName: () => `${obs.debugName}.mapOutFalsy`\n\t}, reader => {\n\t\tnonUndefinedObs.read(reader);\n\t\tconst val = obs.read(reader);\n\t\tif (!val) {\n\t\t\treturn undefined as Falsy<T>;\n\t\t}\n\n\t\treturn nonUndefinedObs as IObservable<RemoveFalsy<T>>;\n\t});\n}\n\nexport function rectToProps(fn: (reader: IReader) => Rect) {\n\treturn {\n\t\tleft: derived({ name: 'editor.validOverlay.left' }, reader => /** @description left */ fn(reader).left),\n\t\ttop: derived({ name: 'editor.validOverlay.top' }, reader => /** @description top */ fn(reader).top),\n\t\twidth: derived({ name: 'editor.validOverlay.width' }, reader => /** @description width */ fn(reader).right - fn(reader).left),\n\t\theight: derived({ name: 'editor.validOverlay.height' }, reader => /** @description height */ fn(reader).bottom - fn(reader).top),\n\t};\n}\n\nexport type FirstFnArg<T> = T extends (arg: infer U) => any ? U : never;\n","\nimport { numberComparator } from '../../../../../../../base/common/arrays.js';\nimport { findFirstMin } from '../../../../../../../base/common/arraysFind.js';\nimport { derived, derivedObservableWithCache, derivedOpts, IObservable, IReader } from '../../../../../../../base/common/observable.js';\nimport { splitLines } from '../../../../../../../base/common/strings.js';\nimport { ICodeEditor } from '../../../../../../browser/editorBrowser.js';\nimport { ObservableCodeEditor } from '../../../../../../browser/observableCodeEditor.js';\nimport { Point } from '../../../../../../common/core/2d/point.js';\nimport { Rect } from '../../../../../../common/core/2d/rect.js';\nimport { EditorOption } from '../../../../../../common/config/editorOptions.js';\nimport { LineRange } from '../../../../../../common/core/ranges/lineRange.js';\nimport { OffsetRange } from '../../../../../../common/core/ranges/offsetRange.js';\nimport { Position } from '../../../../../../common/core/position.js';\nimport { Range } from '../../../../../../common/core/range.js';\nimport { TextReplacement, TextEdit } from '../../../../../../common/core/edits/textEdit.js';\nimport { RangeMapping } from '../../../../../../common/diff/rangeMapping.js';\nimport { ITextModel } from '../../../../../../common/model.js';\nimport { indentOfLine } from '../../../../../../common/model/textModel.js';\nimport { CharCode } from '../../../../../../../base/common/charCode.js';\nimport { BugIndicatingError } from '../../../../../../../base/common/errors.js';\n\nexport function maxContentWidthInRange(editor: ObservableCodeEditor, range: LineRange, reader: IReader | undefined): number {\n\teditor.layoutInfo.read(reader);\n\teditor.value.read(reader);\n\n\tconst model = editor.model.read(reader);\n\tif (!model) { return 0; }\n\tlet maxContentWidth = 0;\n\n\teditor.scrollTop.read(reader);\n\tfor (let i = range.startLineNumber; i < range.endLineNumberExclusive; i++) {\n\t\tconst column = model.getLineMaxColumn(i);\n\t\tlet lineContentWidth = editor.editor.getOffsetForColumn(i, column);\n\t\tif (lineContentWidth === -1) {\n\t\t\t// approximation\n\t\t\tconst typicalHalfwidthCharacterWidth = editor.editor.getOption(EditorOption.fontInfo).typicalHalfwidthCharacterWidth;\n\t\t\tconst approximation = column * typicalHalfwidthCharacterWidth;\n\t\t\tlineContentWidth = approximation;\n\t\t}\n\t\tmaxContentWidth = Math.max(maxContentWidth, lineContentWidth);\n\t}\n\tconst lines = range.mapToLineArray(l => model.getLineContent(l));\n\n\tif (maxContentWidth < 5 && lines.some(l => l.length > 0) && model.uri.scheme !== 'file') {\n\t\tconsole.error('unexpected width');\n\t}\n\treturn maxContentWidth;\n}\n\nexport function getOffsetForPos(editor: ObservableCodeEditor, pos: Position, reader: IReader): number {\n\teditor.layoutInfo.read(reader);\n\teditor.value.read(reader);\n\n\tconst model = editor.model.read(reader);\n\tif (!model) { return 0; }\n\n\teditor.scrollTop.read(reader);\n\tconst lineContentWidth = editor.editor.getOffsetForColumn(pos.lineNumber, pos.column);\n\n\treturn lineContentWidth;\n}\n\nexport function getPrefixTrim(diffRanges: Range[], originalLinesRange: LineRange, modifiedLines: string[], editor: ICodeEditor): { prefixTrim: number; prefixLeftOffset: number } {\n\tconst textModel = editor.getModel();\n\tif (!textModel) {\n\t\treturn { prefixTrim: 0, prefixLeftOffset: 0 };\n\t}\n\n\tconst replacementStart = diffRanges.map(r => r.isSingleLine() ? r.startColumn - 1 : 0);\n\tconst originalIndents = originalLinesRange.mapToLineArray(line => indentOfLine(textModel.getLineContent(line)));\n\tconst modifiedIndents = modifiedLines.filter(line => line !== '').map(line => indentOfLine(line));\n\tconst prefixTrim = Math.min(...replacementStart, ...originalIndents, ...modifiedIndents);\n\n\tlet prefixLeftOffset;\n\tconst startLineIndent = textModel.getLineIndentColumn(originalLinesRange.startLineNumber);\n\tif (startLineIndent >= prefixTrim + 1) {\n\t\t// We can use the editor to get the offset\n\t\tprefixLeftOffset = editor.getOffsetForColumn(originalLinesRange.startLineNumber, prefixTrim + 1);\n\t} else if (modifiedLines.length > 0) {\n\t\t// Content is not in the editor, we can use the content width to calculate the offset\n\t\tprefixLeftOffset = getContentRenderWidth(modifiedLines[0].slice(0, prefixTrim), editor, textModel);\n\t} else {\n\t\t// unable to approximate the offset\n\t\treturn { prefixTrim: 0, prefixLeftOffset: 0 };\n\t}\n\n\treturn { prefixTrim, prefixLeftOffset };\n}\n\nexport function getContentRenderWidth(content: string, editor: ICodeEditor, textModel: ITextModel) {\n\tconst w = editor.getOption(EditorOption.fontInfo).typicalHalfwidthCharacterWidth;\n\tconst tabSize = textModel.getOptions().tabSize * w;\n\n\tconst numTabs = content.split('\\t').length - 1;\n\tconst numNoneTabs = content.length - numTabs;\n\treturn numNoneTabs * w + numTabs * tabSize;\n}\n\nexport function getEditorValidOverlayRect(editor: ObservableCodeEditor): IObservable<Rect> {\n\tconst contentLeft = editor.layoutInfoContentLeft;\n\n\tconst width = derived({ name: 'editor.validOverlay.width' }, r => {\n\t\tconst hasMinimapOnTheRight = editor.layoutInfoMinimap.read(r).minimapLeft !== 0;\n\t\tconst editorWidth = editor.layoutInfoWidth.read(r) - contentLeft.read(r);\n\n\t\tif (hasMinimapOnTheRight) {\n\t\t\tconst minimapAndScrollbarWidth = editor.layoutInfoMinimap.read(r).minimapWidth + editor.layoutInfoVerticalScrollbarWidth.read(r);\n\t\t\treturn editorWidth - minimapAndScrollbarWidth;\n\t\t}\n\n\t\treturn editorWidth;\n\t});\n\n\tconst height = derived({ name: 'editor.validOverlay.height' }, r => editor.layoutInfoHeight.read(r) + editor.contentHeight.read(r));\n\n\treturn derived({ name: 'editor.validOverlay' }, r => Rect.fromLeftTopWidthHeight(contentLeft.read(r), 0, width.read(r), height.read(r)));\n}\nexport function applyEditToModifiedRangeMappings(rangeMapping: RangeMapping[], edit: TextEdit): RangeMapping[] {\n\tconst updatedMappings: RangeMapping[] = [];\n\tfor (const m of rangeMapping) {\n\t\tconst updatedRange = edit.mapRange(m.modifiedRange);\n\t\tupdatedMappings.push(new RangeMapping(m.originalRange, updatedRange));\n\t}\n\treturn updatedMappings;\n}\n\n\nexport function classNames(...classes: (string | false | undefined | null)[]) {\n\treturn classes.filter(c => typeof c === 'string').join(' ');\n}\n\nfunction offsetRangeToRange(columnOffsetRange: OffsetRange, startPos: Position): Range {\n\treturn new Range(\n\t\tstartPos.lineNumber,\n\t\tstartPos.column + columnOffsetRange.start,\n\t\tstartPos.lineNumber,\n\t\tstartPos.column + columnOffsetRange.endExclusive,\n\t);\n}\n\n/**\n * Calculates the indentation size (in spaces) of a given line,\n * interpreting tabs as the specified tab size.\n */\nfunction getIndentationSize(line: string, tabSize: number): number {\n\tlet currentSize = 0;\n\tloop: for (let i = 0, len = line.length; i < len; i++) {\n\t\tswitch (line.charCodeAt(i)) {\n\t\t\tcase CharCode.Tab: currentSize += tabSize; break;\n\t\t\tcase CharCode.Space: currentSize++; break;\n\t\t\tdefault: break loop;\n\t\t}\n\t}\n\t// if currentSize % tabSize !== 0,\n\t// then there are spaces which are not part of the indentation\n\treturn currentSize - (currentSize % tabSize);\n}\n\n/**\n * Calculates the number of characters at the start of a line that correspond to a given indentation size,\n * taking into account both tabs and spaces.\n */\nfunction indentSizeToIndentLength(line: string, indentSize: number, tabSize: number): number {\n\tlet remainingSize = indentSize - (indentSize % tabSize);\n\tlet i = 0;\n\tfor (; i < line.length; i++) {\n\t\tif (remainingSize === 0) {\n\t\t\tbreak;\n\t\t}\n\t\tswitch (line.charCodeAt(i)) {\n\t\t\tcase CharCode.Tab: remainingSize -= tabSize; break;\n\t\t\tcase CharCode.Space: remainingSize--; break;\n\t\t\tdefault: throw new BugIndicatingError('Unexpected character found while calculating indent length');\n\t\t}\n\t}\n\treturn i;\n}\n\nexport function createReindentEdit(text: string, range: LineRange, tabSize: number): TextEdit {\n\tconst newLines = splitLines(text);\n\tconst edits: TextReplacement[] = [];\n\tconst minIndentSize = findFirstMin(range.mapToLineArray(l => getIndentationSize(newLines[l - 1], tabSize)), numberComparator)!;\n\trange.forEach(lineNumber => {\n\t\tconst indentLength = indentSizeToIndentLength(newLines[lineNumber - 1], minIndentSize, tabSize);\n\t\tedits.push(new TextReplacement(offsetRangeToRange(new OffsetRange(0, indentLength), new Position(lineNumber, 1)), ''));\n\t});\n\treturn new TextEdit(edits);\n}\n\nexport class PathBuilder {\n\tprivate _data: string = '';\n\n\tpublic moveTo(point: Point): this {\n\t\tthis._data += `M ${point.x} ${point.y} `;\n\t\treturn this;\n\t}\n\n\tpublic lineTo(point: Point): this {\n\t\tthis._data += `L ${point.x} ${point.y} `;\n\t\treturn this;\n\t}\n\n\tpublic build(): string {\n\t\treturn this._data;\n\t}\n}\n\ntype RemoveFalsy<T> = T extends false | undefined | null ? never : T;\ntype Falsy<T> = T extends false | undefined | null ? T : never;\n\nexport function mapOutFalsy<T>(obs: IObservable<T>): IObservable<IObservable<RemoveFalsy<T>> | Falsy<T>> {\n\tconst nonUndefinedObs = derivedObservableWithCache<T | undefined | null | false>(undefined, (reader, lastValue) => obs.read(reader) || lastValue);\n\n\treturn derivedOpts({\n\t\tdebugName: () => `${obs.debugName}.mapOutFalsy`\n\t}, reader => {\n\t\tnonUndefinedObs.read(reader);\n\t\tconst val = obs.read(reader);\n\t\tif (!val) {\n\t\t\treturn undefined as Falsy<T>;\n\t\t}\n\n\t\treturn nonUndefinedObs as IObservable<RemoveFalsy<T>>;\n\t});\n}\n\nexport function rectToProps(fn: (reader: IReader) => Rect) {\n\treturn {\n\t\tleft: derived({ name: 'editor.validOverlay.left' }, reader => /** @description left */ fn(reader).left),\n\t\ttop: derived({ name: 'editor.validOverlay.top' }, reader => /** @description top */ fn(reader).top),\n\t\twidth: derived({ name: 'editor.validOverlay.width' }, reader => /** @description width */ fn(reader).right - fn(reader).left),\n\t\theight: derived({ name: 'editor.validOverlay.height' }, reader => /** @description height */ fn(reader).bottom - fn(reader).top),\n\t};\n}\n\nexport type FirstFnArg<T> = T extends (arg: infer U) => any ? U : never;\n"]}
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/utils/utils.ts","vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/utils/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,gDAAgD,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,0BAA0B,EAAE,WAAW,EAAwB,MAAM,gDAAgD,CAAC;AACvJ,OAAO,EAAE,UAAU,EAAE,MAAM,6CAA6C,CAAC;AAEzE,OAAO,EAAE,oBAAoB,EAAwB,MAAM,mDAAmD,CAAC;AAE/G,OAAO,EAAE,IAAI,EAAE,MAAM,0CAA0C,CAAC;AAGhE,OAAO,EAAE,WAAW,EAAE,MAAM,qDAAqD,CAAC;AAClF,OAAO,EAAE,QAAQ,EAAE,MAAM,2CAA2C,CAAC;AACrE,OAAO,EAAE,KAAK,EAAE,MAAM,wCAAwC,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,QAAQ,E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I,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,4BAA4B,EAAE,EAAE,MAAM,CAAC,EAAE,CAAC,0BAA0B,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,aAAa,CAAC;KAC/I,CAAC;AACH,CAAC","file":"utils.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["\nimport { numberComparator } from '../../../../../../../base/common/arrays.js';\nimport { findFirstMin } from '../../../../../../../base/common/arraysFind.js';\nimport { DebugLocation, derived, derivedObservableWithCache, derivedOpts, IObservable, IReader } from '../../../../../../../base/common/observable.js';\nimport { splitLines } from '../../../../../../../base/common/strings.js';\nimport { ICodeEditor } from '../../../../../../browser/editorBrowser.js';\nimport { observableCodeEditor, ObservableCodeEditor } from '../../../../../../browser/observableCodeEditor.js';\nimport { Point } from '../../../../../../common/core/2d/point.js';\nimport { Rect } from '../../../../../../common/core/2d/rect.js';\nimport { EditorOption } from '../../../../../../common/config/editorOptions.js';\nimport { LineRange } from '../../../../../../common/core/ranges/lineRange.js';\nimport { OffsetRange } from '../../../../../../common/core/ranges/offsetRange.js';\nimport { Position } from '../../../../../../common/core/position.js';\nimport { Range } from '../../../../../../common/core/range.js';\nimport { TextReplacement, TextEdit } from '../../../../../../common/core/edits/textEdit.js';\nimport { RangeMapping } from '../../../../../../common/diff/rangeMapping.js';\nimport { ITextModel } from '../../../../../../common/model.js';\nimport { indentOfLine } from '../../../../../../common/model/textModel.js';\nimport { CharCode } from '../../../../../../../base/common/charCode.js';\nimport { BugIndicatingError } from '../../../../../../../base/common/errors.js';\n\nexport function maxContentWidthInRange(editor: ObservableCodeEditor, range: LineRange, reader: IReader | undefined): number {\n\teditor.layoutInfo.read(reader);\n\teditor.value.read(reader);\n\n\tconst model = editor.model.read(reader);\n\tif (!model) { return 0; }\n\tlet maxContentWidth = 0;\n\n\teditor.scrollTop.read(reader);\n\tfor (let i = range.startLineNumber; i < range.endLineNumberExclusive; i++) {\n\t\tconst column = model.getLineMaxColumn(i);\n\t\tlet lineContentWidth = editor.editor.getOffsetForColumn(i, column);\n\t\tif (lineContentWidth === -1) {\n\t\t\t// approximation\n\t\t\tconst typicalHalfwidthCharacterWidth = editor.editor.getOption(EditorOption.fontInfo).typicalHalfwidthCharacterWidth;\n\t\t\tconst approximation = column * typicalHalfwidthCharacterWidth;\n\t\t\tlineContentWidth = approximation;\n\t\t}\n\t\tmaxContentWidth = Math.max(maxContentWidth, lineContentWidth);\n\t}\n\tconst lines = range.mapToLineArray(l => model.getLineContent(l));\n\n\tif (maxContentWidth < 5 && lines.some(l => l.length > 0) && model.uri.scheme !== 'file') {\n\t\tconsole.error('unexpected width');\n\t}\n\treturn maxContentWidth;\n}\n\nexport function getOffsetForPos(editor: ObservableCodeEditor, pos: Position, reader: IReader): number {\n\teditor.layoutInfo.read(reader);\n\teditor.value.read(reader);\n\n\tconst model = editor.model.read(reader);\n\tif (!model) { return 0; }\n\n\teditor.scrollTop.read(reader);\n\tconst lineContentWidth = editor.editor.getOffsetForColumn(pos.lineNumber, pos.column);\n\n\treturn lineContentWidth;\n}\n\nexport function getPrefixTrim(diffRanges: Range[], originalLinesRange: LineRange, modifiedLines: string[], editor: ICodeEditor, reader: IReader | undefined = undefined): { prefixTrim: number; prefixLeftOffset: number } {\n\tconst textModel = editor.getModel();\n\tif (!textModel) {\n\t\treturn { prefixTrim: 0, prefixLeftOffset: 0 };\n\t}\n\n\tconst replacementStart = diffRanges.map(r => r.isSingleLine() ? r.startColumn - 1 : 0);\n\tconst originalIndents = originalLinesRange.mapToLineArray(line => indentOfLine(textModel.getLineContent(line)));\n\tconst modifiedIndents = modifiedLines.filter(line => line !== '').map(line => indentOfLine(line));\n\tconst prefixTrim = Math.min(...replacementStart, ...originalIndents, ...modifiedIndents);\n\n\tlet prefixLeftOffset;\n\tconst startLineIndent = textModel.getLineIndentColumn(originalLinesRange.startLineNumber);\n\tif (startLineIndent >= prefixTrim + 1) {\n\t\t// We can use the editor to get the offset\n\t\t// TODO go through other usages of getOffsetForColumn and come up with a robust reactive solution to read it\n\t\tobservableCodeEditor(editor).scrollTop.read(reader); // getOffsetForColumn requires the line number to be visible. This might change on scroll top.\n\t\tprefixLeftOffset = editor.getOffsetForColumn(originalLinesRange.startLineNumber, prefixTrim + 1);\n\t} else if (modifiedLines.length > 0) {\n\t\t// Content is not in the editor, we can use the content width to calculate the offset\n\t\tprefixLeftOffset = getContentRenderWidth(modifiedLines[0].slice(0, prefixTrim), editor, textModel);\n\t} else {\n\t\t// unable to approximate the offset\n\t\treturn { prefixTrim: 0, prefixLeftOffset: 0 };\n\t}\n\n\treturn { prefixTrim, prefixLeftOffset };\n}\n\nexport function getContentRenderWidth(content: string, editor: ICodeEditor, textModel: ITextModel) {\n\tconst w = editor.getOption(EditorOption.fontInfo).typicalHalfwidthCharacterWidth;\n\tconst tabSize = textModel.getOptions().tabSize * w;\n\n\tconst numTabs = content.split('\\t').length - 1;\n\tconst numNoneTabs = content.length - numTabs;\n\treturn numNoneTabs * w + numTabs * tabSize;\n}\n\nexport function getEditorValidOverlayRect(editor: ObservableCodeEditor): IObservable<Rect> {\n\tconst contentLeft = editor.layoutInfoContentLeft;\n\n\tconst width = derived({ name: 'editor.validOverlay.width' }, r => {\n\t\tconst hasMinimapOnTheRight = editor.layoutInfoMinimap.read(r).minimapLeft !== 0;\n\t\tconst editorWidth = editor.layoutInfoWidth.read(r) - contentLeft.read(r);\n\n\t\tif (hasMinimapOnTheRight) {\n\t\t\tconst minimapAndScrollbarWidth = editor.layoutInfoMinimap.read(r).minimapWidth + editor.layoutInfoVerticalScrollbarWidth.read(r);\n\t\t\treturn editorWidth - minimapAndScrollbarWidth;\n\t\t}\n\n\t\treturn editorWidth;\n\t});\n\n\tconst height = derived({ name: 'editor.validOverlay.height' }, r => editor.layoutInfoHeight.read(r) + editor.contentHeight.read(r));\n\n\treturn derived({ name: 'editor.validOverlay' }, r => Rect.fromLeftTopWidthHeight(contentLeft.read(r), 0, width.read(r), height.read(r)));\n}\nexport function applyEditToModifiedRangeMappings(rangeMapping: RangeMapping[], edit: TextEdit): RangeMapping[] {\n\tconst updatedMappings: RangeMapping[] = [];\n\tfor (const m of rangeMapping) {\n\t\tconst updatedRange = edit.mapRange(m.modifiedRange);\n\t\tupdatedMappings.push(new RangeMapping(m.originalRange, updatedRange));\n\t}\n\treturn updatedMappings;\n}\n\n\nexport function classNames(...classes: (string | false | undefined | null)[]) {\n\treturn classes.filter(c => typeof c === 'string').join(' ');\n}\n\nfunction offsetRangeToRange(columnOffsetRange: OffsetRange, startPos: Position): Range {\n\treturn new Range(\n\t\tstartPos.lineNumber,\n\t\tstartPos.column + columnOffsetRange.start,\n\t\tstartPos.lineNumber,\n\t\tstartPos.column + columnOffsetRange.endExclusive,\n\t);\n}\n\n/**\n * Calculates the indentation size (in spaces) of a given line,\n * interpreting tabs as the specified tab size.\n */\nfunction getIndentationSize(line: string, tabSize: number): number {\n\tlet currentSize = 0;\n\tloop: for (let i = 0, len = line.length; i < len; i++) {\n\t\tswitch (line.charCodeAt(i)) {\n\t\t\tcase CharCode.Tab: currentSize += tabSize; break;\n\t\t\tcase CharCode.Space: currentSize++; break;\n\t\t\tdefault: break loop;\n\t\t}\n\t}\n\t// if currentSize % tabSize !== 0,\n\t// then there are spaces which are not part of the indentation\n\treturn currentSize - (currentSize % tabSize);\n}\n\n/**\n * Calculates the number of characters at the start of a line that correspond to a given indentation size,\n * taking into account both tabs and spaces.\n */\nfunction indentSizeToIndentLength(line: string, indentSize: number, tabSize: number): number {\n\tlet remainingSize = indentSize - (indentSize % tabSize);\n\tlet i = 0;\n\tfor (; i < line.length; i++) {\n\t\tif (remainingSize === 0) {\n\t\t\tbreak;\n\t\t}\n\t\tswitch (line.charCodeAt(i)) {\n\t\t\tcase CharCode.Tab: remainingSize -= tabSize; break;\n\t\t\tcase CharCode.Space: remainingSize--; break;\n\t\t\tdefault: throw new BugIndicatingError('Unexpected character found while calculating indent length');\n\t\t}\n\t}\n\treturn i;\n}\n\nexport function createReindentEdit(text: string, range: LineRange, tabSize: number): TextEdit {\n\tconst newLines = splitLines(text);\n\tconst edits: TextReplacement[] = [];\n\tconst minIndentSize = findFirstMin(range.mapToLineArray(l => getIndentationSize(newLines[l - 1], tabSize)), numberComparator)!;\n\trange.forEach(lineNumber => {\n\t\tconst indentLength = indentSizeToIndentLength(newLines[lineNumber - 1], minIndentSize, tabSize);\n\t\tedits.push(new TextReplacement(offsetRangeToRange(new OffsetRange(0, indentLength), new Position(lineNumber, 1)), ''));\n\t});\n\treturn new TextEdit(edits);\n}\n\nexport class PathBuilder {\n\tprivate _data: string = '';\n\n\tpublic moveTo(point: Point): this {\n\t\tthis._data += `M ${point.x} ${point.y} `;\n\t\treturn this;\n\t}\n\n\tpublic lineTo(point: Point): this {\n\t\tthis._data += `L ${point.x} ${point.y} `;\n\t\treturn this;\n\t}\n\n\tpublic build(): string {\n\t\treturn this._data;\n\t}\n}\n\ntype RemoveFalsy<T> = T extends false | undefined | null ? never : T;\ntype Falsy<T> = T extends false | undefined | null ? T : never;\n\nexport function mapOutFalsy<T>(obs: IObservable<T>): IObservable<IObservable<RemoveFalsy<T>> | Falsy<T>> {\n\tconst nonUndefinedObs = derivedObservableWithCache<T | undefined | null | false>(undefined, (reader, lastValue) => obs.read(reader) || lastValue);\n\n\treturn derivedOpts({\n\t\tdebugName: () => `${obs.debugName}.mapOutFalsy`\n\t}, reader => {\n\t\tnonUndefinedObs.read(reader);\n\t\tconst val = obs.read(reader);\n\t\tif (!val) {\n\t\t\treturn undefined as Falsy<T>;\n\t\t}\n\n\t\treturn nonUndefinedObs as IObservable<RemoveFalsy<T>>;\n\t});\n}\n\nexport function rectToProps(fn: (reader: IReader) => Rect, debugLocation: DebugLocation = DebugLocation.ofCaller()) {\n\treturn {\n\t\tleft: derived({ name: 'editor.validOverlay.left' }, reader => /** @description left */ fn(reader).left, debugLocation),\n\t\ttop: derived({ name: 'editor.validOverlay.top' }, reader => /** @description top */ fn(reader).top, debugLocation),\n\t\twidth: derived({ name: 'editor.validOverlay.width' }, reader => /** @description width */ fn(reader).right - fn(reader).left, debugLocation),\n\t\theight: derived({ name: 'editor.validOverlay.height' }, reader => /** @description height */ fn(reader).bottom - fn(reader).top, debugLocation),\n\t};\n}\n\nexport type FirstFnArg<T> = T extends (arg: infer U) => any ? U : never;\n","\nimport { numberComparator } from '../../../../../../../base/common/arrays.js';\nimport { findFirstMin } from '../../../../../../../base/common/arraysFind.js';\nimport { DebugLocation, derived, derivedObservableWithCache, derivedOpts, IObservable, IReader } from '../../../../../../../base/common/observable.js';\nimport { splitLines } from '../../../../../../../base/common/strings.js';\nimport { ICodeEditor } from '../../../../../../browser/editorBrowser.js';\nimport { observableCodeEditor, ObservableCodeEditor } from '../../../../../../browser/observableCodeEditor.js';\nimport { Point } from '../../../../../../common/core/2d/point.js';\nimport { Rect } from '../../../../../../common/core/2d/rect.js';\nimport { EditorOption } from '../../../../../../common/config/editorOptions.js';\nimport { LineRange } from '../../../../../../common/core/ranges/lineRange.js';\nimport { OffsetRange } from '../../../../../../common/core/ranges/offsetRange.js';\nimport { Position } from '../../../../../../common/core/position.js';\nimport { Range } from '../../../../../../common/core/range.js';\nimport { TextReplacement, TextEdit } from '../../../../../../common/core/edits/textEdit.js';\nimport { RangeMapping } from '../../../../../../common/diff/rangeMapping.js';\nimport { ITextModel } from '../../../../../../common/model.js';\nimport { indentOfLine } from '../../../../../../common/model/textModel.js';\nimport { CharCode } from '../../../../../../../base/common/charCode.js';\nimport { BugIndicatingError } from '../../../../../../../base/common/errors.js';\n\nexport function maxContentWidthInRange(editor: ObservableCodeEditor, range: LineRange, reader: IReader | undefined): number {\n\teditor.layoutInfo.read(reader);\n\teditor.value.read(reader);\n\n\tconst model = editor.model.read(reader);\n\tif (!model) { return 0; }\n\tlet maxContentWidth = 0;\n\n\teditor.scrollTop.read(reader);\n\tfor (let i = range.startLineNumber; i < range.endLineNumberExclusive; i++) {\n\t\tconst column = model.getLineMaxColumn(i);\n\t\tlet lineContentWidth = editor.editor.getOffsetForColumn(i, column);\n\t\tif (lineContentWidth === -1) {\n\t\t\t// approximation\n\t\t\tconst typicalHalfwidthCharacterWidth = editor.editor.getOption(EditorOption.fontInfo).typicalHalfwidthCharacterWidth;\n\t\t\tconst approximation = column * typicalHalfwidthCharacterWidth;\n\t\t\tlineContentWidth = approximation;\n\t\t}\n\t\tmaxContentWidth = Math.max(maxContentWidth, lineContentWidth);\n\t}\n\tconst lines = range.mapToLineArray(l => model.getLineContent(l));\n\n\tif (maxContentWidth < 5 && lines.some(l => l.length > 0) && model.uri.scheme !== 'file') {\n\t\tconsole.error('unexpected width');\n\t}\n\treturn maxContentWidth;\n}\n\nexport function getOffsetForPos(editor: ObservableCodeEditor, pos: Position, reader: IReader): number {\n\teditor.layoutInfo.read(reader);\n\teditor.value.read(reader);\n\n\tconst model = editor.model.read(reader);\n\tif (!model) { return 0; }\n\n\teditor.scrollTop.read(reader);\n\tconst lineContentWidth = editor.editor.getOffsetForColumn(pos.lineNumber, pos.column);\n\n\treturn lineContentWidth;\n}\n\nexport function getPrefixTrim(diffRanges: Range[], originalLinesRange: LineRange, modifiedLines: string[], editor: ICodeEditor, reader: IReader | undefined = undefined): { prefixTrim: number; prefixLeftOffset: number } {\n\tconst textModel = editor.getModel();\n\tif (!textModel) {\n\t\treturn { prefixTrim: 0, prefixLeftOffset: 0 };\n\t}\n\n\tconst replacementStart = diffRanges.map(r => r.isSingleLine() ? r.startColumn - 1 : 0);\n\tconst originalIndents = originalLinesRange.mapToLineArray(line => indentOfLine(textModel.getLineContent(line)));\n\tconst modifiedIndents = modifiedLines.filter(line => line !== '').map(line => indentOfLine(line));\n\tconst prefixTrim = Math.min(...replacementStart, ...originalIndents, ...modifiedIndents);\n\n\tlet prefixLeftOffset;\n\tconst startLineIndent = textModel.getLineIndentColumn(originalLinesRange.startLineNumber);\n\tif (startLineIndent >= prefixTrim + 1) {\n\t\t// We can use the editor to get the offset\n\t\t// TODO go through other usages of getOffsetForColumn and come up with a robust reactive solution to read it\n\t\tobservableCodeEditor(editor).scrollTop.read(reader); // getOffsetForColumn requires the line number to be visible. This might change on scroll top.\n\t\tprefixLeftOffset = editor.getOffsetForColumn(originalLinesRange.startLineNumber, prefixTrim + 1);\n\t} else if (modifiedLines.length > 0) {\n\t\t// Content is not in the editor, we can use the content width to calculate the offset\n\t\tprefixLeftOffset = getContentRenderWidth(modifiedLines[0].slice(0, prefixTrim), editor, textModel);\n\t} else {\n\t\t// unable to approximate the offset\n\t\treturn { prefixTrim: 0, prefixLeftOffset: 0 };\n\t}\n\n\treturn { prefixTrim, prefixLeftOffset };\n}\n\nexport function getContentRenderWidth(content: string, editor: ICodeEditor, textModel: ITextModel) {\n\tconst w = editor.getOption(EditorOption.fontInfo).typicalHalfwidthCharacterWidth;\n\tconst tabSize = textModel.getOptions().tabSize * w;\n\n\tconst numTabs = content.split('\\t').length - 1;\n\tconst numNoneTabs = content.length - numTabs;\n\treturn numNoneTabs * w + numTabs * tabSize;\n}\n\nexport function getEditorValidOverlayRect(editor: ObservableCodeEditor): IObservable<Rect> {\n\tconst contentLeft = editor.layoutInfoContentLeft;\n\n\tconst width = derived({ name: 'editor.validOverlay.width' }, r => {\n\t\tconst hasMinimapOnTheRight = editor.layoutInfoMinimap.read(r).minimapLeft !== 0;\n\t\tconst editorWidth = editor.layoutInfoWidth.read(r) - contentLeft.read(r);\n\n\t\tif (hasMinimapOnTheRight) {\n\t\t\tconst minimapAndScrollbarWidth = editor.layoutInfoMinimap.read(r).minimapWidth + editor.layoutInfoVerticalScrollbarWidth.read(r);\n\t\t\treturn editorWidth - minimapAndScrollbarWidth;\n\t\t}\n\n\t\treturn editorWidth;\n\t});\n\n\tconst height = derived({ name: 'editor.validOverlay.height' }, r => editor.layoutInfoHeight.read(r) + editor.contentHeight.read(r));\n\n\treturn derived({ name: 'editor.validOverlay' }, r => Rect.fromLeftTopWidthHeight(contentLeft.read(r), 0, width.read(r), height.read(r)));\n}\nexport function applyEditToModifiedRangeMappings(rangeMapping: RangeMapping[], edit: TextEdit): RangeMapping[] {\n\tconst updatedMappings: RangeMapping[] = [];\n\tfor (const m of rangeMapping) {\n\t\tconst updatedRange = edit.mapRange(m.modifiedRange);\n\t\tupdatedMappings.push(new RangeMapping(m.originalRange, updatedRange));\n\t}\n\treturn updatedMappings;\n}\n\n\nexport function classNames(...classes: (string | false | undefined | null)[]) {\n\treturn classes.filter(c => typeof c === 'string').join(' ');\n}\n\nfunction offsetRangeToRange(columnOffsetRange: OffsetRange, startPos: Position): Range {\n\treturn new Range(\n\t\tstartPos.lineNumber,\n\t\tstartPos.column + columnOffsetRange.start,\n\t\tstartPos.lineNumber,\n\t\tstartPos.column + columnOffsetRange.endExclusive,\n\t);\n}\n\n/**\n * Calculates the indentation size (in spaces) of a given line,\n * interpreting tabs as the specified tab size.\n */\nfunction getIndentationSize(line: string, tabSize: number): number {\n\tlet currentSize = 0;\n\tloop: for (let i = 0, len = line.length; i < len; i++) {\n\t\tswitch (line.charCodeAt(i)) {\n\t\t\tcase CharCode.Tab: currentSize += tabSize; break;\n\t\t\tcase CharCode.Space: currentSize++; break;\n\t\t\tdefault: break loop;\n\t\t}\n\t}\n\t// if currentSize % tabSize !== 0,\n\t// then there are spaces which are not part of the indentation\n\treturn currentSize - (currentSize % tabSize);\n}\n\n/**\n * Calculates the number of characters at the start of a line that correspond to a given indentation size,\n * taking into account both tabs and spaces.\n */\nfunction indentSizeToIndentLength(line: string, indentSize: number, tabSize: number): number {\n\tlet remainingSize = indentSize - (indentSize % tabSize);\n\tlet i = 0;\n\tfor (; i < line.length; i++) {\n\t\tif (remainingSize === 0) {\n\t\t\tbreak;\n\t\t}\n\t\tswitch (line.charCodeAt(i)) {\n\t\t\tcase CharCode.Tab: remainingSize -= tabSize; break;\n\t\t\tcase CharCode.Space: remainingSize--; break;\n\t\t\tdefault: throw new BugIndicatingError('Unexpected character found while calculating indent length');\n\t\t}\n\t}\n\treturn i;\n}\n\nexport function createReindentEdit(text: string, range: LineRange, tabSize: number): TextEdit {\n\tconst newLines = splitLines(text);\n\tconst edits: TextReplacement[] = [];\n\tconst minIndentSize = findFirstMin(range.mapToLineArray(l => getIndentationSize(newLines[l - 1], tabSize)), numberComparator)!;\n\trange.forEach(lineNumber => {\n\t\tconst indentLength = indentSizeToIndentLength(newLines[lineNumber - 1], minIndentSize, tabSize);\n\t\tedits.push(new TextReplacement(offsetRangeToRange(new OffsetRange(0, indentLength), new Position(lineNumber, 1)), ''));\n\t});\n\treturn new TextEdit(edits);\n}\n\nexport class PathBuilder {\n\tprivate _data: string = '';\n\n\tpublic moveTo(point: Point): this {\n\t\tthis._data += `M ${point.x} ${point.y} `;\n\t\treturn this;\n\t}\n\n\tpublic lineTo(point: Point): this {\n\t\tthis._data += `L ${point.x} ${point.y} `;\n\t\treturn this;\n\t}\n\n\tpublic build(): string {\n\t\treturn this._data;\n\t}\n}\n\ntype RemoveFalsy<T> = T extends false | undefined | null ? never : T;\ntype Falsy<T> = T extends false | undefined | null ? T : never;\n\nexport function mapOutFalsy<T>(obs: IObservable<T>): IObservable<IObservable<RemoveFalsy<T>> | Falsy<T>> {\n\tconst nonUndefinedObs = derivedObservableWithCache<T | undefined | null | false>(undefined, (reader, lastValue) => obs.read(reader) || lastValue);\n\n\treturn derivedOpts({\n\t\tdebugName: () => `${obs.debugName}.mapOutFalsy`\n\t}, reader => {\n\t\tnonUndefinedObs.read(reader);\n\t\tconst val = obs.read(reader);\n\t\tif (!val) {\n\t\t\treturn undefined as Falsy<T>;\n\t\t}\n\n\t\treturn nonUndefinedObs as IObservable<RemoveFalsy<T>>;\n\t});\n}\n\nexport function rectToProps(fn: (reader: IReader) => Rect, debugLocation: DebugLocation = DebugLocation.ofCaller()) {\n\treturn {\n\t\tleft: derived({ name: 'editor.validOverlay.left' }, reader => /** @description left */ fn(reader).left, debugLocation),\n\t\ttop: derived({ name: 'editor.validOverlay.top' }, reader => /** @description top */ fn(reader).top, debugLocation),\n\t\twidth: derived({ name: 'editor.validOverlay.width' }, reader => /** @description width */ fn(reader).right - fn(reader).left, debugLocation),\n\t\theight: derived({ name: 'editor.validOverlay.height' }, reader => /** @description height */ fn(reader).bottom - fn(reader).top, debugLocation),\n\t};\n}\n\nexport type FirstFnArg<T> = T extends (arg: infer U) => any ? U : never;\n"]}
|