monaco-editor-core 0.56.0-dev-20251218 → 0.56.0-dev-20251220

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/esm/nls.messages.cs.js +1 -1
  2. package/esm/nls.messages.de.js +1 -1
  3. package/esm/nls.messages.es.js +1 -1
  4. package/esm/nls.messages.fr.js +1 -1
  5. package/esm/nls.messages.it.js +1 -1
  6. package/esm/nls.messages.ja.js +1 -1
  7. package/esm/nls.messages.ko.js +1 -1
  8. package/esm/nls.messages.pl.js +1 -1
  9. package/esm/nls.messages.pt-br.js +1 -1
  10. package/esm/nls.messages.ru.js +1 -1
  11. package/esm/nls.messages.tr.js +1 -1
  12. package/esm/nls.messages.zh-cn.js +1 -1
  13. package/esm/nls.messages.zh-tw.js +1 -1
  14. package/esm/vs/base/common/fuzzyScorer.js +3 -2
  15. package/esm/vs/base/common/fuzzyScorer.js.map +1 -1
  16. package/esm/vs/editor/common/cursor/cursorTypeEditOperations.js +3 -3
  17. package/esm/vs/editor/common/cursor/cursorTypeEditOperations.js.map +1 -1
  18. package/esm/vs/editor/common/viewModel/viewModelImpl.js +4 -15
  19. package/esm/vs/editor/common/viewModel/viewModelImpl.js.map +1 -1
  20. package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.js +2 -1
  21. package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.js.map +1 -1
  22. package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsSource.js +1 -1
  23. package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsSource.js.map +1 -1
  24. package/esm/vs/editor/contrib/inlineCompletions/browser/model/renameSymbolProcessor.js +2 -2
  25. package/esm/vs/editor/contrib/inlineCompletions/browser/model/renameSymbolProcessor.js.map +1 -1
  26. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorView.js +6 -6
  27. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorView.js.map +1 -1
  28. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsModel.js +1 -1
  29. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsModel.js.map +1 -1
  30. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsView.js +13 -11
  31. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsView.js.map +1 -1
  32. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsCustomView.js +5 -7
  33. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsCustomView.js.map +1 -1
  34. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsDeletionView.js +6 -5
  35. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsDeletionView.js.map +1 -1
  36. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsInsertionView.js +6 -5
  37. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsInsertionView.js.map +1 -1
  38. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsLineReplacementView.js +9 -7
  39. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsLineReplacementView.js.map +1 -1
  40. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsSideBySideView.js +14 -9
  41. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsSideBySideView.js.map +1 -1
  42. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsWordReplacementView.js +9 -7
  43. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsWordReplacementView.js.map +1 -1
  44. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/inlineEditsLongDistanceHint.js +5 -4
  45. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/inlineEditsLongDistanceHint.js.map +1 -1
  46. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/originalEditorInlineDiffView.js +2 -1
  47. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/originalEditorInlineDiffView.js.map +1 -1
  48. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/theme.js +20 -1
  49. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/theme.js.map +1 -1
  50. package/esm/vs/platform/quickinput/browser/quickInput.js +3 -37
  51. package/esm/vs/platform/quickinput/browser/quickInput.js.map +1 -1
  52. package/esm/vs/platform/quickinput/browser/quickInputController.js +1 -0
  53. package/esm/vs/platform/quickinput/browser/quickInputController.js.map +1 -1
  54. package/esm/vs/platform/quickinput/browser/quickInputUtils.js +1 -1
  55. package/esm/vs/platform/quickinput/browser/quickInputUtils.js.map +1 -1
  56. package/esm/vs/platform/quickinput/common/quickInput.js.map +1 -1
  57. 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/inlineEditsCustomView.ts","vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsCustomView.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;gGAGgG;AAChG,OAAO,EAAE,CAAC,EAAE,MAAM,0CAA0C,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,2CAA2C,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,+CA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ode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { n } from '../../../../../../../base/browser/dom.js';\nimport { Emitter } from '../../../../../../../base/common/event.js';\nimport { Disposable } from '../../../../../../../base/common/lifecycle.js';\nimport { autorun, constObservable, derived, derivedObservableWithCache, IObservable, IReader, observableValue } from '../../../../../../../base/common/observable.js';\nimport { editorBackground } from '../../../../../../../platform/theme/common/colorRegistry.js';\nimport { asCssVariable } from '../../../../../../../platform/theme/common/colorUtils.js';\nimport { IThemeService } from '../../../../../../../platform/theme/common/themeService.js';\nimport { ICodeEditor } from '../../../../../../browser/editorBrowser.js';\nimport { ObservableCodeEditor, observableCodeEditor } from '../../../../../../browser/observableCodeEditor.js';\nimport { LineSource, renderLines, RenderOptions } from '../../../../../../browser/widget/diffEditor/components/diffEditorViewZones/renderLines.js';\nimport { EditorOption } from '../../../../../../common/config/editorOptions.js';\nimport { Rect } from '../../../../../../common/core/2d/rect.js';\nimport { LineRange } from '../../../../../../common/core/ranges/lineRange.js';\nimport { InlineCompletionHintStyle } from '../../../../../../common/languages.js';\nimport { ILanguageService } from '../../../../../../common/languages/language.js';\nimport { LineTokens, TokenArray } from '../../../../../../common/tokens/lineTokens.js';\nimport { InlineSuggestHint } from '../../../model/inlineSuggestionItem.js';\nimport { IInlineEditsView, InlineEditClickEvent, InlineEditTabAction } from '../inlineEditsViewInterface.js';\nimport { getEditorBlendedColor, INLINE_EDITS_BORDER_RADIUS, inlineEditIndicatorPrimaryBackground, inlineEditIndicatorSecondaryBackground, inlineEditIndicatorSuccessfulBackground } from '../theme.js';\nimport { getContentRenderWidth, maxContentWidthInRange, rectToProps } from '../utils/utils.js';\n\nconst MIN_END_OF_LINE_PADDING = 14;\nconst PADDING_VERTICALLY = 0;\nconst PADDING_HORIZONTALLY = 4;\nconst HORIZONTAL_OFFSET_WHEN_ABOVE_BELOW = 4;\nconst VERTICAL_OFFSET_WHEN_ABOVE_BELOW = 2;\n// !! minEndOfLinePadding should always be larger than paddingHorizontally + horizontalOffsetWhenAboveBelow\n\nexport class InlineEditsCustomView extends Disposable implements IInlineEditsView {\n\n\tprivate readonly _onDidClick = this._register(new Emitter<InlineEditClickEvent>());\n\treadonly onDidClick = this._onDidClick.event;\n\n\tprivate readonly _isHovered = observableValue(this, false);\n\treadonly isHovered: IObservable<boolean> = this._isHovered;\n\tprivate readonly _viewRef = n.ref<HTMLDivElement>();\n\n\tprivate readonly _editorObs: ObservableCodeEditor;\n\n\treadonly minEditorScrollHeight: IObservable<number>;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tdisplayLocation: IObservable<InlineSuggestHint | undefined>,\n\t\ttabAction: IObservable<InlineEditTabAction>,\n\t\t@IThemeService themeService: IThemeService,\n\t\t@ILanguageService private readonly _languageService: ILanguageService,\n\t) {\n\t\tsuper();\n\n\t\tthis._editorObs = observableCodeEditor(this._editor);\n\n\t\tconst styles = tabAction.map((v, reader) => {\n\t\t\tlet border;\n\t\t\tswitch (v) {\n\t\t\t\tcase InlineEditTabAction.Inactive: border = inlineEditIndicatorSecondaryBackground; break;\n\t\t\t\tcase InlineEditTabAction.Jump: border = inlineEditIndicatorPrimaryBackground; break;\n\t\t\t\tcase InlineEditTabAction.Accept: border = inlineEditIndicatorSuccessfulBackground; break;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tborder: getEditorBlendedColor(border, themeService).read(reader).toString(),\n\t\t\t\tbackground: asCssVariable(editorBackground)\n\t\t\t};\n\t\t});\n\n\t\tconst state = displayLocation.map(dl => dl ? this.getState(dl) : undefined);\n\n\t\tconst view = state.map(s => s ? this.getRendering(s, styles) : undefined);\n\n\t\tthis.minEditorScrollHeight = derived(this, reader => {\n\t\t\tconst s = state.read(reader);\n\t\t\tif (!s) {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\treturn s.rect.read(reader).bottom + this._editor.getScrollTop();\n\t\t});\n\n\t\tconst overlay = n.div({\n\t\t\tclass: 'inline-edits-custom-view',\n\t\t\tstyle: {\n\t\t\t\tposition: 'absolute',\n\t\t\t\toverflow: 'visible',\n\t\t\t\ttop: '0px',\n\t\t\t\tleft: '0px',\n\t\t\t\tdisplay: 'block',\n\t\t\t},\n\t\t}, [view]).keepUpdated(this._store);\n\n\t\tthis._register(this._editorObs.createOverlayWidget({\n\t\t\tdomNode: overlay.element,\n\t\t\tposition: constObservable(null),\n\t\t\tallowEditorOverflow: false,\n\t\t\tminContentWidthInPx: derivedObservableWithCache<number>(this, (reader, prev) => {\n\t\t\t\tconst s = state.read(reader);\n\t\t\t\tif (!s) { return prev ?? 0; }\n\n\t\t\t\tconst current = s.rect.map(rect => rect.right).read(reader)\n\t\t\t\t\t+ this._editorObs.layoutInfoVerticalScrollbarWidth.read(reader)\n\t\t\t\t\t+ PADDING_HORIZONTALLY\n\t\t\t\t\t- this._editorObs.layoutInfoContentLeft.read(reader);\n\t\t\t\treturn Math.max(prev ?? 0, current); // will run into infinite loop otherwise TODO: fix this\n\t\t\t}).recomputeInitiallyAndOnChange(this._store),\n\t\t}));\n\n\t\tthis._register(autorun((reader) => {\n\t\t\tconst v = view.read(reader);\n\t\t\tif (!v) { this._isHovered.set(false, undefined); return; }\n\t\t\tthis._isHovered.set(overlay.isHovered.read(reader), undefined);\n\t\t}));\n\t}\n\n\t// TODO: this is very similar to side by side `fitsInsideViewport`, try to use the same function\n\tprivate fitsInsideViewport(range: LineRange, displayLabel: string, reader: IReader | undefined): boolean {\n\t\tconst editorWidth = this._editorObs.layoutInfoWidth.read(reader);\n\t\tconst editorContentLeft = this._editorObs.layoutInfoContentLeft.read(reader);\n\t\tconst editorVerticalScrollbar = this._editor.getLayoutInfo().verticalScrollbarWidth;\n\t\tconst minimapWidth = this._editorObs.layoutInfoMinimap.read(reader).minimapLeft !== 0 ? this._editorObs.layoutInfoMinimap.read(reader).minimapWidth : 0;\n\n\t\tconst maxOriginalContent = maxContentWidthInRange(this._editorObs, range, undefined);\n\t\tconst maxModifiedContent = getContentRenderWidth(displayLabel, this._editor, this._editor.getModel()!);\n\t\tconst padding = PADDING_HORIZONTALLY + MIN_END_OF_LINE_PADDING;\n\n\t\treturn maxOriginalContent + maxModifiedContent + padding < editorWidth - editorContentLeft - editorVerticalScrollbar - minimapWidth;\n\t}\n\n\tprivate getState(displayLocation: InlineSuggestHint): { rect: IObservable<Rect>; label: string; kind: InlineCompletionHintStyle } {\n\n\t\tconst contentState = derived(this, (reader) => {\n\t\t\tconst startLineNumber = displayLocation.range.startLineNumber;\n\t\t\tconst endLineNumber = displayLocation.range.endLineNumber;\n\t\t\tconst startColumn = displayLocation.range.startColumn;\n\t\t\tconst endColumn = displayLocation.range.endColumn;\n\t\t\tconst lineCount = this._editor.getModel()?.getLineCount() ?? 0;\n\n\t\t\tconst lineWidth = maxContentWidthInRange(this._editorObs, new LineRange(startLineNumber, startLineNumber + 1), reader);\n\t\t\tconst lineWidthBelow = startLineNumber + 1 <= lineCount ? maxContentWidthInRange(this._editorObs, new LineRange(startLineNumber + 1, startLineNumber + 2), reader) : undefined;\n\t\t\tconst lineWidthAbove = startLineNumber - 1 >= 1 ? maxContentWidthInRange(this._editorObs, new LineRange(startLineNumber - 1, startLineNumber), reader) : undefined;\n\t\t\tconst startContentLeftOffset = this._editor.getOffsetForColumn(startLineNumber, startColumn);\n\t\t\tconst endContentLeftOffset = this._editor.getOffsetForColumn(endLineNumber, endColumn);\n\n\t\t\treturn {\n\t\t\t\tlineWidth,\n\t\t\t\tlineWidthBelow,\n\t\t\t\tlineWidthAbove,\n\t\t\t\tstartContentLeftOffset,\n\t\t\t\tendContentLeftOffset\n\t\t\t};\n\t\t});\n\n\t\tconst startLineNumber = displayLocation.range.startLineNumber;\n\t\tconst endLineNumber = displayLocation.range.endLineNumber;\n\t\t// only check viewport once in the beginning when rendering the view\n\t\tconst fitsInsideViewport = this.fitsInsideViewport(new LineRange(startLineNumber, endLineNumber + 1), displayLocation.content, undefined);\n\n\t\tconst rect = derived(this, reader => {\n\t\t\tconst w = this._editorObs.getOption(EditorOption.fontInfo).read(reader).typicalHalfwidthCharacterWidth;\n\n\t\t\tconst { lineWidth, lineWidthBelow, lineWidthAbove, startContentLeftOffset, endContentLeftOffset } = contentState.read(reader);\n\n\t\t\tconst contentLeft = this._editorObs.layoutInfoContentLeft.read(reader);\n\t\t\tconst lineHeight = this._editorObs.observeLineHeightForLine(startLineNumber).recomputeInitiallyAndOnChange(reader.store).read(reader);\n\t\t\tconst scrollTop = this._editorObs.scrollTop.read(reader);\n\t\t\tconst scrollLeft = this._editorObs.scrollLeft.read(reader);\n\n\t\t\tlet position: 'end' | 'below' | 'above';\n\t\t\tif (startLineNumber === endLineNumber && endContentLeftOffset + 5 * w >= lineWidth && fitsInsideViewport) {\n\t\t\t\tposition = 'end'; // Render at the end of the line if the range ends almost at the end of the line\n\t\t\t} else if (lineWidthBelow !== undefined && lineWidthBelow + MIN_END_OF_LINE_PADDING - HORIZONTAL_OFFSET_WHEN_ABOVE_BELOW - PADDING_HORIZONTALLY < startContentLeftOffset) {\n\t\t\t\tposition = 'below'; // Render Below if possible\n\t\t\t} else if (lineWidthAbove !== undefined && lineWidthAbove + MIN_END_OF_LINE_PADDING - HORIZONTAL_OFFSET_WHEN_ABOVE_BELOW - PADDING_HORIZONTALLY < startContentLeftOffset) {\n\t\t\t\tposition = 'above'; // Render Above if possible\n\t\t\t} else {\n\t\t\t\tposition = 'end'; // Render at the end of the line otherwise\n\t\t\t}\n\n\t\t\tlet topOfLine;\n\t\t\tlet contentStartOffset;\n\t\t\tlet deltaX = 0;\n\t\t\tlet deltaY = 0;\n\n\t\t\tswitch (position) {\n\t\t\t\tcase 'end': {\n\t\t\t\t\ttopOfLine = this._editorObs.editor.getTopForLineNumber(startLineNumber);\n\t\t\t\t\tcontentStartOffset = lineWidth;\n\t\t\t\t\tdeltaX = PADDING_HORIZONTALLY + MIN_END_OF_LINE_PADDING;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase 'below': {\n\t\t\t\t\ttopOfLine = this._editorObs.editor.getTopForLineNumber(startLineNumber + 1);\n\t\t\t\t\tcontentStartOffset = startContentLeftOffset;\n\t\t\t\t\tdeltaX = PADDING_HORIZONTALLY + HORIZONTAL_OFFSET_WHEN_ABOVE_BELOW;\n\t\t\t\t\tdeltaY = PADDING_VERTICALLY + VERTICAL_OFFSET_WHEN_ABOVE_BELOW;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase 'above': {\n\t\t\t\t\ttopOfLine = this._editorObs.editor.getTopForLineNumber(startLineNumber - 1);\n\t\t\t\t\tcontentStartOffset = startContentLeftOffset;\n\t\t\t\t\tdeltaX = PADDING_HORIZONTALLY + HORIZONTAL_OFFSET_WHEN_ABOVE_BELOW;\n\t\t\t\t\tdeltaY = -PADDING_VERTICALLY + VERTICAL_OFFSET_WHEN_ABOVE_BELOW;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst textRect = Rect.fromLeftTopWidthHeight(\n\t\t\t\tcontentLeft + contentStartOffset - scrollLeft,\n\t\t\t\ttopOfLine - scrollTop,\n\t\t\t\tw * displayLocation.content.length,\n\t\t\t\tlineHeight\n\t\t\t);\n\n\t\t\treturn textRect.withMargin(PADDING_VERTICALLY, PADDING_HORIZONTALLY).translateX(deltaX).translateY(deltaY);\n\t\t});\n\n\t\treturn {\n\t\t\trect,\n\t\t\tlabel: displayLocation.content,\n\t\t\tkind: displayLocation.style\n\t\t};\n\t}\n\n\tprivate getRendering(state: { rect: IObservable<Rect>; label: string; kind: InlineCompletionHintStyle }, styles: IObservable<{ background: string; border: string }>) {\n\n\t\tconst line = document.createElement('div');\n\t\tconst t = this._editor.getModel()!.tokenization.tokenizeLinesAt(1, [state.label])?.[0];\n\t\tlet tokens: LineTokens;\n\t\tif (t && state.kind === InlineCompletionHintStyle.Code) {\n\t\t\ttokens = TokenArray.fromLineTokens(t).toLineTokens(state.label, this._languageService.languageIdCodec);\n\t\t} else {\n\t\t\ttokens = LineTokens.createEmpty(state.label, this._languageService.languageIdCodec);\n\t\t}\n\n\t\tconst result = renderLines(new LineSource([tokens]), RenderOptions.fromEditor(this._editor).withSetWidth(false).withScrollBeyondLastColumn(0), [], line, true);\n\t\tline.style.width = `${result.minWidthInPx}px`;\n\n\t\tconst rect = state.rect.map(r => r.withMargin(0, PADDING_HORIZONTALLY));\n\n\t\treturn n.div({\n\t\t\tclass: 'collapsedView',\n\t\t\tref: this._viewRef,\n\t\t\tstyle: {\n\t\t\t\tposition: 'absolute',\n\t\t\t\t...rectToProps(reader => rect.read(reader)),\n\t\t\t\toverflow: 'hidden',\n\t\t\t\tboxSizing: 'border-box',\n\t\t\t\tcursor: 'pointer',\n\t\t\t\tborder: styles.map(s => `1px solid ${s.border}`),\n\t\t\t\tborderRadius: `${INLINE_EDITS_BORDER_RADIUS}px`,\n\t\t\t\tbackgroundColor: styles.map(s => s.background),\n\n\t\t\t\tdisplay: 'flex',\n\t\t\t\talignItems: 'center',\n\t\t\t\tjustifyContent: 'center',\n\t\t\t\twhiteSpace: 'nowrap',\n\t\t\t},\n\t\t\tonmousedown: e => {\n\t\t\t\te.preventDefault(); // This prevents that the editor loses focus\n\t\t\t},\n\t\t\tonclick: (e) => { this._onDidClick.fire(InlineEditClickEvent.create(e)); }\n\t\t}, [\n\t\t\tline\n\t\t]);\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { n } from '../../../../../../../base/browser/dom.js';\nimport { Emitter } from '../../../../../../../base/common/event.js';\nimport { Disposable } from '../../../../../../../base/common/lifecycle.js';\nimport { autorun, constObservable, derived, derivedObservableWithCache, IObservable, IReader, observableValue } from '../../../../../../../base/common/observable.js';\nimport { editorBackground } from '../../../../../../../platform/theme/common/colorRegistry.js';\nimport { asCssVariable } from '../../../../../../../platform/theme/common/colorUtils.js';\nimport { IThemeService } from '../../../../../../../platform/theme/common/themeService.js';\nimport { ICodeEditor } from '../../../../../../browser/editorBrowser.js';\nimport { ObservableCodeEditor, observableCodeEditor } from '../../../../../../browser/observableCodeEditor.js';\nimport { LineSource, renderLines, RenderOptions } from '../../../../../../browser/widget/diffEditor/components/diffEditorViewZones/renderLines.js';\nimport { EditorOption } from '../../../../../../common/config/editorOptions.js';\nimport { Rect } from '../../../../../../common/core/2d/rect.js';\nimport { LineRange } from '../../../../../../common/core/ranges/lineRange.js';\nimport { InlineCompletionHintStyle } from '../../../../../../common/languages.js';\nimport { ILanguageService } from '../../../../../../common/languages/language.js';\nimport { LineTokens, TokenArray } from '../../../../../../common/tokens/lineTokens.js';\nimport { InlineSuggestHint } from '../../../model/inlineSuggestionItem.js';\nimport { IInlineEditsView, InlineEditClickEvent, InlineEditTabAction } from '../inlineEditsViewInterface.js';\nimport { getEditorBlendedColor, INLINE_EDITS_BORDER_RADIUS, inlineEditIndicatorPrimaryBackground, inlineEditIndicatorSecondaryBackground, inlineEditIndicatorSuccessfulBackground } from '../theme.js';\nimport { getContentRenderWidth, maxContentWidthInRange, rectToProps } from '../utils/utils.js';\n\nconst MIN_END_OF_LINE_PADDING = 14;\nconst PADDING_VERTICALLY = 0;\nconst PADDING_HORIZONTALLY = 4;\nconst HORIZONTAL_OFFSET_WHEN_ABOVE_BELOW = 4;\nconst VERTICAL_OFFSET_WHEN_ABOVE_BELOW = 2;\n// !! minEndOfLinePadding should always be larger than paddingHorizontally + horizontalOffsetWhenAboveBelow\n\nexport class InlineEditsCustomView extends Disposable implements IInlineEditsView {\n\n\tprivate readonly _onDidClick = this._register(new Emitter<InlineEditClickEvent>());\n\treadonly onDidClick = this._onDidClick.event;\n\n\tprivate readonly _isHovered = observableValue(this, false);\n\treadonly isHovered: IObservable<boolean> = this._isHovered;\n\tprivate readonly _viewRef = n.ref<HTMLDivElement>();\n\n\tprivate readonly _editorObs: ObservableCodeEditor;\n\n\treadonly minEditorScrollHeight: IObservable<number>;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tdisplayLocation: IObservable<InlineSuggestHint | undefined>,\n\t\ttabAction: IObservable<InlineEditTabAction>,\n\t\t@IThemeService themeService: IThemeService,\n\t\t@ILanguageService private readonly _languageService: ILanguageService,\n\t) {\n\t\tsuper();\n\n\t\tthis._editorObs = observableCodeEditor(this._editor);\n\n\t\tconst styles = tabAction.map((v, reader) => {\n\t\t\tlet border;\n\t\t\tswitch (v) {\n\t\t\t\tcase InlineEditTabAction.Inactive: border = inlineEditIndicatorSecondaryBackground; break;\n\t\t\t\tcase InlineEditTabAction.Jump: border = inlineEditIndicatorPrimaryBackground; break;\n\t\t\t\tcase InlineEditTabAction.Accept: border = inlineEditIndicatorSuccessfulBackground; break;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tborder: getEditorBlendedColor(border, themeService).read(reader).toString(),\n\t\t\t\tbackground: asCssVariable(editorBackground)\n\t\t\t};\n\t\t});\n\n\t\tconst state = displayLocation.map(dl => dl ? this.getState(dl) : undefined);\n\n\t\tconst view = state.map(s => s ? this.getRendering(s, styles) : undefined);\n\n\t\tthis.minEditorScrollHeight = derived(this, reader => {\n\t\t\tconst s = state.read(reader);\n\t\t\tif (!s) {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\treturn s.rect.read(reader).bottom + this._editor.getScrollTop();\n\t\t});\n\n\t\tconst overlay = n.div({\n\t\t\tclass: 'inline-edits-custom-view',\n\t\t\tstyle: {\n\t\t\t\tposition: 'absolute',\n\t\t\t\toverflow: 'visible',\n\t\t\t\ttop: '0px',\n\t\t\t\tleft: '0px',\n\t\t\t\tdisplay: 'block',\n\t\t\t},\n\t\t}, [view]).keepUpdated(this._store);\n\n\t\tthis._register(this._editorObs.createOverlayWidget({\n\t\t\tdomNode: overlay.element,\n\t\t\tposition: constObservable(null),\n\t\t\tallowEditorOverflow: false,\n\t\t\tminContentWidthInPx: derivedObservableWithCache<number>(this, (reader, prev) => {\n\t\t\t\tconst s = state.read(reader);\n\t\t\t\tif (!s) { return prev ?? 0; }\n\n\t\t\t\tconst current = s.rect.map(rect => rect.right).read(reader)\n\t\t\t\t\t+ this._editorObs.layoutInfoVerticalScrollbarWidth.read(reader)\n\t\t\t\t\t+ PADDING_HORIZONTALLY\n\t\t\t\t\t- this._editorObs.layoutInfoContentLeft.read(reader);\n\t\t\t\treturn Math.max(prev ?? 0, current); // will run into infinite loop otherwise TODO: fix this\n\t\t\t}).recomputeInitiallyAndOnChange(this._store),\n\t\t}));\n\n\t\tthis._register(autorun((reader) => {\n\t\t\tconst v = view.read(reader);\n\t\t\tif (!v) { this._isHovered.set(false, undefined); return; }\n\t\t\tthis._isHovered.set(overlay.isHovered.read(reader), undefined);\n\t\t}));\n\t}\n\n\t// TODO: this is very similar to side by side `fitsInsideViewport`, try to use the same function\n\tprivate fitsInsideViewport(range: LineRange, displayLabel: string, reader: IReader | undefined): boolean {\n\t\tconst editorWidth = this._editorObs.layoutInfoWidth.read(reader);\n\t\tconst editorContentLeft = this._editorObs.layoutInfoContentLeft.read(reader);\n\t\tconst editorVerticalScrollbar = this._editor.getLayoutInfo().verticalScrollbarWidth;\n\t\tconst minimapWidth = this._editorObs.layoutInfoMinimap.read(reader).minimapLeft !== 0 ? this._editorObs.layoutInfoMinimap.read(reader).minimapWidth : 0;\n\n\t\tconst maxOriginalContent = maxContentWidthInRange(this._editorObs, range, undefined);\n\t\tconst maxModifiedContent = getContentRenderWidth(displayLabel, this._editor, this._editor.getModel()!);\n\t\tconst padding = PADDING_HORIZONTALLY + MIN_END_OF_LINE_PADDING;\n\n\t\treturn maxOriginalContent + maxModifiedContent + padding < editorWidth - editorContentLeft - editorVerticalScrollbar - minimapWidth;\n\t}\n\n\tprivate getState(displayLocation: InlineSuggestHint): { rect: IObservable<Rect>; label: string; kind: InlineCompletionHintStyle } {\n\n\t\tconst contentState = derived(this, (reader) => {\n\t\t\tconst startLineNumber = displayLocation.range.startLineNumber;\n\t\t\tconst endLineNumber = displayLocation.range.endLineNumber;\n\t\t\tconst startColumn = displayLocation.range.startColumn;\n\t\t\tconst endColumn = displayLocation.range.endColumn;\n\t\t\tconst lineCount = this._editor.getModel()?.getLineCount() ?? 0;\n\n\t\t\tconst lineWidth = maxContentWidthInRange(this._editorObs, new LineRange(startLineNumber, startLineNumber + 1), reader);\n\t\t\tconst lineWidthBelow = startLineNumber + 1 <= lineCount ? maxContentWidthInRange(this._editorObs, new LineRange(startLineNumber + 1, startLineNumber + 2), reader) : undefined;\n\t\t\tconst lineWidthAbove = startLineNumber - 1 >= 1 ? maxContentWidthInRange(this._editorObs, new LineRange(startLineNumber - 1, startLineNumber), reader) : undefined;\n\t\t\tconst startContentLeftOffset = this._editor.getOffsetForColumn(startLineNumber, startColumn);\n\t\t\tconst endContentLeftOffset = this._editor.getOffsetForColumn(endLineNumber, endColumn);\n\n\t\t\treturn {\n\t\t\t\tlineWidth,\n\t\t\t\tlineWidthBelow,\n\t\t\t\tlineWidthAbove,\n\t\t\t\tstartContentLeftOffset,\n\t\t\t\tendContentLeftOffset\n\t\t\t};\n\t\t});\n\n\t\tconst startLineNumber = displayLocation.range.startLineNumber;\n\t\tconst endLineNumber = displayLocation.range.endLineNumber;\n\t\t// only check viewport once in the beginning when rendering the view\n\t\tconst fitsInsideViewport = this.fitsInsideViewport(new LineRange(startLineNumber, endLineNumber + 1), displayLocation.content, undefined);\n\n\t\tconst rect = derived(this, reader => {\n\t\t\tconst w = this._editorObs.getOption(EditorOption.fontInfo).read(reader).typicalHalfwidthCharacterWidth;\n\n\t\t\tconst { lineWidth, lineWidthBelow, lineWidthAbove, startContentLeftOffset, endContentLeftOffset } = contentState.read(reader);\n\n\t\t\tconst contentLeft = this._editorObs.layoutInfoContentLeft.read(reader);\n\t\t\tconst lineHeight = this._editorObs.observeLineHeightForLine(startLineNumber).recomputeInitiallyAndOnChange(reader.store).read(reader);\n\t\t\tconst scrollTop = this._editorObs.scrollTop.read(reader);\n\t\t\tconst scrollLeft = this._editorObs.scrollLeft.read(reader);\n\n\t\t\tlet position: 'end' | 'below' | 'above';\n\t\t\tif (startLineNumber === endLineNumber && endContentLeftOffset + 5 * w >= lineWidth && fitsInsideViewport) {\n\t\t\t\tposition = 'end'; // Render at the end of the line if the range ends almost at the end of the line\n\t\t\t} else if (lineWidthBelow !== undefined && lineWidthBelow + MIN_END_OF_LINE_PADDING - HORIZONTAL_OFFSET_WHEN_ABOVE_BELOW - PADDING_HORIZONTALLY < startContentLeftOffset) {\n\t\t\t\tposition = 'below'; // Render Below if possible\n\t\t\t} else if (lineWidthAbove !== undefined && lineWidthAbove + MIN_END_OF_LINE_PADDING - HORIZONTAL_OFFSET_WHEN_ABOVE_BELOW - PADDING_HORIZONTALLY < startContentLeftOffset) {\n\t\t\t\tposition = 'above'; // Render Above if possible\n\t\t\t} else {\n\t\t\t\tposition = 'end'; // Render at the end of the line otherwise\n\t\t\t}\n\n\t\t\tlet topOfLine;\n\t\t\tlet contentStartOffset;\n\t\t\tlet deltaX = 0;\n\t\t\tlet deltaY = 0;\n\n\t\t\tswitch (position) {\n\t\t\t\tcase 'end': {\n\t\t\t\t\ttopOfLine = this._editorObs.editor.getTopForLineNumber(startLineNumber);\n\t\t\t\t\tcontentStartOffset = lineWidth;\n\t\t\t\t\tdeltaX = PADDING_HORIZONTALLY + MIN_END_OF_LINE_PADDING;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase 'below': {\n\t\t\t\t\ttopOfLine = this._editorObs.editor.getTopForLineNumber(startLineNumber + 1);\n\t\t\t\t\tcontentStartOffset = startContentLeftOffset;\n\t\t\t\t\tdeltaX = PADDING_HORIZONTALLY + HORIZONTAL_OFFSET_WHEN_ABOVE_BELOW;\n\t\t\t\t\tdeltaY = PADDING_VERTICALLY + VERTICAL_OFFSET_WHEN_ABOVE_BELOW;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase 'above': {\n\t\t\t\t\ttopOfLine = this._editorObs.editor.getTopForLineNumber(startLineNumber - 1);\n\t\t\t\t\tcontentStartOffset = startContentLeftOffset;\n\t\t\t\t\tdeltaX = PADDING_HORIZONTALLY + HORIZONTAL_OFFSET_WHEN_ABOVE_BELOW;\n\t\t\t\t\tdeltaY = -PADDING_VERTICALLY + VERTICAL_OFFSET_WHEN_ABOVE_BELOW;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst textRect = Rect.fromLeftTopWidthHeight(\n\t\t\t\tcontentLeft + contentStartOffset - scrollLeft,\n\t\t\t\ttopOfLine - scrollTop,\n\t\t\t\tw * displayLocation.content.length,\n\t\t\t\tlineHeight\n\t\t\t);\n\n\t\t\treturn textRect.withMargin(PADDING_VERTICALLY, PADDING_HORIZONTALLY).translateX(deltaX).translateY(deltaY);\n\t\t});\n\n\t\treturn {\n\t\t\trect,\n\t\t\tlabel: displayLocation.content,\n\t\t\tkind: displayLocation.style\n\t\t};\n\t}\n\n\tprivate getRendering(state: { rect: IObservable<Rect>; label: string; kind: InlineCompletionHintStyle }, styles: IObservable<{ background: string; border: string }>) {\n\n\t\tconst line = document.createElement('div');\n\t\tconst t = this._editor.getModel()!.tokenization.tokenizeLinesAt(1, [state.label])?.[0];\n\t\tlet tokens: LineTokens;\n\t\tif (t && state.kind === InlineCompletionHintStyle.Code) {\n\t\t\ttokens = TokenArray.fromLineTokens(t).toLineTokens(state.label, this._languageService.languageIdCodec);\n\t\t} else {\n\t\t\ttokens = LineTokens.createEmpty(state.label, this._languageService.languageIdCodec);\n\t\t}\n\n\t\tconst result = renderLines(new LineSource([tokens]), RenderOptions.fromEditor(this._editor).withSetWidth(false).withScrollBeyondLastColumn(0), [], line, true);\n\t\tline.style.width = `${result.minWidthInPx}px`;\n\n\t\tconst rect = state.rect.map(r => r.withMargin(0, PADDING_HORIZONTALLY));\n\n\t\treturn n.div({\n\t\t\tclass: 'collapsedView',\n\t\t\tref: this._viewRef,\n\t\t\tstyle: {\n\t\t\t\tposition: 'absolute',\n\t\t\t\t...rectToProps(reader => rect.read(reader)),\n\t\t\t\toverflow: 'hidden',\n\t\t\t\tboxSizing: 'border-box',\n\t\t\t\tcursor: 'pointer',\n\t\t\t\tborder: styles.map(s => `1px solid ${s.border}`),\n\t\t\t\tborderRadius: `${INLINE_EDITS_BORDER_RADIUS}px`,\n\t\t\t\tbackgroundColor: styles.map(s => s.background),\n\n\t\t\t\tdisplay: 'flex',\n\t\t\t\talignItems: 'center',\n\t\t\t\tjustifyContent: 'center',\n\t\t\t\twhiteSpace: 'nowrap',\n\t\t\t},\n\t\t\tonmousedown: e => {\n\t\t\t\te.preventDefault(); // This prevents that the editor loses focus\n\t\t\t},\n\t\t\tonclick: (e) => { this._onDidClick.fire(InlineEditClickEvent.create(e)); }\n\t\t}, [\n\t\t\tline\n\t\t]);\n\t}\n}\n"]}
