monaco-editor-core 0.56.0-dev-20260120 → 0.56.0-dev-20260121
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/nls.messages.cs.js +1 -1
- package/esm/nls.messages.de.js +1 -1
- package/esm/nls.messages.es.js +1 -1
- package/esm/nls.messages.fr.js +1 -1
- package/esm/nls.messages.it.js +1 -1
- package/esm/nls.messages.ja.js +1 -1
- package/esm/nls.messages.ko.js +1 -1
- package/esm/nls.messages.pl.js +1 -1
- package/esm/nls.messages.pt-br.js +1 -1
- package/esm/nls.messages.ru.js +1 -1
- package/esm/nls.messages.tr.js +1 -1
- package/esm/nls.messages.zh-cn.js +1 -1
- package/esm/nls.messages.zh-tw.js +1 -1
- package/esm/vs/base/browser/dom.js +8 -0
- package/esm/vs/base/browser/dom.js.map +1 -1
- package/esm/vs/base/browser/markdownRenderer.js +1 -0
- package/esm/vs/base/browser/markdownRenderer.js.map +1 -1
- package/esm/vs/editor/browser/controller/editContext/clipboardUtils.js +81 -35
- package/esm/vs/editor/browser/controller/editContext/clipboardUtils.js.map +1 -1
- package/esm/vs/editor/browser/controller/editContext/editContext.js +11 -0
- package/esm/vs/editor/browser/controller/editContext/editContext.js.map +1 -1
- package/esm/vs/editor/browser/controller/editContext/native/nativeEditContext.js +39 -32
- package/esm/vs/editor/browser/controller/editContext/native/nativeEditContext.js.map +1 -1
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContext.js +5 -16
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContext.js.map +1 -1
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextInput.js +39 -16
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextInput.js.map +1 -1
- package/esm/vs/editor/browser/editorBrowser.js.map +1 -1
- package/esm/vs/editor/browser/view.js +21 -1
- package/esm/vs/editor/browser/view.js.map +1 -1
- package/esm/vs/editor/browser/widget/codeEditor/codeEditorWidget.js +18 -0
- package/esm/vs/editor/browser/widget/codeEditor/codeEditorWidget.js.map +1 -1
- package/esm/vs/editor/common/model/bracketPairsTextModelPart/colorizedBracketPairsDecorationProvider.js +3 -3
- package/esm/vs/editor/common/model/bracketPairsTextModelPart/colorizedBracketPairsDecorationProvider.js.map +1 -1
- package/esm/vs/editor/common/model/textModel.js +4 -4
- package/esm/vs/editor/common/model/textModel.js.map +1 -1
- package/esm/vs/editor/common/model/tokens/tokenizationFontDecorationsProvider.js +20 -16
- package/esm/vs/editor/common/model/tokens/tokenizationFontDecorationsProvider.js.map +1 -1
- package/esm/vs/editor/common/model.js.map +1 -1
- package/esm/vs/editor/common/viewModel/viewModelDecorations.js +11 -4
- package/esm/vs/editor/common/viewModel/viewModelDecorations.js.map +1 -1
- package/esm/vs/editor/common/viewModel/viewModelImpl.js +25 -14
- package/esm/vs/editor/common/viewModel/viewModelImpl.js.map +1 -1
- package/esm/vs/editor/common/viewModel.js.map +1 -1
- package/esm/vs/editor/contrib/clipboard/browser/clipboard.js +3 -3
- package/esm/vs/editor/contrib/clipboard/browser/clipboard.js.map +1 -1
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.js +28 -64
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.js.map +1 -1
- package/esm/vs/editor/contrib/floatingMenu/browser/floatingMenu.css +27 -20
- package/esm/vs/editor/contrib/floatingMenu/browser/floatingMenu.js +37 -10
- package/esm/vs/editor/contrib/floatingMenu/browser/floatingMenu.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.css +7 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.js +22 -3
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineSuggestionsView.js +1 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineSuggestionsView.js.map +1 -1
- package/esm/vs/editor/editor.api.d.ts +5 -1
- package/esm/vs/platform/actionWidget/browser/actionList.js +46 -6
- package/esm/vs/platform/actionWidget/browser/actionList.js.map +1 -1
- package/esm/vs/platform/actionWidget/browser/actionWidget.js +8 -1
- package/esm/vs/platform/actionWidget/browser/actionWidget.js.map +1 -1
- package/monaco.d.ts +5 -1
- package/package.json +2 -2
- package/version.txt +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.ts","vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;AAEhG,OAAO,EAAE,wBAAwB,EAAE,MAAM,gDAAgD,CAAC;AAC1F,OAAO,EAAE,UAAU,EAAE,MAAM,2DAA2D,CAAC;AACvF,OAAO,EAAE,OAAO,EAAE,MAAM,2CAA2C,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAC1H,OAAO,EAAe,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,OAAO,EAAE,WAAW,EAAE,yBAAyB,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AACxL,OAAO,KAAK,OAAO,MAAM,0CAA0C,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAC;AAE7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,gDAAgD,CAAC;AACtF,OAAO,EAAE,mBAAmB,EAAwC,MAAM,+CAA+C,CAAC;AAC1H,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAC/F,OAAO,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAClE,OAAO,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AAE,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC","file":"ghostTextView.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { createTrustedTypesPolicy } from '../../../../../../base/browser/trustedTypes.js';\nimport { renderIcon } from '../../../../../../base/browser/ui/iconLabel/iconLabels.js';\nimport { Codicon } from '../../../../../../base/common/codicons.js';\nimport { Emitter, Event } from '../../../../../../base/common/event.js';\nimport { Disposable, DisposableStore, MutableDisposable, toDisposable } from '../../../../../../base/common/lifecycle.js';\nimport { IObservable, autorun, autorunWithStore, constObservable, derived, derivedOpts, observableSignalFromEvent, observableValue } from '../../../../../../base/common/observable.js';\nimport * as strings from '../../../../../../base/common/strings.js';\nimport { applyFontInfo } from '../../../../../browser/config/domFontInfo.js';\nimport { ContentWidgetPositionPreference, ICodeEditor, IContentWidgetPosition, IViewZoneChangeAccessor, MouseTargetType } from '../../../../../browser/editorBrowser.js';\nimport { observableCodeEditor } from '../../../../../browser/observableCodeEditor.js';\nimport { EditorFontLigatures, EditorOption, IComputedEditorOptions } from '../../../../../common/config/editorOptions.js';\nimport { StringEdit, StringReplacement } from '../../../../../common/core/edits/stringEdit.js';\nimport { Position } from '../../../../../common/core/position.js';\nimport { Range } from '../../../../../common/core/range.js';\nimport { StringBuilder } from '../../../../../common/core/stringBuilder.js';\nimport { IconPath, InlineCompletionWarning } from '../../../../../common/languages.js';\nimport { ILanguageService } from '../../../../../common/languages/language.js';\nimport { IModelDeltaDecoration, ITextModel, InjectedTextCursorStops, PositionAffinity } from '../../../../../common/model.js';\nimport { LineTokens } from '../../../../../common/tokens/lineTokens.js';\nimport { LineDecoration } from '../../../../../common/viewLayout/lineDecorations.js';\nimport { RenderLineInput, renderViewLine } from '../../../../../common/viewLayout/viewLineRenderer.js';\nimport { GhostText, GhostTextReplacement, IGhostTextLine } from '../../model/ghostText.js';\nimport { RangeSingleLine } from '../../../../../common/core/ranges/rangeSingleLine.js';\nimport { ColumnRange } from '../../../../../common/core/ranges/columnRange.js';\nimport { addDisposableListener, getWindow, isHTMLElement, n } from '../../../../../../base/browser/dom.js';\nimport './ghostTextView.css';\nimport { IMouseEvent, StandardMouseEvent } from '../../../../../../base/browser/mouseEvent.js';\nimport { CodeEditorWidget } from '../../../../../browser/widget/codeEditor/codeEditorWidget.js';\nimport { TokenWithTextArray } from '../../../../../common/tokens/tokenWithTextArray.js';\nimport { InlineCompletionViewData } from '../inlineEdits/inlineEditsViewInterface.js';\nimport { InlineDecorationType } from '../../../../../common/viewModel/inlineDecorations.js';\nimport { equals, sum } from '../../../../../../base/common/arrays.js';\nimport { equalsIfDefinedC, IEquatable, thisEqualsC } from '../../../../../../base/common/equals.js';\n\nexport interface IGhostTextWidgetData {\n\treadonly ghostText: GhostText | GhostTextReplacement;\n\treadonly warning: GhostTextWidgetWarning | undefined;\n\thandleInlineCompletionShown(viewData: InlineCompletionViewData): void;\n}\n\nexport class GhostTextWidgetWarning {\n\tpublic static from(warning: InlineCompletionWarning | undefined): GhostTextWidgetWarning | undefined {\n\t\tif (!warning) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn new GhostTextWidgetWarning(warning.icon);\n\t}\n\n\tconstructor(\n\t\tpublic readonly icon: IconPath = Codicon.warning,\n\t) { }\n}\n\nconst USE_SQUIGGLES_FOR_WARNING = true;\nconst GHOST_TEXT_CLASS_NAME = 'ghost-text';\n\nexport class GhostTextView extends Disposable {\n\tprivate readonly _isDisposed = observableValue(this, false);\n\tprivate readonly _editorObs;\n\tprivate readonly _warningState = derived(reader => {\n\t\tconst model = this._data.read(reader);\n\t\tconst warning = model?.warning;\n\t\tif (!model || !warning) { return undefined; }\n\t\tconst gt = model.ghostText;\n\t\treturn { lineNumber: gt.lineNumber, position: new Position(gt.lineNumber, gt.parts[0].column), icon: warning.icon };\n\t});\n\n\tprivate readonly _onDidClick = this._register(new Emitter<IMouseEvent>());\n\tpublic readonly onDidClick = this._onDidClick.event;\n\n\tprivate readonly _extraClasses: readonly string[];\n\tprivate readonly _isClickable: boolean;\n\tprivate readonly _shouldKeepCursorStable: boolean;\n\tprivate readonly _minReservedLineCount: IObservable<number>;\n\tprivate readonly _useSyntaxHighlighting: IObservable<boolean>;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tprivate readonly _data: IObservable<IGhostTextWidgetData | undefined>,\n\t\toptions: {\n\t\t\textraClasses?: readonly string[]; // TODO@benibenj improve\n\t\t\tisClickable?: boolean;\n\t\t\tshouldKeepCursorStable?: boolean;\n\t\t\tminReservedLineCount?: IObservable<number>;\n\t\t\tuseSyntaxHighlighting?: IObservable<boolean>;\n\t\t},\n\t\t@ILanguageService private readonly _languageService: ILanguageService\n\t) {\n\t\tsuper();\n\n\t\tthis._extraClasses = options.extraClasses ?? [];\n\t\tthis._isClickable = options.isClickable ?? false;\n\t\tthis._shouldKeepCursorStable = options.shouldKeepCursorStable ?? false;\n\t\tthis._minReservedLineCount = options.minReservedLineCount ?? constObservable(0);\n\t\tthis._useSyntaxHighlighting = options.useSyntaxHighlighting ?? constObservable(true);\n\n\t\tthis._editorObs = observableCodeEditor(this._editor);\n\t\tthis._additionalLinesWidget = this._register(\n\t\t\tnew AdditionalLinesWidget(\n\t\t\t\tthis._editor,\n\t\t\t\tderivedOpts({ owner: this, equalsFn: equalsIfDefinedC(thisEqualsC()) }, reader => {\n\t\t\t\t\t/** @description lines */\n\t\t\t\t\tconst uiState = this._state.read(reader);\n\t\t\t\t\treturn uiState ? new AdditionalLinesData(\n\t\t\t\t\t\tuiState.lineNumber,\n\t\t\t\t\t\tuiState.additionalLines,\n\t\t\t\t\t\tuiState.additionalReservedLineCount,\n\t\t\t\t\t) : undefined;\n\t\t\t\t}),\n\t\t\t\tthis._shouldKeepCursorStable,\n\t\t\t\tthis._isClickable\n\t\t\t)\n\t\t);\n\t\tthis._isInlineTextHovered = this._editorObs.isTargetHovered(\n\t\t\tp => p.target.type === MouseTargetType.CONTENT_TEXT &&\n\t\t\t\tp.target.detail.injectedText?.options.attachedData instanceof GhostTextAttachedData &&\n\t\t\t\tp.target.detail.injectedText.options.attachedData.owner === this,\n\t\t\tthis._store\n\t\t);\n\n\t\tthis._register(toDisposable(() => { this._isDisposed.set(true, undefined); }));\n\t\tthis._register(this._editorObs.setDecorations(this._decorations));\n\n\t\tif (this._isClickable) {\n\t\t\tthis._register(this._additionalLinesWidget.onDidClick((e) => this._onDidClick.fire(e)));\n\t\t\tthis._register(this._editor.onMouseUp(e => {\n\t\t\t\tif (e.target.type !== MouseTargetType.CONTENT_TEXT) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst a = e.target.detail.injectedText?.options.attachedData;\n\t\t\t\tif (a instanceof GhostTextAttachedData && a.owner === this) {\n\t\t\t\t\tthis._onDidClick.fire(e.event);\n\t\t\t\t}\n\t\t\t}));\n\t\t}\n\n\t\tthis._register(autorun(reader => {\n\t\t\tconst state = this._state.read(reader);\n\t\t\tstate?.handleInlineCompletionShown(state.telemetryViewData);\n\t\t}));\n\n\t\tthis._register(autorunWithStore((reader, store) => {\n\t\t\tif (USE_SQUIGGLES_FOR_WARNING) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst state = this._warningState.read(reader);\n\t\t\tif (!state) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst lineHeight = this._editorObs.getOption(EditorOption.lineHeight);\n\t\t\tstore.add(this._editorObs.createContentWidget({\n\t\t\t\tposition: constObservable<IContentWidgetPosition>({\n\t\t\t\t\tposition: new Position(state.lineNumber, Number.MAX_SAFE_INTEGER),\n\t\t\t\t\tpreference: [ContentWidgetPositionPreference.EXACT],\n\t\t\t\t\tpositionAffinity: PositionAffinity.Right,\n\t\t\t\t}),\n\t\t\t\tallowEditorOverflow: false,\n\t\t\t\tdomNode: n.div({\n\t\t\t\t\tclass: 'ghost-text-view-warning-widget',\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\twidth: lineHeight,\n\t\t\t\t\t\theight: lineHeight,\n\t\t\t\t\t\tmarginLeft: 4,\n\t\t\t\t\t\tcolor: 'orange',\n\t\t\t\t\t},\n\t\t\t\t\tref: (dom) => {\n\t\t\t\t\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\t\t\t\t\t(dom as any as WidgetDomElement).ghostTextViewWarningWidgetData = { range: Range.fromPositions(state.position) };\n\t\t\t\t\t}\n\t\t\t\t}, [\n\t\t\t\t\tn.div({\n\t\t\t\t\t\tclass: 'ghost-text-view-warning-widget-icon',\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\talignContent: 'center',\n\t\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\t[renderIcon(state.icon)]\n\t\t\t\t\t)\n\t\t\t\t]).keepUpdated(store).element,\n\t\t\t}));\n\t\t}));\n\t}\n\n\tpublic static getWarningWidgetContext(domNode: HTMLElement): { range: Range } | undefined {\n\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\tconst data = (domNode as any as WidgetDomElement).ghostTextViewWarningWidgetData;\n\t\tif (data) {\n\t\t\treturn data;\n\t\t} else if (domNode.parentElement) {\n\t\t\treturn this.getWarningWidgetContext(domNode.parentElement);\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tprivate readonly _extraClassNames = derived(this, reader => {\n\t\tconst extraClasses = this._extraClasses.slice();\n\t\tif (this._useSyntaxHighlighting.read(reader)) {\n\t\t\textraClasses.push('syntax-highlighted');\n\t\t}\n\t\tif (USE_SQUIGGLES_FOR_WARNING && this._warningState.read(reader)) {\n\t\t\textraClasses.push('warning');\n\t\t}\n\t\tconst extraClassNames = extraClasses.map(c => ` ${c}`).join('');\n\t\treturn extraClassNames;\n\t});\n\n\tprivate readonly _state = derived(this, reader => {\n\t\tif (this._isDisposed.read(reader)) { return undefined; }\n\n\t\tconst props = this._data.read(reader);\n\t\tif (!props) { return undefined; }\n\n\t\tconst textModel = this._editorObs.model.read(reader);\n\t\tif (!textModel) { return undefined; }\n\n\t\tconst ghostText = props.ghostText;\n\t\tconst replacedRange = ghostText instanceof GhostTextReplacement ? ghostText.columnRange : undefined;\n\n\t\tconst syntaxHighlightingEnabled = this._useSyntaxHighlighting.read(reader);\n\t\tconst extraClassNames = this._extraClassNames.read(reader);\n\t\tconst { inlineTexts, additionalLines, hiddenRange, additionalLinesOriginalSuffix } = computeGhostTextViewData(ghostText, textModel, GHOST_TEXT_CLASS_NAME + extraClassNames);\n\n\t\tconst currentLine = textModel.getLineContent(ghostText.lineNumber);\n\t\tconst edit = new StringEdit(inlineTexts.map(t => StringReplacement.insert(t.column - 1, t.text)));\n\t\tconst tokens = syntaxHighlightingEnabled ? textModel.tokenization.tokenizeLinesAt(ghostText.lineNumber, [edit.apply(currentLine), ...additionalLines.map(l => l.content)]) : undefined;\n\t\tconst newRanges = edit.getNewRanges();\n\t\tconst inlineTextsWithTokens = inlineTexts.map((t, idx) => ({ ...t, tokens: tokens?.[0]?.getTokensInRange(newRanges[idx]) }));\n\n\t\tconst tokenizedAdditionalLines: LineData[] = additionalLines.map((l, idx) => {\n\t\t\tlet content = tokens?.[idx + 1] ?? LineTokens.createEmpty(l.content, this._languageService.languageIdCodec);\n\t\t\tif (idx === additionalLines.length - 1 && additionalLinesOriginalSuffix) {\n\t\t\t\tconst t = TokenWithTextArray.fromLineTokens(textModel.tokenization.getLineTokens(additionalLinesOriginalSuffix.lineNumber));\n\t\t\t\tconst existingContent = t.slice(additionalLinesOriginalSuffix.columnRange.toZeroBasedOffsetRange());\n\t\t\t\tcontent = TokenWithTextArray.fromLineTokens(content).append(existingContent).toLineTokens(content.languageIdCodec);\n\t\t\t}\n\t\t\treturn new LineData(\n\t\t\t\tcontent,\n\t\t\t\tl.decorations,\n\t\t\t);\n\t\t});\n\n\t\tconst cursorColumn = this._editor.getSelection()?.getStartPosition().column!;\n\t\tconst disjointInlineTexts = inlineTextsWithTokens.filter(inline => inline.text !== '');\n\t\tconst hasInsertionOnCurrentLine = disjointInlineTexts.length !== 0;\n\t\tconst telemetryViewData = new InlineCompletionViewData(\n\t\t\t(hasInsertionOnCurrentLine ? disjointInlineTexts[0].column : 1) - cursorColumn,\n\t\t\thasInsertionOnCurrentLine ? 0 : (additionalLines.findIndex(line => line.content !== '') + 1),\n\t\t\thasInsertionOnCurrentLine ? 1 : 0,\n\t\t\tadditionalLines.length + (hasInsertionOnCurrentLine ? 1 : 0),\n\t\t\t0,\n\t\t\tsum(disjointInlineTexts.map(inline => inline.text.length)) + sum(tokenizedAdditionalLines.map(line => line.content.getTextLength())),\n\t\t\tdisjointInlineTexts.length + (additionalLines.length > 0 ? 1 : 0),\n\t\t\tdisjointInlineTexts.length > 1 && tokenizedAdditionalLines.length === 0 ? disjointInlineTexts.every(inline => inline.text === disjointInlineTexts[0].text) : undefined\n\t\t);\n\n\t\treturn {\n\t\t\treplacedRange,\n\t\t\tinlineTexts: inlineTextsWithTokens,\n\t\t\tadditionalLines: tokenizedAdditionalLines,\n\t\t\thiddenRange,\n\t\t\tlineNumber: ghostText.lineNumber,\n\t\t\tadditionalReservedLineCount: this._minReservedLineCount.read(reader),\n\t\t\ttargetTextModel: textModel,\n\t\t\tsyntaxHighlightingEnabled,\n\t\t\ttelemetryViewData,\n\t\t\thandleInlineCompletionShown: props.handleInlineCompletionShown,\n\t\t};\n\t});\n\n\tprivate readonly _decorations = derived(this, reader => {\n\t\tconst uiState = this._state.read(reader);\n\t\tif (!uiState) { return []; }\n\n\t\tconst decorations: IModelDeltaDecoration[] = [];\n\n\t\tconst extraClassNames = this._extraClassNames.read(reader);\n\n\t\tif (uiState.replacedRange) {\n\t\t\tdecorations.push({\n\t\t\t\trange: uiState.replacedRange.toRange(uiState.lineNumber),\n\t\t\t\toptions: { inlineClassName: 'inline-completion-text-to-replace' + extraClassNames, description: 'GhostTextReplacement' }\n\t\t\t});\n\t\t}\n\n\t\tif (uiState.hiddenRange) {\n\t\t\tdecorations.push({\n\t\t\t\trange: uiState.hiddenRange.toRange(uiState.lineNumber),\n\t\t\t\toptions: { inlineClassName: 'ghost-text-hidden', description: 'ghost-text-hidden', }\n\t\t\t});\n\t\t}\n\n\t\tfor (const p of uiState.inlineTexts) {\n\t\t\tdecorations.push({\n\t\t\t\trange: Range.fromPositions(new Position(uiState.lineNumber, p.column)),\n\t\t\t\toptions: {\n\t\t\t\t\tdescription: 'ghost-text-decoration',\n\t\t\t\t\tafter: {\n\t\t\t\t\t\tcontent: p.text,\n\t\t\t\t\t\ttokens: p.tokens,\n\t\t\t\t\t\tinlineClassName: (p.preview ? 'ghost-text-decoration-preview' : 'ghost-text-decoration')\n\t\t\t\t\t\t\t+ (this._isClickable ? ' clickable' : '')\n\t\t\t\t\t\t\t+ extraClassNames\n\t\t\t\t\t\t\t+ p.lineDecorations.map(d => ' ' + d.className).join(' '), // TODO: take the ranges into account for line decorations\n\t\t\t\t\t\tcursorStops: InjectedTextCursorStops.Left,\n\t\t\t\t\t\tattachedData: new GhostTextAttachedData(this),\n\t\t\t\t\t},\n\t\t\t\t\tshowIfCollapsed: true,\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\treturn decorations;\n\t});\n\n\tprivate readonly _additionalLinesWidget;\n\n\tprivate readonly _isInlineTextHovered;\n\n\tpublic readonly isHovered = derived(this, reader => {\n\t\tif (this._isDisposed.read(reader)) { return false; }\n\t\treturn this._isInlineTextHovered.read(reader) || this._additionalLinesWidget.isHovered.read(reader);\n\t});\n\n\tpublic readonly height = derived(this, reader => {\n\t\tconst lineHeight = this._editorObs.getOption(EditorOption.lineHeight).read(reader);\n\t\treturn lineHeight + (this._additionalLinesWidget.viewZoneHeight.read(reader) ?? 0);\n\t});\n\n\tpublic ownsViewZone(viewZoneId: string): boolean {\n\t\treturn this._additionalLinesWidget.viewZoneId === viewZoneId;\n\t}\n}\n\nclass GhostTextAttachedData {\n\tconstructor(public readonly owner: GhostTextView) { }\n}\n\ninterface WidgetDomElement {\n\tghostTextViewWarningWidgetData?: {\n\t\trange: Range;\n\t};\n}\n\nfunction computeGhostTextViewData(ghostText: GhostText | GhostTextReplacement, textModel: ITextModel, ghostTextClassName: string) {\n\tconst inlineTexts: { column: number; text: string; preview: boolean; lineDecorations: LineDecoration[] }[] = [];\n\tconst additionalLines: { content: string; decorations: LineDecoration[] }[] = [];\n\n\tfunction addToAdditionalLines(ghLines: readonly IGhostTextLine[], className: string | undefined) {\n\t\tif (additionalLines.length > 0) {\n\t\t\tconst lastLine = additionalLines[additionalLines.length - 1];\n\t\t\tif (className) {\n\t\t\t\tlastLine.decorations.push(new LineDecoration(\n\t\t\t\t\tlastLine.content.length + 1,\n\t\t\t\t\tlastLine.content.length + 1 + ghLines[0].line.length,\n\t\t\t\t\tclassName,\n\t\t\t\t\tInlineDecorationType.Regular\n\t\t\t\t));\n\t\t\t}\n\t\t\tlastLine.content += ghLines[0].line;\n\n\t\t\tghLines = ghLines.slice(1);\n\t\t}\n\t\tfor (const ghLine of ghLines) {\n\t\t\tadditionalLines.push({\n\t\t\t\tcontent: ghLine.line,\n\t\t\t\tdecorations: className ? [new LineDecoration(\n\t\t\t\t\t1,\n\t\t\t\t\tghLine.line.length + 1,\n\t\t\t\t\tclassName,\n\t\t\t\t\tInlineDecorationType.Regular\n\t\t\t\t), ...ghLine.lineDecorations] : [...ghLine.lineDecorations]\n\t\t\t});\n\t\t}\n\t}\n\n\tconst textBufferLine = textModel.getLineContent(ghostText.lineNumber);\n\n\tlet hiddenTextStartColumn: number | undefined = undefined;\n\tlet lastIdx = 0;\n\tfor (const part of ghostText.parts) {\n\t\tlet ghLines = part.lines;\n\t\tif (hiddenTextStartColumn === undefined) {\n\t\t\tinlineTexts.push({ column: part.column, text: ghLines[0].line, preview: part.preview, lineDecorations: ghLines[0].lineDecorations });\n\t\t\tghLines = ghLines.slice(1);\n\t\t} else {\n\t\t\taddToAdditionalLines([{ line: textBufferLine.substring(lastIdx, part.column - 1), lineDecorations: [] }], undefined);\n\t\t}\n\n\t\tif (ghLines.length > 0) {\n\t\t\taddToAdditionalLines(ghLines, ghostTextClassName);\n\t\t\tif (hiddenTextStartColumn === undefined && part.column <= textBufferLine.length) {\n\t\t\t\thiddenTextStartColumn = part.column;\n\t\t\t}\n\t\t}\n\n\t\tlastIdx = part.column - 1;\n\t}\n\tlet additionalLinesOriginalSuffix: RangeSingleLine | undefined = undefined;\n\tif (hiddenTextStartColumn !== undefined) {\n\t\tadditionalLinesOriginalSuffix = new RangeSingleLine(ghostText.lineNumber, new ColumnRange(lastIdx + 1, textBufferLine.length + 1));\n\t}\n\n\tconst hiddenRange = hiddenTextStartColumn !== undefined ? new ColumnRange(hiddenTextStartColumn, textBufferLine.length + 1) : undefined;\n\n\treturn {\n\t\tinlineTexts,\n\t\tadditionalLines,\n\t\thiddenRange,\n\t\tadditionalLinesOriginalSuffix,\n\t};\n}\n\nclass AdditionalLinesData implements IEquatable<AdditionalLinesData> {\n\tconstructor(\n\t\tpublic readonly lineNumber: number,\n\t\tpublic readonly additionalLines: readonly LineData[],\n\t\tpublic readonly minReservedLineCount: number,\n\t) { }\n\n\tequals(other: AdditionalLinesData): boolean {\n\t\tif (this.lineNumber !== other.lineNumber) {\n\t\t\treturn false;\n\t\t}\n\t\tif (this.minReservedLineCount !== other.minReservedLineCount) {\n\t\t\treturn false;\n\t\t}\n\t\treturn equals(this.additionalLines, other.additionalLines, thisEqualsC());\n\t}\n}\n\nexport class AdditionalLinesWidget extends Disposable {\n\tprivate _viewZoneInfo: { viewZoneId: string; heightInLines: number; lineNumber: number } | undefined;\n\tpublic get viewZoneId(): string | undefined { return this._viewZoneInfo?.viewZoneId; }\n\n\tprivate _viewZoneHeight;\n\tpublic get viewZoneHeight(): IObservable<number | undefined> { return this._viewZoneHeight; }\n\n\tprivate readonly editorOptionsChanged;\n\n\tprivate readonly _onDidClick;\n\tpublic readonly onDidClick;\n\n\tprivate readonly _viewZoneListener;\n\n\treadonly isHovered;\n\n\tprivate hasBeenAccepted;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tprivate readonly _lines: IObservable<AdditionalLinesData | undefined>,\n\t\tprivate readonly _shouldKeepCursorStable: boolean,\n\t\tprivate readonly _isClickable: boolean,\n\t) {\n\t\tsuper();\n\t\tthis._viewZoneHeight = observableValue<undefined | number>('viewZoneHeight', undefined);\n\t\tthis.editorOptionsChanged = observableSignalFromEvent('editorOptionChanged', Event.filter(\n\t\t\tthis._editor.onDidChangeConfiguration,\n\t\t\te => e.hasChanged(EditorOption.disableMonospaceOptimizations)\n\t\t\t\t|| e.hasChanged(EditorOption.stopRenderingLineAfter)\n\t\t\t\t|| e.hasChanged(EditorOption.renderWhitespace)\n\t\t\t\t|| e.hasChanged(EditorOption.renderControlCharacters)\n\t\t\t\t|| e.hasChanged(EditorOption.fontLigatures)\n\t\t\t\t|| e.hasChanged(EditorOption.fontInfo)\n\t\t\t\t|| e.hasChanged(EditorOption.lineHeight)\n\t\t));\n\t\tthis._onDidClick = this._register(new Emitter<IMouseEvent>());\n\t\tthis.onDidClick = this._onDidClick.event;\n\t\tthis._viewZoneListener = this._register(new MutableDisposable());\n\t\tthis.isHovered = observableCodeEditor(this._editor).isTargetHovered(\n\t\t\tp => isTargetGhostText(p.target.element),\n\t\t\tthis._store\n\t\t);\n\t\tthis.hasBeenAccepted = false;\n\n\t\tif (this._editor instanceof CodeEditorWidget && this._shouldKeepCursorStable) {\n\t\t\tthis._register(this._editor.onBeforeExecuteEdit(e => this.hasBeenAccepted = e.source === 'inlineSuggestion.accept'));\n\t\t}\n\n\t\tthis._register(autorun(reader => {\n\t\t\t/** @description update view zone */\n\t\t\tconst lines = this._lines.read(reader);\n\t\t\tthis.editorOptionsChanged.read(reader);\n\n\t\t\tif (lines) {\n\t\t\t\tthis.hasBeenAccepted = false;\n\t\t\t\tthis.updateLines(lines.lineNumber, lines.additionalLines, lines.minReservedLineCount);\n\t\t\t} else {\n\t\t\t\tthis.clear();\n\t\t\t}\n\t\t}));\n\t}\n\n\tpublic override dispose(): void {\n\t\tsuper.dispose();\n\t\tthis.clear();\n\t}\n\n\tprivate clear(): void {\n\t\tthis._viewZoneListener.clear();\n\n\t\tthis._editor.changeViewZones((changeAccessor) => {\n\t\t\tthis.removeActiveViewZone(changeAccessor);\n\t\t});\n\t}\n\n\tprivate updateLines(lineNumber: number, additionalLines: readonly LineData[], minReservedLineCount: number): void {\n\t\tconst textModel = this._editor.getModel();\n\t\tif (!textModel) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { tabSize } = textModel.getOptions();\n\n\t\tobservableCodeEditor(this._editor).transaction(_ => {\n\t\t\tthis._editor.changeViewZones((changeAccessor) => {\n\t\t\t\tconst store = new DisposableStore();\n\n\t\t\t\tthis.removeActiveViewZone(changeAccessor);\n\n\t\t\t\tconst heightInLines = Math.max(additionalLines.length, minReservedLineCount);\n\t\t\t\tif (heightInLines > 0) {\n\t\t\t\t\tconst domNode = document.createElement('div');\n\t\t\t\t\trenderLines(domNode, tabSize, additionalLines, this._editor.getOptions(), this._isClickable);\n\n\t\t\t\t\tif (this._isClickable) {\n\t\t\t\t\t\tstore.add(addDisposableListener(domNode, 'mousedown', (e) => {\n\t\t\t\t\t\t\te.preventDefault(); // This prevents that the editor loses focus\n\t\t\t\t\t\t}));\n\t\t\t\t\t\tstore.add(addDisposableListener(domNode, 'click', (e) => {\n\t\t\t\t\t\t\tif (isTargetGhostText(e.target)) {\n\t\t\t\t\t\t\t\tthis._onDidClick.fire(new StandardMouseEvent(getWindow(e), e));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}));\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.addViewZone(changeAccessor, lineNumber, heightInLines, domNode);\n\t\t\t\t}\n\n\t\t\t\tthis._viewZoneListener.value = store;\n\t\t\t});\n\t\t});\n\t}\n\n\tprivate addViewZone(changeAccessor: IViewZoneChangeAccessor, afterLineNumber: number, heightInLines: number, domNode: HTMLElement): void {\n\t\tconst id = changeAccessor.addZone({\n\t\t\tafterLineNumber: afterLineNumber,\n\t\t\theightInLines: heightInLines,\n\t\t\tdomNode,\n\t\t\tafterColumnAffinity: PositionAffinity.Right,\n\t\t\tonComputedHeight: (height: number) => {\n\t\t\t\tthis._viewZoneHeight.set(height, undefined); // TODO: can a transaction be used to avoid flickering?\n\t\t\t}\n\t\t});\n\n\t\tthis.keepCursorStable(afterLineNumber, heightInLines);\n\n\t\tthis._viewZoneInfo = { viewZoneId: id, heightInLines, lineNumber: afterLineNumber };\n\t}\n\n\tprivate removeActiveViewZone(changeAccessor: IViewZoneChangeAccessor): void {\n\t\tif (this._viewZoneInfo) {\n\t\t\tchangeAccessor.removeZone(this._viewZoneInfo.viewZoneId);\n\n\t\t\tif (!this.hasBeenAccepted) {\n\t\t\t\tthis.keepCursorStable(this._viewZoneInfo.lineNumber, -this._viewZoneInfo.heightInLines);\n\t\t\t}\n\n\t\t\tthis._viewZoneInfo = undefined;\n\t\t\tthis._viewZoneHeight.set(undefined, undefined);\n\t\t}\n\t}\n\n\tprivate keepCursorStable(lineNumber: number, heightInLines: number): void {\n\t\tif (!this._shouldKeepCursorStable) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst cursorLineNumber = this._editor.getSelection()?.getStartPosition()?.lineNumber;\n\t\tif (cursorLineNumber !== undefined && lineNumber < cursorLineNumber) {\n\t\t\tthis._editor.setScrollTop(this._editor.getScrollTop() + heightInLines * this._editor.getOption(EditorOption.lineHeight));\n\t\t}\n\t}\n}\n\nfunction isTargetGhostText(target: EventTarget | null): boolean {\n\treturn isHTMLElement(target) && target.classList.contains(GHOST_TEXT_CLASS_NAME);\n}\n\nexport class LineData implements IEquatable<LineData> {\n\tconstructor(\n\t\tpublic readonly content: LineTokens, // Must not contain a linebreak!\n\t\tpublic readonly decorations: readonly LineDecoration[]\n\t) { }\n\n\tequals(other: LineData): boolean {\n\t\tif (!this.content.equals(other.content)) {\n\t\t\treturn false;\n\t\t}\n\t\treturn LineDecoration.equalsArr(this.decorations, other.decorations);\n\t}\n}\n\nfunction renderLines(domNode: HTMLElement, tabSize: number, lines: readonly LineData[], opts: IComputedEditorOptions, isClickable: boolean): void {\n\tconst disableMonospaceOptimizations = opts.get(EditorOption.disableMonospaceOptimizations);\n\tconst stopRenderingLineAfter = opts.get(EditorOption.stopRenderingLineAfter);\n\t// To avoid visual confusion, we don't want to render visible whitespace\n\tconst renderWhitespace = 'none';\n\tconst renderControlCharacters = opts.get(EditorOption.renderControlCharacters);\n\tconst fontLigatures = opts.get(EditorOption.fontLigatures);\n\tconst fontInfo = opts.get(EditorOption.fontInfo);\n\tconst lineHeight = opts.get(EditorOption.lineHeight);\n\n\tlet classNames = 'suggest-preview-text';\n\tif (isClickable) {\n\t\tclassNames += ' clickable';\n\t}\n\n\tconst sb = new StringBuilder(10000);\n\tsb.appendString(`<div class=\"${classNames}\">`);\n\n\tfor (let i = 0, len = lines.length; i < len; i++) {\n\t\tconst lineData = lines[i];\n\t\tconst lineTokens = lineData.content;\n\t\tsb.appendString('<div class=\"view-line');\n\t\tsb.appendString('\" style=\"top:');\n\t\tsb.appendString(String(i * lineHeight));\n\t\tsb.appendString('px;width:1000000px;\">');\n\n\t\tconst line = lineTokens.getLineContent();\n\t\tconst isBasicASCII = strings.isBasicASCII(line);\n\t\tconst containsRTL = strings.containsRTL(line);\n\n\t\trenderViewLine(new RenderLineInput(\n\t\t\t(fontInfo.isMonospace && !disableMonospaceOptimizations),\n\t\t\tfontInfo.canUseHalfwidthRightwardsArrow,\n\t\t\tline,\n\t\t\tfalse,\n\t\t\tisBasicASCII,\n\t\t\tcontainsRTL,\n\t\t\t0,\n\t\t\tlineTokens,\n\t\t\tlineData.decorations.slice(),\n\t\t\ttabSize,\n\t\t\t0,\n\t\t\tfontInfo.spaceWidth,\n\t\t\tfontInfo.middotWidth,\n\t\t\tfontInfo.wsmiddotWidth,\n\t\t\tstopRenderingLineAfter,\n\t\t\trenderWhitespace,\n\t\t\trenderControlCharacters,\n\t\t\tfontLigatures !== EditorFontLigatures.OFF,\n\t\t\tnull,\n\t\t\tnull,\n\t\t\t0\n\t\t), sb);\n\n\t\tsb.appendString('</div>');\n\t}\n\tsb.appendString('</div>');\n\n\tapplyFontInfo(domNode, fontInfo);\n\tconst html = sb.build();\n\tconst trustedhtml = ttPolicy ? ttPolicy.createHTML(html) : html;\n\tdomNode.innerHTML = trustedhtml as string;\n}\n\nexport const ttPolicy = createTrustedTypesPolicy('editorGhostText', { createHTML: value => value });\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { createTrustedTypesPolicy } from '../../../../../../base/browser/trustedTypes.js';\nimport { renderIcon } from '../../../../../../base/browser/ui/iconLabel/iconLabels.js';\nimport { Codicon } from '../../../../../../base/common/codicons.js';\nimport { Emitter, Event } from '../../../../../../base/common/event.js';\nimport { Disposable, DisposableStore, MutableDisposable, toDisposable } from '../../../../../../base/common/lifecycle.js';\nimport { IObservable, autorun, autorunWithStore, constObservable, derived, derivedOpts, observableSignalFromEvent, observableValue } from '../../../../../../base/common/observable.js';\nimport * as strings from '../../../../../../base/common/strings.js';\nimport { applyFontInfo } from '../../../../../browser/config/domFontInfo.js';\nimport { ContentWidgetPositionPreference, ICodeEditor, IContentWidgetPosition, IViewZoneChangeAccessor, MouseTargetType } from '../../../../../browser/editorBrowser.js';\nimport { observableCodeEditor } from '../../../../../browser/observableCodeEditor.js';\nimport { EditorFontLigatures, EditorOption, IComputedEditorOptions } from '../../../../../common/config/editorOptions.js';\nimport { StringEdit, StringReplacement } from '../../../../../common/core/edits/stringEdit.js';\nimport { Position } from '../../../../../common/core/position.js';\nimport { Range } from '../../../../../common/core/range.js';\nimport { StringBuilder } from '../../../../../common/core/stringBuilder.js';\nimport { IconPath, InlineCompletionWarning } from '../../../../../common/languages.js';\nimport { ILanguageService } from '../../../../../common/languages/language.js';\nimport { IModelDeltaDecoration, ITextModel, InjectedTextCursorStops, PositionAffinity } from '../../../../../common/model.js';\nimport { LineTokens } from '../../../../../common/tokens/lineTokens.js';\nimport { LineDecoration } from '../../../../../common/viewLayout/lineDecorations.js';\nimport { RenderLineInput, renderViewLine } from '../../../../../common/viewLayout/viewLineRenderer.js';\nimport { GhostText, GhostTextReplacement, IGhostTextLine } from '../../model/ghostText.js';\nimport { RangeSingleLine } from '../../../../../common/core/ranges/rangeSingleLine.js';\nimport { ColumnRange } from '../../../../../common/core/ranges/columnRange.js';\nimport { addDisposableListener, getWindow, isHTMLElement, n } from '../../../../../../base/browser/dom.js';\nimport './ghostTextView.css';\nimport { IMouseEvent, StandardMouseEvent } from '../../../../../../base/browser/mouseEvent.js';\nimport { CodeEditorWidget } from '../../../../../browser/widget/codeEditor/codeEditorWidget.js';\nimport { TokenWithTextArray } from '../../../../../common/tokens/tokenWithTextArray.js';\nimport { InlineCompletionViewData } from '../inlineEdits/inlineEditsViewInterface.js';\nimport { InlineDecorationType } from '../../../../../common/viewModel/inlineDecorations.js';\nimport { equals, sum } from '../../../../../../base/common/arrays.js';\nimport { equalsIfDefinedC, IEquatable, thisEqualsC } from '../../../../../../base/common/equals.js';\n\nexport interface IGhostTextWidgetData {\n\treadonly ghostText: GhostText | GhostTextReplacement;\n\treadonly warning: GhostTextWidgetWarning | undefined;\n\thandleInlineCompletionShown(viewData: InlineCompletionViewData): void;\n}\n\nexport class GhostTextWidgetWarning {\n\tpublic static from(warning: InlineCompletionWarning | undefined): GhostTextWidgetWarning | undefined {\n\t\tif (!warning) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn new GhostTextWidgetWarning(warning.icon);\n\t}\n\n\tconstructor(\n\t\tpublic readonly icon: IconPath = Codicon.warning,\n\t) { }\n}\n\nconst USE_SQUIGGLES_FOR_WARNING = true;\nconst GHOST_TEXT_CLASS_NAME = 'ghost-text';\n\nexport class GhostTextView extends Disposable {\n\tprivate readonly _isDisposed = observableValue(this, false);\n\tprivate readonly _editorObs;\n\tprivate readonly _warningState = derived(reader => {\n\t\tconst model = this._data.read(reader);\n\t\tconst warning = model?.warning;\n\t\tif (!model || !warning) { return undefined; }\n\t\tconst gt = model.ghostText;\n\t\treturn { lineNumber: gt.lineNumber, position: new Position(gt.lineNumber, gt.parts[0].column), icon: warning.icon };\n\t});\n\n\tprivate readonly _onDidClick = this._register(new Emitter<IMouseEvent>());\n\tpublic readonly onDidClick = this._onDidClick.event;\n\n\tprivate readonly _extraClasses: readonly string[];\n\tprivate readonly _isClickable: boolean;\n\tprivate readonly _shouldKeepCursorStable: boolean;\n\tprivate readonly _minReservedLineCount: IObservable<number>;\n\tprivate readonly _useSyntaxHighlighting: IObservable<boolean>;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tprivate readonly _data: IObservable<IGhostTextWidgetData | undefined>,\n\t\toptions: {\n\t\t\textraClasses?: readonly string[]; // TODO@benibenj improve\n\t\t\tisClickable?: boolean;\n\t\t\tshouldKeepCursorStable?: boolean;\n\t\t\tminReservedLineCount?: IObservable<number>;\n\t\t\tuseSyntaxHighlighting?: IObservable<boolean>;\n\t\t},\n\t\t@ILanguageService private readonly _languageService: ILanguageService\n\t) {\n\t\tsuper();\n\n\t\tthis._extraClasses = options.extraClasses ?? [];\n\t\tthis._isClickable = options.isClickable ?? false;\n\t\tthis._shouldKeepCursorStable = options.shouldKeepCursorStable ?? false;\n\t\tthis._minReservedLineCount = options.minReservedLineCount ?? constObservable(0);\n\t\tthis._useSyntaxHighlighting = options.useSyntaxHighlighting ?? constObservable(true);\n\n\t\tthis._editorObs = observableCodeEditor(this._editor);\n\t\tthis._additionalLinesWidget = this._register(\n\t\t\tnew AdditionalLinesWidget(\n\t\t\t\tthis._editor,\n\t\t\t\tderivedOpts({ owner: this, equalsFn: equalsIfDefinedC(thisEqualsC()) }, reader => {\n\t\t\t\t\t/** @description lines */\n\t\t\t\t\tconst uiState = this._state.read(reader);\n\t\t\t\t\treturn uiState ? new AdditionalLinesData(\n\t\t\t\t\t\tuiState.lineNumber,\n\t\t\t\t\t\tuiState.additionalLines,\n\t\t\t\t\t\tuiState.additionalReservedLineCount,\n\t\t\t\t\t) : undefined;\n\t\t\t\t}),\n\t\t\t\tthis._shouldKeepCursorStable,\n\t\t\t\tthis._isClickable\n\t\t\t)\n\t\t);\n\t\tthis._isInlineTextHovered = this._editorObs.isTargetHovered(\n\t\t\tp => p.target.type === MouseTargetType.CONTENT_TEXT &&\n\t\t\t\tp.target.detail.injectedText?.options.attachedData instanceof GhostTextAttachedData &&\n\t\t\t\tp.target.detail.injectedText.options.attachedData.owner === this,\n\t\t\tthis._store\n\t\t);\n\n\t\tthis._register(toDisposable(() => { this._isDisposed.set(true, undefined); }));\n\t\tthis._register(this._editorObs.setDecorations(this._decorations));\n\n\t\tif (this._isClickable) {\n\t\t\tthis._register(this._additionalLinesWidget.onDidClick((e) => this._onDidClick.fire(e)));\n\t\t\tthis._register(this._editor.onMouseUp(e => {\n\t\t\t\tif (e.target.type !== MouseTargetType.CONTENT_TEXT) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst a = e.target.detail.injectedText?.options.attachedData;\n\t\t\t\tif (a instanceof GhostTextAttachedData && a.owner === this) {\n\t\t\t\t\tthis._onDidClick.fire(e.event);\n\t\t\t\t}\n\t\t\t}));\n\t\t}\n\n\t\tthis._register(autorun(reader => {\n\t\t\tconst state = this._state.read(reader);\n\t\t\tstate?.handleInlineCompletionShown(state.telemetryViewData);\n\t\t}));\n\n\t\tthis._register(autorunWithStore((reader, store) => {\n\t\t\tif (USE_SQUIGGLES_FOR_WARNING) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst state = this._warningState.read(reader);\n\t\t\tif (!state) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst lineHeight = this._editorObs.getOption(EditorOption.lineHeight);\n\t\t\tstore.add(this._editorObs.createContentWidget({\n\t\t\t\tposition: constObservable<IContentWidgetPosition>({\n\t\t\t\t\tposition: new Position(state.lineNumber, Number.MAX_SAFE_INTEGER),\n\t\t\t\t\tpreference: [ContentWidgetPositionPreference.EXACT],\n\t\t\t\t\tpositionAffinity: PositionAffinity.Right,\n\t\t\t\t}),\n\t\t\t\tallowEditorOverflow: false,\n\t\t\t\tdomNode: n.div({\n\t\t\t\t\tclass: 'ghost-text-view-warning-widget',\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\twidth: lineHeight,\n\t\t\t\t\t\theight: lineHeight,\n\t\t\t\t\t\tmarginLeft: 4,\n\t\t\t\t\t\tcolor: 'orange',\n\t\t\t\t\t},\n\t\t\t\t\tref: (dom) => {\n\t\t\t\t\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\t\t\t\t\t(dom as any as WidgetDomElement).ghostTextViewWarningWidgetData = { range: Range.fromPositions(state.position) };\n\t\t\t\t\t}\n\t\t\t\t}, [\n\t\t\t\t\tn.div({\n\t\t\t\t\t\tclass: 'ghost-text-view-warning-widget-icon',\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\talignContent: 'center',\n\t\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\t[renderIcon(state.icon)]\n\t\t\t\t\t)\n\t\t\t\t]).keepUpdated(store).element,\n\t\t\t}));\n\t\t}));\n\t}\n\n\tpublic static getWarningWidgetContext(domNode: HTMLElement): { range: Range } | undefined {\n\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\tconst data = (domNode as any as WidgetDomElement).ghostTextViewWarningWidgetData;\n\t\tif (data) {\n\t\t\treturn data;\n\t\t} else if (domNode.parentElement) {\n\t\t\treturn this.getWarningWidgetContext(domNode.parentElement);\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tprivate readonly _extraClassNames = derived(this, reader => {\n\t\tconst extraClasses = this._extraClasses.slice();\n\t\tif (this._useSyntaxHighlighting.read(reader)) {\n\t\t\textraClasses.push('syntax-highlighted');\n\t\t}\n\t\tif (USE_SQUIGGLES_FOR_WARNING && this._warningState.read(reader)) {\n\t\t\textraClasses.push('warning');\n\t\t}\n\t\tconst extraClassNames = extraClasses.map(c => ` ${c}`).join('');\n\t\treturn extraClassNames;\n\t});\n\n\tprivate readonly _state = derived(this, reader => {\n\t\tif (this._isDisposed.read(reader)) { return undefined; }\n\n\t\tconst props = this._data.read(reader);\n\t\tif (!props) { return undefined; }\n\n\t\tconst textModel = this._editorObs.model.read(reader);\n\t\tif (!textModel) { return undefined; }\n\n\t\tconst ghostText = props.ghostText;\n\t\tconst replacedRange = ghostText instanceof GhostTextReplacement ? ghostText.columnRange : undefined;\n\n\t\tconst syntaxHighlightingEnabled = this._useSyntaxHighlighting.read(reader);\n\t\tconst extraClassNames = this._extraClassNames.read(reader);\n\t\tconst { inlineTexts, additionalLines, hiddenRange, additionalLinesOriginalSuffix } = computeGhostTextViewData(ghostText, textModel, GHOST_TEXT_CLASS_NAME + extraClassNames);\n\n\t\tconst currentLine = textModel.getLineContent(ghostText.lineNumber);\n\t\tconst edit = new StringEdit(inlineTexts.map(t => StringReplacement.insert(t.column - 1, t.text)));\n\t\tconst tokens = syntaxHighlightingEnabled ? textModel.tokenization.tokenizeLinesAt(ghostText.lineNumber, [edit.apply(currentLine), ...additionalLines.map(l => l.content)]) : undefined;\n\t\tconst newRanges = edit.getNewRanges();\n\t\tconst inlineTextsWithTokens = inlineTexts.map((t, idx) => ({ ...t, tokens: tokens?.[0]?.getTokensInRange(newRanges[idx]) }));\n\n\t\tconst tokenizedAdditionalLines: LineData[] = additionalLines.map((l, idx) => {\n\t\t\tlet content = tokens?.[idx + 1] ?? LineTokens.createEmpty(l.content, this._languageService.languageIdCodec);\n\t\t\tif (idx === additionalLines.length - 1 && additionalLinesOriginalSuffix) {\n\t\t\t\tconst t = TokenWithTextArray.fromLineTokens(textModel.tokenization.getLineTokens(additionalLinesOriginalSuffix.lineNumber));\n\t\t\t\tconst existingContent = t.slice(additionalLinesOriginalSuffix.columnRange.toZeroBasedOffsetRange());\n\t\t\t\tcontent = TokenWithTextArray.fromLineTokens(content).append(existingContent).toLineTokens(content.languageIdCodec);\n\t\t\t}\n\t\t\treturn new LineData(\n\t\t\t\tcontent,\n\t\t\t\tl.decorations,\n\t\t\t);\n\t\t});\n\n\t\tconst cursorColumn = this._editor.getSelection()?.getStartPosition().column!;\n\t\tconst disjointInlineTexts = inlineTextsWithTokens.filter(inline => inline.text !== '');\n\t\tconst hasInsertionOnCurrentLine = disjointInlineTexts.length !== 0;\n\t\tconst telemetryViewData = new InlineCompletionViewData(\n\t\t\t(hasInsertionOnCurrentLine ? disjointInlineTexts[0].column : 1) - cursorColumn,\n\t\t\thasInsertionOnCurrentLine ? 0 : (additionalLines.findIndex(line => line.content !== '') + 1),\n\t\t\thasInsertionOnCurrentLine ? 1 : 0,\n\t\t\tadditionalLines.length + (hasInsertionOnCurrentLine ? 1 : 0),\n\t\t\t0,\n\t\t\tsum(disjointInlineTexts.map(inline => inline.text.length)) + sum(tokenizedAdditionalLines.map(line => line.content.getTextLength())),\n\t\t\tdisjointInlineTexts.length + (additionalLines.length > 0 ? 1 : 0),\n\t\t\tdisjointInlineTexts.length > 1 && tokenizedAdditionalLines.length === 0 ? disjointInlineTexts.every(inline => inline.text === disjointInlineTexts[0].text) : undefined\n\t\t);\n\n\t\treturn {\n\t\t\treplacedRange,\n\t\t\tinlineTexts: inlineTextsWithTokens,\n\t\t\tadditionalLines: tokenizedAdditionalLines,\n\t\t\thiddenRange,\n\t\t\tlineNumber: ghostText.lineNumber,\n\t\t\tadditionalReservedLineCount: this._minReservedLineCount.read(reader),\n\t\t\ttargetTextModel: textModel,\n\t\t\tsyntaxHighlightingEnabled,\n\t\t\ttelemetryViewData,\n\t\t\thandleInlineCompletionShown: props.handleInlineCompletionShown,\n\t\t};\n\t});\n\n\tprivate readonly _decorations = derived(this, reader => {\n\t\tconst uiState = this._state.read(reader);\n\t\tif (!uiState) { return []; }\n\n\t\tconst decorations: IModelDeltaDecoration[] = [];\n\n\t\tconst extraClassNames = this._extraClassNames.read(reader);\n\n\t\tif (uiState.replacedRange) {\n\t\t\tdecorations.push({\n\t\t\t\trange: uiState.replacedRange.toRange(uiState.lineNumber),\n\t\t\t\toptions: { inlineClassName: 'inline-completion-text-to-replace' + extraClassNames, description: 'GhostTextReplacement' }\n\t\t\t});\n\t\t}\n\n\t\tif (uiState.hiddenRange) {\n\t\t\tdecorations.push({\n\t\t\t\trange: uiState.hiddenRange.toRange(uiState.lineNumber),\n\t\t\t\toptions: { inlineClassName: 'ghost-text-hidden', description: 'ghost-text-hidden', }\n\t\t\t});\n\t\t}\n\n\t\tfor (const p of uiState.inlineTexts) {\n\t\t\tdecorations.push({\n\t\t\t\trange: Range.fromPositions(new Position(uiState.lineNumber, p.column)),\n\t\t\t\toptions: {\n\t\t\t\t\tdescription: 'ghost-text-decoration',\n\t\t\t\t\tafter: {\n\t\t\t\t\t\tcontent: p.text,\n\t\t\t\t\t\ttokens: p.tokens,\n\t\t\t\t\t\tinlineClassName: (p.preview ? 'ghost-text-decoration-preview' : 'ghost-text-decoration')\n\t\t\t\t\t\t\t+ (this._isClickable ? ' clickable' : '')\n\t\t\t\t\t\t\t+ extraClassNames\n\t\t\t\t\t\t\t+ p.lineDecorations.map(d => ' ' + d.className).join(' '), // TODO: take the ranges into account for line decorations\n\t\t\t\t\t\tcursorStops: InjectedTextCursorStops.Left,\n\t\t\t\t\t\tattachedData: new GhostTextAttachedData(this),\n\t\t\t\t\t},\n\t\t\t\t\tshowIfCollapsed: true,\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\treturn decorations;\n\t});\n\n\tprivate readonly _additionalLinesWidget;\n\n\tprivate readonly _isInlineTextHovered;\n\n\tpublic readonly isHovered = derived(this, reader => {\n\t\tif (this._isDisposed.read(reader)) { return false; }\n\t\treturn this._isInlineTextHovered.read(reader) || this._additionalLinesWidget.isHovered.read(reader);\n\t});\n\n\tpublic readonly height = derived(this, reader => {\n\t\tconst lineHeight = this._editorObs.getOption(EditorOption.lineHeight).read(reader);\n\t\treturn lineHeight + (this._additionalLinesWidget.viewZoneHeight.read(reader) ?? 0);\n\t});\n\n\tpublic ownsViewZone(viewZoneId: string): boolean {\n\t\treturn this._additionalLinesWidget.viewZoneId === viewZoneId;\n\t}\n}\n\nclass GhostTextAttachedData {\n\tconstructor(public readonly owner: GhostTextView) { }\n}\n\ninterface WidgetDomElement {\n\tghostTextViewWarningWidgetData?: {\n\t\trange: Range;\n\t};\n}\n\nfunction computeGhostTextViewData(ghostText: GhostText | GhostTextReplacement, textModel: ITextModel, ghostTextClassName: string) {\n\tconst inlineTexts: { column: number; text: string; preview: boolean; lineDecorations: LineDecoration[] }[] = [];\n\tconst additionalLines: { content: string; decorations: LineDecoration[] }[] = [];\n\n\tfunction addToAdditionalLines(ghLines: readonly IGhostTextLine[], className: string | undefined) {\n\t\tif (additionalLines.length > 0) {\n\t\t\tconst lastLine = additionalLines[additionalLines.length - 1];\n\t\t\tif (className) {\n\t\t\t\tlastLine.decorations.push(new LineDecoration(\n\t\t\t\t\tlastLine.content.length + 1,\n\t\t\t\t\tlastLine.content.length + 1 + ghLines[0].line.length,\n\t\t\t\t\tclassName,\n\t\t\t\t\tInlineDecorationType.Regular\n\t\t\t\t));\n\t\t\t}\n\t\t\tlastLine.content += ghLines[0].line;\n\n\t\t\tghLines = ghLines.slice(1);\n\t\t}\n\t\tfor (const ghLine of ghLines) {\n\t\t\tadditionalLines.push({\n\t\t\t\tcontent: ghLine.line,\n\t\t\t\tdecorations: className ? [new LineDecoration(\n\t\t\t\t\t1,\n\t\t\t\t\tghLine.line.length + 1,\n\t\t\t\t\tclassName,\n\t\t\t\t\tInlineDecorationType.Regular\n\t\t\t\t), ...ghLine.lineDecorations] : [...ghLine.lineDecorations]\n\t\t\t});\n\t\t}\n\t}\n\n\tconst textBufferLine = textModel.getLineContent(ghostText.lineNumber);\n\n\tlet hiddenTextStartColumn: number | undefined = undefined;\n\tlet lastIdx = 0;\n\tfor (const part of ghostText.parts) {\n\t\tlet ghLines = part.lines;\n\t\tif (hiddenTextStartColumn === undefined) {\n\t\t\tinlineTexts.push({ column: part.column, text: ghLines[0].line, preview: part.preview, lineDecorations: ghLines[0].lineDecorations });\n\t\t\tghLines = ghLines.slice(1);\n\t\t} else {\n\t\t\taddToAdditionalLines([{ line: textBufferLine.substring(lastIdx, part.column - 1), lineDecorations: [] }], undefined);\n\t\t}\n\n\t\tif (ghLines.length > 0) {\n\t\t\taddToAdditionalLines(ghLines, ghostTextClassName);\n\t\t\tif (hiddenTextStartColumn === undefined && part.column <= textBufferLine.length) {\n\t\t\t\thiddenTextStartColumn = part.column;\n\t\t\t}\n\t\t}\n\n\t\tlastIdx = part.column - 1;\n\t}\n\tlet additionalLinesOriginalSuffix: RangeSingleLine | undefined = undefined;\n\tif (hiddenTextStartColumn !== undefined) {\n\t\tadditionalLinesOriginalSuffix = new RangeSingleLine(ghostText.lineNumber, new ColumnRange(lastIdx + 1, textBufferLine.length + 1));\n\t}\n\n\tconst hiddenRange = hiddenTextStartColumn !== undefined ? new ColumnRange(hiddenTextStartColumn, textBufferLine.length + 1) : undefined;\n\n\treturn {\n\t\tinlineTexts,\n\t\tadditionalLines,\n\t\thiddenRange,\n\t\tadditionalLinesOriginalSuffix,\n\t};\n}\n\nclass AdditionalLinesData implements IEquatable<AdditionalLinesData> {\n\tconstructor(\n\t\tpublic readonly lineNumber: number,\n\t\tpublic readonly additionalLines: readonly LineData[],\n\t\tpublic readonly minReservedLineCount: number,\n\t) { }\n\n\tequals(other: AdditionalLinesData): boolean {\n\t\tif (this.lineNumber !== other.lineNumber) {\n\t\t\treturn false;\n\t\t}\n\t\tif (this.minReservedLineCount !== other.minReservedLineCount) {\n\t\t\treturn false;\n\t\t}\n\t\treturn equals(this.additionalLines, other.additionalLines, thisEqualsC());\n\t}\n}\n\nexport class AdditionalLinesWidget extends Disposable {\n\tprivate _viewZoneInfo: { viewZoneId: string; heightInLines: number; lineNumber: number } | undefined;\n\tpublic get viewZoneId(): string | undefined { return this._viewZoneInfo?.viewZoneId; }\n\n\tprivate _viewZoneHeight;\n\tpublic get viewZoneHeight(): IObservable<number | undefined> { return this._viewZoneHeight; }\n\n\tprivate readonly editorOptionsChanged;\n\n\tprivate readonly _onDidClick;\n\tpublic readonly onDidClick;\n\n\tprivate readonly _viewZoneListener;\n\n\treadonly isHovered;\n\n\tprivate hasBeenAccepted;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tprivate readonly _lines: IObservable<AdditionalLinesData | undefined>,\n\t\tprivate readonly _shouldKeepCursorStable: boolean,\n\t\tprivate readonly _isClickable: boolean,\n\t) {\n\t\tsuper();\n\t\tthis._viewZoneHeight = observableValue<undefined | number>('viewZoneHeight', undefined);\n\t\tthis.editorOptionsChanged = observableSignalFromEvent('editorOptionChanged', Event.filter(\n\t\t\tthis._editor.onDidChangeConfiguration,\n\t\t\te => e.hasChanged(EditorOption.disableMonospaceOptimizations)\n\t\t\t\t|| e.hasChanged(EditorOption.stopRenderingLineAfter)\n\t\t\t\t|| e.hasChanged(EditorOption.renderWhitespace)\n\t\t\t\t|| e.hasChanged(EditorOption.renderControlCharacters)\n\t\t\t\t|| e.hasChanged(EditorOption.fontLigatures)\n\t\t\t\t|| e.hasChanged(EditorOption.fontInfo)\n\t\t\t\t|| e.hasChanged(EditorOption.lineHeight)\n\t\t));\n\t\tthis._onDidClick = this._register(new Emitter<IMouseEvent>());\n\t\tthis.onDidClick = this._onDidClick.event;\n\t\tthis._viewZoneListener = this._register(new MutableDisposable());\n\t\tthis.isHovered = observableCodeEditor(this._editor).isTargetHovered(\n\t\t\tp => isTargetGhostText(p.target.element),\n\t\t\tthis._store\n\t\t);\n\t\tthis.hasBeenAccepted = false;\n\n\t\tif (this._editor instanceof CodeEditorWidget && this._shouldKeepCursorStable) {\n\t\t\tthis._register(this._editor.onBeforeExecuteEdit(e => this.hasBeenAccepted = e.source === 'inlineSuggestion.accept'));\n\t\t}\n\n\t\tthis._register(autorun(reader => {\n\t\t\t/** @description update view zone */\n\t\t\tconst lines = this._lines.read(reader);\n\t\t\tthis.editorOptionsChanged.read(reader);\n\n\t\t\tif (lines) {\n\t\t\t\tthis.hasBeenAccepted = false;\n\t\t\t\tthis.updateLines(lines.lineNumber, lines.additionalLines, lines.minReservedLineCount);\n\t\t\t} else {\n\t\t\t\tthis.clear();\n\t\t\t}\n\t\t}));\n\t}\n\n\tpublic override dispose(): void {\n\t\tsuper.dispose();\n\t\tthis.clear();\n\t}\n\n\tprivate clear(): void {\n\t\tthis._viewZoneListener.clear();\n\n\t\tthis._editor.changeViewZones((changeAccessor) => {\n\t\t\tthis.removeActiveViewZone(changeAccessor);\n\t\t});\n\t}\n\n\tprivate updateLines(lineNumber: number, additionalLines: readonly LineData[], minReservedLineCount: number): void {\n\t\tconst textModel = this._editor.getModel();\n\t\tif (!textModel) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { tabSize } = textModel.getOptions();\n\n\t\tobservableCodeEditor(this._editor).transaction(_ => {\n\t\t\tthis._editor.changeViewZones((changeAccessor) => {\n\t\t\t\tconst store = new DisposableStore();\n\n\t\t\t\tthis.removeActiveViewZone(changeAccessor);\n\n\t\t\t\tconst heightInLines = Math.max(additionalLines.length, minReservedLineCount);\n\t\t\t\tif (heightInLines > 0) {\n\t\t\t\t\tconst domNode = document.createElement('div');\n\t\t\t\t\trenderLines(domNode, tabSize, additionalLines, this._editor.getOptions(), this._isClickable);\n\n\t\t\t\t\tif (this._isClickable) {\n\t\t\t\t\t\tstore.add(addDisposableListener(domNode, 'mousedown', (e) => {\n\t\t\t\t\t\t\te.preventDefault(); // This prevents that the editor loses focus\n\t\t\t\t\t\t}));\n\t\t\t\t\t\tstore.add(addDisposableListener(domNode, 'click', (e) => {\n\t\t\t\t\t\t\tif (isTargetGhostText(e.target)) {\n\t\t\t\t\t\t\t\tthis._onDidClick.fire(new StandardMouseEvent(getWindow(e), e));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}));\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.addViewZone(changeAccessor, lineNumber, heightInLines, domNode);\n\t\t\t\t}\n\n\t\t\t\tthis._viewZoneListener.value = store;\n\t\t\t});\n\t\t});\n\t}\n\n\tprivate addViewZone(changeAccessor: IViewZoneChangeAccessor, afterLineNumber: number, heightInLines: number, domNode: HTMLElement): void {\n\t\tconst id = changeAccessor.addZone({\n\t\t\tafterLineNumber: afterLineNumber,\n\t\t\theightInLines: heightInLines,\n\t\t\tdomNode,\n\t\t\tafterColumnAffinity: PositionAffinity.Right,\n\t\t\tonComputedHeight: (height: number) => {\n\t\t\t\tthis._viewZoneHeight.set(height, undefined); // TODO: can a transaction be used to avoid flickering?\n\t\t\t}\n\t\t});\n\n\t\tthis.keepCursorStable(afterLineNumber, heightInLines);\n\n\t\tthis._viewZoneInfo = { viewZoneId: id, heightInLines, lineNumber: afterLineNumber };\n\t}\n\n\tprivate removeActiveViewZone(changeAccessor: IViewZoneChangeAccessor): void {\n\t\tif (this._viewZoneInfo) {\n\t\t\tchangeAccessor.removeZone(this._viewZoneInfo.viewZoneId);\n\n\t\t\tif (!this.hasBeenAccepted) {\n\t\t\t\tthis.keepCursorStable(this._viewZoneInfo.lineNumber, -this._viewZoneInfo.heightInLines);\n\t\t\t}\n\n\t\t\tthis._viewZoneInfo = undefined;\n\t\t\tthis._viewZoneHeight.set(undefined, undefined);\n\t\t}\n\t}\n\n\tprivate keepCursorStable(lineNumber: number, heightInLines: number): void {\n\t\tif (!this._shouldKeepCursorStable) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst cursorLineNumber = this._editor.getSelection()?.getStartPosition()?.lineNumber;\n\t\tif (cursorLineNumber !== undefined && lineNumber < cursorLineNumber) {\n\t\t\tthis._editor.setScrollTop(this._editor.getScrollTop() + heightInLines * this._editor.getOption(EditorOption.lineHeight));\n\t\t}\n\t}\n}\n\nfunction isTargetGhostText(target: EventTarget | null): boolean {\n\treturn isHTMLElement(target) && target.classList.contains(GHOST_TEXT_CLASS_NAME);\n}\n\nexport class LineData implements IEquatable<LineData> {\n\tconstructor(\n\t\tpublic readonly content: LineTokens, // Must not contain a linebreak!\n\t\tpublic readonly decorations: readonly LineDecoration[]\n\t) { }\n\n\tequals(other: LineData): boolean {\n\t\tif (!this.content.equals(other.content)) {\n\t\t\treturn false;\n\t\t}\n\t\treturn LineDecoration.equalsArr(this.decorations, other.decorations);\n\t}\n}\n\nfunction renderLines(domNode: HTMLElement, tabSize: number, lines: readonly LineData[], opts: IComputedEditorOptions, isClickable: boolean): void {\n\tconst disableMonospaceOptimizations = opts.get(EditorOption.disableMonospaceOptimizations);\n\tconst stopRenderingLineAfter = opts.get(EditorOption.stopRenderingLineAfter);\n\t// To avoid visual confusion, we don't want to render visible whitespace\n\tconst renderWhitespace = 'none';\n\tconst renderControlCharacters = opts.get(EditorOption.renderControlCharacters);\n\tconst fontLigatures = opts.get(EditorOption.fontLigatures);\n\tconst fontInfo = opts.get(EditorOption.fontInfo);\n\tconst lineHeight = opts.get(EditorOption.lineHeight);\n\n\tlet classNames = 'suggest-preview-text';\n\tif (isClickable) {\n\t\tclassNames += ' clickable';\n\t}\n\n\tconst sb = new StringBuilder(10000);\n\tsb.appendString(`<div class=\"${classNames}\">`);\n\n\tfor (let i = 0, len = lines.length; i < len; i++) {\n\t\tconst lineData = lines[i];\n\t\tconst lineTokens = lineData.content;\n\t\tsb.appendString('<div class=\"view-line');\n\t\tsb.appendString('\" style=\"top:');\n\t\tsb.appendString(String(i * lineHeight));\n\t\tsb.appendString('px;width:1000000px;\">');\n\n\t\tconst line = lineTokens.getLineContent();\n\t\tconst isBasicASCII = strings.isBasicASCII(line);\n\t\tconst containsRTL = strings.containsRTL(line);\n\n\t\trenderViewLine(new RenderLineInput(\n\t\t\t(fontInfo.isMonospace && !disableMonospaceOptimizations),\n\t\t\tfontInfo.canUseHalfwidthRightwardsArrow,\n\t\t\tline,\n\t\t\tfalse,\n\t\t\tisBasicASCII,\n\t\t\tcontainsRTL,\n\t\t\t0,\n\t\t\tlineTokens,\n\t\t\tlineData.decorations.slice(),\n\t\t\ttabSize,\n\t\t\t0,\n\t\t\tfontInfo.spaceWidth,\n\t\t\tfontInfo.middotWidth,\n\t\t\tfontInfo.wsmiddotWidth,\n\t\t\tstopRenderingLineAfter,\n\t\t\trenderWhitespace,\n\t\t\trenderControlCharacters,\n\t\t\tfontLigatures !== EditorFontLigatures.OFF,\n\t\t\tnull,\n\t\t\tnull,\n\t\t\t0\n\t\t), sb);\n\n\t\tsb.appendString('</div>');\n\t}\n\tsb.appendString('</div>');\n\n\tapplyFontInfo(domNode, fontInfo);\n\tconst html = sb.build();\n\tconst trustedhtml = ttPolicy ? ttPolicy.createHTML(html) : html;\n\tdomNode.innerHTML = trustedhtml as string;\n}\n\nexport const ttPolicy = createTrustedTypesPolicy('editorGhostText', { createHTML: value => value });\n"]}
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.ts","vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;AAEhG,OAAO,EAAE,wBAAwB,EAAE,MAAM,gDAAgD,CAAC;AAC1F,OAAO,EAAE,UAAU,EAAE,MAAM,2DAA2D,CAAC;AACvF,OAAO,EAAE,OAAO,EAAE,MAAM,2CAA2C,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,iBAAiB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,YAAY,CAAC,QAAQ,CAAC,CAAC;IAE1B,aAAa,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACjC,MAAM,IAAI,GAAG,EAAE,CAAC,KAAK,EAAE,CAAC;IACxB,MAAM,WAAW,GAAG,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAChE,OAAO,CAAC,SAAS,GAAG,WAAqB,CAAC;AAC3C,CAAC;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,wBAAwB,CAAC,iBAAiB,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC","file":"ghostTextView.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { createTrustedTypesPolicy } from '../../../../../../base/browser/trustedTypes.js';\nimport { renderIcon } from '../../../../../../base/browser/ui/iconLabel/iconLabels.js';\nimport { Codicon } from '../../../../../../base/common/codicons.js';\nimport { Emitter, Event } from '../../../../../../base/common/event.js';\nimport { Disposable, DisposableStore, MutableDisposable, toDisposable } from '../../../../../../base/common/lifecycle.js';\nimport { IObservable, autorun, autorunWithStore, constObservable, derived, derivedOpts, observableSignalFromEvent, observableValue } from '../../../../../../base/common/observable.js';\nimport * as strings from '../../../../../../base/common/strings.js';\nimport { applyFontInfo } from '../../../../../browser/config/domFontInfo.js';\nimport { ContentWidgetPositionPreference, ICodeEditor, IContentWidgetPosition, IViewZoneChangeAccessor, MouseTargetType } from '../../../../../browser/editorBrowser.js';\nimport { observableCodeEditor } from '../../../../../browser/observableCodeEditor.js';\nimport { EditorFontLigatures, EditorOption, IComputedEditorOptions } from '../../../../../common/config/editorOptions.js';\nimport { StringEdit, StringReplacement } from '../../../../../common/core/edits/stringEdit.js';\nimport { Position } from '../../../../../common/core/position.js';\nimport { Range } from '../../../../../common/core/range.js';\nimport { StringBuilder } from '../../../../../common/core/stringBuilder.js';\nimport { IconPath, InlineCompletionWarning } from '../../../../../common/languages.js';\nimport { ILanguageService } from '../../../../../common/languages/language.js';\nimport { IModelDeltaDecoration, ITextModel, InjectedTextCursorStops, PositionAffinity } from '../../../../../common/model.js';\nimport { LineTokens } from '../../../../../common/tokens/lineTokens.js';\nimport { LineDecoration } from '../../../../../common/viewLayout/lineDecorations.js';\nimport { RenderLineInput, renderViewLine } from '../../../../../common/viewLayout/viewLineRenderer.js';\nimport { GhostText, GhostTextReplacement, IGhostTextLine } from '../../model/ghostText.js';\nimport { RangeSingleLine } from '../../../../../common/core/ranges/rangeSingleLine.js';\nimport { ColumnRange } from '../../../../../common/core/ranges/columnRange.js';\nimport { addDisposableListener, getWindow, isHTMLElement, n } from '../../../../../../base/browser/dom.js';\nimport './ghostTextView.css';\nimport { IMouseEvent, StandardMouseEvent } from '../../../../../../base/browser/mouseEvent.js';\nimport { CodeEditorWidget } from '../../../../../browser/widget/codeEditor/codeEditorWidget.js';\nimport { TokenWithTextArray } from '../../../../../common/tokens/tokenWithTextArray.js';\nimport { InlineCompletionViewData } from '../inlineEdits/inlineEditsViewInterface.js';\nimport { InlineDecorationType } from '../../../../../common/viewModel/inlineDecorations.js';\nimport { equals, sum } from '../../../../../../base/common/arrays.js';\nimport { equalsIfDefinedC, IEquatable, thisEqualsC } from '../../../../../../base/common/equals.js';\n\nexport interface IGhostTextWidgetData {\n\treadonly ghostText: GhostText | GhostTextReplacement;\n\treadonly warning: GhostTextWidgetWarning | undefined;\n\thandleInlineCompletionShown(viewData: InlineCompletionViewData): void;\n}\n\nexport class GhostTextWidgetWarning {\n\tpublic static from(warning: InlineCompletionWarning | undefined): GhostTextWidgetWarning | undefined {\n\t\tif (!warning) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn new GhostTextWidgetWarning(warning.icon);\n\t}\n\n\tconstructor(\n\t\tpublic readonly icon: IconPath = Codicon.warning,\n\t) { }\n}\n\nconst USE_SQUIGGLES_FOR_WARNING = true;\nconst GHOST_TEXT_CLASS_NAME = 'ghost-text';\n\nexport class GhostTextView extends Disposable {\n\tprivate readonly _isDisposed = observableValue(this, false);\n\tprivate readonly _editorObs;\n\tprivate readonly _warningState = derived(reader => {\n\t\tconst model = this._data.read(reader);\n\t\tconst warning = model?.warning;\n\t\tif (!model || !warning) { return undefined; }\n\t\tconst gt = model.ghostText;\n\t\treturn { lineNumber: gt.lineNumber, position: new Position(gt.lineNumber, gt.parts[0].column), icon: warning.icon };\n\t});\n\n\tprivate readonly _onDidClick = this._register(new Emitter<IMouseEvent>());\n\tpublic readonly onDidClick = this._onDidClick.event;\n\n\tprivate readonly _extraClasses: readonly string[];\n\tprivate readonly _isClickable: boolean;\n\tprivate readonly _shouldKeepCursorStable: boolean;\n\tprivate readonly _minReservedLineCount: IObservable<number>;\n\tprivate readonly _useSyntaxHighlighting: IObservable<boolean>;\n\tprivate readonly _highlightShortText: boolean;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tprivate readonly _data: IObservable<IGhostTextWidgetData | undefined>,\n\t\toptions: {\n\t\t\textraClasses?: readonly string[]; // TODO@benibenj improve\n\t\t\tisClickable?: boolean;\n\t\t\tshouldKeepCursorStable?: boolean;\n\t\t\tminReservedLineCount?: IObservable<number>;\n\t\t\tuseSyntaxHighlighting?: IObservable<boolean>;\n\t\t\thighlightShortSuggestions?: boolean;\n\t\t},\n\t\t@ILanguageService private readonly _languageService: ILanguageService\n\t) {\n\t\tsuper();\n\n\t\tthis._extraClasses = options.extraClasses ?? [];\n\t\tthis._isClickable = options.isClickable ?? false;\n\t\tthis._shouldKeepCursorStable = options.shouldKeepCursorStable ?? false;\n\t\tthis._minReservedLineCount = options.minReservedLineCount ?? constObservable(0);\n\t\tthis._useSyntaxHighlighting = options.useSyntaxHighlighting ?? constObservable(true);\n\t\tthis._highlightShortText = options.highlightShortSuggestions ?? false;\n\n\t\tthis._editorObs = observableCodeEditor(this._editor);\n\t\tthis._additionalLinesWidget = this._register(\n\t\t\tnew AdditionalLinesWidget(\n\t\t\t\tthis._editor,\n\t\t\t\tderivedOpts({ owner: this, equalsFn: equalsIfDefinedC(thisEqualsC()) }, reader => {\n\t\t\t\t\t/** @description lines */\n\t\t\t\t\tconst uiState = this._state.read(reader);\n\t\t\t\t\treturn uiState ? new AdditionalLinesData(\n\t\t\t\t\t\tuiState.lineNumber,\n\t\t\t\t\t\tuiState.additionalLines,\n\t\t\t\t\t\tuiState.additionalReservedLineCount,\n\t\t\t\t\t) : undefined;\n\t\t\t\t}),\n\t\t\t\tthis._shouldKeepCursorStable,\n\t\t\t\tthis._isClickable\n\t\t\t)\n\t\t);\n\t\tthis._isInlineTextHovered = this._editorObs.isTargetHovered(\n\t\t\tp => p.target.type === MouseTargetType.CONTENT_TEXT &&\n\t\t\t\tp.target.detail.injectedText?.options.attachedData instanceof GhostTextAttachedData &&\n\t\t\t\tp.target.detail.injectedText.options.attachedData.owner === this,\n\t\t\tthis._store\n\t\t);\n\n\t\tthis._register(toDisposable(() => { this._isDisposed.set(true, undefined); }));\n\t\tthis._register(this._editorObs.setDecorations(this._decorations));\n\n\t\tif (this._isClickable) {\n\t\t\tthis._register(this._additionalLinesWidget.onDidClick((e) => this._onDidClick.fire(e)));\n\t\t\tthis._register(this._editor.onMouseUp(e => {\n\t\t\t\tif (e.target.type !== MouseTargetType.CONTENT_TEXT) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst a = e.target.detail.injectedText?.options.attachedData;\n\t\t\t\tif (a instanceof GhostTextAttachedData && a.owner === this) {\n\t\t\t\t\tthis._onDidClick.fire(e.event);\n\t\t\t\t}\n\t\t\t}));\n\t\t}\n\n\t\tthis._register(autorun(reader => {\n\t\t\tconst state = this._state.read(reader);\n\t\t\tstate?.handleInlineCompletionShown(state.telemetryViewData);\n\t\t}));\n\n\t\tthis._register(autorunWithStore((reader, store) => {\n\t\t\tif (USE_SQUIGGLES_FOR_WARNING) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst state = this._warningState.read(reader);\n\t\t\tif (!state) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst lineHeight = this._editorObs.getOption(EditorOption.lineHeight);\n\t\t\tstore.add(this._editorObs.createContentWidget({\n\t\t\t\tposition: constObservable<IContentWidgetPosition>({\n\t\t\t\t\tposition: new Position(state.lineNumber, Number.MAX_SAFE_INTEGER),\n\t\t\t\t\tpreference: [ContentWidgetPositionPreference.EXACT],\n\t\t\t\t\tpositionAffinity: PositionAffinity.Right,\n\t\t\t\t}),\n\t\t\t\tallowEditorOverflow: false,\n\t\t\t\tdomNode: n.div({\n\t\t\t\t\tclass: 'ghost-text-view-warning-widget',\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\twidth: lineHeight,\n\t\t\t\t\t\theight: lineHeight,\n\t\t\t\t\t\tmarginLeft: 4,\n\t\t\t\t\t\tcolor: 'orange',\n\t\t\t\t\t},\n\t\t\t\t\tref: (dom) => {\n\t\t\t\t\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\t\t\t\t\t(dom as any as WidgetDomElement).ghostTextViewWarningWidgetData = { range: Range.fromPositions(state.position) };\n\t\t\t\t\t}\n\t\t\t\t}, [\n\t\t\t\t\tn.div({\n\t\t\t\t\t\tclass: 'ghost-text-view-warning-widget-icon',\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\talignContent: 'center',\n\t\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\t[renderIcon(state.icon)]\n\t\t\t\t\t)\n\t\t\t\t]).keepUpdated(store).element,\n\t\t\t}));\n\t\t}));\n\t}\n\n\tpublic static getWarningWidgetContext(domNode: HTMLElement): { range: Range } | undefined {\n\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\tconst data = (domNode as any as WidgetDomElement).ghostTextViewWarningWidgetData;\n\t\tif (data) {\n\t\t\treturn data;\n\t\t} else if (domNode.parentElement) {\n\t\t\treturn this.getWarningWidgetContext(domNode.parentElement);\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tprivate readonly _nonWhitespaceCount = derived(this, reader => {\n\t\tconst data = this._data.read(reader);\n\t\tif (!data) { return undefined; }\n\t\tconst ghostText = data.ghostText;\n\t\tconst allText = ghostText.parts.map(p => p.lines.map(l => l.line).join('')).join('');\n\t\treturn allText.replace(/\\s/g, '').length;\n\t});\n\n\tprivate readonly _extraClassNames = derived(this, reader => {\n\t\tconst extraClasses = this._extraClasses.slice();\n\t\tif (USE_SQUIGGLES_FOR_WARNING && this._warningState.read(reader)) {\n\t\t\textraClasses.push('warning');\n\t\t}\n\t\tconst nonWhitespaceCount = this._nonWhitespaceCount.read(reader);\n\t\tif (this._highlightShortText && nonWhitespaceCount && nonWhitespaceCount < 3) {\n\t\t\textraClasses.push('short-text');\n\t\t} else if (this._useSyntaxHighlighting.read(reader)) {\n\t\t\textraClasses.push('syntax-highlighted');\n\t\t}\n\t\tconst extraClassNames = extraClasses.map(c => ` ${c}`).join('');\n\t\treturn extraClassNames;\n\t});\n\n\tprivate readonly _state = derived(this, reader => {\n\t\tif (this._isDisposed.read(reader)) { return undefined; }\n\n\t\tconst props = this._data.read(reader);\n\t\tif (!props) { return undefined; }\n\n\t\tconst textModel = this._editorObs.model.read(reader);\n\t\tif (!textModel) { return undefined; }\n\n\t\tconst ghostText = props.ghostText;\n\t\tconst replacedRange = ghostText instanceof GhostTextReplacement ? ghostText.columnRange : undefined;\n\n\t\tconst syntaxHighlightingEnabled = this._useSyntaxHighlighting.read(reader);\n\t\tconst extraClassNames = this._extraClassNames.read(reader);\n\t\tconst { inlineTexts, additionalLines, hiddenRange, additionalLinesOriginalSuffix } = computeGhostTextViewData(ghostText, textModel, GHOST_TEXT_CLASS_NAME + extraClassNames);\n\n\t\tconst currentLine = textModel.getLineContent(ghostText.lineNumber);\n\t\tconst edit = new StringEdit(inlineTexts.map(t => StringReplacement.insert(t.column - 1, t.text)));\n\t\tconst tokens = syntaxHighlightingEnabled ? textModel.tokenization.tokenizeLinesAt(ghostText.lineNumber, [edit.apply(currentLine), ...additionalLines.map(l => l.content)]) : undefined;\n\t\tconst newRanges = edit.getNewRanges();\n\t\tconst inlineTextsWithTokens = inlineTexts.map((t, idx) => ({ ...t, tokens: tokens?.[0]?.getTokensInRange(newRanges[idx]) }));\n\n\t\tconst tokenizedAdditionalLines: LineData[] = additionalLines.map((l, idx) => {\n\t\t\tlet content = tokens?.[idx + 1] ?? LineTokens.createEmpty(l.content, this._languageService.languageIdCodec);\n\t\t\tif (idx === additionalLines.length - 1 && additionalLinesOriginalSuffix) {\n\t\t\t\tconst t = TokenWithTextArray.fromLineTokens(textModel.tokenization.getLineTokens(additionalLinesOriginalSuffix.lineNumber));\n\t\t\t\tconst existingContent = t.slice(additionalLinesOriginalSuffix.columnRange.toZeroBasedOffsetRange());\n\t\t\t\tcontent = TokenWithTextArray.fromLineTokens(content).append(existingContent).toLineTokens(content.languageIdCodec);\n\t\t\t}\n\t\t\treturn new LineData(\n\t\t\t\tcontent,\n\t\t\t\tl.decorations,\n\t\t\t);\n\t\t});\n\n\t\tconst cursorColumn = this._editor.getSelection()?.getStartPosition().column!;\n\t\tconst disjointInlineTexts = inlineTextsWithTokens.filter(inline => inline.text !== '');\n\t\tconst hasInsertionOnCurrentLine = disjointInlineTexts.length !== 0;\n\t\tconst telemetryViewData = new InlineCompletionViewData(\n\t\t\t(hasInsertionOnCurrentLine ? disjointInlineTexts[0].column : 1) - cursorColumn,\n\t\t\thasInsertionOnCurrentLine ? 0 : (additionalLines.findIndex(line => line.content !== '') + 1),\n\t\t\thasInsertionOnCurrentLine ? 1 : 0,\n\t\t\tadditionalLines.length + (hasInsertionOnCurrentLine ? 1 : 0),\n\t\t\t0,\n\t\t\tsum(disjointInlineTexts.map(inline => inline.text.length)) + sum(tokenizedAdditionalLines.map(line => line.content.getTextLength())),\n\t\t\tdisjointInlineTexts.length + (additionalLines.length > 0 ? 1 : 0),\n\t\t\tdisjointInlineTexts.length > 1 && tokenizedAdditionalLines.length === 0 ? disjointInlineTexts.every(inline => inline.text === disjointInlineTexts[0].text) : undefined\n\t\t);\n\n\t\treturn {\n\t\t\treplacedRange,\n\t\t\tinlineTexts: inlineTextsWithTokens,\n\t\t\tadditionalLines: tokenizedAdditionalLines,\n\t\t\thiddenRange,\n\t\t\tlineNumber: ghostText.lineNumber,\n\t\t\tadditionalReservedLineCount: this._minReservedLineCount.read(reader),\n\t\t\ttargetTextModel: textModel,\n\t\t\tsyntaxHighlightingEnabled,\n\t\t\ttelemetryViewData,\n\t\t\thandleInlineCompletionShown: props.handleInlineCompletionShown,\n\t\t};\n\t});\n\n\tprivate readonly _decorations = derived(this, reader => {\n\t\tconst uiState = this._state.read(reader);\n\t\tif (!uiState) { return []; }\n\n\t\tconst decorations: IModelDeltaDecoration[] = [];\n\n\t\tconst extraClassNames = this._extraClassNames.read(reader);\n\n\t\tif (uiState.replacedRange) {\n\t\t\tdecorations.push({\n\t\t\t\trange: uiState.replacedRange.toRange(uiState.lineNumber),\n\t\t\t\toptions: { inlineClassName: 'inline-completion-text-to-replace' + extraClassNames, description: 'GhostTextReplacement' }\n\t\t\t});\n\t\t}\n\n\t\tif (uiState.hiddenRange) {\n\t\t\tdecorations.push({\n\t\t\t\trange: uiState.hiddenRange.toRange(uiState.lineNumber),\n\t\t\t\toptions: { inlineClassName: 'ghost-text-hidden', description: 'ghost-text-hidden', }\n\t\t\t});\n\t\t}\n\n\t\tfor (const p of uiState.inlineTexts) {\n\t\t\tlet inlineExtraClassNames = '';\n\t\t\tif (this._highlightShortText && p.text.length < 5) {\n\t\t\t\tinlineExtraClassNames += ' short-text';\n\t\t\t}\n\t\t\tdecorations.push({\n\t\t\t\trange: Range.fromPositions(new Position(uiState.lineNumber, p.column)),\n\t\t\t\toptions: {\n\t\t\t\t\tdescription: 'ghost-text-decoration',\n\t\t\t\t\tafter: {\n\t\t\t\t\t\tcontent: p.text,\n\t\t\t\t\t\ttokens: p.tokens,\n\t\t\t\t\t\tinlineClassName: (p.preview ? 'ghost-text-decoration-preview' : 'ghost-text-decoration')\n\t\t\t\t\t\t\t+ (this._isClickable ? ' clickable' : '')\n\t\t\t\t\t\t\t+ extraClassNames\n\t\t\t\t\t\t\t+ inlineExtraClassNames\n\t\t\t\t\t\t\t+ p.lineDecorations.map(d => ' ' + d.className).join(' '), // TODO: take the ranges into account for line decorations\n\t\t\t\t\t\tcursorStops: InjectedTextCursorStops.Left,\n\t\t\t\t\t\tattachedData: new GhostTextAttachedData(this),\n\t\t\t\t\t},\n\t\t\t\t\tshowIfCollapsed: true,\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\treturn decorations;\n\t});\n\n\tprivate readonly _additionalLinesWidget;\n\n\tprivate readonly _isInlineTextHovered;\n\n\tpublic readonly isHovered = derived(this, reader => {\n\t\tif (this._isDisposed.read(reader)) { return false; }\n\t\treturn this._isInlineTextHovered.read(reader) || this._additionalLinesWidget.isHovered.read(reader);\n\t});\n\n\tpublic readonly height = derived(this, reader => {\n\t\tconst lineHeight = this._editorObs.getOption(EditorOption.lineHeight).read(reader);\n\t\treturn lineHeight + (this._additionalLinesWidget.viewZoneHeight.read(reader) ?? 0);\n\t});\n\n\tpublic ownsViewZone(viewZoneId: string): boolean {\n\t\treturn this._additionalLinesWidget.viewZoneId === viewZoneId;\n\t}\n}\n\nclass GhostTextAttachedData {\n\tconstructor(public readonly owner: GhostTextView) { }\n}\n\ninterface WidgetDomElement {\n\tghostTextViewWarningWidgetData?: {\n\t\trange: Range;\n\t};\n}\n\nfunction computeGhostTextViewData(ghostText: GhostText | GhostTextReplacement, textModel: ITextModel, ghostTextClassName: string) {\n\tconst inlineTexts: { column: number; text: string; preview: boolean; lineDecorations: LineDecoration[] }[] = [];\n\tconst additionalLines: { content: string; decorations: LineDecoration[] }[] = [];\n\n\tfunction addToAdditionalLines(ghLines: readonly IGhostTextLine[], className: string | undefined) {\n\t\tif (additionalLines.length > 0) {\n\t\t\tconst lastLine = additionalLines[additionalLines.length - 1];\n\t\t\tif (className) {\n\t\t\t\tlastLine.decorations.push(new LineDecoration(\n\t\t\t\t\tlastLine.content.length + 1,\n\t\t\t\t\tlastLine.content.length + 1 + ghLines[0].line.length,\n\t\t\t\t\tclassName,\n\t\t\t\t\tInlineDecorationType.Regular\n\t\t\t\t));\n\t\t\t}\n\t\t\tlastLine.content += ghLines[0].line;\n\n\t\t\tghLines = ghLines.slice(1);\n\t\t}\n\t\tfor (const ghLine of ghLines) {\n\t\t\tadditionalLines.push({\n\t\t\t\tcontent: ghLine.line,\n\t\t\t\tdecorations: className ? [new LineDecoration(\n\t\t\t\t\t1,\n\t\t\t\t\tghLine.line.length + 1,\n\t\t\t\t\tclassName,\n\t\t\t\t\tInlineDecorationType.Regular\n\t\t\t\t), ...ghLine.lineDecorations] : [...ghLine.lineDecorations]\n\t\t\t});\n\t\t}\n\t}\n\n\tconst textBufferLine = textModel.getLineContent(ghostText.lineNumber);\n\n\tlet hiddenTextStartColumn: number | undefined = undefined;\n\tlet lastIdx = 0;\n\tfor (const part of ghostText.parts) {\n\t\tlet ghLines = part.lines;\n\t\tif (hiddenTextStartColumn === undefined) {\n\t\t\tinlineTexts.push({ column: part.column, text: ghLines[0].line, preview: part.preview, lineDecorations: ghLines[0].lineDecorations });\n\t\t\tghLines = ghLines.slice(1);\n\t\t} else {\n\t\t\taddToAdditionalLines([{ line: textBufferLine.substring(lastIdx, part.column - 1), lineDecorations: [] }], undefined);\n\t\t}\n\n\t\tif (ghLines.length > 0) {\n\t\t\taddToAdditionalLines(ghLines, ghostTextClassName);\n\t\t\tif (hiddenTextStartColumn === undefined && part.column <= textBufferLine.length) {\n\t\t\t\thiddenTextStartColumn = part.column;\n\t\t\t}\n\t\t}\n\n\t\tlastIdx = part.column - 1;\n\t}\n\tlet additionalLinesOriginalSuffix: RangeSingleLine | undefined = undefined;\n\tif (hiddenTextStartColumn !== undefined) {\n\t\tadditionalLinesOriginalSuffix = new RangeSingleLine(ghostText.lineNumber, new ColumnRange(lastIdx + 1, textBufferLine.length + 1));\n\t}\n\n\tconst hiddenRange = hiddenTextStartColumn !== undefined ? new ColumnRange(hiddenTextStartColumn, textBufferLine.length + 1) : undefined;\n\n\treturn {\n\t\tinlineTexts,\n\t\tadditionalLines,\n\t\thiddenRange,\n\t\tadditionalLinesOriginalSuffix,\n\t};\n}\n\nclass AdditionalLinesData implements IEquatable<AdditionalLinesData> {\n\tconstructor(\n\t\tpublic readonly lineNumber: number,\n\t\tpublic readonly additionalLines: readonly LineData[],\n\t\tpublic readonly minReservedLineCount: number,\n\t) { }\n\n\tequals(other: AdditionalLinesData): boolean {\n\t\tif (this.lineNumber !== other.lineNumber) {\n\t\t\treturn false;\n\t\t}\n\t\tif (this.minReservedLineCount !== other.minReservedLineCount) {\n\t\t\treturn false;\n\t\t}\n\t\treturn equals(this.additionalLines, other.additionalLines, thisEqualsC());\n\t}\n}\n\nexport class AdditionalLinesWidget extends Disposable {\n\tprivate _viewZoneInfo: { viewZoneId: string; heightInLines: number; lineNumber: number } | undefined;\n\tpublic get viewZoneId(): string | undefined { return this._viewZoneInfo?.viewZoneId; }\n\n\tprivate _viewZoneHeight;\n\tpublic get viewZoneHeight(): IObservable<number | undefined> { return this._viewZoneHeight; }\n\n\tprivate readonly editorOptionsChanged;\n\n\tprivate readonly _onDidClick;\n\tpublic readonly onDidClick;\n\n\tprivate readonly _viewZoneListener;\n\n\treadonly isHovered;\n\n\tprivate hasBeenAccepted;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tprivate readonly _lines: IObservable<AdditionalLinesData | undefined>,\n\t\tprivate readonly _shouldKeepCursorStable: boolean,\n\t\tprivate readonly _isClickable: boolean,\n\t) {\n\t\tsuper();\n\t\tthis._viewZoneHeight = observableValue<undefined | number>('viewZoneHeight', undefined);\n\t\tthis.editorOptionsChanged = observableSignalFromEvent('editorOptionChanged', Event.filter(\n\t\t\tthis._editor.onDidChangeConfiguration,\n\t\t\te => e.hasChanged(EditorOption.disableMonospaceOptimizations)\n\t\t\t\t|| e.hasChanged(EditorOption.stopRenderingLineAfter)\n\t\t\t\t|| e.hasChanged(EditorOption.renderWhitespace)\n\t\t\t\t|| e.hasChanged(EditorOption.renderControlCharacters)\n\t\t\t\t|| e.hasChanged(EditorOption.fontLigatures)\n\t\t\t\t|| e.hasChanged(EditorOption.fontInfo)\n\t\t\t\t|| e.hasChanged(EditorOption.lineHeight)\n\t\t));\n\t\tthis._onDidClick = this._register(new Emitter<IMouseEvent>());\n\t\tthis.onDidClick = this._onDidClick.event;\n\t\tthis._viewZoneListener = this._register(new MutableDisposable());\n\t\tthis.isHovered = observableCodeEditor(this._editor).isTargetHovered(\n\t\t\tp => isTargetGhostText(p.target.element),\n\t\t\tthis._store\n\t\t);\n\t\tthis.hasBeenAccepted = false;\n\n\t\tif (this._editor instanceof CodeEditorWidget && this._shouldKeepCursorStable) {\n\t\t\tthis._register(this._editor.onBeforeExecuteEdit(e => this.hasBeenAccepted = e.source === 'inlineSuggestion.accept'));\n\t\t}\n\n\t\tthis._register(autorun(reader => {\n\t\t\t/** @description update view zone */\n\t\t\tconst lines = this._lines.read(reader);\n\t\t\tthis.editorOptionsChanged.read(reader);\n\n\t\t\tif (lines) {\n\t\t\t\tthis.hasBeenAccepted = false;\n\t\t\t\tthis.updateLines(lines.lineNumber, lines.additionalLines, lines.minReservedLineCount);\n\t\t\t} else {\n\t\t\t\tthis.clear();\n\t\t\t}\n\t\t}));\n\t}\n\n\tpublic override dispose(): void {\n\t\tsuper.dispose();\n\t\tthis.clear();\n\t}\n\n\tprivate clear(): void {\n\t\tthis._viewZoneListener.clear();\n\n\t\tthis._editor.changeViewZones((changeAccessor) => {\n\t\t\tthis.removeActiveViewZone(changeAccessor);\n\t\t});\n\t}\n\n\tprivate updateLines(lineNumber: number, additionalLines: readonly LineData[], minReservedLineCount: number): void {\n\t\tconst textModel = this._editor.getModel();\n\t\tif (!textModel) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { tabSize } = textModel.getOptions();\n\n\t\tobservableCodeEditor(this._editor).transaction(_ => {\n\t\t\tthis._editor.changeViewZones((changeAccessor) => {\n\t\t\t\tconst store = new DisposableStore();\n\n\t\t\t\tthis.removeActiveViewZone(changeAccessor);\n\n\t\t\t\tconst heightInLines = Math.max(additionalLines.length, minReservedLineCount);\n\t\t\t\tif (heightInLines > 0) {\n\t\t\t\t\tconst domNode = document.createElement('div');\n\t\t\t\t\trenderLines(domNode, tabSize, additionalLines, this._editor.getOptions(), this._isClickable);\n\n\t\t\t\t\tif (this._isClickable) {\n\t\t\t\t\t\tstore.add(addDisposableListener(domNode, 'mousedown', (e) => {\n\t\t\t\t\t\t\te.preventDefault(); // This prevents that the editor loses focus\n\t\t\t\t\t\t}));\n\t\t\t\t\t\tstore.add(addDisposableListener(domNode, 'click', (e) => {\n\t\t\t\t\t\t\tif (isTargetGhostText(e.target)) {\n\t\t\t\t\t\t\t\tthis._onDidClick.fire(new StandardMouseEvent(getWindow(e), e));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}));\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.addViewZone(changeAccessor, lineNumber, heightInLines, domNode);\n\t\t\t\t}\n\n\t\t\t\tthis._viewZoneListener.value = store;\n\t\t\t});\n\t\t});\n\t}\n\n\tprivate addViewZone(changeAccessor: IViewZoneChangeAccessor, afterLineNumber: number, heightInLines: number, domNode: HTMLElement): void {\n\t\tconst id = changeAccessor.addZone({\n\t\t\tafterLineNumber: afterLineNumber,\n\t\t\theightInLines: heightInLines,\n\t\t\tdomNode,\n\t\t\tafterColumnAffinity: PositionAffinity.Right,\n\t\t\tonComputedHeight: (height: number) => {\n\t\t\t\tthis._viewZoneHeight.set(height, undefined); // TODO: can a transaction be used to avoid flickering?\n\t\t\t}\n\t\t});\n\n\t\tthis.keepCursorStable(afterLineNumber, heightInLines);\n\n\t\tthis._viewZoneInfo = { viewZoneId: id, heightInLines, lineNumber: afterLineNumber };\n\t}\n\n\tprivate removeActiveViewZone(changeAccessor: IViewZoneChangeAccessor): void {\n\t\tif (this._viewZoneInfo) {\n\t\t\tchangeAccessor.removeZone(this._viewZoneInfo.viewZoneId);\n\n\t\t\tif (!this.hasBeenAccepted) {\n\t\t\t\tthis.keepCursorStable(this._viewZoneInfo.lineNumber, -this._viewZoneInfo.heightInLines);\n\t\t\t}\n\n\t\t\tthis._viewZoneInfo = undefined;\n\t\t\tthis._viewZoneHeight.set(undefined, undefined);\n\t\t}\n\t}\n\n\tprivate keepCursorStable(lineNumber: number, heightInLines: number): void {\n\t\tif (!this._shouldKeepCursorStable) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst cursorLineNumber = this._editor.getSelection()?.getStartPosition()?.lineNumber;\n\t\tif (cursorLineNumber !== undefined && lineNumber < cursorLineNumber) {\n\t\t\tthis._editor.setScrollTop(this._editor.getScrollTop() + heightInLines * this._editor.getOption(EditorOption.lineHeight));\n\t\t}\n\t}\n}\n\nfunction isTargetGhostText(target: EventTarget | null): boolean {\n\treturn isHTMLElement(target) && target.classList.contains(GHOST_TEXT_CLASS_NAME);\n}\n\nexport class LineData implements IEquatable<LineData> {\n\tconstructor(\n\t\tpublic readonly content: LineTokens, // Must not contain a linebreak!\n\t\tpublic readonly decorations: readonly LineDecoration[]\n\t) { }\n\n\tequals(other: LineData): boolean {\n\t\tif (!this.content.equals(other.content)) {\n\t\t\treturn false;\n\t\t}\n\t\treturn LineDecoration.equalsArr(this.decorations, other.decorations);\n\t}\n}\n\nfunction renderLines(domNode: HTMLElement, tabSize: number, lines: readonly LineData[], opts: IComputedEditorOptions, isClickable: boolean): void {\n\tconst disableMonospaceOptimizations = opts.get(EditorOption.disableMonospaceOptimizations);\n\tconst stopRenderingLineAfter = opts.get(EditorOption.stopRenderingLineAfter);\n\t// To avoid visual confusion, we don't want to render visible whitespace\n\tconst renderWhitespace = 'none';\n\tconst renderControlCharacters = opts.get(EditorOption.renderControlCharacters);\n\tconst fontLigatures = opts.get(EditorOption.fontLigatures);\n\tconst fontInfo = opts.get(EditorOption.fontInfo);\n\tconst lineHeight = opts.get(EditorOption.lineHeight);\n\n\tlet classNames = 'suggest-preview-text';\n\tif (isClickable) {\n\t\tclassNames += ' clickable';\n\t}\n\n\tconst sb = new StringBuilder(10000);\n\tsb.appendString(`<div class=\"${classNames}\">`);\n\n\tfor (let i = 0, len = lines.length; i < len; i++) {\n\t\tconst lineData = lines[i];\n\t\tconst lineTokens = lineData.content;\n\t\tsb.appendString('<div class=\"view-line');\n\t\tsb.appendString('\" style=\"top:');\n\t\tsb.appendString(String(i * lineHeight));\n\t\tsb.appendString('px;width:1000000px;\">');\n\n\t\tconst line = lineTokens.getLineContent();\n\t\tconst isBasicASCII = strings.isBasicASCII(line);\n\t\tconst containsRTL = strings.containsRTL(line);\n\n\t\trenderViewLine(new RenderLineInput(\n\t\t\t(fontInfo.isMonospace && !disableMonospaceOptimizations),\n\t\t\tfontInfo.canUseHalfwidthRightwardsArrow,\n\t\t\tline,\n\t\t\tfalse,\n\t\t\tisBasicASCII,\n\t\t\tcontainsRTL,\n\t\t\t0,\n\t\t\tlineTokens,\n\t\t\tlineData.decorations.slice(),\n\t\t\ttabSize,\n\t\t\t0,\n\t\t\tfontInfo.spaceWidth,\n\t\t\tfontInfo.middotWidth,\n\t\t\tfontInfo.wsmiddotWidth,\n\t\t\tstopRenderingLineAfter,\n\t\t\trenderWhitespace,\n\t\t\trenderControlCharacters,\n\t\t\tfontLigatures !== EditorFontLigatures.OFF,\n\t\t\tnull,\n\t\t\tnull,\n\t\t\t0\n\t\t), sb);\n\n\t\tsb.appendString('</div>');\n\t}\n\tsb.appendString('</div>');\n\n\tapplyFontInfo(domNode, fontInfo);\n\tconst html = sb.build();\n\tconst trustedhtml = ttPolicy ? ttPolicy.createHTML(html) : html;\n\tdomNode.innerHTML = trustedhtml as string;\n}\n\nexport const ttPolicy = createTrustedTypesPolicy('editorGhostText', { createHTML: value => value });\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { createTrustedTypesPolicy } from '../../../../../../base/browser/trustedTypes.js';\nimport { renderIcon } from '../../../../../../base/browser/ui/iconLabel/iconLabels.js';\nimport { Codicon } from '../../../../../../base/common/codicons.js';\nimport { Emitter, Event } from '../../../../../../base/common/event.js';\nimport { Disposable, DisposableStore, MutableDisposable, toDisposable } from '../../../../../../base/common/lifecycle.js';\nimport { IObservable, autorun, autorunWithStore, constObservable, derived, derivedOpts, observableSignalFromEvent, observableValue } from '../../../../../../base/common/observable.js';\nimport * as strings from '../../../../../../base/common/strings.js';\nimport { applyFontInfo } from '../../../../../browser/config/domFontInfo.js';\nimport { ContentWidgetPositionPreference, ICodeEditor, IContentWidgetPosition, IViewZoneChangeAccessor, MouseTargetType } from '../../../../../browser/editorBrowser.js';\nimport { observableCodeEditor } from '../../../../../browser/observableCodeEditor.js';\nimport { EditorFontLigatures, EditorOption, IComputedEditorOptions } from '../../../../../common/config/editorOptions.js';\nimport { StringEdit, StringReplacement } from '../../../../../common/core/edits/stringEdit.js';\nimport { Position } from '../../../../../common/core/position.js';\nimport { Range } from '../../../../../common/core/range.js';\nimport { StringBuilder } from '../../../../../common/core/stringBuilder.js';\nimport { IconPath, InlineCompletionWarning } from '../../../../../common/languages.js';\nimport { ILanguageService } from '../../../../../common/languages/language.js';\nimport { IModelDeltaDecoration, ITextModel, InjectedTextCursorStops, PositionAffinity } from '../../../../../common/model.js';\nimport { LineTokens } from '../../../../../common/tokens/lineTokens.js';\nimport { LineDecoration } from '../../../../../common/viewLayout/lineDecorations.js';\nimport { RenderLineInput, renderViewLine } from '../../../../../common/viewLayout/viewLineRenderer.js';\nimport { GhostText, GhostTextReplacement, IGhostTextLine } from '../../model/ghostText.js';\nimport { RangeSingleLine } from '../../../../../common/core/ranges/rangeSingleLine.js';\nimport { ColumnRange } from '../../../../../common/core/ranges/columnRange.js';\nimport { addDisposableListener, getWindow, isHTMLElement, n } from '../../../../../../base/browser/dom.js';\nimport './ghostTextView.css';\nimport { IMouseEvent, StandardMouseEvent } from '../../../../../../base/browser/mouseEvent.js';\nimport { CodeEditorWidget } from '../../../../../browser/widget/codeEditor/codeEditorWidget.js';\nimport { TokenWithTextArray } from '../../../../../common/tokens/tokenWithTextArray.js';\nimport { InlineCompletionViewData } from '../inlineEdits/inlineEditsViewInterface.js';\nimport { InlineDecorationType } from '../../../../../common/viewModel/inlineDecorations.js';\nimport { equals, sum } from '../../../../../../base/common/arrays.js';\nimport { equalsIfDefinedC, IEquatable, thisEqualsC } from '../../../../../../base/common/equals.js';\n\nexport interface IGhostTextWidgetData {\n\treadonly ghostText: GhostText | GhostTextReplacement;\n\treadonly warning: GhostTextWidgetWarning | undefined;\n\thandleInlineCompletionShown(viewData: InlineCompletionViewData): void;\n}\n\nexport class GhostTextWidgetWarning {\n\tpublic static from(warning: InlineCompletionWarning | undefined): GhostTextWidgetWarning | undefined {\n\t\tif (!warning) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn new GhostTextWidgetWarning(warning.icon);\n\t}\n\n\tconstructor(\n\t\tpublic readonly icon: IconPath = Codicon.warning,\n\t) { }\n}\n\nconst USE_SQUIGGLES_FOR_WARNING = true;\nconst GHOST_TEXT_CLASS_NAME = 'ghost-text';\n\nexport class GhostTextView extends Disposable {\n\tprivate readonly _isDisposed = observableValue(this, false);\n\tprivate readonly _editorObs;\n\tprivate readonly _warningState = derived(reader => {\n\t\tconst model = this._data.read(reader);\n\t\tconst warning = model?.warning;\n\t\tif (!model || !warning) { return undefined; }\n\t\tconst gt = model.ghostText;\n\t\treturn { lineNumber: gt.lineNumber, position: new Position(gt.lineNumber, gt.parts[0].column), icon: warning.icon };\n\t});\n\n\tprivate readonly _onDidClick = this._register(new Emitter<IMouseEvent>());\n\tpublic readonly onDidClick = this._onDidClick.event;\n\n\tprivate readonly _extraClasses: readonly string[];\n\tprivate readonly _isClickable: boolean;\n\tprivate readonly _shouldKeepCursorStable: boolean;\n\tprivate readonly _minReservedLineCount: IObservable<number>;\n\tprivate readonly _useSyntaxHighlighting: IObservable<boolean>;\n\tprivate readonly _highlightShortText: boolean;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tprivate readonly _data: IObservable<IGhostTextWidgetData | undefined>,\n\t\toptions: {\n\t\t\textraClasses?: readonly string[]; // TODO@benibenj improve\n\t\t\tisClickable?: boolean;\n\t\t\tshouldKeepCursorStable?: boolean;\n\t\t\tminReservedLineCount?: IObservable<number>;\n\t\t\tuseSyntaxHighlighting?: IObservable<boolean>;\n\t\t\thighlightShortSuggestions?: boolean;\n\t\t},\n\t\t@ILanguageService private readonly _languageService: ILanguageService\n\t) {\n\t\tsuper();\n\n\t\tthis._extraClasses = options.extraClasses ?? [];\n\t\tthis._isClickable = options.isClickable ?? false;\n\t\tthis._shouldKeepCursorStable = options.shouldKeepCursorStable ?? false;\n\t\tthis._minReservedLineCount = options.minReservedLineCount ?? constObservable(0);\n\t\tthis._useSyntaxHighlighting = options.useSyntaxHighlighting ?? constObservable(true);\n\t\tthis._highlightShortText = options.highlightShortSuggestions ?? false;\n\n\t\tthis._editorObs = observableCodeEditor(this._editor);\n\t\tthis._additionalLinesWidget = this._register(\n\t\t\tnew AdditionalLinesWidget(\n\t\t\t\tthis._editor,\n\t\t\t\tderivedOpts({ owner: this, equalsFn: equalsIfDefinedC(thisEqualsC()) }, reader => {\n\t\t\t\t\t/** @description lines */\n\t\t\t\t\tconst uiState = this._state.read(reader);\n\t\t\t\t\treturn uiState ? new AdditionalLinesData(\n\t\t\t\t\t\tuiState.lineNumber,\n\t\t\t\t\t\tuiState.additionalLines,\n\t\t\t\t\t\tuiState.additionalReservedLineCount,\n\t\t\t\t\t) : undefined;\n\t\t\t\t}),\n\t\t\t\tthis._shouldKeepCursorStable,\n\t\t\t\tthis._isClickable\n\t\t\t)\n\t\t);\n\t\tthis._isInlineTextHovered = this._editorObs.isTargetHovered(\n\t\t\tp => p.target.type === MouseTargetType.CONTENT_TEXT &&\n\t\t\t\tp.target.detail.injectedText?.options.attachedData instanceof GhostTextAttachedData &&\n\t\t\t\tp.target.detail.injectedText.options.attachedData.owner === this,\n\t\t\tthis._store\n\t\t);\n\n\t\tthis._register(toDisposable(() => { this._isDisposed.set(true, undefined); }));\n\t\tthis._register(this._editorObs.setDecorations(this._decorations));\n\n\t\tif (this._isClickable) {\n\t\t\tthis._register(this._additionalLinesWidget.onDidClick((e) => this._onDidClick.fire(e)));\n\t\t\tthis._register(this._editor.onMouseUp(e => {\n\t\t\t\tif (e.target.type !== MouseTargetType.CONTENT_TEXT) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst a = e.target.detail.injectedText?.options.attachedData;\n\t\t\t\tif (a instanceof GhostTextAttachedData && a.owner === this) {\n\t\t\t\t\tthis._onDidClick.fire(e.event);\n\t\t\t\t}\n\t\t\t}));\n\t\t}\n\n\t\tthis._register(autorun(reader => {\n\t\t\tconst state = this._state.read(reader);\n\t\t\tstate?.handleInlineCompletionShown(state.telemetryViewData);\n\t\t}));\n\n\t\tthis._register(autorunWithStore((reader, store) => {\n\t\t\tif (USE_SQUIGGLES_FOR_WARNING) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst state = this._warningState.read(reader);\n\t\t\tif (!state) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst lineHeight = this._editorObs.getOption(EditorOption.lineHeight);\n\t\t\tstore.add(this._editorObs.createContentWidget({\n\t\t\t\tposition: constObservable<IContentWidgetPosition>({\n\t\t\t\t\tposition: new Position(state.lineNumber, Number.MAX_SAFE_INTEGER),\n\t\t\t\t\tpreference: [ContentWidgetPositionPreference.EXACT],\n\t\t\t\t\tpositionAffinity: PositionAffinity.Right,\n\t\t\t\t}),\n\t\t\t\tallowEditorOverflow: false,\n\t\t\t\tdomNode: n.div({\n\t\t\t\t\tclass: 'ghost-text-view-warning-widget',\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\twidth: lineHeight,\n\t\t\t\t\t\theight: lineHeight,\n\t\t\t\t\t\tmarginLeft: 4,\n\t\t\t\t\t\tcolor: 'orange',\n\t\t\t\t\t},\n\t\t\t\t\tref: (dom) => {\n\t\t\t\t\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\t\t\t\t\t(dom as any as WidgetDomElement).ghostTextViewWarningWidgetData = { range: Range.fromPositions(state.position) };\n\t\t\t\t\t}\n\t\t\t\t}, [\n\t\t\t\t\tn.div({\n\t\t\t\t\t\tclass: 'ghost-text-view-warning-widget-icon',\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\talignContent: 'center',\n\t\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t\t[renderIcon(state.icon)]\n\t\t\t\t\t)\n\t\t\t\t]).keepUpdated(store).element,\n\t\t\t}));\n\t\t}));\n\t}\n\n\tpublic static getWarningWidgetContext(domNode: HTMLElement): { range: Range } | undefined {\n\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\tconst data = (domNode as any as WidgetDomElement).ghostTextViewWarningWidgetData;\n\t\tif (data) {\n\t\t\treturn data;\n\t\t} else if (domNode.parentElement) {\n\t\t\treturn this.getWarningWidgetContext(domNode.parentElement);\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tprivate readonly _nonWhitespaceCount = derived(this, reader => {\n\t\tconst data = this._data.read(reader);\n\t\tif (!data) { return undefined; }\n\t\tconst ghostText = data.ghostText;\n\t\tconst allText = ghostText.parts.map(p => p.lines.map(l => l.line).join('')).join('');\n\t\treturn allText.replace(/\\s/g, '').length;\n\t});\n\n\tprivate readonly _extraClassNames = derived(this, reader => {\n\t\tconst extraClasses = this._extraClasses.slice();\n\t\tif (USE_SQUIGGLES_FOR_WARNING && this._warningState.read(reader)) {\n\t\t\textraClasses.push('warning');\n\t\t}\n\t\tconst nonWhitespaceCount = this._nonWhitespaceCount.read(reader);\n\t\tif (this._highlightShortText && nonWhitespaceCount && nonWhitespaceCount < 3) {\n\t\t\textraClasses.push('short-text');\n\t\t} else if (this._useSyntaxHighlighting.read(reader)) {\n\t\t\textraClasses.push('syntax-highlighted');\n\t\t}\n\t\tconst extraClassNames = extraClasses.map(c => ` ${c}`).join('');\n\t\treturn extraClassNames;\n\t});\n\n\tprivate readonly _state = derived(this, reader => {\n\t\tif (this._isDisposed.read(reader)) { return undefined; }\n\n\t\tconst props = this._data.read(reader);\n\t\tif (!props) { return undefined; }\n\n\t\tconst textModel = this._editorObs.model.read(reader);\n\t\tif (!textModel) { return undefined; }\n\n\t\tconst ghostText = props.ghostText;\n\t\tconst replacedRange = ghostText instanceof GhostTextReplacement ? ghostText.columnRange : undefined;\n\n\t\tconst syntaxHighlightingEnabled = this._useSyntaxHighlighting.read(reader);\n\t\tconst extraClassNames = this._extraClassNames.read(reader);\n\t\tconst { inlineTexts, additionalLines, hiddenRange, additionalLinesOriginalSuffix } = computeGhostTextViewData(ghostText, textModel, GHOST_TEXT_CLASS_NAME + extraClassNames);\n\n\t\tconst currentLine = textModel.getLineContent(ghostText.lineNumber);\n\t\tconst edit = new StringEdit(inlineTexts.map(t => StringReplacement.insert(t.column - 1, t.text)));\n\t\tconst tokens = syntaxHighlightingEnabled ? textModel.tokenization.tokenizeLinesAt(ghostText.lineNumber, [edit.apply(currentLine), ...additionalLines.map(l => l.content)]) : undefined;\n\t\tconst newRanges = edit.getNewRanges();\n\t\tconst inlineTextsWithTokens = inlineTexts.map((t, idx) => ({ ...t, tokens: tokens?.[0]?.getTokensInRange(newRanges[idx]) }));\n\n\t\tconst tokenizedAdditionalLines: LineData[] = additionalLines.map((l, idx) => {\n\t\t\tlet content = tokens?.[idx + 1] ?? LineTokens.createEmpty(l.content, this._languageService.languageIdCodec);\n\t\t\tif (idx === additionalLines.length - 1 && additionalLinesOriginalSuffix) {\n\t\t\t\tconst t = TokenWithTextArray.fromLineTokens(textModel.tokenization.getLineTokens(additionalLinesOriginalSuffix.lineNumber));\n\t\t\t\tconst existingContent = t.slice(additionalLinesOriginalSuffix.columnRange.toZeroBasedOffsetRange());\n\t\t\t\tcontent = TokenWithTextArray.fromLineTokens(content).append(existingContent).toLineTokens(content.languageIdCodec);\n\t\t\t}\n\t\t\treturn new LineData(\n\t\t\t\tcontent,\n\t\t\t\tl.decorations,\n\t\t\t);\n\t\t});\n\n\t\tconst cursorColumn = this._editor.getSelection()?.getStartPosition().column!;\n\t\tconst disjointInlineTexts = inlineTextsWithTokens.filter(inline => inline.text !== '');\n\t\tconst hasInsertionOnCurrentLine = disjointInlineTexts.length !== 0;\n\t\tconst telemetryViewData = new InlineCompletionViewData(\n\t\t\t(hasInsertionOnCurrentLine ? disjointInlineTexts[0].column : 1) - cursorColumn,\n\t\t\thasInsertionOnCurrentLine ? 0 : (additionalLines.findIndex(line => line.content !== '') + 1),\n\t\t\thasInsertionOnCurrentLine ? 1 : 0,\n\t\t\tadditionalLines.length + (hasInsertionOnCurrentLine ? 1 : 0),\n\t\t\t0,\n\t\t\tsum(disjointInlineTexts.map(inline => inline.text.length)) + sum(tokenizedAdditionalLines.map(line => line.content.getTextLength())),\n\t\t\tdisjointInlineTexts.length + (additionalLines.length > 0 ? 1 : 0),\n\t\t\tdisjointInlineTexts.length > 1 && tokenizedAdditionalLines.length === 0 ? disjointInlineTexts.every(inline => inline.text === disjointInlineTexts[0].text) : undefined\n\t\t);\n\n\t\treturn {\n\t\t\treplacedRange,\n\t\t\tinlineTexts: inlineTextsWithTokens,\n\t\t\tadditionalLines: tokenizedAdditionalLines,\n\t\t\thiddenRange,\n\t\t\tlineNumber: ghostText.lineNumber,\n\t\t\tadditionalReservedLineCount: this._minReservedLineCount.read(reader),\n\t\t\ttargetTextModel: textModel,\n\t\t\tsyntaxHighlightingEnabled,\n\t\t\ttelemetryViewData,\n\t\t\thandleInlineCompletionShown: props.handleInlineCompletionShown,\n\t\t};\n\t});\n\n\tprivate readonly _decorations = derived(this, reader => {\n\t\tconst uiState = this._state.read(reader);\n\t\tif (!uiState) { return []; }\n\n\t\tconst decorations: IModelDeltaDecoration[] = [];\n\n\t\tconst extraClassNames = this._extraClassNames.read(reader);\n\n\t\tif (uiState.replacedRange) {\n\t\t\tdecorations.push({\n\t\t\t\trange: uiState.replacedRange.toRange(uiState.lineNumber),\n\t\t\t\toptions: { inlineClassName: 'inline-completion-text-to-replace' + extraClassNames, description: 'GhostTextReplacement' }\n\t\t\t});\n\t\t}\n\n\t\tif (uiState.hiddenRange) {\n\t\t\tdecorations.push({\n\t\t\t\trange: uiState.hiddenRange.toRange(uiState.lineNumber),\n\t\t\t\toptions: { inlineClassName: 'ghost-text-hidden', description: 'ghost-text-hidden', }\n\t\t\t});\n\t\t}\n\n\t\tfor (const p of uiState.inlineTexts) {\n\t\t\tlet inlineExtraClassNames = '';\n\t\t\tif (this._highlightShortText && p.text.length < 5) {\n\t\t\t\tinlineExtraClassNames += ' short-text';\n\t\t\t}\n\t\t\tdecorations.push({\n\t\t\t\trange: Range.fromPositions(new Position(uiState.lineNumber, p.column)),\n\t\t\t\toptions: {\n\t\t\t\t\tdescription: 'ghost-text-decoration',\n\t\t\t\t\tafter: {\n\t\t\t\t\t\tcontent: p.text,\n\t\t\t\t\t\ttokens: p.tokens,\n\t\t\t\t\t\tinlineClassName: (p.preview ? 'ghost-text-decoration-preview' : 'ghost-text-decoration')\n\t\t\t\t\t\t\t+ (this._isClickable ? ' clickable' : '')\n\t\t\t\t\t\t\t+ extraClassNames\n\t\t\t\t\t\t\t+ inlineExtraClassNames\n\t\t\t\t\t\t\t+ p.lineDecorations.map(d => ' ' + d.className).join(' '), // TODO: take the ranges into account for line decorations\n\t\t\t\t\t\tcursorStops: InjectedTextCursorStops.Left,\n\t\t\t\t\t\tattachedData: new GhostTextAttachedData(this),\n\t\t\t\t\t},\n\t\t\t\t\tshowIfCollapsed: true,\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\treturn decorations;\n\t});\n\n\tprivate readonly _additionalLinesWidget;\n\n\tprivate readonly _isInlineTextHovered;\n\n\tpublic readonly isHovered = derived(this, reader => {\n\t\tif (this._isDisposed.read(reader)) { return false; }\n\t\treturn this._isInlineTextHovered.read(reader) || this._additionalLinesWidget.isHovered.read(reader);\n\t});\n\n\tpublic readonly height = derived(this, reader => {\n\t\tconst lineHeight = this._editorObs.getOption(EditorOption.lineHeight).read(reader);\n\t\treturn lineHeight + (this._additionalLinesWidget.viewZoneHeight.read(reader) ?? 0);\n\t});\n\n\tpublic ownsViewZone(viewZoneId: string): boolean {\n\t\treturn this._additionalLinesWidget.viewZoneId === viewZoneId;\n\t}\n}\n\nclass GhostTextAttachedData {\n\tconstructor(public readonly owner: GhostTextView) { }\n}\n\ninterface WidgetDomElement {\n\tghostTextViewWarningWidgetData?: {\n\t\trange: Range;\n\t};\n}\n\nfunction computeGhostTextViewData(ghostText: GhostText | GhostTextReplacement, textModel: ITextModel, ghostTextClassName: string) {\n\tconst inlineTexts: { column: number; text: string; preview: boolean; lineDecorations: LineDecoration[] }[] = [];\n\tconst additionalLines: { content: string; decorations: LineDecoration[] }[] = [];\n\n\tfunction addToAdditionalLines(ghLines: readonly IGhostTextLine[], className: string | undefined) {\n\t\tif (additionalLines.length > 0) {\n\t\t\tconst lastLine = additionalLines[additionalLines.length - 1];\n\t\t\tif (className) {\n\t\t\t\tlastLine.decorations.push(new LineDecoration(\n\t\t\t\t\tlastLine.content.length + 1,\n\t\t\t\t\tlastLine.content.length + 1 + ghLines[0].line.length,\n\t\t\t\t\tclassName,\n\t\t\t\t\tInlineDecorationType.Regular\n\t\t\t\t));\n\t\t\t}\n\t\t\tlastLine.content += ghLines[0].line;\n\n\t\t\tghLines = ghLines.slice(1);\n\t\t}\n\t\tfor (const ghLine of ghLines) {\n\t\t\tadditionalLines.push({\n\t\t\t\tcontent: ghLine.line,\n\t\t\t\tdecorations: className ? [new LineDecoration(\n\t\t\t\t\t1,\n\t\t\t\t\tghLine.line.length + 1,\n\t\t\t\t\tclassName,\n\t\t\t\t\tInlineDecorationType.Regular\n\t\t\t\t), ...ghLine.lineDecorations] : [...ghLine.lineDecorations]\n\t\t\t});\n\t\t}\n\t}\n\n\tconst textBufferLine = textModel.getLineContent(ghostText.lineNumber);\n\n\tlet hiddenTextStartColumn: number | undefined = undefined;\n\tlet lastIdx = 0;\n\tfor (const part of ghostText.parts) {\n\t\tlet ghLines = part.lines;\n\t\tif (hiddenTextStartColumn === undefined) {\n\t\t\tinlineTexts.push({ column: part.column, text: ghLines[0].line, preview: part.preview, lineDecorations: ghLines[0].lineDecorations });\n\t\t\tghLines = ghLines.slice(1);\n\t\t} else {\n\t\t\taddToAdditionalLines([{ line: textBufferLine.substring(lastIdx, part.column - 1), lineDecorations: [] }], undefined);\n\t\t}\n\n\t\tif (ghLines.length > 0) {\n\t\t\taddToAdditionalLines(ghLines, ghostTextClassName);\n\t\t\tif (hiddenTextStartColumn === undefined && part.column <= textBufferLine.length) {\n\t\t\t\thiddenTextStartColumn = part.column;\n\t\t\t}\n\t\t}\n\n\t\tlastIdx = part.column - 1;\n\t}\n\tlet additionalLinesOriginalSuffix: RangeSingleLine | undefined = undefined;\n\tif (hiddenTextStartColumn !== undefined) {\n\t\tadditionalLinesOriginalSuffix = new RangeSingleLine(ghostText.lineNumber, new ColumnRange(lastIdx + 1, textBufferLine.length + 1));\n\t}\n\n\tconst hiddenRange = hiddenTextStartColumn !== undefined ? new ColumnRange(hiddenTextStartColumn, textBufferLine.length + 1) : undefined;\n\n\treturn {\n\t\tinlineTexts,\n\t\tadditionalLines,\n\t\thiddenRange,\n\t\tadditionalLinesOriginalSuffix,\n\t};\n}\n\nclass AdditionalLinesData implements IEquatable<AdditionalLinesData> {\n\tconstructor(\n\t\tpublic readonly lineNumber: number,\n\t\tpublic readonly additionalLines: readonly LineData[],\n\t\tpublic readonly minReservedLineCount: number,\n\t) { }\n\n\tequals(other: AdditionalLinesData): boolean {\n\t\tif (this.lineNumber !== other.lineNumber) {\n\t\t\treturn false;\n\t\t}\n\t\tif (this.minReservedLineCount !== other.minReservedLineCount) {\n\t\t\treturn false;\n\t\t}\n\t\treturn equals(this.additionalLines, other.additionalLines, thisEqualsC());\n\t}\n}\n\nexport class AdditionalLinesWidget extends Disposable {\n\tprivate _viewZoneInfo: { viewZoneId: string; heightInLines: number; lineNumber: number } | undefined;\n\tpublic get viewZoneId(): string | undefined { return this._viewZoneInfo?.viewZoneId; }\n\n\tprivate _viewZoneHeight;\n\tpublic get viewZoneHeight(): IObservable<number | undefined> { return this._viewZoneHeight; }\n\n\tprivate readonly editorOptionsChanged;\n\n\tprivate readonly _onDidClick;\n\tpublic readonly onDidClick;\n\n\tprivate readonly _viewZoneListener;\n\n\treadonly isHovered;\n\n\tprivate hasBeenAccepted;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tprivate readonly _lines: IObservable<AdditionalLinesData | undefined>,\n\t\tprivate readonly _shouldKeepCursorStable: boolean,\n\t\tprivate readonly _isClickable: boolean,\n\t) {\n\t\tsuper();\n\t\tthis._viewZoneHeight = observableValue<undefined | number>('viewZoneHeight', undefined);\n\t\tthis.editorOptionsChanged = observableSignalFromEvent('editorOptionChanged', Event.filter(\n\t\t\tthis._editor.onDidChangeConfiguration,\n\t\t\te => e.hasChanged(EditorOption.disableMonospaceOptimizations)\n\t\t\t\t|| e.hasChanged(EditorOption.stopRenderingLineAfter)\n\t\t\t\t|| e.hasChanged(EditorOption.renderWhitespace)\n\t\t\t\t|| e.hasChanged(EditorOption.renderControlCharacters)\n\t\t\t\t|| e.hasChanged(EditorOption.fontLigatures)\n\t\t\t\t|| e.hasChanged(EditorOption.fontInfo)\n\t\t\t\t|| e.hasChanged(EditorOption.lineHeight)\n\t\t));\n\t\tthis._onDidClick = this._register(new Emitter<IMouseEvent>());\n\t\tthis.onDidClick = this._onDidClick.event;\n\t\tthis._viewZoneListener = this._register(new MutableDisposable());\n\t\tthis.isHovered = observableCodeEditor(this._editor).isTargetHovered(\n\t\t\tp => isTargetGhostText(p.target.element),\n\t\t\tthis._store\n\t\t);\n\t\tthis.hasBeenAccepted = false;\n\n\t\tif (this._editor instanceof CodeEditorWidget && this._shouldKeepCursorStable) {\n\t\t\tthis._register(this._editor.onBeforeExecuteEdit(e => this.hasBeenAccepted = e.source === 'inlineSuggestion.accept'));\n\t\t}\n\n\t\tthis._register(autorun(reader => {\n\t\t\t/** @description update view zone */\n\t\t\tconst lines = this._lines.read(reader);\n\t\t\tthis.editorOptionsChanged.read(reader);\n\n\t\t\tif (lines) {\n\t\t\t\tthis.hasBeenAccepted = false;\n\t\t\t\tthis.updateLines(lines.lineNumber, lines.additionalLines, lines.minReservedLineCount);\n\t\t\t} else {\n\t\t\t\tthis.clear();\n\t\t\t}\n\t\t}));\n\t}\n\n\tpublic override dispose(): void {\n\t\tsuper.dispose();\n\t\tthis.clear();\n\t}\n\n\tprivate clear(): void {\n\t\tthis._viewZoneListener.clear();\n\n\t\tthis._editor.changeViewZones((changeAccessor) => {\n\t\t\tthis.removeActiveViewZone(changeAccessor);\n\t\t});\n\t}\n\n\tprivate updateLines(lineNumber: number, additionalLines: readonly LineData[], minReservedLineCount: number): void {\n\t\tconst textModel = this._editor.getModel();\n\t\tif (!textModel) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { tabSize } = textModel.getOptions();\n\n\t\tobservableCodeEditor(this._editor).transaction(_ => {\n\t\t\tthis._editor.changeViewZones((changeAccessor) => {\n\t\t\t\tconst store = new DisposableStore();\n\n\t\t\t\tthis.removeActiveViewZone(changeAccessor);\n\n\t\t\t\tconst heightInLines = Math.max(additionalLines.length, minReservedLineCount);\n\t\t\t\tif (heightInLines > 0) {\n\t\t\t\t\tconst domNode = document.createElement('div');\n\t\t\t\t\trenderLines(domNode, tabSize, additionalLines, this._editor.getOptions(), this._isClickable);\n\n\t\t\t\t\tif (this._isClickable) {\n\t\t\t\t\t\tstore.add(addDisposableListener(domNode, 'mousedown', (e) => {\n\t\t\t\t\t\t\te.preventDefault(); // This prevents that the editor loses focus\n\t\t\t\t\t\t}));\n\t\t\t\t\t\tstore.add(addDisposableListener(domNode, 'click', (e) => {\n\t\t\t\t\t\t\tif (isTargetGhostText(e.target)) {\n\t\t\t\t\t\t\t\tthis._onDidClick.fire(new StandardMouseEvent(getWindow(e), e));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}));\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.addViewZone(changeAccessor, lineNumber, heightInLines, domNode);\n\t\t\t\t}\n\n\t\t\t\tthis._viewZoneListener.value = store;\n\t\t\t});\n\t\t});\n\t}\n\n\tprivate addViewZone(changeAccessor: IViewZoneChangeAccessor, afterLineNumber: number, heightInLines: number, domNode: HTMLElement): void {\n\t\tconst id = changeAccessor.addZone({\n\t\t\tafterLineNumber: afterLineNumber,\n\t\t\theightInLines: heightInLines,\n\t\t\tdomNode,\n\t\t\tafterColumnAffinity: PositionAffinity.Right,\n\t\t\tonComputedHeight: (height: number) => {\n\t\t\t\tthis._viewZoneHeight.set(height, undefined); // TODO: can a transaction be used to avoid flickering?\n\t\t\t}\n\t\t});\n\n\t\tthis.keepCursorStable(afterLineNumber, heightInLines);\n\n\t\tthis._viewZoneInfo = { viewZoneId: id, heightInLines, lineNumber: afterLineNumber };\n\t}\n\n\tprivate removeActiveViewZone(changeAccessor: IViewZoneChangeAccessor): void {\n\t\tif (this._viewZoneInfo) {\n\t\t\tchangeAccessor.removeZone(this._viewZoneInfo.viewZoneId);\n\n\t\t\tif (!this.hasBeenAccepted) {\n\t\t\t\tthis.keepCursorStable(this._viewZoneInfo.lineNumber, -this._viewZoneInfo.heightInLines);\n\t\t\t}\n\n\t\t\tthis._viewZoneInfo = undefined;\n\t\t\tthis._viewZoneHeight.set(undefined, undefined);\n\t\t}\n\t}\n\n\tprivate keepCursorStable(lineNumber: number, heightInLines: number): void {\n\t\tif (!this._shouldKeepCursorStable) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst cursorLineNumber = this._editor.getSelection()?.getStartPosition()?.lineNumber;\n\t\tif (cursorLineNumber !== undefined && lineNumber < cursorLineNumber) {\n\t\t\tthis._editor.setScrollTop(this._editor.getScrollTop() + heightInLines * this._editor.getOption(EditorOption.lineHeight));\n\t\t}\n\t}\n}\n\nfunction isTargetGhostText(target: EventTarget | null): boolean {\n\treturn isHTMLElement(target) && target.classList.contains(GHOST_TEXT_CLASS_NAME);\n}\n\nexport class LineData implements IEquatable<LineData> {\n\tconstructor(\n\t\tpublic readonly content: LineTokens, // Must not contain a linebreak!\n\t\tpublic readonly decorations: readonly LineDecoration[]\n\t) { }\n\n\tequals(other: LineData): boolean {\n\t\tif (!this.content.equals(other.content)) {\n\t\t\treturn false;\n\t\t}\n\t\treturn LineDecoration.equalsArr(this.decorations, other.decorations);\n\t}\n}\n\nfunction renderLines(domNode: HTMLElement, tabSize: number, lines: readonly LineData[], opts: IComputedEditorOptions, isClickable: boolean): void {\n\tconst disableMonospaceOptimizations = opts.get(EditorOption.disableMonospaceOptimizations);\n\tconst stopRenderingLineAfter = opts.get(EditorOption.stopRenderingLineAfter);\n\t// To avoid visual confusion, we don't want to render visible whitespace\n\tconst renderWhitespace = 'none';\n\tconst renderControlCharacters = opts.get(EditorOption.renderControlCharacters);\n\tconst fontLigatures = opts.get(EditorOption.fontLigatures);\n\tconst fontInfo = opts.get(EditorOption.fontInfo);\n\tconst lineHeight = opts.get(EditorOption.lineHeight);\n\n\tlet classNames = 'suggest-preview-text';\n\tif (isClickable) {\n\t\tclassNames += ' clickable';\n\t}\n\n\tconst sb = new StringBuilder(10000);\n\tsb.appendString(`<div class=\"${classNames}\">`);\n\n\tfor (let i = 0, len = lines.length; i < len; i++) {\n\t\tconst lineData = lines[i];\n\t\tconst lineTokens = lineData.content;\n\t\tsb.appendString('<div class=\"view-line');\n\t\tsb.appendString('\" style=\"top:');\n\t\tsb.appendString(String(i * lineHeight));\n\t\tsb.appendString('px;width:1000000px;\">');\n\n\t\tconst line = lineTokens.getLineContent();\n\t\tconst isBasicASCII = strings.isBasicASCII(line);\n\t\tconst containsRTL = strings.containsRTL(line);\n\n\t\trenderViewLine(new RenderLineInput(\n\t\t\t(fontInfo.isMonospace && !disableMonospaceOptimizations),\n\t\t\tfontInfo.canUseHalfwidthRightwardsArrow,\n\t\t\tline,\n\t\t\tfalse,\n\t\t\tisBasicASCII,\n\t\t\tcontainsRTL,\n\t\t\t0,\n\t\t\tlineTokens,\n\t\t\tlineData.decorations.slice(),\n\t\t\ttabSize,\n\t\t\t0,\n\t\t\tfontInfo.spaceWidth,\n\t\t\tfontInfo.middotWidth,\n\t\t\tfontInfo.wsmiddotWidth,\n\t\t\tstopRenderingLineAfter,\n\t\t\trenderWhitespace,\n\t\t\trenderControlCharacters,\n\t\t\tfontLigatures !== EditorFontLigatures.OFF,\n\t\t\tnull,\n\t\t\tnull,\n\t\t\t0\n\t\t), sb);\n\n\t\tsb.appendString('</div>');\n\t}\n\tsb.appendString('</div>');\n\n\tapplyFontInfo(domNode, fontInfo);\n\tconst html = sb.build();\n\tconst trustedhtml = ttPolicy ? ttPolicy.createHTML(html) : html;\n\tdomNode.innerHTML = trustedhtml as string;\n}\n\nexport const ttPolicy = createTrustedTypesPolicy('editorGhostText', { createHTML: value => value });\n"]}
|
|
@@ -148,6 +148,7 @@ let InlineSuggestionsView = class InlineSuggestionsView extends Disposable {
|
|
|
148
148
|
};
|
|
149
149
|
}), {
|
|
150
150
|
useSyntaxHighlighting: this._editorObs.getOption(71 /* EditorOption.inlineSuggest */).map(v => v.syntaxHighlightingEnabled),
|
|
151
|
+
highlightShortSuggestions: true,
|
|
151
152
|
});
|
|
152
153
|
}
|
|
153
154
|
shouldShowHoverAtViewZone(viewZoneId) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/inlineCompletions/browser/view/inlineSuggestionsView.ts","vs/editor/contrib/inlineCompletions/browser/view/inlineSuggestionsView.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;AAEhG,OAAO,EAAE,8BAA8B,EAAE,MAAM,+CAA+C,CAAC;AAC/F,OAAO,EAAE,cAAc,EAAE,MAAM,gDAAgD,CAAC;AAChF,OAAO,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,0BAA0B,EAAoC,eAAe,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAChN,OAAO,EAAE,qBAAqB,EAAE,MAAM,+DAA+D,CAAC;AAEtG,OAAO,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;AAEnF,OAAO,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAC;AACxE,OAAO,EAAE,4BAA4B,EAAE,MAAM,gDAAgD,CAAC;AAI9F,OAAO,EAAE,+BAA+B,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAwB,MAAM,8BAA8B,CAAC;AAC3G,OAAO,EAAE,0BAA0B,EAAE,8BAA8B,EAAE,8BAA8B,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,CAAC;AACvL,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AACvF,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAC1G,OAAO,EAAE,8BAA8B,EAAE,MAAM,0CAA0C,CAAC;AAEnF,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,UAAU;aACtC,QAAG,GAA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C;IACd,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,OAAO,GAAG,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC;QAClC,KAAK,EAAE,CAAC;QACR,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC;IACpB,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC","file":"inlineSuggestionsView.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { createStyleSheetFromObservable } from '../../../../../base/browser/domStylesheets.js';\nimport { createHotClass } from '../../../../../base/common/hotReloadHelpers.js';\nimport { Disposable } from '../../../../../base/common/lifecycle.js';\nimport { derived, mapObservableArrayCached, derivedDisposable, derivedObservableWithCache, IObservable, ISettableObservable, constObservable, observableValue } from '../../../../../base/common/observable.js';\nimport { IInstantiationService } from '../../../../../platform/instantiation/common/instantiation.js';\nimport { ICodeEditor } from '../../../../browser/editorBrowser.js';\nimport { observableCodeEditor } from '../../../../browser/observableCodeEditor.js';\nimport { EditorOption } from '../../../../common/config/editorOptions.js';\nimport { LineRange } from '../../../../common/core/ranges/lineRange.js';\nimport { InlineCompletionsHintsWidget } from '../hintsWidget/inlineCompletionsHintsWidget.js';\nimport { GhostTextOrReplacement } from '../model/ghostText.js';\nimport { InlineCompletionsModel } from '../model/inlineCompletionsModel.js';\nimport { InlineCompletionItem } from '../model/inlineSuggestionItem.js';\nimport { convertItemsToStableObservables } from '../utils.js';\nimport { GhostTextView, GhostTextWidgetWarning, IGhostTextWidgetData } from './ghostText/ghostTextView.js';\nimport { InlineEditsGutterIndicator, InlineEditsGutterIndicatorData, InlineSuggestionGutterMenuData, SimpleInlineSuggestModel } from './inlineEdits/components/gutterIndicatorView.js';\nimport { InlineEditsOnboardingExperience } from './inlineEdits/inlineEditsNewUsers.js';\nimport { InlineCompletionViewKind, InlineEditTabAction } from './inlineEdits/inlineEditsViewInterface.js';\nimport { InlineEditsViewAndDiffProducer } from './inlineEdits/inlineEditsViewProducer.js';\n\nexport class InlineSuggestionsView extends Disposable {\n\tpublic static hot = createHotClass(this);\n\n\tprivate readonly _ghostTexts = derived(this, (reader) => {\n\t\tconst model = this._model.read(reader);\n\t\treturn model?.ghostTexts.read(reader) ?? [];\n\t});\n\n\tprivate readonly _stablizedGhostTexts;\n\tprivate readonly _editorObs;\n\tprivate readonly _ghostTextWidgets;\n\n\tprivate readonly _inlineEdit = derived(this, reader => this._model.read(reader)?.inlineEditState.read(reader)?.inlineSuggestion);\n\tprivate readonly _everHadInlineEdit = derivedObservableWithCache<boolean>(this,\n\t\t(reader, last) => last || !!this._inlineEdit.read(reader)\n\t\t\t|| !!this._model.read(reader)?.inlineCompletionState.read(reader)?.inlineSuggestion?.showInlineEditMenu\n\t);\n\n\t// To break a cyclic dependency\n\tprivate readonly _indicatorIsHoverVisible = observableValue<IObservable<boolean> | undefined>(this, undefined);\n\n\tprivate readonly _showInlineEditCollapsed = derived(this, reader => {\n\t\tconst s = this._model.read(reader)?.showCollapsed.read(reader) ?? false;\n\t\treturn s && !this._indicatorIsHoverVisible.read(reader)?.read(reader);\n\t});\n\n\tprivate readonly _inlineEditWidget = derivedDisposable(reader => {\n\t\tif (!this._everHadInlineEdit.read(reader)) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn this._instantiationService.createInstance(InlineEditsViewAndDiffProducer, this._editor, this._model, this._showInlineEditCollapsed);\n\t});\n\n\tprivate readonly _fontFamily;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tprivate readonly _model: IObservable<InlineCompletionsModel | undefined>,\n\t\tprivate readonly _focusIsInMenu: ISettableObservable<boolean>,\n\t\t@IInstantiationService private readonly _instantiationService: IInstantiationService\n\t) {\n\t\tsuper();\n\n\t\tthis._stablizedGhostTexts = convertItemsToStableObservables(this._ghostTexts, this._store);\n\t\tthis._editorObs = observableCodeEditor(this._editor);\n\n\t\tthis._ghostTextWidgets = mapObservableArrayCached(\n\t\t\tthis,\n\t\t\tthis._stablizedGhostTexts,\n\t\t\t(ghostText, store) => store.add(this._createGhostText(ghostText))\n\t\t).recomputeInitiallyAndOnChange(this._store);\n\n\t\tthis._inlineEditWidget.recomputeInitiallyAndOnChange(this._store);\n\n\t\tthis._fontFamily = this._editorObs.getOption(EditorOption.inlineSuggest).map(val => val.fontFamily);\n\n\t\tthis._register(createStyleSheetFromObservable(derived(reader => {\n\t\t\tconst fontFamily = this._fontFamily.read(reader);\n\t\t\treturn `\n.monaco-editor .ghost-text-decoration,\n.monaco-editor .ghost-text-decoration-preview,\n.monaco-editor .ghost-text {\n\tfont-family: ${fontFamily};\n}`;\n\t\t})));\n\n\t\tthis._register(new InlineCompletionsHintsWidget(this._editor, this._model, this._instantiationService));\n\n\t\tthis._indicator = this._register(this._instantiationService.createInstance(\n\t\t\tInlineEditsGutterIndicator,\n\t\t\tthis._editorObs,\n\t\t\tderived(reader => {\n\t\t\t\tconst s = this._gutterIndicatorState.read(reader);\n\t\t\t\tif (!s) { return undefined; }\n\t\t\t\treturn new InlineEditsGutterIndicatorData(\n\t\t\t\t\tInlineSuggestionGutterMenuData.fromInlineSuggestion(s.inlineSuggestion),\n\t\t\t\t\ts.displayRange,\n\t\t\t\t\tSimpleInlineSuggestModel.fromInlineCompletionModel(s.model),\n\t\t\t\t\ts.inlineSuggestion.action?.kind === 'edit' ? s.inlineSuggestion.action.alternativeAction : undefined,\n\t\t\t\t);\n\t\t\t}),\n\t\t\tthis._gutterIndicatorState.map((s, reader) => s?.tabAction.read(reader) ?? InlineEditTabAction.Inactive),\n\t\t\tthis._gutterIndicatorState.map((s, reader) => s?.gutterIndicatorOffset.read(reader) ?? 0),\n\t\t\tthis._inlineEditWidget.map((w, reader) => w?.view.inlineEditsIsHovered.read(reader) ?? false),\n\t\t\tthis._focusIsInMenu,\n\t\t));\n\t\tthis._indicatorIsHoverVisible.set(this._indicator.isHoverVisible, undefined);\n\n\t\tderived(reader => {\n\t\t\tconst w = this._inlineEditWidget.read(reader);\n\t\t\tif (!w) { return undefined; }\n\t\t\treturn reader.store.add(this._instantiationService.createInstance(\n\t\t\t\tInlineEditsOnboardingExperience,\n\t\t\t\tw._inlineEditModel,\n\t\t\t\tconstObservable(this._indicator),\n\t\t\t\tw.view._inlineCollapsedView,\n\t\t\t));\n\t\t}).recomputeInitiallyAndOnChange(this._store);\n\t}\n\n\tprivate _createGhostText(ghostText: IObservable<GhostTextOrReplacement>): GhostTextView {\n\t\treturn this._instantiationService.createInstance(\n\t\t\tGhostTextView,\n\t\t\tthis._editor,\n\t\t\tderived(reader => {\n\t\t\t\tconst model = this._model.read(reader);\n\t\t\t\tconst inlineCompletion = model?.inlineCompletionState.read(reader)?.inlineSuggestion;\n\t\t\t\tif (!model || !inlineCompletion) {\n\t\t\t\t\t// editor.suggest.preview: true causes situations where we have ghost text, but no suggest preview.\n\t\t\t\t\treturn {\n\t\t\t\t\t\tghostText: ghostText.read(reader),\n\t\t\t\t\t\thandleInlineCompletionShown: () => { /* no-op */ },\n\t\t\t\t\t\twarning: undefined,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tghostText: ghostText.read(reader),\n\t\t\t\t\thandleInlineCompletionShown: (viewData) => model.handleInlineSuggestionShown(inlineCompletion, InlineCompletionViewKind.GhostText, viewData, Date.now()),\n\t\t\t\t\twarning: GhostTextWidgetWarning.from(model?.warning.read(reader)),\n\t\t\t\t} satisfies IGhostTextWidgetData;\n\t\t\t}),\n\t\t\t{\n\t\t\t\tuseSyntaxHighlighting: this._editorObs.getOption(EditorOption.inlineSuggest).map(v => v.syntaxHighlightingEnabled),\n\t\t\t},\n\t\t);\n\t}\n\n\tpublic shouldShowHoverAtViewZone(viewZoneId: string): boolean {\n\t\treturn this._ghostTextWidgets.get()[0]?.ownsViewZone(viewZoneId) ?? false;\n\t}\n\n\tprivate readonly _gutterIndicatorState = derived(reader => {\n\t\tconst model = this._model.read(reader);\n\t\tif (!model) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst state = model.state.read(reader);\n\n\t\tif (state?.kind === 'ghostText' && state.inlineSuggestion?.showInlineEditMenu) {\n\t\t\treturn {\n\t\t\t\tdisplayRange: LineRange.ofLength(state.primaryGhostText.lineNumber, 1),\n\t\t\t\ttabAction: derived<InlineEditTabAction>(this,\n\t\t\t\t\treader => this._editorObs.isFocused.read(reader) ? InlineEditTabAction.Accept : InlineEditTabAction.Inactive\n\t\t\t\t),\n\t\t\t\tgutterIndicatorOffset: constObservable(getGhostTextTopOffset(state.inlineSuggestion, this._editor)),\n\t\t\t\tinlineSuggestion: state.inlineSuggestion,\n\t\t\t\tmodel,\n\t\t\t};\n\t\t} else if (state?.kind === 'inlineEdit') {\n\t\t\tconst inlineEditWidget = this._inlineEditWidget.read(reader)?.view;\n\t\t\tif (!inlineEditWidget) { return undefined; }\n\n\t\t\tconst displayRange = inlineEditWidget.displayRange.read(reader);\n\t\t\tif (!displayRange) { return undefined; }\n\t\t\treturn {\n\t\t\t\tdisplayRange,\n\t\t\t\ttabAction: derived(reader => {\n\t\t\t\t\tif (this._editorObs.isFocused.read(reader)) {\n\t\t\t\t\t\tif (model.tabShouldJumpToInlineEdit.read(reader)) { return InlineEditTabAction.Jump; }\n\t\t\t\t\t\tif (model.tabShouldAcceptInlineEdit.read(reader)) { return InlineEditTabAction.Accept; }\n\t\t\t\t\t}\n\t\t\t\t\treturn InlineEditTabAction.Inactive;\n\t\t\t\t}),\n\t\t\t\tgutterIndicatorOffset: inlineEditWidget.gutterIndicatorOffset,\n\t\t\t\tinlineSuggestion: state.inlineSuggestion,\n\t\t\t\tmodel,\n\t\t\t};\n\t\t} else {\n\t\t\treturn undefined;\n\t\t}\n\t});\n\n\tprotected readonly _indicator;\n}\n\nfunction getGhostTextTopOffset(inlineCompletion: InlineCompletionItem, editor: ICodeEditor): number {\n\tconst replacement = inlineCompletion.getSingleTextEdit();\n\tconst textModel = editor.getModel();\n\tif (!textModel) {\n\t\treturn 0;\n\t}\n\n\tconst EOL = textModel.getEOL();\n\tif (replacement.range.isEmpty() && replacement.text.startsWith(EOL)) {\n\t\tconst lineHeight = editor.getLineHeightForPosition(replacement.range.getStartPosition());\n\t\treturn countPrefixRepeats(replacement.text, EOL) * lineHeight;\n\t}\n\n\treturn 0;\n}\n\nfunction countPrefixRepeats(str: string, prefix: string): number {\n\tif (!prefix.length) {\n\t\treturn 0;\n\t}\n\tlet count = 0;\n\tlet i = 0;\n\twhile (str.startsWith(prefix, i)) {\n\t\tcount++;\n\t\ti += prefix.length;\n\t}\n\treturn count;\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { createStyleSheetFromObservable } from '../../../../../base/browser/domStylesheets.js';\nimport { createHotClass } from '../../../../../base/common/hotReloadHelpers.js';\nimport { Disposable } from '../../../../../base/common/lifecycle.js';\nimport { derived, mapObservableArrayCached, derivedDisposable, derivedObservableWithCache, IObservable, ISettableObservable, constObservable, observableValue } from '../../../../../base/common/observable.js';\nimport { IInstantiationService } from '../../../../../platform/instantiation/common/instantiation.js';\nimport { ICodeEditor } from '../../../../browser/editorBrowser.js';\nimport { observableCodeEditor } from '../../../../browser/observableCodeEditor.js';\nimport { EditorOption } from '../../../../common/config/editorOptions.js';\nimport { LineRange } from '../../../../common/core/ranges/lineRange.js';\nimport { InlineCompletionsHintsWidget } from '../hintsWidget/inlineCompletionsHintsWidget.js';\nimport { GhostTextOrReplacement } from '../model/ghostText.js';\nimport { InlineCompletionsModel } from '../model/inlineCompletionsModel.js';\nimport { InlineCompletionItem } from '../model/inlineSuggestionItem.js';\nimport { convertItemsToStableObservables } from '../utils.js';\nimport { GhostTextView, GhostTextWidgetWarning, IGhostTextWidgetData } from './ghostText/ghostTextView.js';\nimport { InlineEditsGutterIndicator, InlineEditsGutterIndicatorData, InlineSuggestionGutterMenuData, SimpleInlineSuggestModel } from './inlineEdits/components/gutterIndicatorView.js';\nimport { InlineEditsOnboardingExperience } from './inlineEdits/inlineEditsNewUsers.js';\nimport { InlineCompletionViewKind, InlineEditTabAction } from './inlineEdits/inlineEditsViewInterface.js';\nimport { InlineEditsViewAndDiffProducer } from './inlineEdits/inlineEditsViewProducer.js';\n\nexport class InlineSuggestionsView extends Disposable {\n\tpublic static hot = createHotClass(this);\n\n\tprivate readonly _ghostTexts = derived(this, (reader) => {\n\t\tconst model = this._model.read(reader);\n\t\treturn model?.ghostTexts.read(reader) ?? [];\n\t});\n\n\tprivate readonly _stablizedGhostTexts;\n\tprivate readonly _editorObs;\n\tprivate readonly _ghostTextWidgets;\n\n\tprivate readonly _inlineEdit = derived(this, reader => this._model.read(reader)?.inlineEditState.read(reader)?.inlineSuggestion);\n\tprivate readonly _everHadInlineEdit = derivedObservableWithCache<boolean>(this,\n\t\t(reader, last) => last || !!this._inlineEdit.read(reader)\n\t\t\t|| !!this._model.read(reader)?.inlineCompletionState.read(reader)?.inlineSuggestion?.showInlineEditMenu\n\t);\n\n\t// To break a cyclic dependency\n\tprivate readonly _indicatorIsHoverVisible = observableValue<IObservable<boolean> | undefined>(this, undefined);\n\n\tprivate readonly _showInlineEditCollapsed = derived(this, reader => {\n\t\tconst s = this._model.read(reader)?.showCollapsed.read(reader) ?? false;\n\t\treturn s && !this._indicatorIsHoverVisible.read(reader)?.read(reader);\n\t});\n\n\tprivate readonly _inlineEditWidget = derivedDisposable(reader => {\n\t\tif (!this._everHadInlineEdit.read(reader)) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn this._instantiationService.createInstance(InlineEditsViewAndDiffProducer, this._editor, this._model, this._showInlineEditCollapsed);\n\t});\n\n\tprivate readonly _fontFamily;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tprivate readonly _model: IObservable<InlineCompletionsModel | undefined>,\n\t\tprivate readonly _focusIsInMenu: ISettableObservable<boolean>,\n\t\t@IInstantiationService private readonly _instantiationService: IInstantiationService\n\t) {\n\t\tsuper();\n\n\t\tthis._stablizedGhostTexts = convertItemsToStableObservables(this._ghostTexts, this._store);\n\t\tthis._editorObs = observableCodeEditor(this._editor);\n\n\t\tthis._ghostTextWidgets = mapObservableArrayCached(\n\t\t\tthis,\n\t\t\tthis._stablizedGhostTexts,\n\t\t\t(ghostText, store) => store.add(this._createGhostText(ghostText))\n\t\t).recomputeInitiallyAndOnChange(this._store);\n\n\t\tthis._inlineEditWidget.recomputeInitiallyAndOnChange(this._store);\n\n\t\tthis._fontFamily = this._editorObs.getOption(EditorOption.inlineSuggest).map(val => val.fontFamily);\n\n\t\tthis._register(createStyleSheetFromObservable(derived(reader => {\n\t\t\tconst fontFamily = this._fontFamily.read(reader);\n\t\t\treturn `\n.monaco-editor .ghost-text-decoration,\n.monaco-editor .ghost-text-decoration-preview,\n.monaco-editor .ghost-text {\n\tfont-family: ${fontFamily};\n}`;\n\t\t})));\n\n\t\tthis._register(new InlineCompletionsHintsWidget(this._editor, this._model, this._instantiationService));\n\n\t\tthis._indicator = this._register(this._instantiationService.createInstance(\n\t\t\tInlineEditsGutterIndicator,\n\t\t\tthis._editorObs,\n\t\t\tderived(reader => {\n\t\t\t\tconst s = this._gutterIndicatorState.read(reader);\n\t\t\t\tif (!s) { return undefined; }\n\t\t\t\treturn new InlineEditsGutterIndicatorData(\n\t\t\t\t\tInlineSuggestionGutterMenuData.fromInlineSuggestion(s.inlineSuggestion),\n\t\t\t\t\ts.displayRange,\n\t\t\t\t\tSimpleInlineSuggestModel.fromInlineCompletionModel(s.model),\n\t\t\t\t\ts.inlineSuggestion.action?.kind === 'edit' ? s.inlineSuggestion.action.alternativeAction : undefined,\n\t\t\t\t);\n\t\t\t}),\n\t\t\tthis._gutterIndicatorState.map((s, reader) => s?.tabAction.read(reader) ?? InlineEditTabAction.Inactive),\n\t\t\tthis._gutterIndicatorState.map((s, reader) => s?.gutterIndicatorOffset.read(reader) ?? 0),\n\t\t\tthis._inlineEditWidget.map((w, reader) => w?.view.inlineEditsIsHovered.read(reader) ?? false),\n\t\t\tthis._focusIsInMenu,\n\t\t));\n\t\tthis._indicatorIsHoverVisible.set(this._indicator.isHoverVisible, undefined);\n\n\t\tderived(reader => {\n\t\t\tconst w = this._inlineEditWidget.read(reader);\n\t\t\tif (!w) { return undefined; }\n\t\t\treturn reader.store.add(this._instantiationService.createInstance(\n\t\t\t\tInlineEditsOnboardingExperience,\n\t\t\t\tw._inlineEditModel,\n\t\t\t\tconstObservable(this._indicator),\n\t\t\t\tw.view._inlineCollapsedView,\n\t\t\t));\n\t\t}).recomputeInitiallyAndOnChange(this._store);\n\t}\n\n\tprivate _createGhostText(ghostText: IObservable<GhostTextOrReplacement>): GhostTextView {\n\t\treturn this._instantiationService.createInstance(\n\t\t\tGhostTextView,\n\t\t\tthis._editor,\n\t\t\tderived(reader => {\n\t\t\t\tconst model = this._model.read(reader);\n\t\t\t\tconst inlineCompletion = model?.inlineCompletionState.read(reader)?.inlineSuggestion;\n\t\t\t\tif (!model || !inlineCompletion) {\n\t\t\t\t\t// editor.suggest.preview: true causes situations where we have ghost text, but no suggest preview.\n\t\t\t\t\treturn {\n\t\t\t\t\t\tghostText: ghostText.read(reader),\n\t\t\t\t\t\thandleInlineCompletionShown: () => { /* no-op */ },\n\t\t\t\t\t\twarning: undefined,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tghostText: ghostText.read(reader),\n\t\t\t\t\thandleInlineCompletionShown: (viewData) => model.handleInlineSuggestionShown(inlineCompletion, InlineCompletionViewKind.GhostText, viewData, Date.now()),\n\t\t\t\t\twarning: GhostTextWidgetWarning.from(model?.warning.read(reader)),\n\t\t\t\t} satisfies IGhostTextWidgetData;\n\t\t\t}),\n\t\t\t{\n\t\t\t\tuseSyntaxHighlighting: this._editorObs.getOption(EditorOption.inlineSuggest).map(v => v.syntaxHighlightingEnabled),\n\t\t\t},\n\t\t);\n\t}\n\n\tpublic shouldShowHoverAtViewZone(viewZoneId: string): boolean {\n\t\treturn this._ghostTextWidgets.get()[0]?.ownsViewZone(viewZoneId) ?? false;\n\t}\n\n\tprivate readonly _gutterIndicatorState = derived(reader => {\n\t\tconst model = this._model.read(reader);\n\t\tif (!model) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst state = model.state.read(reader);\n\n\t\tif (state?.kind === 'ghostText' && state.inlineSuggestion?.showInlineEditMenu) {\n\t\t\treturn {\n\t\t\t\tdisplayRange: LineRange.ofLength(state.primaryGhostText.lineNumber, 1),\n\t\t\t\ttabAction: derived<InlineEditTabAction>(this,\n\t\t\t\t\treader => this._editorObs.isFocused.read(reader) ? InlineEditTabAction.Accept : InlineEditTabAction.Inactive\n\t\t\t\t),\n\t\t\t\tgutterIndicatorOffset: constObservable(getGhostTextTopOffset(state.inlineSuggestion, this._editor)),\n\t\t\t\tinlineSuggestion: state.inlineSuggestion,\n\t\t\t\tmodel,\n\t\t\t};\n\t\t} else if (state?.kind === 'inlineEdit') {\n\t\t\tconst inlineEditWidget = this._inlineEditWidget.read(reader)?.view;\n\t\t\tif (!inlineEditWidget) { return undefined; }\n\n\t\t\tconst displayRange = inlineEditWidget.displayRange.read(reader);\n\t\t\tif (!displayRange) { return undefined; }\n\t\t\treturn {\n\t\t\t\tdisplayRange,\n\t\t\t\ttabAction: derived(reader => {\n\t\t\t\t\tif (this._editorObs.isFocused.read(reader)) {\n\t\t\t\t\t\tif (model.tabShouldJumpToInlineEdit.read(reader)) { return InlineEditTabAction.Jump; }\n\t\t\t\t\t\tif (model.tabShouldAcceptInlineEdit.read(reader)) { return InlineEditTabAction.Accept; }\n\t\t\t\t\t}\n\t\t\t\t\treturn InlineEditTabAction.Inactive;\n\t\t\t\t}),\n\t\t\t\tgutterIndicatorOffset: inlineEditWidget.gutterIndicatorOffset,\n\t\t\t\tinlineSuggestion: state.inlineSuggestion,\n\t\t\t\tmodel,\n\t\t\t};\n\t\t} else {\n\t\t\treturn undefined;\n\t\t}\n\t});\n\n\tprotected readonly _indicator;\n}\n\nfunction getGhostTextTopOffset(inlineCompletion: InlineCompletionItem, editor: ICodeEditor): number {\n\tconst replacement = inlineCompletion.getSingleTextEdit();\n\tconst textModel = editor.getModel();\n\tif (!textModel) {\n\t\treturn 0;\n\t}\n\n\tconst EOL = textModel.getEOL();\n\tif (replacement.range.isEmpty() && replacement.text.startsWith(EOL)) {\n\t\tconst lineHeight = editor.getLineHeightForPosition(replacement.range.getStartPosition());\n\t\treturn countPrefixRepeats(replacement.text, EOL) * lineHeight;\n\t}\n\n\treturn 0;\n}\n\nfunction countPrefixRepeats(str: string, prefix: string): number {\n\tif (!prefix.length) {\n\t\treturn 0;\n\t}\n\tlet count = 0;\n\tlet i = 0;\n\twhile (str.startsWith(prefix, i)) {\n\t\tcount++;\n\t\ti += prefix.length;\n\t}\n\treturn count;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/inlineCompletions/browser/view/inlineSuggestionsView.ts","vs/editor/contrib/inlineCompletions/browser/view/inlineSuggestionsView.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;AAEhG,OAAO,EAAE,8BAA8B,EAAE,MAAM,+CAA+C,CAAC;AAC/F,OAAO,EAAE,cAAc,EAAE,MAAM,gDAAgD,CAAC;AAChF,OAAO,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,0BAA0B,EAAoC,eAAe,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAChN,OAAO,EAAE,qBAAqB,EAAE,MAAM,+DAA+D,CAAC;AAEtG,OAAO,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;AAEnF,OAAO,EAAE,SAAS,EAAE,MAAM,6C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IAED,MAAM,GAAG,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC;IAC/B,IAAI,WAAW,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACrE,MAAM,UAAU,GAAG,MAAM,CAAC,wBAAwB,CAAC,WAAW,CAAC,KAAK,CAAC,gBAAgB,EAAE,CAAC,CAAC;QACzF,OAAO,kBAAkB,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,UAAU,CAAC;IAC/D,CAAC;IAED,OAAO,CAAC,CAAC;AACV,CAAC;AAED,SAAS,kBAAkB,CAAC,GAAW,EAAE,MAAc;IACtD,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QACpB,OAAO,CAAC,CAAC;IACV,CAAC;IACD,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,OAAO,GAAG,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC;QAClC,KAAK,EAAE,CAAC;QACR,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC;IACpB,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC","file":"inlineSuggestionsView.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { createStyleSheetFromObservable } from '../../../../../base/browser/domStylesheets.js';\nimport { createHotClass } from '../../../../../base/common/hotReloadHelpers.js';\nimport { Disposable } from '../../../../../base/common/lifecycle.js';\nimport { derived, mapObservableArrayCached, derivedDisposable, derivedObservableWithCache, IObservable, ISettableObservable, constObservable, observableValue } from '../../../../../base/common/observable.js';\nimport { IInstantiationService } from '../../../../../platform/instantiation/common/instantiation.js';\nimport { ICodeEditor } from '../../../../browser/editorBrowser.js';\nimport { observableCodeEditor } from '../../../../browser/observableCodeEditor.js';\nimport { EditorOption } from '../../../../common/config/editorOptions.js';\nimport { LineRange } from '../../../../common/core/ranges/lineRange.js';\nimport { InlineCompletionsHintsWidget } from '../hintsWidget/inlineCompletionsHintsWidget.js';\nimport { GhostTextOrReplacement } from '../model/ghostText.js';\nimport { InlineCompletionsModel } from '../model/inlineCompletionsModel.js';\nimport { InlineCompletionItem } from '../model/inlineSuggestionItem.js';\nimport { convertItemsToStableObservables } from '../utils.js';\nimport { GhostTextView, GhostTextWidgetWarning, IGhostTextWidgetData } from './ghostText/ghostTextView.js';\nimport { InlineEditsGutterIndicator, InlineEditsGutterIndicatorData, InlineSuggestionGutterMenuData, SimpleInlineSuggestModel } from './inlineEdits/components/gutterIndicatorView.js';\nimport { InlineEditsOnboardingExperience } from './inlineEdits/inlineEditsNewUsers.js';\nimport { InlineCompletionViewKind, InlineEditTabAction } from './inlineEdits/inlineEditsViewInterface.js';\nimport { InlineEditsViewAndDiffProducer } from './inlineEdits/inlineEditsViewProducer.js';\n\nexport class InlineSuggestionsView extends Disposable {\n\tpublic static hot = createHotClass(this);\n\n\tprivate readonly _ghostTexts = derived(this, (reader) => {\n\t\tconst model = this._model.read(reader);\n\t\treturn model?.ghostTexts.read(reader) ?? [];\n\t});\n\n\tprivate readonly _stablizedGhostTexts;\n\tprivate readonly _editorObs;\n\tprivate readonly _ghostTextWidgets;\n\n\tprivate readonly _inlineEdit = derived(this, reader => this._model.read(reader)?.inlineEditState.read(reader)?.inlineSuggestion);\n\tprivate readonly _everHadInlineEdit = derivedObservableWithCache<boolean>(this,\n\t\t(reader, last) => last || !!this._inlineEdit.read(reader)\n\t\t\t|| !!this._model.read(reader)?.inlineCompletionState.read(reader)?.inlineSuggestion?.showInlineEditMenu\n\t);\n\n\t// To break a cyclic dependency\n\tprivate readonly _indicatorIsHoverVisible = observableValue<IObservable<boolean> | undefined>(this, undefined);\n\n\tprivate readonly _showInlineEditCollapsed = derived(this, reader => {\n\t\tconst s = this._model.read(reader)?.showCollapsed.read(reader) ?? false;\n\t\treturn s && !this._indicatorIsHoverVisible.read(reader)?.read(reader);\n\t});\n\n\tprivate readonly _inlineEditWidget = derivedDisposable(reader => {\n\t\tif (!this._everHadInlineEdit.read(reader)) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn this._instantiationService.createInstance(InlineEditsViewAndDiffProducer, this._editor, this._model, this._showInlineEditCollapsed);\n\t});\n\n\tprivate readonly _fontFamily;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tprivate readonly _model: IObservable<InlineCompletionsModel | undefined>,\n\t\tprivate readonly _focusIsInMenu: ISettableObservable<boolean>,\n\t\t@IInstantiationService private readonly _instantiationService: IInstantiationService\n\t) {\n\t\tsuper();\n\n\t\tthis._stablizedGhostTexts = convertItemsToStableObservables(this._ghostTexts, this._store);\n\t\tthis._editorObs = observableCodeEditor(this._editor);\n\n\t\tthis._ghostTextWidgets = mapObservableArrayCached(\n\t\t\tthis,\n\t\t\tthis._stablizedGhostTexts,\n\t\t\t(ghostText, store) => store.add(this._createGhostText(ghostText))\n\t\t).recomputeInitiallyAndOnChange(this._store);\n\n\t\tthis._inlineEditWidget.recomputeInitiallyAndOnChange(this._store);\n\n\t\tthis._fontFamily = this._editorObs.getOption(EditorOption.inlineSuggest).map(val => val.fontFamily);\n\n\t\tthis._register(createStyleSheetFromObservable(derived(reader => {\n\t\t\tconst fontFamily = this._fontFamily.read(reader);\n\t\t\treturn `\n.monaco-editor .ghost-text-decoration,\n.monaco-editor .ghost-text-decoration-preview,\n.monaco-editor .ghost-text {\n\tfont-family: ${fontFamily};\n}`;\n\t\t})));\n\n\t\tthis._register(new InlineCompletionsHintsWidget(this._editor, this._model, this._instantiationService));\n\n\t\tthis._indicator = this._register(this._instantiationService.createInstance(\n\t\t\tInlineEditsGutterIndicator,\n\t\t\tthis._editorObs,\n\t\t\tderived(reader => {\n\t\t\t\tconst s = this._gutterIndicatorState.read(reader);\n\t\t\t\tif (!s) { return undefined; }\n\t\t\t\treturn new InlineEditsGutterIndicatorData(\n\t\t\t\t\tInlineSuggestionGutterMenuData.fromInlineSuggestion(s.inlineSuggestion),\n\t\t\t\t\ts.displayRange,\n\t\t\t\t\tSimpleInlineSuggestModel.fromInlineCompletionModel(s.model),\n\t\t\t\t\ts.inlineSuggestion.action?.kind === 'edit' ? s.inlineSuggestion.action.alternativeAction : undefined,\n\t\t\t\t);\n\t\t\t}),\n\t\t\tthis._gutterIndicatorState.map((s, reader) => s?.tabAction.read(reader) ?? InlineEditTabAction.Inactive),\n\t\t\tthis._gutterIndicatorState.map((s, reader) => s?.gutterIndicatorOffset.read(reader) ?? 0),\n\t\t\tthis._inlineEditWidget.map((w, reader) => w?.view.inlineEditsIsHovered.read(reader) ?? false),\n\t\t\tthis._focusIsInMenu,\n\t\t));\n\t\tthis._indicatorIsHoverVisible.set(this._indicator.isHoverVisible, undefined);\n\n\t\tderived(reader => {\n\t\t\tconst w = this._inlineEditWidget.read(reader);\n\t\t\tif (!w) { return undefined; }\n\t\t\treturn reader.store.add(this._instantiationService.createInstance(\n\t\t\t\tInlineEditsOnboardingExperience,\n\t\t\t\tw._inlineEditModel,\n\t\t\t\tconstObservable(this._indicator),\n\t\t\t\tw.view._inlineCollapsedView,\n\t\t\t));\n\t\t}).recomputeInitiallyAndOnChange(this._store);\n\t}\n\n\tprivate _createGhostText(ghostText: IObservable<GhostTextOrReplacement>): GhostTextView {\n\t\treturn this._instantiationService.createInstance(\n\t\t\tGhostTextView,\n\t\t\tthis._editor,\n\t\t\tderived(reader => {\n\t\t\t\tconst model = this._model.read(reader);\n\t\t\t\tconst inlineCompletion = model?.inlineCompletionState.read(reader)?.inlineSuggestion;\n\t\t\t\tif (!model || !inlineCompletion) {\n\t\t\t\t\t// editor.suggest.preview: true causes situations where we have ghost text, but no suggest preview.\n\t\t\t\t\treturn {\n\t\t\t\t\t\tghostText: ghostText.read(reader),\n\t\t\t\t\t\thandleInlineCompletionShown: () => { /* no-op */ },\n\t\t\t\t\t\twarning: undefined,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tghostText: ghostText.read(reader),\n\t\t\t\t\thandleInlineCompletionShown: (viewData) => model.handleInlineSuggestionShown(inlineCompletion, InlineCompletionViewKind.GhostText, viewData, Date.now()),\n\t\t\t\t\twarning: GhostTextWidgetWarning.from(model?.warning.read(reader)),\n\t\t\t\t} satisfies IGhostTextWidgetData;\n\t\t\t}),\n\t\t\t{\n\t\t\t\tuseSyntaxHighlighting: this._editorObs.getOption(EditorOption.inlineSuggest).map(v => v.syntaxHighlightingEnabled),\n\t\t\t\thighlightShortSuggestions: true,\n\t\t\t},\n\t\t);\n\t}\n\n\tpublic shouldShowHoverAtViewZone(viewZoneId: string): boolean {\n\t\treturn this._ghostTextWidgets.get()[0]?.ownsViewZone(viewZoneId) ?? false;\n\t}\n\n\tprivate readonly _gutterIndicatorState = derived(reader => {\n\t\tconst model = this._model.read(reader);\n\t\tif (!model) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst state = model.state.read(reader);\n\n\t\tif (state?.kind === 'ghostText' && state.inlineSuggestion?.showInlineEditMenu) {\n\t\t\treturn {\n\t\t\t\tdisplayRange: LineRange.ofLength(state.primaryGhostText.lineNumber, 1),\n\t\t\t\ttabAction: derived<InlineEditTabAction>(this,\n\t\t\t\t\treader => this._editorObs.isFocused.read(reader) ? InlineEditTabAction.Accept : InlineEditTabAction.Inactive\n\t\t\t\t),\n\t\t\t\tgutterIndicatorOffset: constObservable(getGhostTextTopOffset(state.inlineSuggestion, this._editor)),\n\t\t\t\tinlineSuggestion: state.inlineSuggestion,\n\t\t\t\tmodel,\n\t\t\t};\n\t\t} else if (state?.kind === 'inlineEdit') {\n\t\t\tconst inlineEditWidget = this._inlineEditWidget.read(reader)?.view;\n\t\t\tif (!inlineEditWidget) { return undefined; }\n\n\t\t\tconst displayRange = inlineEditWidget.displayRange.read(reader);\n\t\t\tif (!displayRange) { return undefined; }\n\t\t\treturn {\n\t\t\t\tdisplayRange,\n\t\t\t\ttabAction: derived(reader => {\n\t\t\t\t\tif (this._editorObs.isFocused.read(reader)) {\n\t\t\t\t\t\tif (model.tabShouldJumpToInlineEdit.read(reader)) { return InlineEditTabAction.Jump; }\n\t\t\t\t\t\tif (model.tabShouldAcceptInlineEdit.read(reader)) { return InlineEditTabAction.Accept; }\n\t\t\t\t\t}\n\t\t\t\t\treturn InlineEditTabAction.Inactive;\n\t\t\t\t}),\n\t\t\t\tgutterIndicatorOffset: inlineEditWidget.gutterIndicatorOffset,\n\t\t\t\tinlineSuggestion: state.inlineSuggestion,\n\t\t\t\tmodel,\n\t\t\t};\n\t\t} else {\n\t\t\treturn undefined;\n\t\t}\n\t});\n\n\tprotected readonly _indicator;\n}\n\nfunction getGhostTextTopOffset(inlineCompletion: InlineCompletionItem, editor: ICodeEditor): number {\n\tconst replacement = inlineCompletion.getSingleTextEdit();\n\tconst textModel = editor.getModel();\n\tif (!textModel) {\n\t\treturn 0;\n\t}\n\n\tconst EOL = textModel.getEOL();\n\tif (replacement.range.isEmpty() && replacement.text.startsWith(EOL)) {\n\t\tconst lineHeight = editor.getLineHeightForPosition(replacement.range.getStartPosition());\n\t\treturn countPrefixRepeats(replacement.text, EOL) * lineHeight;\n\t}\n\n\treturn 0;\n}\n\nfunction countPrefixRepeats(str: string, prefix: string): number {\n\tif (!prefix.length) {\n\t\treturn 0;\n\t}\n\tlet count = 0;\n\tlet i = 0;\n\twhile (str.startsWith(prefix, i)) {\n\t\tcount++;\n\t\ti += prefix.length;\n\t}\n\treturn count;\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { createStyleSheetFromObservable } from '../../../../../base/browser/domStylesheets.js';\nimport { createHotClass } from '../../../../../base/common/hotReloadHelpers.js';\nimport { Disposable } from '../../../../../base/common/lifecycle.js';\nimport { derived, mapObservableArrayCached, derivedDisposable, derivedObservableWithCache, IObservable, ISettableObservable, constObservable, observableValue } from '../../../../../base/common/observable.js';\nimport { IInstantiationService } from '../../../../../platform/instantiation/common/instantiation.js';\nimport { ICodeEditor } from '../../../../browser/editorBrowser.js';\nimport { observableCodeEditor } from '../../../../browser/observableCodeEditor.js';\nimport { EditorOption } from '../../../../common/config/editorOptions.js';\nimport { LineRange } from '../../../../common/core/ranges/lineRange.js';\nimport { InlineCompletionsHintsWidget } from '../hintsWidget/inlineCompletionsHintsWidget.js';\nimport { GhostTextOrReplacement } from '../model/ghostText.js';\nimport { InlineCompletionsModel } from '../model/inlineCompletionsModel.js';\nimport { InlineCompletionItem } from '../model/inlineSuggestionItem.js';\nimport { convertItemsToStableObservables } from '../utils.js';\nimport { GhostTextView, GhostTextWidgetWarning, IGhostTextWidgetData } from './ghostText/ghostTextView.js';\nimport { InlineEditsGutterIndicator, InlineEditsGutterIndicatorData, InlineSuggestionGutterMenuData, SimpleInlineSuggestModel } from './inlineEdits/components/gutterIndicatorView.js';\nimport { InlineEditsOnboardingExperience } from './inlineEdits/inlineEditsNewUsers.js';\nimport { InlineCompletionViewKind, InlineEditTabAction } from './inlineEdits/inlineEditsViewInterface.js';\nimport { InlineEditsViewAndDiffProducer } from './inlineEdits/inlineEditsViewProducer.js';\n\nexport class InlineSuggestionsView extends Disposable {\n\tpublic static hot = createHotClass(this);\n\n\tprivate readonly _ghostTexts = derived(this, (reader) => {\n\t\tconst model = this._model.read(reader);\n\t\treturn model?.ghostTexts.read(reader) ?? [];\n\t});\n\n\tprivate readonly _stablizedGhostTexts;\n\tprivate readonly _editorObs;\n\tprivate readonly _ghostTextWidgets;\n\n\tprivate readonly _inlineEdit = derived(this, reader => this._model.read(reader)?.inlineEditState.read(reader)?.inlineSuggestion);\n\tprivate readonly _everHadInlineEdit = derivedObservableWithCache<boolean>(this,\n\t\t(reader, last) => last || !!this._inlineEdit.read(reader)\n\t\t\t|| !!this._model.read(reader)?.inlineCompletionState.read(reader)?.inlineSuggestion?.showInlineEditMenu\n\t);\n\n\t// To break a cyclic dependency\n\tprivate readonly _indicatorIsHoverVisible = observableValue<IObservable<boolean> | undefined>(this, undefined);\n\n\tprivate readonly _showInlineEditCollapsed = derived(this, reader => {\n\t\tconst s = this._model.read(reader)?.showCollapsed.read(reader) ?? false;\n\t\treturn s && !this._indicatorIsHoverVisible.read(reader)?.read(reader);\n\t});\n\n\tprivate readonly _inlineEditWidget = derivedDisposable(reader => {\n\t\tif (!this._everHadInlineEdit.read(reader)) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn this._instantiationService.createInstance(InlineEditsViewAndDiffProducer, this._editor, this._model, this._showInlineEditCollapsed);\n\t});\n\n\tprivate readonly _fontFamily;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tprivate readonly _model: IObservable<InlineCompletionsModel | undefined>,\n\t\tprivate readonly _focusIsInMenu: ISettableObservable<boolean>,\n\t\t@IInstantiationService private readonly _instantiationService: IInstantiationService\n\t) {\n\t\tsuper();\n\n\t\tthis._stablizedGhostTexts = convertItemsToStableObservables(this._ghostTexts, this._store);\n\t\tthis._editorObs = observableCodeEditor(this._editor);\n\n\t\tthis._ghostTextWidgets = mapObservableArrayCached(\n\t\t\tthis,\n\t\t\tthis._stablizedGhostTexts,\n\t\t\t(ghostText, store) => store.add(this._createGhostText(ghostText))\n\t\t).recomputeInitiallyAndOnChange(this._store);\n\n\t\tthis._inlineEditWidget.recomputeInitiallyAndOnChange(this._store);\n\n\t\tthis._fontFamily = this._editorObs.getOption(EditorOption.inlineSuggest).map(val => val.fontFamily);\n\n\t\tthis._register(createStyleSheetFromObservable(derived(reader => {\n\t\t\tconst fontFamily = this._fontFamily.read(reader);\n\t\t\treturn `\n.monaco-editor .ghost-text-decoration,\n.monaco-editor .ghost-text-decoration-preview,\n.monaco-editor .ghost-text {\n\tfont-family: ${fontFamily};\n}`;\n\t\t})));\n\n\t\tthis._register(new InlineCompletionsHintsWidget(this._editor, this._model, this._instantiationService));\n\n\t\tthis._indicator = this._register(this._instantiationService.createInstance(\n\t\t\tInlineEditsGutterIndicator,\n\t\t\tthis._editorObs,\n\t\t\tderived(reader => {\n\t\t\t\tconst s = this._gutterIndicatorState.read(reader);\n\t\t\t\tif (!s) { return undefined; }\n\t\t\t\treturn new InlineEditsGutterIndicatorData(\n\t\t\t\t\tInlineSuggestionGutterMenuData.fromInlineSuggestion(s.inlineSuggestion),\n\t\t\t\t\ts.displayRange,\n\t\t\t\t\tSimpleInlineSuggestModel.fromInlineCompletionModel(s.model),\n\t\t\t\t\ts.inlineSuggestion.action?.kind === 'edit' ? s.inlineSuggestion.action.alternativeAction : undefined,\n\t\t\t\t);\n\t\t\t}),\n\t\t\tthis._gutterIndicatorState.map((s, reader) => s?.tabAction.read(reader) ?? InlineEditTabAction.Inactive),\n\t\t\tthis._gutterIndicatorState.map((s, reader) => s?.gutterIndicatorOffset.read(reader) ?? 0),\n\t\t\tthis._inlineEditWidget.map((w, reader) => w?.view.inlineEditsIsHovered.read(reader) ?? false),\n\t\t\tthis._focusIsInMenu,\n\t\t));\n\t\tthis._indicatorIsHoverVisible.set(this._indicator.isHoverVisible, undefined);\n\n\t\tderived(reader => {\n\t\t\tconst w = this._inlineEditWidget.read(reader);\n\t\t\tif (!w) { return undefined; }\n\t\t\treturn reader.store.add(this._instantiationService.createInstance(\n\t\t\t\tInlineEditsOnboardingExperience,\n\t\t\t\tw._inlineEditModel,\n\t\t\t\tconstObservable(this._indicator),\n\t\t\t\tw.view._inlineCollapsedView,\n\t\t\t));\n\t\t}).recomputeInitiallyAndOnChange(this._store);\n\t}\n\n\tprivate _createGhostText(ghostText: IObservable<GhostTextOrReplacement>): GhostTextView {\n\t\treturn this._instantiationService.createInstance(\n\t\t\tGhostTextView,\n\t\t\tthis._editor,\n\t\t\tderived(reader => {\n\t\t\t\tconst model = this._model.read(reader);\n\t\t\t\tconst inlineCompletion = model?.inlineCompletionState.read(reader)?.inlineSuggestion;\n\t\t\t\tif (!model || !inlineCompletion) {\n\t\t\t\t\t// editor.suggest.preview: true causes situations where we have ghost text, but no suggest preview.\n\t\t\t\t\treturn {\n\t\t\t\t\t\tghostText: ghostText.read(reader),\n\t\t\t\t\t\thandleInlineCompletionShown: () => { /* no-op */ },\n\t\t\t\t\t\twarning: undefined,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tghostText: ghostText.read(reader),\n\t\t\t\t\thandleInlineCompletionShown: (viewData) => model.handleInlineSuggestionShown(inlineCompletion, InlineCompletionViewKind.GhostText, viewData, Date.now()),\n\t\t\t\t\twarning: GhostTextWidgetWarning.from(model?.warning.read(reader)),\n\t\t\t\t} satisfies IGhostTextWidgetData;\n\t\t\t}),\n\t\t\t{\n\t\t\t\tuseSyntaxHighlighting: this._editorObs.getOption(EditorOption.inlineSuggest).map(v => v.syntaxHighlightingEnabled),\n\t\t\t\thighlightShortSuggestions: true,\n\t\t\t},\n\t\t);\n\t}\n\n\tpublic shouldShowHoverAtViewZone(viewZoneId: string): boolean {\n\t\treturn this._ghostTextWidgets.get()[0]?.ownsViewZone(viewZoneId) ?? false;\n\t}\n\n\tprivate readonly _gutterIndicatorState = derived(reader => {\n\t\tconst model = this._model.read(reader);\n\t\tif (!model) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst state = model.state.read(reader);\n\n\t\tif (state?.kind === 'ghostText' && state.inlineSuggestion?.showInlineEditMenu) {\n\t\t\treturn {\n\t\t\t\tdisplayRange: LineRange.ofLength(state.primaryGhostText.lineNumber, 1),\n\t\t\t\ttabAction: derived<InlineEditTabAction>(this,\n\t\t\t\t\treader => this._editorObs.isFocused.read(reader) ? InlineEditTabAction.Accept : InlineEditTabAction.Inactive\n\t\t\t\t),\n\t\t\t\tgutterIndicatorOffset: constObservable(getGhostTextTopOffset(state.inlineSuggestion, this._editor)),\n\t\t\t\tinlineSuggestion: state.inlineSuggestion,\n\t\t\t\tmodel,\n\t\t\t};\n\t\t} else if (state?.kind === 'inlineEdit') {\n\t\t\tconst inlineEditWidget = this._inlineEditWidget.read(reader)?.view;\n\t\t\tif (!inlineEditWidget) { return undefined; }\n\n\t\t\tconst displayRange = inlineEditWidget.displayRange.read(reader);\n\t\t\tif (!displayRange) { return undefined; }\n\t\t\treturn {\n\t\t\t\tdisplayRange,\n\t\t\t\ttabAction: derived(reader => {\n\t\t\t\t\tif (this._editorObs.isFocused.read(reader)) {\n\t\t\t\t\t\tif (model.tabShouldJumpToInlineEdit.read(reader)) { return InlineEditTabAction.Jump; }\n\t\t\t\t\t\tif (model.tabShouldAcceptInlineEdit.read(reader)) { return InlineEditTabAction.Accept; }\n\t\t\t\t\t}\n\t\t\t\t\treturn InlineEditTabAction.Inactive;\n\t\t\t\t}),\n\t\t\t\tgutterIndicatorOffset: inlineEditWidget.gutterIndicatorOffset,\n\t\t\t\tinlineSuggestion: state.inlineSuggestion,\n\t\t\t\tmodel,\n\t\t\t};\n\t\t} else {\n\t\t\treturn undefined;\n\t\t}\n\t});\n\n\tprotected readonly _indicator;\n}\n\nfunction getGhostTextTopOffset(inlineCompletion: InlineCompletionItem, editor: ICodeEditor): number {\n\tconst replacement = inlineCompletion.getSingleTextEdit();\n\tconst textModel = editor.getModel();\n\tif (!textModel) {\n\t\treturn 0;\n\t}\n\n\tconst EOL = textModel.getEOL();\n\tif (replacement.range.isEmpty() && replacement.text.startsWith(EOL)) {\n\t\tconst lineHeight = editor.getLineHeightForPosition(replacement.range.getStartPosition());\n\t\treturn countPrefixRepeats(replacement.text, EOL) * lineHeight;\n\t}\n\n\treturn 0;\n}\n\nfunction countPrefixRepeats(str: string, prefix: string): number {\n\tif (!prefix.length) {\n\t\treturn 0;\n\t}\n\tlet count = 0;\n\tlet i = 0;\n\twhile (str.startsWith(prefix, i)) {\n\t\tcount++;\n\t\ti += prefix.length;\n\t}\n\treturn count;\n}\n"]}
|
|
@@ -1745,7 +1745,7 @@ export namespace editor {
|
|
|
1745
1745
|
*/
|
|
1746
1746
|
glyphMargin?: IModelDecorationGlyphMarginOptions | null;
|
|
1747
1747
|
/**
|
|
1748
|
-
* If set, the decoration will override the line height of the lines it spans.
|
|
1748
|
+
* If set, the decoration will override the line height of the lines it spans. This value is a multiplier to the default line height.
|
|
1749
1749
|
*/
|
|
1750
1750
|
lineHeight?: number | null;
|
|
1751
1751
|
/**
|
|
@@ -6387,6 +6387,10 @@ export namespace editor {
|
|
|
6387
6387
|
* Force an editor render now.
|
|
6388
6388
|
*/
|
|
6389
6389
|
render(forceRedraw?: boolean): void;
|
|
6390
|
+
/**
|
|
6391
|
+
* Render the editor at the next animation frame.
|
|
6392
|
+
*/
|
|
6393
|
+
renderAsync(forceRedraw?: boolean): void;
|
|
6390
6394
|
/**
|
|
6391
6395
|
* Get the hit test target at coordinates `clientX` and `clientY`.
|
|
6392
6396
|
* The coordinates are relative to the top-left of the viewport.
|