monaco-editor-core 0.56.0-dev-20260119 → 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/base/browser/ui/actionbar/actionViewItems.js +4 -1
- package/esm/vs/base/browser/ui/actionbar/actionViewItems.js.map +1 -1
- package/esm/vs/base/browser/ui/actionbar/actionbar.css +8 -5
- package/esm/vs/base/browser/ui/contextview/contextview.js +1 -1
- package/esm/vs/base/browser/ui/contextview/contextview.js.map +1 -1
- package/esm/vs/base/browser/ui/hover/hover.js.map +1 -1
- package/esm/vs/base/browser/ui/list/list.js +1 -0
- package/esm/vs/base/browser/ui/list/list.js.map +1 -1
- package/esm/vs/base/browser/ui/list/listWidget.js +62 -5
- package/esm/vs/base/browser/ui/list/listWidget.js.map +1 -1
- package/esm/vs/base/browser/ui/tree/abstractTree.js +4 -1
- package/esm/vs/base/browser/ui/tree/abstractTree.js.map +1 -1
- package/esm/vs/base/browser/ui/tree/asyncDataTree.js +4 -1
- package/esm/vs/base/browser/ui/tree/asyncDataTree.js.map +1 -1
- package/esm/vs/base/common/defaultAccount.js +0 -4
- package/esm/vs/base/common/defaultAccount.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 +38 -18
- package/esm/vs/editor/browser/controller/editContext/native/nativeEditContext.js.map +1 -1
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContext.js +4 -0
- 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 +7 -5
- package/esm/vs/editor/common/model/textModel.js.map +1 -1
- package/esm/vs/editor/common/model/tokens/tokenizationFontDecorationsProvider.js +21 -17
- 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/model/inlineCompletionsModel.js +2 -2
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.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/inlineEdits/components/gutterIndicatorView.js +19 -13
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorView.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/esm/vs/platform/actions/common/actions.js +2 -1
- package/esm/vs/platform/actions/common/actions.js.map +1 -1
- package/esm/vs/platform/defaultAccount/common/defaultAccount.js.map +1 -1
- package/esm/vs/platform/hover/browser/hoverService.js +1 -0
- package/esm/vs/platform/hover/browser/hoverService.js.map +1 -1
- package/esm/vs/platform/product/common/product.js +16 -1
- package/esm/vs/platform/product/common/product.js.map +1 -1
- package/monaco.d.ts +5 -1
- package/package.json +2 -2
- package/version.txt +1 -1
|
@@ -64,6 +64,13 @@
|
|
|
64
64
|
border-bottom: 4px double var(--vscode-editorWarning-border);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
.monaco-editor .ghost-text-decoration.short-text,
|
|
68
|
+
.monaco-editor .ghost-text-decoration-preview.short-text,
|
|
69
|
+
.monaco-editor .suggest-preview-text .ghost-text.short-text {
|
|
70
|
+
text-decoration: underline dotted var(--vscode-editorGhostText-foreground);
|
|
71
|
+
text-underline-position: under;
|
|
72
|
+
}
|
|
73
|
+
|
|
67
74
|
.ghost-text-view-warning-widget-icon {
|
|
68
75
|
.codicon {
|
|
69
76
|
color: var(--vscode-editorWarning-foreground) !important;
|
|
@@ -72,14 +72,27 @@ let GhostTextView = class GhostTextView extends Disposable {
|
|
|
72
72
|
});
|
|
73
73
|
this._onDidClick = this._register(new Emitter());
|
|
74
74
|
this.onDidClick = this._onDidClick.event;
|
|
75
|
+
this._nonWhitespaceCount = derived(this, reader => {
|
|
76
|
+
const data = this._data.read(reader);
|
|
77
|
+
if (!data) {
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
const ghostText = data.ghostText;
|
|
81
|
+
const allText = ghostText.parts.map(p => p.lines.map(l => l.line).join('')).join('');
|
|
82
|
+
return allText.replace(/\s/g, '').length;
|
|
83
|
+
});
|
|
75
84
|
this._extraClassNames = derived(this, reader => {
|
|
76
85
|
const extraClasses = this._extraClasses.slice();
|
|
77
|
-
if (this._useSyntaxHighlighting.read(reader)) {
|
|
78
|
-
extraClasses.push('syntax-highlighted');
|
|
79
|
-
}
|
|
80
86
|
if (USE_SQUIGGLES_FOR_WARNING && this._warningState.read(reader)) {
|
|
81
87
|
extraClasses.push('warning');
|
|
82
88
|
}
|
|
89
|
+
const nonWhitespaceCount = this._nonWhitespaceCount.read(reader);
|
|
90
|
+
if (this._highlightShortText && nonWhitespaceCount && nonWhitespaceCount < 3) {
|
|
91
|
+
extraClasses.push('short-text');
|
|
92
|
+
}
|
|
93
|
+
else if (this._useSyntaxHighlighting.read(reader)) {
|
|
94
|
+
extraClasses.push('syntax-highlighted');
|
|
95
|
+
}
|
|
83
96
|
const extraClassNames = extraClasses.map(c => ` ${c}`).join('');
|
|
84
97
|
return extraClassNames;
|
|
85
98
|
});
|
|
@@ -151,6 +164,10 @@ let GhostTextView = class GhostTextView extends Disposable {
|
|
|
151
164
|
});
|
|
152
165
|
}
|
|
153
166
|
for (const p of uiState.inlineTexts) {
|
|
167
|
+
let inlineExtraClassNames = '';
|
|
168
|
+
if (this._highlightShortText && p.text.length < 5) {
|
|
169
|
+
inlineExtraClassNames += ' short-text';
|
|
170
|
+
}
|
|
154
171
|
decorations.push({
|
|
155
172
|
range: Range.fromPositions(new Position(uiState.lineNumber, p.column)),
|
|
156
173
|
options: {
|
|
@@ -161,6 +178,7 @@ let GhostTextView = class GhostTextView extends Disposable {
|
|
|
161
178
|
inlineClassName: (p.preview ? 'ghost-text-decoration-preview' : 'ghost-text-decoration')
|
|
162
179
|
+ (this._isClickable ? ' clickable' : '')
|
|
163
180
|
+ extraClassNames
|
|
181
|
+
+ inlineExtraClassNames
|
|
164
182
|
+ p.lineDecorations.map(d => ' ' + d.className).join(' '), // TODO: take the ranges into account for line decorations
|
|
165
183
|
cursorStops: InjectedTextCursorStops.Left,
|
|
166
184
|
attachedData: new GhostTextAttachedData(this),
|
|
@@ -186,6 +204,7 @@ let GhostTextView = class GhostTextView extends Disposable {
|
|
|
186
204
|
this._shouldKeepCursorStable = options.shouldKeepCursorStable ?? false;
|
|
187
205
|
this._minReservedLineCount = options.minReservedLineCount ?? constObservable(0);
|
|
188
206
|
this._useSyntaxHighlighting = options.useSyntaxHighlighting ?? constObservable(true);
|
|
207
|
+
this._highlightShortText = options.highlightShortSuggestions ?? false;
|
|
189
208
|
this._editorObs = observableCodeEditor(this._editor);
|
|
190
209
|
this._additionalLinesWidget = this._register(new AdditionalLinesWidget(this._editor, derivedOpts({ owner: this, equalsFn: equalsIfDefinedC(thisEqualsC()) }, reader => {
|
|
191
210
|
/** @description lines */
|
|
@@ -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,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,6C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","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,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAC1H,OAAO,EAAe,OAAO,EAAE,gBAAgB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AAC;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"]}
|
|
@@ -33,11 +33,12 @@ import { assertNever } from '../../../../../../../base/common/assert.js';
|
|
|
33
33
|
import { localize } from '../../../../../../../nls.js';
|
|
34
34
|
import { asCssVariable } from '../../../../../../../platform/theme/common/colorUtils.js';
|
|
35
35
|
export class InlineEditsGutterIndicatorData {
|
|
36
|
-
constructor(gutterMenuData, originalRange, model, altAction) {
|
|
36
|
+
constructor(gutterMenuData, originalRange, model, altAction, customization) {
|
|
37
37
|
this.gutterMenuData = gutterMenuData;
|
|
38
38
|
this.originalRange = originalRange;
|
|
39
39
|
this.model = model;
|
|
40
40
|
this.altAction = altAction;
|
|
41
|
+
this.customization = customization;
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
44
|
export class InlineSuggestionGutterMenuData {
|
|
@@ -216,18 +217,23 @@ let InlineEditsGutterIndicator = class InlineEditsGutterIndicator extends Dispos
|
|
|
216
217
|
const pillFullyDockedRect = gutterEditArea.withHeight(pillHeight).translateY(pillOffset);
|
|
217
218
|
const pillIsFullyDocked = gutterViewPortWithoutStickyScrollWithoutPaddingTop.containsRect(pillFullyDockedRect);
|
|
218
219
|
// The icon which will be rendered in the pill
|
|
219
|
-
const
|
|
220
|
-
const
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
220
|
+
const customIcon = this._data.read(reader)?.customization?.icon;
|
|
221
|
+
const iconNoneDocked = customIcon
|
|
222
|
+
? constObservable(customIcon)
|
|
223
|
+
: this._tabAction.map(action => action === InlineEditTabAction.Accept ? Codicon.keyboardTab : Codicon.arrowRight);
|
|
224
|
+
const iconDocked = customIcon
|
|
225
|
+
? constObservable(customIcon)
|
|
226
|
+
: derived(this, reader => {
|
|
227
|
+
if (this._isHoveredOverIconDebounced.read(reader) || this._isHoveredOverInlineEditDebounced.read(reader)) {
|
|
228
|
+
return Codicon.check;
|
|
229
|
+
}
|
|
230
|
+
if (this._tabAction.read(reader) === InlineEditTabAction.Accept) {
|
|
231
|
+
return Codicon.keyboardTab;
|
|
232
|
+
}
|
|
233
|
+
const cursorLineNumber = this._editorObs.cursorLineNumber.read(reader) ?? 0;
|
|
234
|
+
const editStartLineNumber = s.range.read(reader).startLineNumber;
|
|
235
|
+
return cursorLineNumber <= editStartLineNumber ? Codicon.keyboardTabAbove : Codicon.keyboardTabBelow;
|
|
236
|
+
});
|
|
231
237
|
const idealIconAreaWidth = 22;
|
|
232
238
|
const iconWidth = (pillRect) => {
|
|
233
239
|
const availableIconAreaWidth = this._availableWidthForIcon.read(undefined)(pillRect.bottom + this._editorObs.editor.getScrollTop()) - gutterViewPortPaddingLeft;
|