1
+ {"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsCustomView.ts","vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsCustomView.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;gGAGgG;AAChG,OAAO,EAAE,CAAC,EAAE,MAAM,0CAA0C,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,2CAA2C,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;AAC3E,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,0BAA0B,EAAwB,eAAe,EAAE,MAAM,gDAAgD,CAAC;AACtK,OAAO,EAAE,aAAa,EAAE,MAAM,4DAA4D,CAAC;AAE3F,OAAO,EAAwB,oBAAoB,EAAE,MAAM,mDAAmD,CAAC;AAC/G,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,2FAA2F,C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,CAAC,CAAC;gBAC3C,QAAQ,EAAE,QAAQ;gBAClB,SAAS,EAAE,YAAY;gBACvB,MAAM,EAAE,SAAS;gBACjB,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,MAAM,EAAE,CAAC;gBAChD,YAAY,EAAE,GAAG,0BAA0B,IAAI;gBAC/C,eAAe,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC;gBAE9C,OAAO,EAAE,MAAM;gBACf,UAAU,EAAE,QAAQ;gBACpB,cAAc,EAAE,QAAQ;gBACxB,UAAU,EAAE,QAAQ;aACpB;YACD,WAAW,EAAE,CAAC,CAAC,EAAE;gBAChB,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC,4CAA4C;YACjE,CAAC;YACD,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SAC1E,EAAE;YACF,IAAI;SACJ,CAAC,CAAC;IACJ,CAAC;CACD,CAAA;AA3OY,qBAAqB;IAkB/B,WAAA,aAAa,CAAA;IACb,WAAA,gBAAgB,CAAA;GAnBN,qBAAqB,CA2OjC","file":"inlineEditsCustomView.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { n } from '../../../../../../../base/browser/dom.js';\nimport { Emitter } from '../../../../../../../base/common/event.js';\nimport { Disposable } from '../../../../../../../base/common/lifecycle.js';\nimport { autorun, constObservable, derived, derivedObservableWithCache, IObservable, IReader, observableValue } from '../../../../../../../base/common/observable.js';\nimport { IThemeService } from '../../../../../../../platform/theme/common/themeService.js';\nimport { ICodeEditor } from '../../../../../../browser/editorBrowser.js';\nimport { ObservableCodeEditor, observableCodeEditor } from '../../../../../../browser/observableCodeEditor.js';\nimport { LineSource, renderLines, RenderOptions } from '../../../../../../browser/widget/diffEditor/components/diffEditorViewZones/renderLines.js';\nimport { EditorOption } from '../../../../../../common/config/editorOptions.js';\nimport { Rect } from '../../../../../../common/core/2d/rect.js';\nimport { LineRange } from '../../../../../../common/core/ranges/lineRange.js';\nimport { InlineCompletionHintStyle } from '../../../../../../common/languages.js';\nimport { ILanguageService } from '../../../../../../common/languages/language.js';\nimport { LineTokens, TokenArray } from '../../../../../../common/tokens/lineTokens.js';\nimport { InlineSuggestHint } from '../../../model/inlineSuggestionItem.js';\nimport { InlineCompletionEditorType } from '../../../model/provideInlineCompletions.js';\nimport { IInlineEditsView, InlineEditClickEvent, InlineEditTabAction } from '../inlineEditsViewInterface.js';\nimport { getEditorBackgroundColor, getEditorBlendedColor, INLINE_EDITS_BORDER_RADIUS, inlineEditIndicatorPrimaryBackground, inlineEditIndicatorSecondaryBackground, inlineEditIndicatorSuccessfulBackground } from '../theme.js';\nimport { getContentRenderWidth, maxContentWidthInRange, rectToProps } from '../utils/utils.js';\n\nconst MIN_END_OF_LINE_PADDING = 14;\nconst PADDING_VERTICALLY = 0;\nconst PADDING_HORIZONTALLY = 4;\nconst HORIZONTAL_OFFSET_WHEN_ABOVE_BELOW = 4;\nconst VERTICAL_OFFSET_WHEN_ABOVE_BELOW = 2;\n// !! minEndOfLinePadding should always be larger than paddingHorizontally + horizontalOffsetWhenAboveBelow\n\nexport class InlineEditsCustomView extends Disposable implements IInlineEditsView {\n\n\tprivate readonly _onDidClick = this._register(new Emitter<InlineEditClickEvent>());\n\treadonly onDidClick = this._onDidClick.event;\n\n\tprivate readonly _isHovered = observableValue(this, false);\n\treadonly isHovered: IObservable<boolean> = this._isHovered;\n\tprivate readonly _viewRef = n.ref<HTMLDivElement>();\n\n\tprivate readonly _editorObs: ObservableCodeEditor;\n\n\treadonly minEditorScrollHeight: IObservable<number>;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tdisplayLocation: IObservable<InlineSuggestHint | undefined>,\n\t\ttabAction: IObservable<InlineEditTabAction>,\n\t\teditorType: IObservable<InlineCompletionEditorType>,\n\t\t@IThemeService themeService: IThemeService,\n\t\t@ILanguageService private readonly _languageService: ILanguageService,\n\t) {\n\t\tsuper();\n\n\t\tthis._editorObs = observableCodeEditor(this._editor);\n\n\t\tconst styles = tabAction.map((v, reader) => {\n\t\t\tlet border;\n\t\t\tswitch (v) {\n\t\t\t\tcase InlineEditTabAction.Inactive: border = inlineEditIndicatorSecondaryBackground; break;\n\t\t\t\tcase InlineEditTabAction.Jump: border = inlineEditIndicatorPrimaryBackground; break;\n\t\t\t\tcase InlineEditTabAction.Accept: border = inlineEditIndicatorSuccessfulBackground; break;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tborder: getEditorBlendedColor(border, themeService).read(reader).toString(),\n\t\t\t\tbackground: getEditorBackgroundColor(editorType.read(reader))\n\t\t\t};\n\t\t});\n\n\t\tconst state = displayLocation.map(dl => dl ? this.getState(dl) : undefined);\n\n\t\tconst view = state.map(s => s ? this.getRendering(s, styles) : undefined);\n\n\t\tthis.minEditorScrollHeight = derived(this, reader => {\n\t\t\tconst s = state.read(reader);\n\t\t\tif (!s) {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\treturn s.rect.read(reader).bottom + this._editor.getScrollTop();\n\t\t});\n\n\t\tconst overlay = n.div({\n\t\t\tclass: 'inline-edits-custom-view',\n\t\t\tstyle: {\n\t\t\t\tposition: 'absolute',\n\t\t\t\toverflow: 'visible',\n\t\t\t\ttop: '0px',\n\t\t\t\tleft: '0px',\n\t\t\t\tdisplay: 'block',\n\t\t\t},\n\t\t}, [view]).keepUpdated(this._store);\n\n\t\tthis._register(this._editorObs.createOverlayWidget({\n\t\t\tdomNode: overlay.element,\n\t\t\tposition: constObservable(null),\n\t\t\tallowEditorOverflow: false,\n\t\t\tminContentWidthInPx: derivedObservableWithCache<number>(this, (reader, prev) => {\n\t\t\t\tconst s = state.read(reader);\n\t\t\t\tif (!s) { return prev ?? 0; }\n\n\t\t\t\tconst current = s.rect.map(rect => rect.right).read(reader)\n\t\t\t\t\t+ this._editorObs.layoutInfoVerticalScrollbarWidth.read(reader)\n\t\t\t\t\t+ PADDING_HORIZONTALLY\n\t\t\t\t\t- this._editorObs.layoutInfoContentLeft.read(reader);\n\t\t\t\treturn Math.max(prev ?? 0, current); // will run into infinite loop otherwise TODO: fix this\n\t\t\t}).recomputeInitiallyAndOnChange(this._store),\n\t\t}));\n\n\t\tthis._register(autorun((reader) => {\n\t\t\tconst v = view.read(reader);\n\t\t\tif (!v) { this._isHovered.set(false, undefined); return; }\n\t\t\tthis._isHovered.set(overlay.isHovered.read(reader), undefined);\n\t\t}));\n\t}\n\n\t// TODO: this is very similar to side by side `fitsInsideViewport`, try to use the same function\n\tprivate fitsInsideViewport(range: LineRange, displayLabel: string, reader: IReader | undefined): boolean {\n\t\tconst editorWidth = this._editorObs.layoutInfoWidth.read(reader);\n\t\tconst editorContentLeft = this._editorObs.layoutInfoContentLeft.read(reader);\n\t\tconst editorVerticalScrollbar = this._editor.getLayoutInfo().verticalScrollbarWidth;\n\t\tconst minimapWidth = this._editorObs.layoutInfoMinimap.read(reader).minimapLeft !== 0 ? this._editorObs.layoutInfoMinimap.read(reader).minimapWidth : 0;\n\n\t\tconst maxOriginalContent = maxContentWidthInRange(this._editorObs, range, undefined);\n\t\tconst maxModifiedContent = getContentRenderWidth(displayLabel, this._editor, this._editor.getModel()!);\n\t\tconst padding = PADDING_HORIZONTALLY + MIN_END_OF_LINE_PADDING;\n\n\t\treturn maxOriginalContent + maxModifiedContent + padding < editorWidth - editorContentLeft - editorVerticalScrollbar - minimapWidth;\n\t}\n\n\tprivate getState(displayLocation: InlineSuggestHint): { rect: IObservable<Rect>; label: string; kind: InlineCompletionHintStyle } {\n\n\t\tconst contentState = derived(this, (reader) => {\n\t\t\tconst startLineNumber = displayLocation.range.startLineNumber;\n\t\t\tconst endLineNumber = displayLocation.range.endLineNumber;\n\t\t\tconst startColumn = displayLocation.range.startColumn;\n\t\t\tconst endColumn = displayLocation.range.endColumn;\n\t\t\tconst lineCount = this._editor.getModel()?.getLineCount() ?? 0;\n\n\t\t\tconst lineWidth = maxContentWidthInRange(this._editorObs, new LineRange(startLineNumber, startLineNumber + 1), reader);\n\t\t\tconst lineWidthBelow = startLineNumber + 1 <= lineCount ? maxContentWidthInRange(this._editorObs, new LineRange(startLineNumber + 1, startLineNumber + 2), reader) : undefined;\n\t\t\tconst lineWidthAbove = startLineNumber - 1 >= 1 ? maxContentWidthInRange(this._editorObs, new LineRange(startLineNumber - 1, startLineNumber), reader) : undefined;\n\t\t\tconst startContentLeftOffset = this._editor.getOffsetForColumn(startLineNumber, startColumn);\n\t\t\tconst endContentLeftOffset = this._editor.getOffsetForColumn(endLineNumber, endColumn);\n\n\t\t\treturn {\n\t\t\t\tlineWidth,\n\t\t\t\tlineWidthBelow,\n\t\t\t\tlineWidthAbove,\n\t\t\t\tstartContentLeftOffset,\n\t\t\t\tendContentLeftOffset\n\t\t\t};\n\t\t});\n\n\t\tconst startLineNumber = displayLocation.range.startLineNumber;\n\t\tconst endLineNumber = displayLocation.range.endLineNumber;\n\t\t// only check viewport once in the beginning when rendering the view\n\t\tconst fitsInsideViewport = this.fitsInsideViewport(new LineRange(startLineNumber, endLineNumber + 1), displayLocation.content, undefined);\n\n\t\tconst rect = derived(this, reader => {\n\t\t\tconst w = this._editorObs.getOption(EditorOption.fontInfo).read(reader).typicalHalfwidthCharacterWidth;\n\n\t\t\tconst { lineWidth, lineWidthBelow, lineWidthAbove, startContentLeftOffset, endContentLeftOffset } = contentState.read(reader);\n\n\t\t\tconst contentLeft = this._editorObs.layoutInfoContentLeft.read(reader);\n\t\t\tconst lineHeight = this._editorObs.observeLineHeightForLine(startLineNumber).recomputeInitiallyAndOnChange(reader.store).read(reader);\n\t\t\tconst scrollTop = this._editorObs.scrollTop.read(reader);\n\t\t\tconst scrollLeft = this._editorObs.scrollLeft.read(reader);\n\n\t\t\tlet position: 'end' | 'below' | 'above';\n\t\t\tif (startLineNumber === endLineNumber && endContentLeftOffset + 5 * w >= lineWidth && fitsInsideViewport) {\n\t\t\t\tposition = 'end'; // Render at the end of the line if the range ends almost at the end of the line\n\t\t\t} else if (lineWidthBelow !== undefined && lineWidthBelow + MIN_END_OF_LINE_PADDING - HORIZONTAL_OFFSET_WHEN_ABOVE_BELOW - PADDING_HORIZONTALLY < startContentLeftOffset) {\n\t\t\t\tposition = 'below'; // Render Below if possible\n\t\t\t} else if (lineWidthAbove !== undefined && lineWidthAbove + MIN_END_OF_LINE_PADDING - HORIZONTAL_OFFSET_WHEN_ABOVE_BELOW - PADDING_HORIZONTALLY < startContentLeftOffset) {\n\t\t\t\tposition = 'above'; // Render Above if possible\n\t\t\t} else {\n\t\t\t\tposition = 'end'; // Render at the end of the line otherwise\n\t\t\t}\n\n\t\t\tlet topOfLine;\n\t\t\tlet contentStartOffset;\n\t\t\tlet deltaX = 0;\n\t\t\tlet deltaY = 0;\n\n\t\t\tswitch (position) {\n\t\t\t\tcase 'end': {\n\t\t\t\t\ttopOfLine = this._editorObs.editor.getTopForLineNumber(startLineNumber);\n\t\t\t\t\tcontentStartOffset = lineWidth;\n\t\t\t\t\tdeltaX = PADDING_HORIZONTALLY + MIN_END_OF_LINE_PADDING;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase 'below': {\n\t\t\t\t\ttopOfLine = this._editorObs.editor.getTopForLineNumber(startLineNumber + 1);\n\t\t\t\t\tcontentStartOffset = startContentLeftOffset;\n\t\t\t\t\tdeltaX = PADDING_HORIZONTALLY + HORIZONTAL_OFFSET_WHEN_ABOVE_BELOW;\n\t\t\t\t\tdeltaY = PADDING_VERTICALLY + VERTICAL_OFFSET_WHEN_ABOVE_BELOW;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase 'above': {\n\t\t\t\t\ttopOfLine = this._editorObs.editor.getTopForLineNumber(startLineNumber - 1);\n\t\t\t\t\tcontentStartOffset = startContentLeftOffset;\n\t\t\t\t\tdeltaX = PADDING_HORIZONTALLY + HORIZONTAL_OFFSET_WHEN_ABOVE_BELOW;\n\t\t\t\t\tdeltaY = -PADDING_VERTICALLY + VERTICAL_OFFSET_WHEN_ABOVE_BELOW;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst textRect = Rect.fromLeftTopWidthHeight(\n\t\t\t\tcontentLeft + contentStartOffset - scrollLeft,\n\t\t\t\ttopOfLine - scrollTop,\n\t\t\t\tw * displayLocation.content.length,\n\t\t\t\tlineHeight\n\t\t\t);\n\n\t\t\treturn textRect.withMargin(PADDING_VERTICALLY, PADDING_HORIZONTALLY).translateX(deltaX).translateY(deltaY);\n\t\t});\n\n\t\treturn {\n\t\t\trect,\n\t\t\tlabel: displayLocation.content,\n\t\t\tkind: displayLocation.style\n\t\t};\n\t}\n\n\tprivate getRendering(state: { rect: IObservable<Rect>; label: string; kind: InlineCompletionHintStyle }, styles: IObservable<{ background: string; border: string }>) {\n\n\t\tconst line = document.createElement('div');\n\t\tconst t = this._editor.getModel()!.tokenization.tokenizeLinesAt(1, [state.label])?.[0];\n\t\tlet tokens: LineTokens;\n\t\tif (t && state.kind === InlineCompletionHintStyle.Code) {\n\t\t\ttokens = TokenArray.fromLineTokens(t).toLineTokens(state.label, this._languageService.languageIdCodec);\n\t\t} else {\n\t\t\ttokens = LineTokens.createEmpty(state.label, this._languageService.languageIdCodec);\n\t\t}\n\n\t\tconst result = renderLines(new LineSource([tokens]), RenderOptions.fromEditor(this._editor).withSetWidth(false).withScrollBeyondLastColumn(0), [], line, true);\n\t\tline.style.width = `${result.minWidthInPx}px`;\n\n\t\tconst rect = state.rect.map(r => r.withMargin(0, PADDING_HORIZONTALLY));\n\n\t\treturn n.div({\n\t\t\tclass: 'collapsedView',\n\t\t\tref: this._viewRef,\n\t\t\tstyle: {\n\t\t\t\tposition: 'absolute',\n\t\t\t\t...rectToProps(reader => rect.read(reader)),\n\t\t\t\toverflow: 'hidden',\n\t\t\t\tboxSizing: 'border-box',\n\t\t\t\tcursor: 'pointer',\n\t\t\t\tborder: styles.map(s => `1px solid ${s.border}`),\n\t\t\t\tborderRadius: `${INLINE_EDITS_BORDER_RADIUS}px`,\n\t\t\t\tbackgroundColor: styles.map(s => s.background),\n\n\t\t\t\tdisplay: 'flex',\n\t\t\t\talignItems: 'center',\n\t\t\t\tjustifyContent: 'center',\n\t\t\t\twhiteSpace: 'nowrap',\n\t\t\t},\n\t\t\tonmousedown: e => {\n\t\t\t\te.preventDefault(); // This prevents that the editor loses focus\n\t\t\t},\n\t\t\tonclick: (e) => { this._onDidClick.fire(InlineEditClickEvent.create(e)); }\n\t\t}, [\n\t\t\tline\n\t\t]);\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { n } from '../../../../../../../base/browser/dom.js';\nimport { Emitter } from '../../../../../../../base/common/event.js';\nimport { Disposable } from '../../../../../../../base/common/lifecycle.js';\nimport { autorun, constObservable, derived, derivedObservableWithCache, IObservable, IReader, observableValue } from '../../../../../../../base/common/observable.js';\nimport { IThemeService } from '../../../../../../../platform/theme/common/themeService.js';\nimport { ICodeEditor } from '../../../../../../browser/editorBrowser.js';\nimport { ObservableCodeEditor, observableCodeEditor } from '../../../../../../browser/observableCodeEditor.js';\nimport { LineSource, renderLines, RenderOptions } from '../../../../../../browser/widget/diffEditor/components/diffEditorViewZones/renderLines.js';\nimport { EditorOption } from '../../../../../../common/config/editorOptions.js';\nimport { Rect } from '../../../../../../common/core/2d/rect.js';\nimport { LineRange } from '../../../../../../common/core/ranges/lineRange.js';\nimport { InlineCompletionHintStyle } from '../../../../../../common/languages.js';\nimport { ILanguageService } from '../../../../../../common/languages/language.js';\nimport { LineTokens, TokenArray } from '../../../../../../common/tokens/lineTokens.js';\nimport { InlineSuggestHint } from '../../../model/inlineSuggestionItem.js';\nimport { InlineCompletionEditorType } from '../../../model/provideInlineCompletions.js';\nimport { IInlineEditsView, InlineEditClickEvent, InlineEditTabAction } from '../inlineEditsViewInterface.js';\nimport { getEditorBackgroundColor, getEditorBlendedColor, INLINE_EDITS_BORDER_RADIUS, inlineEditIndicatorPrimaryBackground, inlineEditIndicatorSecondaryBackground, inlineEditIndicatorSuccessfulBackground } from '../theme.js';\nimport { getContentRenderWidth, maxContentWidthInRange, rectToProps } from '../utils/utils.js';\n\nconst MIN_END_OF_LINE_PADDING = 14;\nconst PADDING_VERTICALLY = 0;\nconst PADDING_HORIZONTALLY = 4;\nconst HORIZONTAL_OFFSET_WHEN_ABOVE_BELOW = 4;\nconst VERTICAL_OFFSET_WHEN_ABOVE_BELOW = 2;\n// !! minEndOfLinePadding should always be larger than paddingHorizontally + horizontalOffsetWhenAboveBelow\n\nexport class InlineEditsCustomView extends Disposable implements IInlineEditsView {\n\n\tprivate readonly _onDidClick = this._register(new Emitter<InlineEditClickEvent>());\n\treadonly onDidClick = this._onDidClick.event;\n\n\tprivate readonly _isHovered = observableValue(this, false);\n\treadonly isHovered: IObservable<boolean> = this._isHovered;\n\tprivate readonly _viewRef = n.ref<HTMLDivElement>();\n\n\tprivate readonly _editorObs: ObservableCodeEditor;\n\n\treadonly minEditorScrollHeight: IObservable<number>;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tdisplayLocation: IObservable<InlineSuggestHint | undefined>,\n\t\ttabAction: IObservable<InlineEditTabAction>,\n\t\teditorType: IObservable<InlineCompletionEditorType>,\n\t\t@IThemeService themeService: IThemeService,\n\t\t@ILanguageService private readonly _languageService: ILanguageService,\n\t) {\n\t\tsuper();\n\n\t\tthis._editorObs = observableCodeEditor(this._editor);\n\n\t\tconst styles = tabAction.map((v, reader) => {\n\t\t\tlet border;\n\t\t\tswitch (v) {\n\t\t\t\tcase InlineEditTabAction.Inactive: border = inlineEditIndicatorSecondaryBackground; break;\n\t\t\t\tcase InlineEditTabAction.Jump: border = inlineEditIndicatorPrimaryBackground; break;\n\t\t\t\tcase InlineEditTabAction.Accept: border = inlineEditIndicatorSuccessfulBackground; break;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tborder: getEditorBlendedColor(border, themeService).read(reader).toString(),\n\t\t\t\tbackground: getEditorBackgroundColor(editorType.read(reader))\n\t\t\t};\n\t\t});\n\n\t\tconst state = displayLocation.map(dl => dl ? this.getState(dl) : undefined);\n\n\t\tconst view = state.map(s => s ? this.getRendering(s, styles) : undefined);\n\n\t\tthis.minEditorScrollHeight = derived(this, reader => {\n\t\t\tconst s = state.read(reader);\n\t\t\tif (!s) {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\treturn s.rect.read(reader).bottom + this._editor.getScrollTop();\n\t\t});\n\n\t\tconst overlay = n.div({\n\t\t\tclass: 'inline-edits-custom-view',\n\t\t\tstyle: {\n\t\t\t\tposition: 'absolute',\n\t\t\t\toverflow: 'visible',\n\t\t\t\ttop: '0px',\n\t\t\t\tleft: '0px',\n\t\t\t\tdisplay: 'block',\n\t\t\t},\n\t\t}, [view]).keepUpdated(this._store);\n\n\t\tthis._register(this._editorObs.createOverlayWidget({\n\t\t\tdomNode: overlay.element,\n\t\t\tposition: constObservable(null),\n\t\t\tallowEditorOverflow: false,\n\t\t\tminContentWidthInPx: derivedObservableWithCache<number>(this, (reader, prev) => {\n\t\t\t\tconst s = state.read(reader);\n\t\t\t\tif (!s) { return prev ?? 0; }\n\n\t\t\t\tconst current = s.rect.map(rect => rect.right).read(reader)\n\t\t\t\t\t+ this._editorObs.layoutInfoVerticalScrollbarWidth.read(reader)\n\t\t\t\t\t+ PADDING_HORIZONTALLY\n\t\t\t\t\t- this._editorObs.layoutInfoContentLeft.read(reader);\n\t\t\t\treturn Math.max(prev ?? 0, current); // will run into infinite loop otherwise TODO: fix this\n\t\t\t}).recomputeInitiallyAndOnChange(this._store),\n\t\t}));\n\n\t\tthis._register(autorun((reader) => {\n\t\t\tconst v = view.read(reader);\n\t\t\tif (!v) { this._isHovered.set(false, undefined); return; }\n\t\t\tthis._isHovered.set(overlay.isHovered.read(reader), undefined);\n\t\t}));\n\t}\n\n\t// TODO: this is very similar to side by side `fitsInsideViewport`, try to use the same function\n\tprivate fitsInsideViewport(range: LineRange, displayLabel: string, reader: IReader | undefined): boolean {\n\t\tconst editorWidth = this._editorObs.layoutInfoWidth.read(reader);\n\t\tconst editorContentLeft = this._editorObs.layoutInfoContentLeft.read(reader);\n\t\tconst editorVerticalScrollbar = this._editor.getLayoutInfo().verticalScrollbarWidth;\n\t\tconst minimapWidth = this._editorObs.layoutInfoMinimap.read(reader).minimapLeft !== 0 ? this._editorObs.layoutInfoMinimap.read(reader).minimapWidth : 0;\n\n\t\tconst maxOriginalContent = maxContentWidthInRange(this._editorObs, range, undefined);\n\t\tconst maxModifiedContent = getContentRenderWidth(displayLabel, this._editor, this._editor.getModel()!);\n\t\tconst padding = PADDING_HORIZONTALLY + MIN_END_OF_LINE_PADDING;\n\n\t\treturn maxOriginalContent + maxModifiedContent + padding < editorWidth - editorContentLeft - editorVerticalScrollbar - minimapWidth;\n\t}\n\n\tprivate getState(displayLocation: InlineSuggestHint): { rect: IObservable<Rect>; label: string; kind: InlineCompletionHintStyle } {\n\n\t\tconst contentState = derived(this, (reader) => {\n\t\t\tconst startLineNumber = displayLocation.range.startLineNumber;\n\t\t\tconst endLineNumber = displayLocation.range.endLineNumber;\n\t\t\tconst startColumn = displayLocation.range.startColumn;\n\t\t\tconst endColumn = displayLocation.range.endColumn;\n\t\t\tconst lineCount = this._editor.getModel()?.getLineCount() ?? 0;\n\n\t\t\tconst lineWidth = maxContentWidthInRange(this._editorObs, new LineRange(startLineNumber, startLineNumber + 1), reader);\n\t\t\tconst lineWidthBelow = startLineNumber + 1 <= lineCount ? maxContentWidthInRange(this._editorObs, new LineRange(startLineNumber + 1, startLineNumber + 2), reader) : undefined;\n\t\t\tconst lineWidthAbove = startLineNumber - 1 >= 1 ? maxContentWidthInRange(this._editorObs, new LineRange(startLineNumber - 1, startLineNumber), reader) : undefined;\n\t\t\tconst startContentLeftOffset = this._editor.getOffsetForColumn(startLineNumber, startColumn);\n\t\t\tconst endContentLeftOffset = this._editor.getOffsetForColumn(endLineNumber, endColumn);\n\n\t\t\treturn {\n\t\t\t\tlineWidth,\n\t\t\t\tlineWidthBelow,\n\t\t\t\tlineWidthAbove,\n\t\t\t\tstartContentLeftOffset,\n\t\t\t\tendContentLeftOffset\n\t\t\t};\n\t\t});\n\n\t\tconst startLineNumber = displayLocation.range.startLineNumber;\n\t\tconst endLineNumber = displayLocation.range.endLineNumber;\n\t\t// only check viewport once in the beginning when rendering the view\n\t\tconst fitsInsideViewport = this.fitsInsideViewport(new LineRange(startLineNumber, endLineNumber + 1), displayLocation.content, undefined);\n\n\t\tconst rect = derived(this, reader => {\n\t\t\tconst w = this._editorObs.getOption(EditorOption.fontInfo).read(reader).typicalHalfwidthCharacterWidth;\n\n\t\t\tconst { lineWidth, lineWidthBelow, lineWidthAbove, startContentLeftOffset, endContentLeftOffset } = contentState.read(reader);\n\n\t\t\tconst contentLeft = this._editorObs.layoutInfoContentLeft.read(reader);\n\t\t\tconst lineHeight = this._editorObs.observeLineHeightForLine(startLineNumber).recomputeInitiallyAndOnChange(reader.store).read(reader);\n\t\t\tconst scrollTop = this._editorObs.scrollTop.read(reader);\n\t\t\tconst scrollLeft = this._editorObs.scrollLeft.read(reader);\n\n\t\t\tlet position: 'end' | 'below' | 'above';\n\t\t\tif (startLineNumber === endLineNumber && endContentLeftOffset + 5 * w >= lineWidth && fitsInsideViewport) {\n\t\t\t\tposition = 'end'; // Render at the end of the line if the range ends almost at the end of the line\n\t\t\t} else if (lineWidthBelow !== undefined && lineWidthBelow + MIN_END_OF_LINE_PADDING - HORIZONTAL_OFFSET_WHEN_ABOVE_BELOW - PADDING_HORIZONTALLY < startContentLeftOffset) {\n\t\t\t\tposition = 'below'; // Render Below if possible\n\t\t\t} else if (lineWidthAbove !== undefined && lineWidthAbove + MIN_END_OF_LINE_PADDING - HORIZONTAL_OFFSET_WHEN_ABOVE_BELOW - PADDING_HORIZONTALLY < startContentLeftOffset) {\n\t\t\t\tposition = 'above'; // Render Above if possible\n\t\t\t} else {\n\t\t\t\tposition = 'end'; // Render at the end of the line otherwise\n\t\t\t}\n\n\t\t\tlet topOfLine;\n\t\t\tlet contentStartOffset;\n\t\t\tlet deltaX = 0;\n\t\t\tlet deltaY = 0;\n\n\t\t\tswitch (position) {\n\t\t\t\tcase 'end': {\n\t\t\t\t\ttopOfLine = this._editorObs.editor.getTopForLineNumber(startLineNumber);\n\t\t\t\t\tcontentStartOffset = lineWidth;\n\t\t\t\t\tdeltaX = PADDING_HORIZONTALLY + MIN_END_OF_LINE_PADDING;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase 'below': {\n\t\t\t\t\ttopOfLine = this._editorObs.editor.getTopForLineNumber(startLineNumber + 1);\n\t\t\t\t\tcontentStartOffset = startContentLeftOffset;\n\t\t\t\t\tdeltaX = PADDING_HORIZONTALLY + HORIZONTAL_OFFSET_WHEN_ABOVE_BELOW;\n\t\t\t\t\tdeltaY = PADDING_VERTICALLY + VERTICAL_OFFSET_WHEN_ABOVE_BELOW;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase 'above': {\n\t\t\t\t\ttopOfLine = this._editorObs.editor.getTopForLineNumber(startLineNumber - 1);\n\t\t\t\t\tcontentStartOffset = startContentLeftOffset;\n\t\t\t\t\tdeltaX = PADDING_HORIZONTALLY + HORIZONTAL_OFFSET_WHEN_ABOVE_BELOW;\n\t\t\t\t\tdeltaY = -PADDING_VERTICALLY + VERTICAL_OFFSET_WHEN_ABOVE_BELOW;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst textRect = Rect.fromLeftTopWidthHeight(\n\t\t\t\tcontentLeft + contentStartOffset - scrollLeft,\n\t\t\t\ttopOfLine - scrollTop,\n\t\t\t\tw * displayLocation.content.length,\n\t\t\t\tlineHeight\n\t\t\t);\n\n\t\t\treturn textRect.withMargin(PADDING_VERTICALLY, PADDING_HORIZONTALLY).translateX(deltaX).translateY(deltaY);\n\t\t});\n\n\t\treturn {\n\t\t\trect,\n\t\t\tlabel: displayLocation.content,\n\t\t\tkind: displayLocation.style\n\t\t};\n\t}\n\n\tprivate getRendering(state: { rect: IObservable<Rect>; label: string; kind: InlineCompletionHintStyle }, styles: IObservable<{ background: string; border: string }>) {\n\n\t\tconst line = document.createElement('div');\n\t\tconst t = this._editor.getModel()!.tokenization.tokenizeLinesAt(1, [state.label])?.[0];\n\t\tlet tokens: LineTokens;\n\t\tif (t && state.kind === InlineCompletionHintStyle.Code) {\n\t\t\ttokens = TokenArray.fromLineTokens(t).toLineTokens(state.label, this._languageService.languageIdCodec);\n\t\t} else {\n\t\t\ttokens = LineTokens.createEmpty(state.label, this._languageService.languageIdCodec);\n\t\t}\n\n\t\tconst result = renderLines(new LineSource([tokens]), RenderOptions.fromEditor(this._editor).withSetWidth(false).withScrollBeyondLastColumn(0), [], line, true);\n\t\tline.style.width = `${result.minWidthInPx}px`;\n\n\t\tconst rect = state.rect.map(r => r.withMargin(0, PADDING_HORIZONTALLY));\n\n\t\treturn n.div({\n\t\t\tclass: 'collapsedView',\n\t\t\tref: this._viewRef,\n\t\t\tstyle: {\n\t\t\t\tposition: 'absolute',\n\t\t\t\t...rectToProps(reader => rect.read(reader)),\n\t\t\t\toverflow: 'hidden',\n\t\t\t\tboxSizing: 'border-box',\n\t\t\t\tcursor: 'pointer',\n\t\t\t\tborder: styles.map(s => `1px solid ${s.border}`),\n\t\t\t\tborderRadius: `${INLINE_EDITS_BORDER_RADIUS}px`,\n\t\t\t\tbackgroundColor: styles.map(s => s.background),\n\n\t\t\t\tdisplay: 'flex',\n\t\t\t\talignItems: 'center',\n\t\t\t\tjustifyContent: 'center',\n\t\t\t\twhiteSpace: 'nowrap',\n\t\t\t},\n\t\t\tonmousedown: e => {\n\t\t\t\te.preventDefault(); // This prevents that the editor loses focus\n\t\t\t},\n\t\t\tonclick: (e) => { this._onDidClick.fire(InlineEditClickEvent.create(e)); }\n\t\t}, [\n\t\t\tline\n\t\t]);\n\t}\n}\n"]}
@@ -6,14 +6,14 @@ import { n } from '../../../../../../../base/browser/dom.js';
6
6
  import { Event } from '../../../../../../../base/common/event.js';
7
7
  import { Disposable } from '../../../../../../../base/common/lifecycle.js';
8
8
  import { constObservable, derived, derivedObservableWithCache } from '../../../../../../../base/common/observable.js';
9
- import { editorBackground } from '../../../../../../../platform/theme/common/colorRegistry.js';
10
9
  import { asCssVariable } from '../../../../../../../platform/theme/common/colorUtils.js';
11
10
  import { observableCodeEditor } from '../../../../../../browser/observableCodeEditor.js';
12
11
  import { Rect } from '../../../../../../common/core/2d/rect.js';
13
12
  import { OffsetRange } from '../../../../../../common/core/ranges/offsetRange.js';
14
13
  import { Position } from '../../../../../../common/core/position.js';
15
- import { getOriginalBorderColor, INLINE_EDITS_BORDER_RADIUS, originalBackgroundColor } from '../theme.js';
14
+ import { getEditorBackgroundColor, getOriginalBorderColor, INLINE_EDITS_BORDER_RADIUS, originalBackgroundColor } from '../theme.js';
16
15
  import { getPrefixTrim, mapOutFalsy, maxContentWidthInRange } from '../utils/utils.js';
16
+ import { InlineCompletionEditorType } from '../../../model/provideInlineCompletions.js';
17
17
  const HORIZONTAL_PADDING = 0;
18
18
  const VERTICAL_PADDING = 0;
19
19
  const BORDER_WIDTH = 1;
@@ -90,15 +90,16 @@ export class InlineEditsDeletionView extends Disposable {
90
90
  const overlayHider = overlayhider.read(reader);
91
91
  return rect.intersectHorizontal(new OffsetRange(overlayHider.left, Number.MAX_SAFE_INTEGER));
92
92
  });
93
- const separatorWidth = this._uiState.map(s => s?.inDiffEditor ? WIDGET_SEPARATOR_DIFF_EDITOR_WIDTH : WIDGET_SEPARATOR_WIDTH).read(reader);
93
+ const separatorWidth = this._uiState.map(s => s?.editorType === InlineCompletionEditorType.DiffEditor ? WIDGET_SEPARATOR_DIFF_EDITOR_WIDTH : WIDGET_SEPARATOR_WIDTH).read(reader);
94
94
  const separatorRect = overlayRect.map(rect => rect.withMargin(separatorWidth, separatorWidth));
95
+ const editorBackground = getEditorBackgroundColor(this._uiState.map(s => s?.editorType ?? InlineCompletionEditorType.TextEditor).read(reader));
95
96
  return [
96
97
  n.div({
97
98
  class: 'originalSeparatorDeletion',
98
99
  style: {
99
100
  ...separatorRect.read(reader).toStyles(),
100
101
  borderRadius: `${BORDER_RADIUS}px`,
101
- border: `${BORDER_WIDTH + separatorWidth}px solid ${asCssVariable(editorBackground)}`,
102
+ border: `${BORDER_WIDTH + separatorWidth}px solid ${editorBackground}`,
102
103
  boxSizing: 'border-box',
103
104
  }
104
105
  }),
@@ -116,7 +117,7 @@ export class InlineEditsDeletionView extends Disposable {
116
117
  class: 'originalOverlayHiderDeletion',
117
118
  style: {
118
119
  ...overlayhider.read(reader).toStyles(),
119
- backgroundColor: asCssVariable(editorBackground),
120
+ backgroundColor: editorBackground,
120
121
  }
121
122
  })
122
123
  ];
@@ -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/inlineEditsDeletionView.ts","vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsDeletionView.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,EAAE,CAAC,EAAE,MAAM,0CAA0C,CAAC;AAC7D,OAAO,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,0BAA0B,EAAe,MAAM,gDAAgD,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CAAC,CAAC;SACF,CAAC,CAAC,CAAC;IACL,CAAC;CAiID","file":"inlineEditsDeletionView.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { n } from '../../../../../../../base/browser/dom.js';\nimport { Event } from '../../../../../../../base/common/event.js';\nimport { Disposable } from '../../../../../../../base/common/lifecycle.js';\nimport { constObservable, derived, derivedObservableWithCache, IObservable } from '../../../../../../../base/common/observable.js';\nimport { editorBackground } from '../../../../../../../platform/theme/common/colorRegistry.js';\nimport { asCssVariable } from '../../../../../../../platform/theme/common/colorUtils.js';\nimport { ICodeEditor } from '../../../../../../browser/editorBrowser.js';\nimport { ObservableCodeEditor, observableCodeEditor } from '../../../../../../browser/observableCodeEditor.js';\nimport { 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 { IInlineEditsView, InlineEditTabAction } from '../inlineEditsViewInterface.js';\nimport { InlineEditWithChanges } from '../inlineEditWithChanges.js';\nimport { getOriginalBorderColor, INLINE_EDITS_BORDER_RADIUS, originalBackgroundColor } from '../theme.js';\nimport { getPrefixTrim, mapOutFalsy, maxContentWidthInRange } from '../utils/utils.js';\n\nconst HORIZONTAL_PADDING = 0;\nconst VERTICAL_PADDING = 0;\nconst BORDER_WIDTH = 1;\nconst WIDGET_SEPARATOR_WIDTH = 1;\nconst WIDGET_SEPARATOR_DIFF_EDITOR_WIDTH = 3;\nconst BORDER_RADIUS = INLINE_EDITS_BORDER_RADIUS;\n\nexport class InlineEditsDeletionView extends Disposable implements IInlineEditsView {\n\n\treadonly onDidClick = Event.None;\n\n\tprivate readonly _editorObs: ObservableCodeEditor;\n\n\tprivate readonly _originalVerticalStartPosition: IObservable<number | undefined>;\n\tprivate readonly _originalVerticalEndPosition: IObservable<number | undefined>;\n\n\tprivate readonly _originalDisplayRange: IObservable<LineRange | undefined>;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tprivate readonly _edit: IObservable<InlineEditWithChanges | undefined>,\n\t\tprivate readonly _uiState: IObservable<{\n\t\t\toriginalRange: LineRange;\n\t\t\tdeletions: Range[];\n\t\t\tinDiffEditor: boolean;\n\t\t} | undefined>,\n\t\tprivate readonly _tabAction: IObservable<InlineEditTabAction>,\n\t) {\n\t\tsuper();\n\n\t\tthis._editorObs = observableCodeEditor(this._editor);\n\n\t\tconst originalStartPosition = derived(this, (reader) => {\n\t\t\tconst inlineEdit = this._edit.read(reader);\n\t\t\treturn inlineEdit ? new Position(inlineEdit.originalLineRange.startLineNumber, 1) : null;\n\t\t});\n\n\t\tconst originalEndPosition = derived(this, (reader) => {\n\t\t\tconst inlineEdit = this._edit.read(reader);\n\t\t\treturn inlineEdit ? new Position(inlineEdit.originalLineRange.endLineNumberExclusive, 1) : null;\n\t\t});\n\n\t\tthis._originalDisplayRange = this._uiState.map(s => s?.originalRange);\n\t\tthis._originalVerticalStartPosition = this._editorObs.observePosition(originalStartPosition, this._store).map(p => p?.y);\n\t\tthis._originalVerticalEndPosition = this._editorObs.observePosition(originalEndPosition, this._store).map(p => p?.y);\n\n\t\tthis._register(this._editorObs.createOverlayWidget({\n\t\t\tdomNode: this._nonOverflowView.element,\n\t\t\tposition: constObservable(null),\n\t\t\tallowEditorOverflow: false,\n\t\t\tminContentWidthInPx: derived(this, reader => {\n\t\t\t\tconst info = this._editorLayoutInfo.read(reader);\n\t\t\t\tif (info === null) { return 0; }\n\t\t\t\treturn info.codeRect.width;\n\t\t\t}),\n\t\t}));\n\t}\n\n\tprivate readonly _display = derived(this, reader => !!this._uiState.read(reader) ? 'block' : 'none');\n\n\tprivate readonly _editorMaxContentWidthInRange = derived(this, reader => {\n\t\tconst originalDisplayRange = this._originalDisplayRange.read(reader);\n\t\tif (!originalDisplayRange) {\n\t\t\treturn constObservable(0);\n\t\t}\n\t\tthis._editorObs.versionId.read(reader);\n\n\t\t// Take the max value that we observed.\n\t\t// Reset when either the edit changes or the editor text version.\n\t\treturn derivedObservableWithCache<number>(this, (reader, lastValue) => {\n\t\t\tconst maxWidth = maxContentWidthInRange(this._editorObs, originalDisplayRange, reader);\n\t\t\treturn Math.max(maxWidth, lastValue ?? 0);\n\t\t});\n\t}).map((v, r) => v.read(r));\n\n\tprivate readonly _maxPrefixTrim = derived(this, reader => {\n\t\tconst state = this._uiState.read(reader);\n\t\tif (!state) {\n\t\t\treturn { prefixTrim: 0, prefixLeftOffset: 0 };\n\t\t}\n\t\treturn getPrefixTrim(state.deletions, state.originalRange, [], this._editor);\n\t});\n\n\tprivate readonly _editorLayoutInfo = derived(this, (reader) => {\n\t\tconst inlineEdit = this._edit.read(reader);\n\t\tif (!inlineEdit) {\n\t\t\treturn null;\n\t\t}\n\t\tconst state = this._uiState.read(reader);\n\t\tif (!state) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst editorLayout = this._editorObs.layoutInfo.read(reader);\n\t\tconst horizontalScrollOffset = this._editorObs.scrollLeft.read(reader);\n\t\tconst w = this._editorObs.getOption(EditorOption.fontInfo).map(f => f.typicalHalfwidthCharacterWidth).read(reader);\n\n\t\tconst right = editorLayout.contentLeft + Math.max(this._editorMaxContentWidthInRange.read(reader), w) - horizontalScrollOffset;\n\n\t\tconst range = inlineEdit.originalLineRange;\n\t\tconst selectionTop = this._originalVerticalStartPosition.read(reader) ?? this._editor.getTopForLineNumber(range.startLineNumber) - this._editorObs.scrollTop.read(reader);\n\t\tconst selectionBottom = this._originalVerticalEndPosition.read(reader) ?? this._editor.getTopForLineNumber(range.endLineNumberExclusive) - this._editorObs.scrollTop.read(reader);\n\n\t\tconst left = editorLayout.contentLeft + this._maxPrefixTrim.read(reader).prefixLeftOffset - horizontalScrollOffset;\n\n\t\tif (right <= left) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst codeRect = Rect.fromLeftTopRightBottom(left, selectionTop, right, selectionBottom).withMargin(VERTICAL_PADDING, HORIZONTAL_PADDING);\n\n\t\treturn {\n\t\t\tcodeRect,\n\t\t\tcontentLeft: editorLayout.contentLeft,\n\t\t};\n\t}).recomputeInitiallyAndOnChange(this._store);\n\n\tprivate readonly _originalOverlay = n.div({\n\t\tstyle: { pointerEvents: 'none', }\n\t}, derived(this, reader => {\n\t\tconst layoutInfoObs = mapOutFalsy(this._editorLayoutInfo).read(reader);\n\t\tif (!layoutInfoObs) { return undefined; }\n\n\t\t// Create an overlay which hides the left hand side of the original overlay when it overflows to the left\n\t\t// such that there is a smooth transition at the edge of content left\n\t\tconst overlayhider = layoutInfoObs.map(layoutInfo => Rect.fromLeftTopRightBottom(\n\t\t\tlayoutInfo.contentLeft - BORDER_RADIUS - BORDER_WIDTH,\n\t\t\tlayoutInfo.codeRect.top,\n\t\t\tlayoutInfo.contentLeft,\n\t\t\tlayoutInfo.codeRect.bottom\n\t\t));\n\n\t\tconst overlayRect = derived(this, reader => {\n\t\t\tconst rect = layoutInfoObs.read(reader).codeRect;\n\t\t\tconst overlayHider = overlayhider.read(reader);\n\t\t\treturn rect.intersectHorizontal(new OffsetRange(overlayHider.left, Number.MAX_SAFE_INTEGER));\n\t\t});\n\n\t\tconst separatorWidth = this._uiState.map(s => s?.inDiffEditor ? WIDGET_SEPARATOR_DIFF_EDITOR_WIDTH : WIDGET_SEPARATOR_WIDTH).read(reader);\n\t\tconst separatorRect = overlayRect.map(rect => rect.withMargin(separatorWidth, separatorWidth));\n\n\t\treturn [\n\t\t\tn.div({\n\t\t\t\tclass: 'originalSeparatorDeletion',\n\t\t\t\tstyle: {\n\t\t\t\t\t...separatorRect.read(reader).toStyles(),\n\t\t\t\t\tborderRadius: `${BORDER_RADIUS}px`,\n\t\t\t\t\tborder: `${BORDER_WIDTH + separatorWidth}px solid ${asCssVariable(editorBackground)}`,\n\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t}\n\t\t\t}),\n\t\t\tn.div({\n\t\t\t\tclass: 'originalOverlayDeletion',\n\t\t\t\tstyle: {\n\t\t\t\t\t...overlayRect.read(reader).toStyles(),\n\t\t\t\t\tborderRadius: `${BORDER_RADIUS}px`,\n\t\t\t\t\tborder: getOriginalBorderColor(this._tabAction).map(bc => `${BORDER_WIDTH}px solid ${asCssVariable(bc)}`),\n\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\tbackgroundColor: asCssVariable(originalBackgroundColor),\n\t\t\t\t}\n\t\t\t}),\n\t\t\tn.div({\n\t\t\t\tclass: 'originalOverlayHiderDeletion',\n\t\t\t\tstyle: {\n\t\t\t\t\t...overlayhider.read(reader).toStyles(),\n\t\t\t\t\tbackgroundColor: asCssVariable(editorBackground),\n\t\t\t\t}\n\t\t\t})\n\t\t];\n\t})).keepUpdated(this._store);\n\n\tprivate readonly _nonOverflowView = n.div({\n\t\tclass: 'inline-edits-view',\n\t\tstyle: {\n\t\t\tposition: 'absolute',\n\t\t\toverflow: 'visible',\n\t\t\ttop: '0px',\n\t\t\tleft: '0px',\n\t\t\tdisplay: this._display,\n\t\t},\n\t}, [\n\t\t[this._originalOverlay],\n\t]).keepUpdated(this._store);\n\n\treadonly isHovered = constObservable(false);\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { n } from '../../../../../../../base/browser/dom.js';\nimport { Event } from '../../../../../../../base/common/event.js';\nimport { Disposable } from '../../../../../../../base/common/lifecycle.js';\nimport { constObservable, derived, derivedObservableWithCache, IObservable } from '../../../../../../../base/common/observable.js';\nimport { editorBackground } from '../../../../../../../platform/theme/common/colorRegistry.js';\nimport { asCssVariable } from '../../../../../../../platform/theme/common/colorUtils.js';\nimport { ICodeEditor } from '../../../../../../browser/editorBrowser.js';\nimport { ObservableCodeEditor, observableCodeEditor } from '../../../../../../browser/observableCodeEditor.js';\nimport { 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 { IInlineEditsView, InlineEditTabAction } from '../inlineEditsViewInterface.js';\nimport { InlineEditWithChanges } from '../inlineEditWithChanges.js';\nimport { getOriginalBorderColor, INLINE_EDITS_BORDER_RADIUS, originalBackgroundColor } from '../theme.js';\nimport { getPrefixTrim, mapOutFalsy, maxContentWidthInRange } from '../utils/utils.js';\n\nconst HORIZONTAL_PADDING = 0;\nconst VERTICAL_PADDING = 0;\nconst BORDER_WIDTH = 1;\nconst WIDGET_SEPARATOR_WIDTH = 1;\nconst WIDGET_SEPARATOR_DIFF_EDITOR_WIDTH = 3;\nconst BORDER_RADIUS = INLINE_EDITS_BORDER_RADIUS;\n\nexport class InlineEditsDeletionView extends Disposable implements IInlineEditsView {\n\n\treadonly onDidClick = Event.None;\n\n\tprivate readonly _editorObs: ObservableCodeEditor;\n\n\tprivate readonly _originalVerticalStartPosition: IObservable<number | undefined>;\n\tprivate readonly _originalVerticalEndPosition: IObservable<number | undefined>;\n\n\tprivate readonly _originalDisplayRange: IObservable<LineRange | undefined>;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tprivate readonly _edit: IObservable<InlineEditWithChanges | undefined>,\n\t\tprivate readonly _uiState: IObservable<{\n\t\t\toriginalRange: LineRange;\n\t\t\tdeletions: Range[];\n\t\t\tinDiffEditor: boolean;\n\t\t} | undefined>,\n\t\tprivate readonly _tabAction: IObservable<InlineEditTabAction>,\n\t) {\n\t\tsuper();\n\n\t\tthis._editorObs = observableCodeEditor(this._editor);\n\n\t\tconst originalStartPosition = derived(this, (reader) => {\n\t\t\tconst inlineEdit = this._edit.read(reader);\n\t\t\treturn inlineEdit ? new Position(inlineEdit.originalLineRange.startLineNumber, 1) : null;\n\t\t});\n\n\t\tconst originalEndPosition = derived(this, (reader) => {\n\t\t\tconst inlineEdit = this._edit.read(reader);\n\t\t\treturn inlineEdit ? new Position(inlineEdit.originalLineRange.endLineNumberExclusive, 1) : null;\n\t\t});\n\n\t\tthis._originalDisplayRange = this._uiState.map(s => s?.originalRange);\n\t\tthis._originalVerticalStartPosition = this._editorObs.observePosition(originalStartPosition, this._store).map(p => p?.y);\n\t\tthis._originalVerticalEndPosition = this._editorObs.observePosition(originalEndPosition, this._store).map(p => p?.y);\n\n\t\tthis._register(this._editorObs.createOverlayWidget({\n\t\t\tdomNode: this._nonOverflowView.element,\n\t\t\tposition: constObservable(null),\n\t\t\tallowEditorOverflow: false,\n\t\t\tminContentWidthInPx: derived(this, reader => {\n\t\t\t\tconst info = this._editorLayoutInfo.read(reader);\n\t\t\t\tif (info === null) { return 0; }\n\t\t\t\treturn info.codeRect.width;\n\t\t\t}),\n\t\t}));\n\t}\n\n\tprivate readonly _display = derived(this, reader => !!this._uiState.read(reader) ? 'block' : 'none');\n\n\tprivate readonly _editorMaxContentWidthInRange = derived(this, reader => {\n\t\tconst originalDisplayRange = this._originalDisplayRange.read(reader);\n\t\tif (!originalDisplayRange) {\n\t\t\treturn constObservable(0);\n\t\t}\n\t\tthis._editorObs.versionId.read(reader);\n\n\t\t// Take the max value that we observed.\n\t\t// Reset when either the edit changes or the editor text version.\n\t\treturn derivedObservableWithCache<number>(this, (reader, lastValue) => {\n\t\t\tconst maxWidth = maxContentWidthInRange(this._editorObs, originalDisplayRange, reader);\n\t\t\treturn Math.max(maxWidth, lastValue ?? 0);\n\t\t});\n\t}).map((v, r) => v.read(r));\n\n\tprivate readonly _maxPrefixTrim = derived(this, reader => {\n\t\tconst state = this._uiState.read(reader);\n\t\tif (!state) {\n\t\t\treturn { prefixTrim: 0, prefixLeftOffset: 0 };\n\t\t}\n\t\treturn getPrefixTrim(state.deletions, state.originalRange, [], this._editor);\n\t});\n\n\tprivate readonly _editorLayoutInfo = derived(this, (reader) => {\n\t\tconst inlineEdit = this._edit.read(reader);\n\t\tif (!inlineEdit) {\n\t\t\treturn null;\n\t\t}\n\t\tconst state = this._uiState.read(reader);\n\t\tif (!state) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst editorLayout = this._editorObs.layoutInfo.read(reader);\n\t\tconst horizontalScrollOffset = this._editorObs.scrollLeft.read(reader);\n\t\tconst w = this._editorObs.getOption(EditorOption.fontInfo).map(f => f.typicalHalfwidthCharacterWidth).read(reader);\n\n\t\tconst right = editorLayout.contentLeft + Math.max(this._editorMaxContentWidthInRange.read(reader), w) - horizontalScrollOffset;\n\n\t\tconst range = inlineEdit.originalLineRange;\n\t\tconst selectionTop = this._originalVerticalStartPosition.read(reader) ?? this._editor.getTopForLineNumber(range.startLineNumber) - this._editorObs.scrollTop.read(reader);\n\t\tconst selectionBottom = this._originalVerticalEndPosition.read(reader) ?? this._editor.getTopForLineNumber(range.endLineNumberExclusive) - this._editorObs.scrollTop.read(reader);\n\n\t\tconst left = editorLayout.contentLeft + this._maxPrefixTrim.read(reader).prefixLeftOffset - horizontalScrollOffset;\n\n\t\tif (right <= left) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst codeRect = Rect.fromLeftTopRightBottom(left, selectionTop, right, selectionBottom).withMargin(VERTICAL_PADDING, HORIZONTAL_PADDING);\n\n\t\treturn {\n\t\t\tcodeRect,\n\t\t\tcontentLeft: editorLayout.contentLeft,\n\t\t};\n\t}).recomputeInitiallyAndOnChange(this._store);\n\n\tprivate readonly _originalOverlay = n.div({\n\t\tstyle: { pointerEvents: 'none', }\n\t}, derived(this, reader => {\n\t\tconst layoutInfoObs = mapOutFalsy(this._editorLayoutInfo).read(reader);\n\t\tif (!layoutInfoObs) { return undefined; }\n\n\t\t// Create an overlay which hides the left hand side of the original overlay when it overflows to the left\n\t\t// such that there is a smooth transition at the edge of content left\n\t\tconst overlayhider = layoutInfoObs.map(layoutInfo => Rect.fromLeftTopRightBottom(\n\t\t\tlayoutInfo.contentLeft - BORDER_RADIUS - BORDER_WIDTH,\n\t\t\tlayoutInfo.codeRect.top,\n\t\t\tlayoutInfo.contentLeft,\n\t\t\tlayoutInfo.codeRect.bottom\n\t\t));\n\n\t\tconst overlayRect = derived(this, reader => {\n\t\t\tconst rect = layoutInfoObs.read(reader).codeRect;\n\t\t\tconst overlayHider = overlayhider.read(reader);\n\t\t\treturn rect.intersectHorizontal(new OffsetRange(overlayHider.left, Number.MAX_SAFE_INTEGER));\n\t\t});\n\n\t\tconst separatorWidth = this._uiState.map(s => s?.inDiffEditor ? WIDGET_SEPARATOR_DIFF_EDITOR_WIDTH : WIDGET_SEPARATOR_WIDTH).read(reader);\n\t\tconst separatorRect = overlayRect.map(rect => rect.withMargin(separatorWidth, separatorWidth));\n\n\t\treturn [\n\t\t\tn.div({\n\t\t\t\tclass: 'originalSeparatorDeletion',\n\t\t\t\tstyle: {\n\t\t\t\t\t...separatorRect.read(reader).toStyles(),\n\t\t\t\t\tborderRadius: `${BORDER_RADIUS}px`,\n\t\t\t\t\tborder: `${BORDER_WIDTH + separatorWidth}px solid ${asCssVariable(editorBackground)}`,\n\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t}\n\t\t\t}),\n\t\t\tn.div({\n\t\t\t\tclass: 'originalOverlayDeletion',\n\t\t\t\tstyle: {\n\t\t\t\t\t...overlayRect.read(reader).toStyles(),\n\t\t\t\t\tborderRadius: `${BORDER_RADIUS}px`,\n\t\t\t\t\tborder: getOriginalBorderColor(this._tabAction).map(bc => `${BORDER_WIDTH}px solid ${asCssVariable(bc)}`),\n\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\tbackgroundColor: asCssVariable(originalBackgroundColor),\n\t\t\t\t}\n\t\t\t}),\n\t\t\tn.div({\n\t\t\t\tclass: 'originalOverlayHiderDeletion',\n\t\t\t\tstyle: {\n\t\t\t\t\t...overlayhider.read(reader).toStyles(),\n\t\t\t\t\tbackgroundColor: asCssVariable(editorBackground),\n\t\t\t\t}\n\t\t\t})\n\t\t];\n\t})).keepUpdated(this._store);\n\n\tprivate readonly _nonOverflowView = n.div({\n\t\tclass: 'inline-edits-view',\n\t\tstyle: {\n\t\t\tposition: 'absolute',\n\t\t\toverflow: 'visible',\n\t\t\ttop: '0px',\n\t\t\tleft: '0px',\n\t\t\tdisplay: this._display,\n\t\t},\n\t}, [\n\t\t[this._originalOverlay],\n\t]).keepUpdated(this._store);\n\n\treadonly isHovered = constObservable(false);\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/inlineEditsDeletionView.ts","vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsDeletionView.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,EAAE,CAAC,EAAE,MAAM,0CAA0C,CAAC;AAC7D,OAAO,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,0BAA0B,EAAe,MAAM,gDAAgD,CAAC;AACnI,OAAO,EAAE,aAAa,EAAE,MAAM,0DAA0D,CAAC;AAEzF,OAAO,EAAwB,oBAAoB,EAAE,MAAM,mDAAmD,CAAC;AAC/G,OAAO,EAAE,IAAI,EAAE,MAAM,0CAA0C,CAAC;AAGhE,OAAO,EAAE,WAAW,EAAE,MAAM,qDAAqD,CAAC;AAClF,OAAO,EAAE,QAAQ,EAAE,MAAM,2CAA2C,CAAC;AAIrE,OAAO,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,u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------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { n } from '../../../../../../../base/browser/dom.js';\nimport { Event } from '../../../../../../../base/common/event.js';\nimport { Disposable } from '../../../../../../../base/common/lifecycle.js';\nimport { constObservable, derived, derivedObservableWithCache, IObservable } from '../../../../../../../base/common/observable.js';\nimport { asCssVariable } from '../../../../../../../platform/theme/common/colorUtils.js';\nimport { ICodeEditor } from '../../../../../../browser/editorBrowser.js';\nimport { ObservableCodeEditor, observableCodeEditor } from '../../../../../../browser/observableCodeEditor.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 { IInlineEditsView, InlineEditTabAction } from '../inlineEditsViewInterface.js';\nimport { InlineEditWithChanges } from '../inlineEditWithChanges.js';\nimport { getEditorBackgroundColor, getOriginalBorderColor, INLINE_EDITS_BORDER_RADIUS, originalBackgroundColor } from '../theme.js';\nimport { getPrefixTrim, mapOutFalsy, maxContentWidthInRange } from '../utils/utils.js';\nimport { InlineCompletionEditorType } from '../../../model/provideInlineCompletions.js';\n\nconst HORIZONTAL_PADDING = 0;\nconst VERTICAL_PADDING = 0;\nconst BORDER_WIDTH = 1;\nconst WIDGET_SEPARATOR_WIDTH = 1;\nconst WIDGET_SEPARATOR_DIFF_EDITOR_WIDTH = 3;\nconst BORDER_RADIUS = INLINE_EDITS_BORDER_RADIUS;\n\nexport class InlineEditsDeletionView extends Disposable implements IInlineEditsView {\n\n\treadonly onDidClick = Event.None;\n\n\tprivate readonly _editorObs: ObservableCodeEditor;\n\n\tprivate readonly _originalVerticalStartPosition: IObservable<number | undefined>;\n\tprivate readonly _originalVerticalEndPosition: IObservable<number | undefined>;\n\n\tprivate readonly _originalDisplayRange: IObservable<LineRange | undefined>;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tprivate readonly _edit: IObservable<InlineEditWithChanges | undefined>,\n\t\tprivate readonly _uiState: IObservable<{\n\t\t\toriginalRange: LineRange;\n\t\t\tdeletions: Range[];\n\t\t\teditorType: InlineCompletionEditorType;\n\t\t} | undefined>,\n\t\tprivate readonly _tabAction: IObservable<InlineEditTabAction>,\n\t) {\n\t\tsuper();\n\n\t\tthis._editorObs = observableCodeEditor(this._editor);\n\n\t\tconst originalStartPosition = derived(this, (reader) => {\n\t\t\tconst inlineEdit = this._edit.read(reader);\n\t\t\treturn inlineEdit ? new Position(inlineEdit.originalLineRange.startLineNumber, 1) : null;\n\t\t});\n\n\t\tconst originalEndPosition = derived(this, (reader) => {\n\t\t\tconst inlineEdit = this._edit.read(reader);\n\t\t\treturn inlineEdit ? new Position(inlineEdit.originalLineRange.endLineNumberExclusive, 1) : null;\n\t\t});\n\n\t\tthis._originalDisplayRange = this._uiState.map(s => s?.originalRange);\n\t\tthis._originalVerticalStartPosition = this._editorObs.observePosition(originalStartPosition, this._store).map(p => p?.y);\n\t\tthis._originalVerticalEndPosition = this._editorObs.observePosition(originalEndPosition, this._store).map(p => p?.y);\n\n\t\tthis._register(this._editorObs.createOverlayWidget({\n\t\t\tdomNode: this._nonOverflowView.element,\n\t\t\tposition: constObservable(null),\n\t\t\tallowEditorOverflow: false,\n\t\t\tminContentWidthInPx: derived(this, reader => {\n\t\t\t\tconst info = this._editorLayoutInfo.read(reader);\n\t\t\t\tif (info === null) { return 0; }\n\t\t\t\treturn info.codeRect.width;\n\t\t\t}),\n\t\t}));\n\t}\n\n\tprivate readonly _display = derived(this, reader => !!this._uiState.read(reader) ? 'block' : 'none');\n\n\tprivate readonly _editorMaxContentWidthInRange = derived(this, reader => {\n\t\tconst originalDisplayRange = this._originalDisplayRange.read(reader);\n\t\tif (!originalDisplayRange) {\n\t\t\treturn constObservable(0);\n\t\t}\n\t\tthis._editorObs.versionId.read(reader);\n\n\t\t// Take the max value that we observed.\n\t\t// Reset when either the edit changes or the editor text version.\n\t\treturn derivedObservableWithCache<number>(this, (reader, lastValue) => {\n\t\t\tconst maxWidth = maxContentWidthInRange(this._editorObs, originalDisplayRange, reader);\n\t\t\treturn Math.max(maxWidth, lastValue ?? 0);\n\t\t});\n\t}).map((v, r) => v.read(r));\n\n\tprivate readonly _maxPrefixTrim = derived(this, reader => {\n\t\tconst state = this._uiState.read(reader);\n\t\tif (!state) {\n\t\t\treturn { prefixTrim: 0, prefixLeftOffset: 0 };\n\t\t}\n\t\treturn getPrefixTrim(state.deletions, state.originalRange, [], this._editor);\n\t});\n\n\tprivate readonly _editorLayoutInfo = derived(this, (reader) => {\n\t\tconst inlineEdit = this._edit.read(reader);\n\t\tif (!inlineEdit) {\n\t\t\treturn null;\n\t\t}\n\t\tconst state = this._uiState.read(reader);\n\t\tif (!state) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst editorLayout = this._editorObs.layoutInfo.read(reader);\n\t\tconst horizontalScrollOffset = this._editorObs.scrollLeft.read(reader);\n\t\tconst w = this._editorObs.getOption(EditorOption.fontInfo).map(f => f.typicalHalfwidthCharacterWidth).read(reader);\n\n\t\tconst right = editorLayout.contentLeft + Math.max(this._editorMaxContentWidthInRange.read(reader), w) - horizontalScrollOffset;\n\n\t\tconst range = inlineEdit.originalLineRange;\n\t\tconst selectionTop = this._originalVerticalStartPosition.read(reader) ?? this._editor.getTopForLineNumber(range.startLineNumber) - this._editorObs.scrollTop.read(reader);\n\t\tconst selectionBottom = this._originalVerticalEndPosition.read(reader) ?? this._editor.getTopForLineNumber(range.endLineNumberExclusive) - this._editorObs.scrollTop.read(reader);\n\n\t\tconst left = editorLayout.contentLeft + this._maxPrefixTrim.read(reader).prefixLeftOffset - horizontalScrollOffset;\n\n\t\tif (right <= left) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst codeRect = Rect.fromLeftTopRightBottom(left, selectionTop, right, selectionBottom).withMargin(VERTICAL_PADDING, HORIZONTAL_PADDING);\n\n\t\treturn {\n\t\t\tcodeRect,\n\t\t\tcontentLeft: editorLayout.contentLeft,\n\t\t};\n\t}).recomputeInitiallyAndOnChange(this._store);\n\n\tprivate readonly _originalOverlay = n.div({\n\t\tstyle: { pointerEvents: 'none', }\n\t}, derived(this, reader => {\n\t\tconst layoutInfoObs = mapOutFalsy(this._editorLayoutInfo).read(reader);\n\t\tif (!layoutInfoObs) { return undefined; }\n\n\t\t// Create an overlay which hides the left hand side of the original overlay when it overflows to the left\n\t\t// such that there is a smooth transition at the edge of content left\n\t\tconst overlayhider = layoutInfoObs.map(layoutInfo => Rect.fromLeftTopRightBottom(\n\t\t\tlayoutInfo.contentLeft - BORDER_RADIUS - BORDER_WIDTH,\n\t\t\tlayoutInfo.codeRect.top,\n\t\t\tlayoutInfo.contentLeft,\n\t\t\tlayoutInfo.codeRect.bottom\n\t\t));\n\n\t\tconst overlayRect = derived(this, reader => {\n\t\t\tconst rect = layoutInfoObs.read(reader).codeRect;\n\t\t\tconst overlayHider = overlayhider.read(reader);\n\t\t\treturn rect.intersectHorizontal(new OffsetRange(overlayHider.left, Number.MAX_SAFE_INTEGER));\n\t\t});\n\n\t\tconst separatorWidth = this._uiState.map(s => s?.editorType === InlineCompletionEditorType.DiffEditor ? WIDGET_SEPARATOR_DIFF_EDITOR_WIDTH : WIDGET_SEPARATOR_WIDTH).read(reader);\n\t\tconst separatorRect = overlayRect.map(rect => rect.withMargin(separatorWidth, separatorWidth));\n\t\tconst editorBackground = getEditorBackgroundColor(this._uiState.map(s => s?.editorType ?? InlineCompletionEditorType.TextEditor).read(reader));\n\t\treturn [\n\t\t\tn.div({\n\t\t\t\tclass: 'originalSeparatorDeletion',\n\t\t\t\tstyle: {\n\t\t\t\t\t...separatorRect.read(reader).toStyles(),\n\t\t\t\t\tborderRadius: `${BORDER_RADIUS}px`,\n\t\t\t\t\tborder: `${BORDER_WIDTH + separatorWidth}px solid ${editorBackground}`,\n\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t}\n\t\t\t}),\n\t\t\tn.div({\n\t\t\t\tclass: 'originalOverlayDeletion',\n\t\t\t\tstyle: {\n\t\t\t\t\t...overlayRect.read(reader).toStyles(),\n\t\t\t\t\tborderRadius: `${BORDER_RADIUS}px`,\n\t\t\t\t\tborder: getOriginalBorderColor(this._tabAction).map(bc => `${BORDER_WIDTH}px solid ${asCssVariable(bc)}`),\n\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\tbackgroundColor: asCssVariable(originalBackgroundColor),\n\t\t\t\t}\n\t\t\t}),\n\t\t\tn.div({\n\t\t\t\tclass: 'originalOverlayHiderDeletion',\n\t\t\t\tstyle: {\n\t\t\t\t\t...overlayhider.read(reader).toStyles(),\n\t\t\t\t\tbackgroundColor: editorBackground,\n\t\t\t\t}\n\t\t\t})\n\t\t];\n\t})).keepUpdated(this._store);\n\n\tprivate readonly _nonOverflowView = n.div({\n\t\tclass: 'inline-edits-view',\n\t\tstyle: {\n\t\t\tposition: 'absolute',\n\t\t\toverflow: 'visible',\n\t\t\ttop: '0px',\n\t\t\tleft: '0px',\n\t\t\tdisplay: this._display,\n\t\t},\n\t}, [\n\t\t[this._originalOverlay],\n\t]).keepUpdated(this._store);\n\n\treadonly isHovered = constObservable(false);\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { n } from '../../../../../../../base/browser/dom.js';\nimport { Event } from '../../../../../../../base/common/event.js';\nimport { Disposable } from '../../../../../../../base/common/lifecycle.js';\nimport { constObservable, derived, derivedObservableWithCache, IObservable } from '../../../../../../../base/common/observable.js';\nimport { asCssVariable } from '../../../../../../../platform/theme/common/colorUtils.js';\nimport { ICodeEditor } from '../../../../../../browser/editorBrowser.js';\nimport { ObservableCodeEditor, observableCodeEditor } from '../../../../../../browser/observableCodeEditor.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 { IInlineEditsView, InlineEditTabAction } from '../inlineEditsViewInterface.js';\nimport { InlineEditWithChanges } from '../inlineEditWithChanges.js';\nimport { getEditorBackgroundColor, getOriginalBorderColor, INLINE_EDITS_BORDER_RADIUS, originalBackgroundColor } from '../theme.js';\nimport { getPrefixTrim, mapOutFalsy, maxContentWidthInRange } from '../utils/utils.js';\nimport { InlineCompletionEditorType } from '../../../model/provideInlineCompletions.js';\n\nconst HORIZONTAL_PADDING = 0;\nconst VERTICAL_PADDING = 0;\nconst BORDER_WIDTH = 1;\nconst WIDGET_SEPARATOR_WIDTH = 1;\nconst WIDGET_SEPARATOR_DIFF_EDITOR_WIDTH = 3;\nconst BORDER_RADIUS = INLINE_EDITS_BORDER_RADIUS;\n\nexport class InlineEditsDeletionView extends Disposable implements IInlineEditsView {\n\n\treadonly onDidClick = Event.None;\n\n\tprivate readonly _editorObs: ObservableCodeEditor;\n\n\tprivate readonly _originalVerticalStartPosition: IObservable<number | undefined>;\n\tprivate readonly _originalVerticalEndPosition: IObservable<number | undefined>;\n\n\tprivate readonly _originalDisplayRange: IObservable<LineRange | undefined>;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tprivate readonly _edit: IObservable<InlineEditWithChanges | undefined>,\n\t\tprivate readonly _uiState: IObservable<{\n\t\t\toriginalRange: LineRange;\n\t\t\tdeletions: Range[];\n\t\t\teditorType: InlineCompletionEditorType;\n\t\t} | undefined>,\n\t\tprivate readonly _tabAction: IObservable<InlineEditTabAction>,\n\t) {\n\t\tsuper();\n\n\t\tthis._editorObs = observableCodeEditor(this._editor);\n\n\t\tconst originalStartPosition = derived(this, (reader) => {\n\t\t\tconst inlineEdit = this._edit.read(reader);\n\t\t\treturn inlineEdit ? new Position(inlineEdit.originalLineRange.startLineNumber, 1) : null;\n\t\t});\n\n\t\tconst originalEndPosition = derived(this, (reader) => {\n\t\t\tconst inlineEdit = this._edit.read(reader);\n\t\t\treturn inlineEdit ? new Position(inlineEdit.originalLineRange.endLineNumberExclusive, 1) : null;\n\t\t});\n\n\t\tthis._originalDisplayRange = this._uiState.map(s => s?.originalRange);\n\t\tthis._originalVerticalStartPosition = this._editorObs.observePosition(originalStartPosition, this._store).map(p => p?.y);\n\t\tthis._originalVerticalEndPosition = this._editorObs.observePosition(originalEndPosition, this._store).map(p => p?.y);\n\n\t\tthis._register(this._editorObs.createOverlayWidget({\n\t\t\tdomNode: this._nonOverflowView.element,\n\t\t\tposition: constObservable(null),\n\t\t\tallowEditorOverflow: false,\n\t\t\tminContentWidthInPx: derived(this, reader => {\n\t\t\t\tconst info = this._editorLayoutInfo.read(reader);\n\t\t\t\tif (info === null) { return 0; }\n\t\t\t\treturn info.codeRect.width;\n\t\t\t}),\n\t\t}));\n\t}\n\n\tprivate readonly _display = derived(this, reader => !!this._uiState.read(reader) ? 'block' : 'none');\n\n\tprivate readonly _editorMaxContentWidthInRange = derived(this, reader => {\n\t\tconst originalDisplayRange = this._originalDisplayRange.read(reader);\n\t\tif (!originalDisplayRange) {\n\t\t\treturn constObservable(0);\n\t\t}\n\t\tthis._editorObs.versionId.read(reader);\n\n\t\t// Take the max value that we observed.\n\t\t// Reset when either the edit changes or the editor text version.\n\t\treturn derivedObservableWithCache<number>(this, (reader, lastValue) => {\n\t\t\tconst maxWidth = maxContentWidthInRange(this._editorObs, originalDisplayRange, reader);\n\t\t\treturn Math.max(maxWidth, lastValue ?? 0);\n\t\t});\n\t}).map((v, r) => v.read(r));\n\n\tprivate readonly _maxPrefixTrim = derived(this, reader => {\n\t\tconst state = this._uiState.read(reader);\n\t\tif (!state) {\n\t\t\treturn { prefixTrim: 0, prefixLeftOffset: 0 };\n\t\t}\n\t\treturn getPrefixTrim(state.deletions, state.originalRange, [], this._editor);\n\t});\n\n\tprivate readonly _editorLayoutInfo = derived(this, (reader) => {\n\t\tconst inlineEdit = this._edit.read(reader);\n\t\tif (!inlineEdit) {\n\t\t\treturn null;\n\t\t}\n\t\tconst state = this._uiState.read(reader);\n\t\tif (!state) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst editorLayout = this._editorObs.layoutInfo.read(reader);\n\t\tconst horizontalScrollOffset = this._editorObs.scrollLeft.read(reader);\n\t\tconst w = this._editorObs.getOption(EditorOption.fontInfo).map(f => f.typicalHalfwidthCharacterWidth).read(reader);\n\n\t\tconst right = editorLayout.contentLeft + Math.max(this._editorMaxContentWidthInRange.read(reader), w) - horizontalScrollOffset;\n\n\t\tconst range = inlineEdit.originalLineRange;\n\t\tconst selectionTop = this._originalVerticalStartPosition.read(reader) ?? this._editor.getTopForLineNumber(range.startLineNumber) - this._editorObs.scrollTop.read(reader);\n\t\tconst selectionBottom = this._originalVerticalEndPosition.read(reader) ?? this._editor.getTopForLineNumber(range.endLineNumberExclusive) - this._editorObs.scrollTop.read(reader);\n\n\t\tconst left = editorLayout.contentLeft + this._maxPrefixTrim.read(reader).prefixLeftOffset - horizontalScrollOffset;\n\n\t\tif (right <= left) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst codeRect = Rect.fromLeftTopRightBottom(left, selectionTop, right, selectionBottom).withMargin(VERTICAL_PADDING, HORIZONTAL_PADDING);\n\n\t\treturn {\n\t\t\tcodeRect,\n\t\t\tcontentLeft: editorLayout.contentLeft,\n\t\t};\n\t}).recomputeInitiallyAndOnChange(this._store);\n\n\tprivate readonly _originalOverlay = n.div({\n\t\tstyle: { pointerEvents: 'none', }\n\t}, derived(this, reader => {\n\t\tconst layoutInfoObs = mapOutFalsy(this._editorLayoutInfo).read(reader);\n\t\tif (!layoutInfoObs) { return undefined; }\n\n\t\t// Create an overlay which hides the left hand side of the original overlay when it overflows to the left\n\t\t// such that there is a smooth transition at the edge of content left\n\t\tconst overlayhider = layoutInfoObs.map(layoutInfo => Rect.fromLeftTopRightBottom(\n\t\t\tlayoutInfo.contentLeft - BORDER_RADIUS - BORDER_WIDTH,\n\t\t\tlayoutInfo.codeRect.top,\n\t\t\tlayoutInfo.contentLeft,\n\t\t\tlayoutInfo.codeRect.bottom\n\t\t));\n\n\t\tconst overlayRect = derived(this, reader => {\n\t\t\tconst rect = layoutInfoObs.read(reader).codeRect;\n\t\t\tconst overlayHider = overlayhider.read(reader);\n\t\t\treturn rect.intersectHorizontal(new OffsetRange(overlayHider.left, Number.MAX_SAFE_INTEGER));\n\t\t});\n\n\t\tconst separatorWidth = this._uiState.map(s => s?.editorType === InlineCompletionEditorType.DiffEditor ? WIDGET_SEPARATOR_DIFF_EDITOR_WIDTH : WIDGET_SEPARATOR_WIDTH).read(reader);\n\t\tconst separatorRect = overlayRect.map(rect => rect.withMargin(separatorWidth, separatorWidth));\n\t\tconst editorBackground = getEditorBackgroundColor(this._uiState.map(s => s?.editorType ?? InlineCompletionEditorType.TextEditor).read(reader));\n\t\treturn [\n\t\t\tn.div({\n\t\t\t\tclass: 'originalSeparatorDeletion',\n\t\t\t\tstyle: {\n\t\t\t\t\t...separatorRect.read(reader).toStyles(),\n\t\t\t\t\tborderRadius: `${BORDER_RADIUS}px`,\n\t\t\t\t\tborder: `${BORDER_WIDTH + separatorWidth}px solid ${editorBackground}`,\n\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t}\n\t\t\t}),\n\t\t\tn.div({\n\t\t\t\tclass: 'originalOverlayDeletion',\n\t\t\t\tstyle: {\n\t\t\t\t\t...overlayRect.read(reader).toStyles(),\n\t\t\t\t\tborderRadius: `${BORDER_RADIUS}px`,\n\t\t\t\t\tborder: getOriginalBorderColor(this._tabAction).map(bc => `${BORDER_WIDTH}px solid ${asCssVariable(bc)}`),\n\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\tbackgroundColor: asCssVariable(originalBackgroundColor),\n\t\t\t\t}\n\t\t\t}),\n\t\t\tn.div({\n\t\t\t\tclass: 'originalOverlayHiderDeletion',\n\t\t\t\tstyle: {\n\t\t\t\t\t...overlayhider.read(reader).toStyles(),\n\t\t\t\t\tbackgroundColor: editorBackground,\n\t\t\t\t}\n\t\t\t})\n\t\t];\n\t})).keepUpdated(this._store);\n\n\tprivate readonly _nonOverflowView = n.div({\n\t\tclass: 'inline-edits-view',\n\t\tstyle: {\n\t\t\tposition: 'absolute',\n\t\t\toverflow: 'visible',\n\t\t\ttop: '0px',\n\t\t\tleft: '0px',\n\t\t\tdisplay: this._display,\n\t\t},\n\t}, [\n\t\t[this._originalOverlay],\n\t]).keepUpdated(this._store);\n\n\treadonly isHovered = constObservable(false);\n}\n"]}
@@ -16,7 +16,6 @@ import { Emitter } from '../../../../../../../base/common/event.js';
16
16
  import { Disposable } from '../../../../../../../base/common/lifecycle.js';
17
17
  import { constObservable, derived, observableValue } from '../../../../../../../base/common/observable.js';
18
18
  import { IInstantiationService } from '../../../../../../../platform/instantiation/common/instantiation.js';
19
- import { editorBackground } from '../../../../../../../platform/theme/common/colorRegistry.js';
20
19
  import { asCssVariable } from '../../../../../../../platform/theme/common/colorUtils.js';
21
20
  import { observableCodeEditor } from '../../../../../../browser/observableCodeEditor.js';
22
21
  import { LineSource, renderLines, RenderOptions } from '../../../../../../browser/widget/diffEditor/components/diffEditorViewZones/renderLines.js';
@@ -29,9 +28,10 @@ import { ILanguageService } from '../../../../../../common/languages/language.js
29
28
  import { LineTokens, TokenArray } from '../../../../../../common/tokens/lineTokens.js';
30
29
  import { InlineDecoration } from '../../../../../../common/viewModel/inlineDecorations.js';
31
30
  import { GhostText, GhostTextPart } from '../../../model/ghostText.js';
31
+ import { InlineCompletionEditorType } from '../../../model/provideInlineCompletions.js';
32
32
  import { GhostTextView } from '../../ghostText/ghostTextView.js';
33
33
  import { InlineEditClickEvent } from '../inlineEditsViewInterface.js';
34
- import { getModifiedBorderColor, INLINE_EDITS_BORDER_RADIUS, modifiedBackgroundColor } from '../theme.js';
34
+ import { getEditorBackgroundColor, getModifiedBorderColor, INLINE_EDITS_BORDER_RADIUS, modifiedBackgroundColor } from '../theme.js';
35
35
  import { getPrefixTrim, mapOutFalsy } from '../utils/utils.js';
36
36
  const BORDER_WIDTH = 1;
37
37
  const WIDGET_SEPARATOR_WIDTH = 1;
@@ -179,16 +179,17 @@ let InlineEditsInsertionView = class InlineEditsInsertionView extends Disposable
179
179
  // Create an overlay which hides the left hand side of the original overlay when it overflows to the left
180
180
  // such that there is a smooth transition at the edge of content left
181
181
  const overlayHider = overlayLayoutObs.map(layoutInfo => Rect.fromLeftTopRightBottom(layoutInfo.contentLeft - BORDER_RADIUS - BORDER_WIDTH, layoutInfo.overlay.top, layoutInfo.contentLeft, layoutInfo.overlay.bottom)).read(reader);
182
- const separatorWidth = this._input.map(i => i?.inDiffEditor ? WIDGET_SEPARATOR_DIFF_EDITOR_WIDTH : WIDGET_SEPARATOR_WIDTH).read(reader);
182
+ const separatorWidth = this._input.map(i => i?.editorType === InlineCompletionEditorType.DiffEditor ? WIDGET_SEPARATOR_DIFF_EDITOR_WIDTH : WIDGET_SEPARATOR_WIDTH).read(reader);
183
183
  const overlayRect = overlayLayoutObs.map(l => l.overlay.withMargin(0, BORDER_WIDTH, 0, l.startsAtContentLeft ? 0 : BORDER_WIDTH).intersectHorizontal(new OffsetRange(overlayHider.left, Number.MAX_SAFE_INTEGER)));
184
184
  const underlayRect = overlayRect.map(rect => rect.withMargin(separatorWidth, separatorWidth));
185
+ const editorBackground = getEditorBackgroundColor(this._input.read(undefined)?.editorType ?? InlineCompletionEditorType.TextEditor);
185
186
  return [
186
187
  n.div({
187
188
  class: 'originalUnderlayInsertion',
188
189
  style: {
189
190
  ...underlayRect.read(reader).toStyles(),
190
191
  borderRadius: BORDER_RADIUS,
191
- border: `${BORDER_WIDTH + separatorWidth}px solid ${asCssVariable(editorBackground)}`,
192
+ border: `${BORDER_WIDTH + separatorWidth}px solid ${editorBackground}`,
192
193
  boxSizing: 'border-box',
193
194
  }
194
195
  }),
@@ -206,7 +207,7 @@ let InlineEditsInsertionView = class InlineEditsInsertionView extends Disposable
206
207
  class: 'originalOverlayHiderInsertion',
207
208
  style: {
208
209
  ...overlayHider.toStyles(),
209
- backgroundColor: asCssVariable(editorBackground),
210
+ backgroundColor: editorBackground,
210
211
  }
211
212
  })
212
213
  ];