monaco-editor-core 0.58.0 → 0.59.0-dev-20261124
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/nls.keys.json +1 -1
- package/esm/nls.messages.cs.js +2 -2
- package/esm/nls.messages.de.js +2 -2
- package/esm/nls.messages.es.js +2 -2
- package/esm/nls.messages.fr.js +2 -2
- package/esm/nls.messages.it.js +2 -2
- package/esm/nls.messages.ja.js +2 -2
- package/esm/nls.messages.js +1 -1
- package/esm/nls.messages.json +1 -1
- package/esm/nls.messages.ko.js +2 -2
- package/esm/nls.messages.pl.js +2 -2
- package/esm/nls.messages.pt-br.js +2 -2
- package/esm/nls.messages.ru.js +2 -2
- package/esm/nls.messages.tr.js +2 -2
- package/esm/nls.messages.zh-cn.js +2 -2
- package/esm/nls.messages.zh-tw.js +2 -2
- package/esm/nls.metadata.json +2 -0
- package/esm/vs/base/browser/ui/selectBox/selectBox.js.map +1 -1
- package/esm/vs/base/browser/ui/selectBox/selectBoxCustom.js +3 -0
- package/esm/vs/base/browser/ui/selectBox/selectBoxCustom.js.map +1 -1
- package/esm/vs/base/browser/ui/selectBox/selectBoxNative.js +4 -2
- package/esm/vs/base/browser/ui/selectBox/selectBoxNative.js.map +1 -1
- package/esm/vs/base/browser/ui/tree/abstractTree.js +27 -1
- package/esm/vs/base/browser/ui/tree/abstractTree.js.map +1 -1
- package/esm/vs/base/common/cancellation.js +3 -1
- package/esm/vs/base/common/cancellation.js.map +1 -1
- package/esm/vs/editor/browser/controller/mouseHandler.js +8 -1
- package/esm/vs/editor/browser/controller/mouseHandler.js.map +1 -1
- package/esm/vs/editor/browser/controller/mouseTarget.js +15 -6
- package/esm/vs/editor/browser/controller/mouseTarget.js.map +1 -1
- package/esm/vs/editor/browser/view.js +3 -2
- package/esm/vs/editor/browser/view.js.map +1 -1
- package/esm/vs/editor/browser/viewParts/contentWidgets/contentWidgets.js +12 -8
- package/esm/vs/editor/browser/viewParts/contentWidgets/contentWidgets.js.map +1 -1
- package/esm/vs/editor/browser/viewParts/viewLines/viewLine.js +7 -11
- package/esm/vs/editor/browser/viewParts/viewLines/viewLine.js.map +1 -1
- package/esm/vs/editor/common/config/editorOptions.js +246 -238
- package/esm/vs/editor/common/config/editorOptions.js.map +1 -1
- package/esm/vs/editor/common/core/editorColorRegistry.js +71 -71
- package/esm/vs/editor/common/editorContextKeys.js +53 -53
- package/esm/vs/editor/common/languages/modesRegistry.js +1 -1
- package/esm/vs/editor/common/languages.js +56 -56
- package/esm/vs/editor/common/model/editStack.js +1 -1
- package/esm/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeBase.js +3 -1
- package/esm/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeBase.js.map +1 -1
- package/esm/vs/editor/common/model/textModel.js +1 -0
- package/esm/vs/editor/common/model/textModel.js.map +1 -1
- package/esm/vs/editor/common/model.js.map +1 -1
- package/esm/vs/editor/common/standaloneStrings.js +11 -11
- package/esm/vs/editor/common/viewLayout/viewLineRenderer.js +2 -2
- package/esm/vs/editor/contrib/anchorSelect/browser/anchorSelect.js +6 -6
- package/esm/vs/editor/contrib/bracketMatching/browser/bracketMatching.js +6 -6
- package/esm/vs/editor/contrib/caretOperations/browser/caretOperations.js +2 -2
- package/esm/vs/editor/contrib/caretOperations/browser/transpose.js +1 -1
- package/esm/vs/editor/contrib/clipboard/browser/clipboard.js +17 -17
- package/esm/vs/editor/contrib/codeAction/browser/codeAction.js +1 -1
- package/esm/vs/editor/contrib/codeAction/browser/codeActionCommands.js +29 -29
- package/esm/vs/editor/contrib/codeAction/browser/codeActionContributions.js +3 -3
- package/esm/vs/editor/contrib/codeAction/browser/codeActionController.js +3 -3
- package/esm/vs/editor/contrib/codeAction/browser/codeActionMenu.js +8 -8
- package/esm/vs/editor/contrib/codeAction/browser/lightBulbWidget.js +9 -9
- package/esm/vs/editor/contrib/codelens/browser/codelensController.js +2 -2
- package/esm/vs/editor/contrib/colorPicker/browser/colorPickerParts/colorPickerCloseButton.js +1 -1
- package/esm/vs/editor/contrib/colorPicker/browser/colorPickerParts/colorPickerHeader.js +1 -1
- package/esm/vs/editor/contrib/colorPicker/browser/hoverColorPicker/hoverColorPickerParticipant.js +1 -1
- package/esm/vs/editor/contrib/colorPicker/browser/standaloneColorPicker/standaloneColorPickerActions.js +7 -7
- package/esm/vs/editor/contrib/comment/browser/comment.js +6 -6
- package/esm/vs/editor/contrib/contextmenu/browser/contextmenu.js +13 -13
- package/esm/vs/editor/contrib/cursorUndo/browser/cursorUndo.js +2 -2
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteContribution.js +4 -4
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.js +9 -9
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/defaultProviders.js +8 -8
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/dropIntoEditorController.js +3 -3
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/postEditWidget.js +2 -2
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/postEditWidget.js.map +1 -1
- package/esm/vs/editor/contrib/editorState/browser/keybindingCancellation.js +1 -1
- package/esm/vs/editor/contrib/find/browser/findController.js +17 -17
- package/esm/vs/editor/contrib/find/browser/findWidget.js +29 -29
- package/esm/vs/editor/contrib/folding/browser/folding.css +15 -0
- package/esm/vs/editor/contrib/folding/browser/folding.js +20 -20
- package/esm/vs/editor/contrib/folding/browser/foldingDecorations.js +9 -9
- package/esm/vs/editor/contrib/fontZoom/browser/fontZoom.js +3 -3
- package/esm/vs/editor/contrib/format/browser/formatActions.js +2 -2
- package/esm/vs/editor/contrib/gotoError/browser/gotoError.js +8 -8
- package/esm/vs/editor/contrib/gotoError/browser/gotoErrorWidget.js +14 -14
- package/esm/vs/editor/contrib/gotoSymbol/browser/goToCommands.js +39 -39
- package/esm/vs/editor/contrib/gotoSymbol/browser/link/goToDefinitionAtPosition.js +1 -1
- package/esm/vs/editor/contrib/gotoSymbol/browser/peek/referencesController.js +3 -3
- package/esm/vs/editor/contrib/gotoSymbol/browser/peek/referencesTree.js +3 -3
- package/esm/vs/editor/contrib/gotoSymbol/browser/peek/referencesWidget.js +3 -3
- package/esm/vs/editor/contrib/gotoSymbol/browser/referencesModel.js +8 -8
- package/esm/vs/editor/contrib/gotoSymbol/browser/symbolNavigation.js +3 -3
- package/esm/vs/editor/contrib/gpu/browser/gpuActions.js +4 -4
- package/esm/vs/editor/contrib/hover/browser/contentHoverRendered.js +1 -1
- package/esm/vs/editor/contrib/hover/browser/contentHoverRendered.js.map +1 -1
- package/esm/vs/editor/contrib/hover/browser/contentHoverWidget.js +0 -5
- package/esm/vs/editor/contrib/hover/browser/contentHoverWidget.js.map +1 -1
- package/esm/vs/editor/contrib/hover/browser/contentHoverWidgetWrapper.js +0 -3
- package/esm/vs/editor/contrib/hover/browser/contentHoverWidgetWrapper.js.map +1 -1
- package/esm/vs/editor/contrib/hover/browser/hover.css +6 -2
- package/esm/vs/editor/contrib/hover/browser/hoverActionIds.js +2 -2
- package/esm/vs/editor/contrib/hover/browser/hoverActions.js +24 -24
- package/esm/vs/editor/contrib/hover/browser/hoverCopyButton.js +2 -2
- package/esm/vs/editor/contrib/hover/browser/hoverTypes.js.map +1 -1
- package/esm/vs/editor/contrib/hover/browser/markdownHoverParticipant.js +19 -39
- package/esm/vs/editor/contrib/hover/browser/markdownHoverParticipant.js.map +1 -1
- package/esm/vs/editor/contrib/hover/browser/markerHoverParticipant.js +7 -7
- package/esm/vs/editor/contrib/inPlaceReplace/browser/inPlaceReplace.js +2 -2
- package/esm/vs/editor/contrib/indentation/browser/indentation.js +20 -20
- package/esm/vs/editor/contrib/indentation/common/indentation.js +14 -3
- package/esm/vs/editor/contrib/indentation/common/indentation.js.map +1 -1
- package/esm/vs/editor/contrib/inlayHints/browser/inlayHintsHover.js +8 -8
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/commands.js +21 -21
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionContextKeys.js +13 -13
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionsController.js +6 -6
- package/esm/vs/editor/contrib/inlineCompletions/browser/hintsWidget/hoverParticipant.js +2 -2
- package/esm/vs/editor/contrib/inlineCompletions/browser/hintsWidget/inlineCompletionsHintsWidget.js +4 -4
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/renameSymbolProcessor.js +2 -2
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorMenu.js +6 -6
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorView.js +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsWordReplacementView.js +3 -3
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/theme.js +20 -20
- package/esm/vs/editor/contrib/insertFinalNewLine/browser/insertFinalNewLine.js +1 -1
- package/esm/vs/editor/contrib/lineSelection/browser/lineSelection.js +1 -1
- package/esm/vs/editor/contrib/linesOperations/browser/linesOperations.js +31 -31
- package/esm/vs/editor/contrib/linkedEditing/browser/linkedEditing.js +2 -2
- package/esm/vs/editor/contrib/links/browser/links.js +11 -10
- package/esm/vs/editor/contrib/links/browser/links.js.map +1 -1
- package/esm/vs/editor/contrib/message/browser/messageController.js +1 -1
- package/esm/vs/editor/contrib/multicursor/browser/multicursor.js +22 -22
- package/esm/vs/editor/contrib/parameterHints/browser/parameterHints.js +1 -1
- package/esm/vs/editor/contrib/parameterHints/browser/parameterHintsWidget.js +4 -4
- package/esm/vs/editor/contrib/peekView/browser/peekView.js +18 -18
- package/esm/vs/editor/contrib/placeholderText/browser/placeholderText.contribution.js +1 -1
- package/esm/vs/editor/contrib/quickAccess/browser/editorNavigationQuickAccess.js +1 -1
- package/esm/vs/editor/contrib/quickAccess/browser/gotoLineQuickAccess.js +12 -12
- package/esm/vs/editor/contrib/quickAccess/browser/gotoSymbolQuickAccess.js +32 -32
- package/esm/vs/editor/contrib/readOnlyMessage/browser/contribution.js +2 -2
- package/esm/vs/editor/contrib/rename/browser/rename.js +11 -11
- package/esm/vs/editor/contrib/rename/browser/renameWidget.js +7 -7
- package/esm/vs/editor/contrib/smartSelect/browser/smartSelect.js +4 -4
- package/esm/vs/editor/contrib/snippet/browser/snippetController2.js +5 -5
- package/esm/vs/editor/contrib/snippet/browser/snippetVariables.js +4 -4
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollActions.js +11 -11
- package/esm/vs/editor/contrib/suggest/browser/suggest.js +9 -9
- package/esm/vs/editor/contrib/suggest/browser/suggestController.js +11 -11
- package/esm/vs/editor/contrib/suggest/browser/suggestModel.js +93 -38
- package/esm/vs/editor/contrib/suggest/browser/suggestModel.js.map +1 -1
- package/esm/vs/editor/contrib/suggest/browser/suggestWidget.js +18 -18
- package/esm/vs/editor/contrib/suggest/browser/suggestWidgetDetails.js +3 -3
- package/esm/vs/editor/contrib/suggest/browser/suggestWidgetRenderer.js +2 -2
- package/esm/vs/editor/contrib/suggest/browser/wordContextKey.js +1 -1
- package/esm/vs/editor/contrib/symbolIcons/browser/symbolIcons.js +33 -33
- package/esm/vs/editor/contrib/toggleTabFocusMode/browser/toggleTabFocusMode.js +4 -4
- package/esm/vs/editor/contrib/tokenization/browser/tokenization.js +1 -1
- package/esm/vs/editor/contrib/unicodeHighlighter/browser/bannerController.js +1 -1
- package/esm/vs/editor/contrib/unicodeHighlighter/browser/unicodeHighlighter.js +24 -24
- package/esm/vs/editor/contrib/unusualLineTerminators/browser/unusualLineTerminators.js +5 -5
- package/esm/vs/editor/contrib/wordHighlighter/browser/highlightDecorations.js +9 -9
- package/esm/vs/editor/contrib/wordHighlighter/browser/wordHighlighter.js +3 -3
- package/esm/vs/editor/contrib/wordOperations/browser/wordOperations.js +3 -3
- package/esm/vs/editor/editor.api.d.ts +5 -0
- package/esm/vs/platform/accessibilitySignal/browser/accessibilitySignalService.js +68 -68
- package/esm/vs/platform/action/common/actionCommonCategories.js +6 -6
- package/esm/vs/platform/actionWidget/browser/actionList.js +30 -31
- package/esm/vs/platform/actionWidget/browser/actionList.js.map +1 -1
- package/esm/vs/platform/actionWidget/browser/actionWidget.css +1 -1
- package/esm/vs/platform/actionWidget/browser/actionWidget.js +12 -12
- package/esm/vs/platform/actions/browser/menuEntryActionViewItem.js +3 -3
- package/esm/vs/platform/actions/browser/toolbar.js +2 -2
- package/esm/vs/platform/actions/common/menuService.js +2 -2
- package/esm/vs/platform/configuration/common/configurationModels.js +15 -3
- package/esm/vs/platform/configuration/common/configurationModels.js.map +1 -1
- package/esm/vs/platform/configuration/common/configurationRegistry.js +12 -12
- package/esm/vs/platform/contextkey/browser/contextKeyService.js +1 -1
- package/esm/vs/platform/contextkey/common/contextkey.js +9 -9
- package/esm/vs/platform/contextkey/common/contextkeys.js +10 -10
- package/esm/vs/platform/contextkey/common/scanner.js +5 -5
- package/esm/vs/platform/history/browser/contextScopedHistoryWidget.js +1 -1
- package/esm/vs/platform/hover/browser/hoverWidget.js +1 -1
- package/esm/vs/platform/hover/browser/updatableHoverWidget.js +1 -1
- package/esm/vs/platform/keybinding/common/abstractKeybindingService.js +5 -5
- package/esm/vs/platform/list/browser/listService.js +27 -27
- package/esm/vs/platform/markers/common/markerService.js +2 -2
- package/esm/vs/platform/markers/common/markers.js +6 -6
- package/esm/vs/platform/quickinput/browser/commandsQuickAccess.js +8 -8
- package/esm/vs/platform/quickinput/browser/helpQuickAccess.js +1 -1
- package/esm/vs/platform/quickinput/browser/quickInput.js +10 -10
- package/esm/vs/platform/quickinput/browser/quickInputActions.js +5 -5
- package/esm/vs/platform/quickinput/browser/quickInputController.js +6 -6
- package/esm/vs/platform/quickinput/browser/quickInputList.js +1 -1
- package/esm/vs/platform/quickinput/browser/quickInputUtils.js +1 -1
- package/esm/vs/platform/quickinput/browser/tree/quickInputTreeAccessibilityProvider.js +1 -1
- package/esm/vs/platform/quickinput/browser/tree/quickTree.js +1 -1
- package/esm/vs/platform/theme/common/colorUtils.js +2 -2
- package/esm/vs/platform/theme/common/colors/baseColors.js +19 -19
- package/esm/vs/platform/theme/common/colors/chartsColors.js +8 -8
- package/esm/vs/platform/theme/common/colors/confettiColors.js +6 -6
- package/esm/vs/platform/theme/common/colors/editorColors.js +95 -95
- package/esm/vs/platform/theme/common/colors/inputColors.js +48 -48
- package/esm/vs/platform/theme/common/colors/listColors.js +36 -36
- package/esm/vs/platform/theme/common/colors/menuColors.js +7 -7
- package/esm/vs/platform/theme/common/colors/minimapColors.js +11 -11
- package/esm/vs/platform/theme/common/colors/miscColors.js +16 -16
- package/esm/vs/platform/theme/common/colors/quickpickColors.js +10 -10
- package/esm/vs/platform/theme/common/colors/searchColors.js +3 -3
- package/esm/vs/platform/theme/common/iconRegistry.js +6 -6
- package/esm/vs/platform/undoRedo/common/undoRedoService.js +20 -20
- package/esm/vs/platform/workspace/common/workspace.js +1 -1
- package/monaco.d.ts +5 -0
- package/package.json +3 -3
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
import * as dom from '../../../../base/browser/dom.js';
|
|
6
6
|
import { createFastDomNode } from '../../../../base/browser/fastDomNode.js';
|
|
7
7
|
import { PartFingerprints, ViewPart } from '../../view/viewPart.js';
|
|
8
|
+
/**
|
|
9
|
+
* Clearance kept between a widget overflowing the editor and the left/right edges of the window.
|
|
10
|
+
*/
|
|
11
|
+
const OVERFLOWING_WIDGET_WINDOW_PADDING = 15;
|
|
8
12
|
/**
|
|
9
13
|
* This view part is responsible for rendering the content widgets, which are
|
|
10
14
|
* used for rendering elements that are associated to an editor position,
|
|
@@ -197,9 +201,12 @@ class Widget {
|
|
|
197
201
|
_getMaxWidth() {
|
|
198
202
|
const elDocument = this.domNode.domNode.ownerDocument;
|
|
199
203
|
const elWindow = elDocument.defaultView;
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
204
|
+
if (!this.allowEditorOverflow) {
|
|
205
|
+
return this._contentWidth;
|
|
206
|
+
}
|
|
207
|
+
const windowWidth = elWindow?.innerWidth || elDocument.documentElement.offsetWidth || elDocument.body.offsetWidth;
|
|
208
|
+
// A wider widget cannot keep the padding on both sides of the window, see _layoutHorizontalSegmentInPage
|
|
209
|
+
return Math.max(0, windowWidth - 2 * OVERFLOWING_WIDGET_WINDOW_PADDING);
|
|
203
210
|
}
|
|
204
211
|
setPosition(primaryAnchor, secondaryAnchor, preference, affinity) {
|
|
205
212
|
this._setPosition(affinity, primaryAnchor, secondaryAnchor);
|
|
@@ -240,12 +247,9 @@ class Widget {
|
|
|
240
247
|
return { fitsAbove, aboveTop, fitsBelow, belowTop, left };
|
|
241
248
|
}
|
|
242
249
|
_layoutHorizontalSegmentInPage(windowSize, domNodePosition, left, width) {
|
|
243
|
-
// Leave some clearance to the left/right
|
|
244
|
-
const LEFT_PADDING = 15;
|
|
245
|
-
const RIGHT_PADDING = 15;
|
|
246
250
|
// Initially, the limits are defined as the dom node limits
|
|
247
|
-
const MIN_LIMIT = Math.max(
|
|
248
|
-
const MAX_LIMIT = Math.min(domNodePosition.left + domNodePosition.width + width, windowSize.width -
|
|
251
|
+
const MIN_LIMIT = Math.max(OVERFLOWING_WIDGET_WINDOW_PADDING, domNodePosition.left - width);
|
|
252
|
+
const MAX_LIMIT = Math.min(domNodePosition.left + domNodePosition.width + width, windowSize.width - OVERFLOWING_WIDGET_WINDOW_PADDING);
|
|
249
253
|
const elDocument = this._viewDomNode.domNode.ownerDocument;
|
|
250
254
|
const elWindow = elDocument.defaultView;
|
|
251
255
|
let absoluteLeft = domNodePosition.left + left - (elWindow?.scrollX ?? 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/browser/viewParts/contentWidgets/contentWidgets.ts","vs/editor/browser/viewParts/contentWidgets/contentWidgets.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,GAAG,MAAM,iCAAiC,CAAC;AACvD,OAAO,EAAe,iBAAiB,EA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7B,qBAAgB,GAAS,SAAS,CAAC;IAK/B,CAAC;CACL;AAED,MAAM,gBAAgB;IAGrB,YACiB,GAAW,EACX,IAAY,EACZ,MAAc;QAFd,QAAG,GAAH,GAAG,CAAQ;QACX,SAAI,GAAJ,IAAI,CAAQ;QACZ,WAAM,GAAN,MAAM,CAAQ;QAL/B,2BAAsB,GAAS,SAAS,CAAC;IAMrC,CAAC;CACL;AAED,8DAA8D;AAC9D,SAAS,UAAU,CAAoC,EAAK,EAAE,OAA6B,EAAE,GAAG,IAAmB;IAClH,IAAI,CAAC;QACJ,OAAO,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;IAClC,CAAC;IAAC,MAAM,CAAC;QACR,SAAS;QACT,OAAO,IAAI,CAAC;IACb,CAAC;AACF,CAAC","file":"contentWidgets.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 * as dom from '../../../../base/browser/dom.js';\nimport { FastDomNode, createFastDomNode } from '../../../../base/browser/fastDomNode.js';\nimport { ContentWidgetPositionPreference, IContentWidget, IContentWidgetRenderedCoordinate } from '../../editorBrowser.js';\nimport { PartFingerprint, PartFingerprints, ViewPart } from '../../view/viewPart.js';\nimport { RenderingContext, RestrictedRenderingContext } from '../../view/renderingContext.js';\nimport { ViewContext } from '../../../common/viewModel/viewContext.js';\nimport * as viewEvents from '../../../common/viewEvents.js';\nimport { ViewportData } from '../../../common/viewLayout/viewLinesViewportData.js';\nimport { EditorOption } from '../../../common/config/editorOptions.js';\nimport { IDimension } from '../../../common/core/2d/dimension.js';\nimport { PositionAffinity } from '../../../common/model.js';\nimport { IPosition, Position } from '../../../common/core/position.js';\nimport { IViewModel } from '../../../common/viewModel.js';\n\n/**\n * This view part is responsible for rendering the content widgets, which are\n * used for rendering elements that are associated to an editor position,\n * such as suggestions or the parameter hints.\n */\nexport class ViewContentWidgets extends ViewPart {\n\n\tprivate readonly _viewDomNode: FastDomNode<HTMLElement>;\n\tprivate _widgets: { [key: string]: Widget };\n\n\tpublic domNode: FastDomNode<HTMLElement>;\n\tpublic overflowingContentWidgetsDomNode: FastDomNode<HTMLElement>;\n\n\tconstructor(context: ViewContext, viewDomNode: FastDomNode<HTMLElement>) {\n\t\tsuper(context);\n\t\tthis._viewDomNode = viewDomNode;\n\t\tthis._widgets = {};\n\n\t\tthis.domNode = createFastDomNode(document.createElement('div'));\n\t\tPartFingerprints.write(this.domNode, PartFingerprint.ContentWidgets);\n\t\tthis.domNode.setClassName('contentWidgets');\n\t\tthis.domNode.setPosition('absolute');\n\t\tthis.domNode.setTop(0);\n\n\t\tthis.overflowingContentWidgetsDomNode = createFastDomNode(document.createElement('div'));\n\t\tPartFingerprints.write(this.overflowingContentWidgetsDomNode, PartFingerprint.OverflowingContentWidgets);\n\t\tthis.overflowingContentWidgetsDomNode.setClassName('overflowingContentWidgets');\n\t}\n\n\tpublic override dispose(): void {\n\t\tsuper.dispose();\n\t\t// Widgets outlive the view, so detach their dom nodes to not keep this view's DOM alive (#146841)\n\t\tfor (const widget of Object.values(this._widgets)) {\n\t\t\tconst domNode = widget.domNode.domNode;\n\t\t\tif (domNode.parentElement === this.domNode.domNode || domNode.parentElement === this.overflowingContentWidgetsDomNode.domNode) {\n\t\t\t\tdomNode.remove();\n\t\t\t\tdomNode.removeAttribute('monaco-visible-content-widget');\n\t\t\t}\n\t\t}\n\t\tthis._widgets = {};\n\t}\n\n\t// --- begin event handlers\n\n\tpublic override onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): boolean {\n\t\tconst keys = Object.keys(this._widgets);\n\t\tfor (const widgetId of keys) {\n\t\t\tthis._widgets[widgetId].onConfigurationChanged(e);\n\t\t}\n\t\treturn true;\n\t}\n\tpublic override onDecorationsChanged(e: viewEvents.ViewDecorationsChangedEvent): boolean {\n\t\t// true for inline decorations that can end up relayouting text\n\t\treturn true;\n\t}\n\tpublic override onFlushed(e: viewEvents.ViewFlushedEvent): boolean {\n\t\treturn true;\n\t}\n\tpublic override onLineMappingChanged(e: viewEvents.ViewLineMappingChangedEvent): boolean {\n\t\tthis._updateAnchorsViewPositions();\n\t\treturn true;\n\t}\n\tpublic override onLinesChanged(e: viewEvents.ViewLinesChangedEvent): boolean {\n\t\tthis._updateAnchorsViewPositions();\n\t\treturn true;\n\t}\n\tpublic override onLinesDeleted(e: viewEvents.ViewLinesDeletedEvent): boolean {\n\t\tthis._updateAnchorsViewPositions();\n\t\treturn true;\n\t}\n\tpublic override onLinesInserted(e: viewEvents.ViewLinesInsertedEvent): boolean {\n\t\tthis._updateAnchorsViewPositions();\n\t\treturn true;\n\t}\n\tpublic override onScrollChanged(e: viewEvents.ViewScrollChangedEvent): boolean {\n\t\treturn true;\n\t}\n\tpublic override onZonesChanged(e: viewEvents.ViewZonesChangedEvent): boolean {\n\t\treturn true;\n\t}\n\n\t// ---- end view event handlers\n\n\tprivate _updateAnchorsViewPositions(): void {\n\t\tconst keys = Object.keys(this._widgets);\n\t\tfor (const widgetId of keys) {\n\t\t\tthis._widgets[widgetId].updateAnchorViewPosition();\n\t\t}\n\t}\n\n\tpublic addWidget(_widget: IContentWidget): void {\n\t\tconst myWidget = new Widget(this._context, this._viewDomNode, _widget);\n\t\tthis._widgets[myWidget.id] = myWidget;\n\n\t\tif (myWidget.allowEditorOverflow) {\n\t\t\tthis.overflowingContentWidgetsDomNode.appendChild(myWidget.domNode);\n\t\t} else {\n\t\t\tthis.domNode.appendChild(myWidget.domNode);\n\t\t}\n\n\t\tthis.setShouldRender();\n\t}\n\n\tpublic setWidgetPosition(widget: IContentWidget, primaryAnchor: IPosition | null, secondaryAnchor: IPosition | null, preference: ContentWidgetPositionPreference[] | null, affinity: PositionAffinity | null): void {\n\t\tconst myWidget = this._widgets[widget.getId()];\n\t\tmyWidget.setPosition(primaryAnchor, secondaryAnchor, preference, affinity);\n\n\t\tif (!myWidget.useDisplayNone) {\n\t\t\tthis.setShouldRender();\n\t\t}\n\t}\n\n\tpublic removeWidget(widget: IContentWidget): void {\n\t\tconst widgetId = widget.getId();\n\t\tif (this._widgets.hasOwnProperty(widgetId)) {\n\t\t\tconst myWidget = this._widgets[widgetId];\n\t\t\tdelete this._widgets[widgetId];\n\n\t\t\tconst domNode = myWidget.domNode.domNode;\n\t\t\tdomNode.remove();\n\t\t\tdomNode.removeAttribute('monaco-visible-content-widget');\n\n\t\t\tthis.setShouldRender();\n\t\t}\n\t}\n\n\tpublic shouldSuppressMouseDownOnWidget(widgetId: string): boolean {\n\t\tif (this._widgets.hasOwnProperty(widgetId)) {\n\t\t\treturn this._widgets[widgetId].suppressMouseDown;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic override onBeforeRender(viewportData: ViewportData): void {\n\t\tconst keys = Object.keys(this._widgets);\n\t\tfor (const widgetId of keys) {\n\t\t\tthis._widgets[widgetId].onBeforeRender(viewportData);\n\t\t}\n\t}\n\n\tpublic prepareRender(ctx: RenderingContext): void {\n\t\tconst keys = Object.keys(this._widgets);\n\t\tfor (const widgetId of keys) {\n\t\t\tthis._widgets[widgetId].prepareRender(ctx);\n\t\t}\n\t}\n\n\tpublic render(ctx: RestrictedRenderingContext): void {\n\t\tconst keys = Object.keys(this._widgets);\n\t\tfor (const widgetId of keys) {\n\t\t\tthis._widgets[widgetId].render(ctx);\n\t\t}\n\t}\n}\n\ninterface IBoxLayoutResult {\n\tfitsAbove: boolean;\n\taboveTop: number;\n\n\tfitsBelow: boolean;\n\tbelowTop: number;\n\n\tleft: number;\n}\n\ninterface IOffViewportRenderData {\n\tkind: 'offViewport';\n\tpreserveFocus: boolean;\n}\n\ninterface IInViewportRenderData {\n\tkind: 'inViewport';\n\tcoordinate: Coordinate;\n\tposition: ContentWidgetPositionPreference;\n}\n\ntype IRenderData = IInViewportRenderData | IOffViewportRenderData;\n\nclass Widget {\n\tprivate readonly _context: ViewContext;\n\tprivate readonly _viewDomNode: FastDomNode<HTMLElement>;\n\tprivate readonly _actual: IContentWidget;\n\n\tpublic readonly domNode: FastDomNode<HTMLElement>;\n\tpublic readonly id: string;\n\tpublic readonly allowEditorOverflow: boolean;\n\tpublic readonly suppressMouseDown: boolean;\n\n\tprivate readonly _fixedOverflowWidgets: boolean;\n\tprivate _contentWidth: number;\n\tprivate _contentLeft: number;\n\n\tprivate _primaryAnchor: PositionPair = new PositionPair(null, null);\n\tprivate _secondaryAnchor: PositionPair = new PositionPair(null, null);\n\tprivate _affinity: PositionAffinity | null;\n\tprivate _preference: ContentWidgetPositionPreference[] | null;\n\tprivate _cachedDomNodeOffsetWidth: number;\n\tprivate _cachedDomNodeOffsetHeight: number;\n\tprivate _maxWidth: number;\n\tprivate _isVisible: boolean;\n\n\tprivate _renderData: IRenderData | null;\n\tpublic readonly useDisplayNone: boolean;\n\n\tconstructor(context: ViewContext, viewDomNode: FastDomNode<HTMLElement>, actual: IContentWidget) {\n\t\tthis._context = context;\n\t\tthis._viewDomNode = viewDomNode;\n\t\tthis._actual = actual;\n\n\t\tconst options = this._context.configuration.options;\n\t\tconst layoutInfo = options.get(EditorOption.layoutInfo);\n\t\tconst allowOverflow = options.get(EditorOption.allowOverflow);\n\n\t\tthis.domNode = createFastDomNode(this._actual.getDomNode());\n\t\tthis.id = this._actual.getId();\n\t\tthis.allowEditorOverflow = (this._actual.allowEditorOverflow || false) && allowOverflow;\n\t\tthis.suppressMouseDown = this._actual.suppressMouseDown || false;\n\t\tthis.useDisplayNone = this._actual.useDisplayNone || false;\n\n\t\tthis._fixedOverflowWidgets = options.get(EditorOption.fixedOverflowWidgets);\n\t\tthis._contentWidth = layoutInfo.contentWidth;\n\t\tthis._contentLeft = layoutInfo.contentLeft;\n\n\t\tthis._affinity = null;\n\t\tthis._preference = [];\n\t\tthis._cachedDomNodeOffsetWidth = -1;\n\t\tthis._cachedDomNodeOffsetHeight = -1;\n\t\tthis._maxWidth = this._getMaxWidth();\n\t\tthis._isVisible = false;\n\t\tthis._renderData = null;\n\n\t\tthis.domNode.setPosition((this._fixedOverflowWidgets && this.allowEditorOverflow) ? 'fixed' : 'absolute');\n\t\tthis.domNode.setDisplay('none');\n\t\tthis.domNode.setVisibility('hidden');\n\t\tthis.domNode.setAttribute('widgetId', this.id);\n\t\tthis.domNode.setMaxWidth(this._maxWidth);\n\t}\n\n\tpublic onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): void {\n\t\tconst options = this._context.configuration.options;\n\t\tif (e.hasChanged(EditorOption.layoutInfo)) {\n\t\t\tconst layoutInfo = options.get(EditorOption.layoutInfo);\n\t\t\tthis._contentLeft = layoutInfo.contentLeft;\n\t\t\tthis._contentWidth = layoutInfo.contentWidth;\n\t\t\tthis._maxWidth = this._getMaxWidth();\n\t\t}\n\t}\n\n\tpublic updateAnchorViewPosition(): void {\n\t\tthis._setPosition(this._affinity, this._primaryAnchor.modelPosition, this._secondaryAnchor.modelPosition);\n\t}\n\n\tprivate _setPosition(affinity: PositionAffinity | null, primaryAnchor: IPosition | null, secondaryAnchor: IPosition | null): void {\n\t\tthis._affinity = affinity;\n\t\tthis._primaryAnchor = getValidPositionPair(primaryAnchor, this._context.viewModel, this._affinity);\n\t\tthis._secondaryAnchor = getValidPositionPair(secondaryAnchor, this._context.viewModel, this._affinity);\n\n\t\tfunction getValidPositionPair(position: IPosition | null, viewModel: IViewModel, affinity: PositionAffinity | null): PositionPair {\n\t\t\tif (!position) {\n\t\t\t\treturn new PositionPair(null, null);\n\t\t\t}\n\t\t\t// Do not trust that widgets give a valid position\n\t\t\tconst validModelPosition = viewModel.model.validatePosition(position);\n\t\t\tif (viewModel.coordinatesConverter.modelPositionIsVisible(validModelPosition)) {\n\t\t\t\tconst viewPosition = viewModel.coordinatesConverter.convertModelPositionToViewPosition(validModelPosition, affinity ?? undefined);\n\t\t\t\treturn new PositionPair(position, viewPosition);\n\t\t\t}\n\t\t\treturn new PositionPair(position, null);\n\t\t}\n\t}\n\n\tprivate _getMaxWidth(): number {\n\t\tconst elDocument = this.domNode.domNode.ownerDocument;\n\t\tconst elWindow = elDocument.defaultView;\n\t\treturn (\n\t\t\tthis.allowEditorOverflow\n\t\t\t\t? elWindow?.innerWidth || elDocument.documentElement.offsetWidth || elDocument.body.offsetWidth\n\t\t\t\t: this._contentWidth\n\t\t);\n\t}\n\n\tpublic setPosition(primaryAnchor: IPosition | null, secondaryAnchor: IPosition | null, preference: ContentWidgetPositionPreference[] | null, affinity: PositionAffinity | null): void {\n\t\tthis._setPosition(affinity, primaryAnchor, secondaryAnchor);\n\t\tthis._preference = preference;\n\t\tif (!this.useDisplayNone && this._primaryAnchor.viewPosition && this._preference && this._preference.length > 0) {\n\t\t\t// this content widget would like to be visible if possible\n\t\t\t// we change it from `display:none` to `display:block` even if it\n\t\t\t// might be outside the viewport such that we can measure its size\n\t\t\t// in `prepareRender`\n\t\t\tthis.domNode.setDisplay('block');\n\t\t} else {\n\t\t\tthis.domNode.setDisplay('none');\n\t\t}\n\t\tthis._cachedDomNodeOffsetWidth = -1;\n\t\tthis._cachedDomNodeOffsetHeight = -1;\n\t}\n\n\tprivate _layoutBoxInViewport(anchor: AnchorCoordinate, width: number, height: number, ctx: RenderingContext): IBoxLayoutResult {\n\t\t// Our visible box is split horizontally by the current line => 2 boxes\n\n\t\t// a) the box above the line\n\t\tconst aboveLineTop = anchor.top;\n\t\tconst heightAvailableAboveLine = aboveLineTop;\n\n\t\t// b) the box under the line\n\t\tconst underLineTop = anchor.top + anchor.height;\n\t\tconst heightAvailableUnderLine = ctx.viewportHeight - underLineTop;\n\n\t\tconst aboveTop = aboveLineTop - height;\n\t\tconst fitsAbove = (heightAvailableAboveLine >= height);\n\t\tconst belowTop = underLineTop;\n\t\tconst fitsBelow = (heightAvailableUnderLine >= height);\n\n\t\t// And its left\n\t\tlet left = anchor.left;\n\t\tif (left + width > ctx.scrollLeft + ctx.viewportWidth) {\n\t\t\tleft = ctx.scrollLeft + ctx.viewportWidth - width;\n\t\t}\n\t\tif (left < ctx.scrollLeft) {\n\t\t\tleft = ctx.scrollLeft;\n\t\t}\n\n\t\treturn { fitsAbove, aboveTop, fitsBelow, belowTop, left };\n\t}\n\n\tprivate _layoutHorizontalSegmentInPage(windowSize: dom.Dimension, domNodePosition: dom.IDomNodePagePosition, left: number, width: number): [number, number] {\n\t\t// Leave some clearance to the left/right\n\t\tconst LEFT_PADDING = 15;\n\t\tconst RIGHT_PADDING = 15;\n\n\t\t// Initially, the limits are defined as the dom node limits\n\t\tconst MIN_LIMIT = Math.max(LEFT_PADDING, domNodePosition.left - width);\n\t\tconst MAX_LIMIT = Math.min(domNodePosition.left + domNodePosition.width + width, windowSize.width - RIGHT_PADDING);\n\n\t\tconst elDocument = this._viewDomNode.domNode.ownerDocument;\n\t\tconst elWindow = elDocument.defaultView;\n\t\tlet absoluteLeft = domNodePosition.left + left - (elWindow?.scrollX ?? 0);\n\n\t\tif (absoluteLeft + width > MAX_LIMIT) {\n\t\t\tconst delta = absoluteLeft - (MAX_LIMIT - width);\n\t\t\tabsoluteLeft -= delta;\n\t\t\tleft -= delta;\n\t\t}\n\n\t\tif (absoluteLeft < MIN_LIMIT) {\n\t\t\tconst delta = absoluteLeft - MIN_LIMIT;\n\t\t\tabsoluteLeft -= delta;\n\t\t\tleft -= delta;\n\t\t}\n\n\t\treturn [left, absoluteLeft];\n\t}\n\n\tprivate _layoutBoxInPage(anchor: AnchorCoordinate, width: number, height: number, ctx: RenderingContext): IBoxLayoutResult | null {\n\t\tconst aboveTop = anchor.top - height;\n\t\tconst belowTop = anchor.top + anchor.height;\n\n\t\tconst domNodePosition = dom.getDomNodePagePosition(this._viewDomNode.domNode);\n\t\tconst elDocument = this._viewDomNode.domNode.ownerDocument;\n\t\tconst elWindow = elDocument.defaultView;\n\t\tconst absoluteAboveTop = domNodePosition.top + aboveTop - (elWindow?.scrollY ?? 0);\n\t\tconst absoluteBelowTop = domNodePosition.top + belowTop - (elWindow?.scrollY ?? 0);\n\n\t\tconst windowSize = dom.getClientArea(elDocument.body);\n\t\tconst [left, absoluteAboveLeft] = this._layoutHorizontalSegmentInPage(windowSize, domNodePosition, anchor.left - ctx.scrollLeft + this._contentLeft, width);\n\n\t\t// Leave some clearance to the top/bottom\n\t\tconst TOP_PADDING = 22;\n\t\tconst BOTTOM_PADDING = 22;\n\n\t\tconst fitsAbove = (absoluteAboveTop >= TOP_PADDING);\n\t\tconst fitsBelow = (absoluteBelowTop + height <= windowSize.height - BOTTOM_PADDING);\n\n\t\tif (this._fixedOverflowWidgets) {\n\t\t\treturn {\n\t\t\t\tfitsAbove,\n\t\t\t\taboveTop: Math.max(absoluteAboveTop, TOP_PADDING),\n\t\t\t\tfitsBelow,\n\t\t\t\tbelowTop: absoluteBelowTop,\n\t\t\t\tleft: absoluteAboveLeft\n\t\t\t};\n\t\t}\n\n\t\treturn { fitsAbove, aboveTop, fitsBelow, belowTop, left };\n\t}\n\n\tprivate _prepareRenderWidgetAtExactPositionOverflowing(topLeft: Coordinate): Coordinate {\n\t\treturn new Coordinate(topLeft.top, topLeft.left + this._contentLeft);\n\t}\n\n\t/**\n\t * Compute the coordinates above and below the primary and secondary anchors.\n\t * The content widget *must* touch the primary anchor.\n\t * The content widget should touch if possible the secondary anchor.\n\t */\n\tprivate _getAnchorsCoordinates(ctx: RenderingContext): { primary: AnchorCoordinate | null; secondary: AnchorCoordinate | null } {\n\t\tconst primary = getCoordinates(this._primaryAnchor.viewPosition, this._affinity);\n\t\tconst secondaryViewPosition = (this._secondaryAnchor.viewPosition?.lineNumber === this._primaryAnchor.viewPosition?.lineNumber ? this._secondaryAnchor.viewPosition : null);\n\t\tconst secondary = getCoordinates(secondaryViewPosition, this._affinity);\n\t\treturn { primary, secondary };\n\n\t\tfunction getCoordinates(position: Position | null, affinity: PositionAffinity | null): AnchorCoordinate | null {\n\t\t\tif (!position) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst horizontalPosition = ctx.visibleRangeForPosition(position);\n\t\t\tif (!horizontalPosition) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\t// Left-align widgets that should appear :before content\n\t\t\tconst left = (position.column === 1 && affinity === PositionAffinity.LeftOfInjectedText ? 0 : horizontalPosition.left);\n\t\t\tconst top = ctx.getVerticalOffsetForLineNumber(position.lineNumber) - ctx.scrollTop;\n\t\t\tconst lineHeight = ctx.getLineHeightForLineNumber(position.lineNumber);\n\t\t\treturn new AnchorCoordinate(top, left, lineHeight);\n\t\t}\n\t}\n\n\tprivate _reduceAnchorCoordinates(primary: AnchorCoordinate, secondary: AnchorCoordinate | null, width: number): AnchorCoordinate {\n\t\tif (!secondary) {\n\t\t\treturn primary;\n\t\t}\n\n\t\tconst fontInfo = this._context.configuration.options.get(EditorOption.fontInfo);\n\n\t\tlet left = secondary.left;\n\t\tif (left < primary.left) {\n\t\t\tleft = Math.max(left, primary.left - width + fontInfo.typicalFullwidthCharacterWidth);\n\t\t} else {\n\t\t\tleft = Math.min(left, primary.left + width - fontInfo.typicalFullwidthCharacterWidth);\n\t\t}\n\t\treturn new AnchorCoordinate(primary.top, left, primary.height);\n\t}\n\n\tprivate _prepareRenderWidget(ctx: RenderingContext): IRenderData | null {\n\t\tif (!this._preference || this._preference.length === 0) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst { primary, secondary } = this._getAnchorsCoordinates(ctx);\n\t\tif (!primary) {\n\t\t\treturn {\n\t\t\t\tkind: 'offViewport',\n\t\t\t\tpreserveFocus: this.domNode.domNode.contains(this.domNode.domNode.ownerDocument.activeElement)\n\t\t\t};\n\t\t\t// return null;\n\t\t}\n\n\t\tif (this._cachedDomNodeOffsetWidth === -1 || this._cachedDomNodeOffsetHeight === -1) {\n\n\t\t\tlet preferredDimensions: IDimension | null = null;\n\t\t\tif (typeof this._actual.beforeRender === 'function') {\n\t\t\t\tpreferredDimensions = safeInvoke(this._actual.beforeRender, this._actual);\n\t\t\t}\n\t\t\tif (preferredDimensions) {\n\t\t\t\tthis._cachedDomNodeOffsetWidth = preferredDimensions.width;\n\t\t\t\tthis._cachedDomNodeOffsetHeight = preferredDimensions.height;\n\t\t\t} else {\n\t\t\t\tconst domNode = this.domNode.domNode;\n\t\t\t\tconst clientRect = domNode.getBoundingClientRect();\n\t\t\t\tthis._cachedDomNodeOffsetWidth = Math.round(clientRect.width);\n\t\t\t\tthis._cachedDomNodeOffsetHeight = Math.round(clientRect.height);\n\t\t\t}\n\t\t}\n\n\t\tconst anchor = this._reduceAnchorCoordinates(primary, secondary, this._cachedDomNodeOffsetWidth);\n\n\t\tlet placement: IBoxLayoutResult | null;\n\t\tif (this.allowEditorOverflow) {\n\t\t\tplacement = this._layoutBoxInPage(anchor, this._cachedDomNodeOffsetWidth, this._cachedDomNodeOffsetHeight, ctx);\n\t\t} else {\n\t\t\tplacement = this._layoutBoxInViewport(anchor, this._cachedDomNodeOffsetWidth, this._cachedDomNodeOffsetHeight, ctx);\n\t\t}\n\n\t\t// Do two passes, first for perfect fit, second picks first option\n\t\tfor (let pass = 1; pass <= 2; pass++) {\n\t\t\tfor (const pref of this._preference) {\n\t\t\t\t// placement\n\t\t\t\tif (pref === ContentWidgetPositionPreference.ABOVE) {\n\t\t\t\t\tif (!placement) {\n\t\t\t\t\t\t// Widget outside of viewport\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\tif (pass === 2 || placement.fitsAbove) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tkind: 'inViewport',\n\t\t\t\t\t\t\tcoordinate: new Coordinate(placement.aboveTop, placement.left),\n\t\t\t\t\t\t\tposition: ContentWidgetPositionPreference.ABOVE\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t} else if (pref === ContentWidgetPositionPreference.BELOW) {\n\t\t\t\t\tif (!placement) {\n\t\t\t\t\t\t// Widget outside of viewport\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\tif (pass === 2 || placement.fitsBelow) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tkind: 'inViewport',\n\t\t\t\t\t\t\tcoordinate: new Coordinate(placement.belowTop, placement.left),\n\t\t\t\t\t\t\tposition: ContentWidgetPositionPreference.BELOW\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (this.allowEditorOverflow) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tkind: 'inViewport',\n\t\t\t\t\t\t\tcoordinate: this._prepareRenderWidgetAtExactPositionOverflowing(new Coordinate(anchor.top, anchor.left)),\n\t\t\t\t\t\t\tposition: ContentWidgetPositionPreference.EXACT\n\t\t\t\t\t\t};\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tkind: 'inViewport',\n\t\t\t\t\t\t\tcoordinate: new Coordinate(anchor.top, anchor.left),\n\t\t\t\t\t\t\tposition: ContentWidgetPositionPreference.EXACT\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t}\n\n\t/**\n\t * On this first pass, we ensure that the content widget (if it is in the viewport) has the max width set correctly.\n\t */\n\tpublic onBeforeRender(viewportData: ViewportData): void {\n\t\tif (!this._primaryAnchor.viewPosition || !this._preference) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._primaryAnchor.viewPosition.lineNumber < viewportData.startLineNumber || this._primaryAnchor.viewPosition.lineNumber > viewportData.endLineNumber) {\n\t\t\t// Outside of viewport\n\t\t\treturn;\n\t\t}\n\n\t\tthis.domNode.setMaxWidth(this._maxWidth);\n\t}\n\n\tpublic prepareRender(ctx: RenderingContext): void {\n\t\tthis._renderData = this._prepareRenderWidget(ctx);\n\t}\n\n\tpublic render(ctx: RestrictedRenderingContext): void {\n\t\tif (!this._renderData || this._renderData.kind === 'offViewport') {\n\t\t\t// This widget should be invisible\n\t\t\tif (this._isVisible) {\n\t\t\t\tthis.domNode.removeAttribute('monaco-visible-content-widget');\n\t\t\t\tthis._isVisible = false;\n\n\t\t\t\tif (this._renderData?.kind === 'offViewport' && this._renderData.preserveFocus) {\n\t\t\t\t\t// widget wants to be shown, but it is outside of the viewport and it\n\t\t\t\t\t// has focus which we need to preserve\n\t\t\t\t\tthis.domNode.setTop(-1000);\n\t\t\t\t} else {\n\t\t\t\t\tthis.domNode.setVisibility('hidden');\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (typeof this._actual.afterRender === 'function') {\n\t\t\t\tsafeInvoke(this._actual.afterRender, this._actual, null, null);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// This widget should be visible\n\t\tif (this.allowEditorOverflow) {\n\t\t\tthis.domNode.setTop(this._renderData.coordinate.top);\n\t\t\tthis.domNode.setLeft(this._renderData.coordinate.left);\n\t\t} else {\n\t\t\tthis.domNode.setTop(this._renderData.coordinate.top + ctx.scrollTop - ctx.bigNumbersDelta);\n\t\t\tthis.domNode.setLeft(this._renderData.coordinate.left);\n\t\t}\n\n\t\tif (!this._isVisible) {\n\t\t\tthis.domNode.setVisibility('inherit');\n\t\t\tthis.domNode.setAttribute('monaco-visible-content-widget', 'true');\n\t\t\tthis._isVisible = true;\n\t\t}\n\n\t\tif (typeof this._actual.afterRender === 'function') {\n\t\t\tsafeInvoke(this._actual.afterRender, this._actual, this._renderData.position, this._renderData.coordinate);\n\t\t}\n\t}\n}\n\nclass PositionPair {\n\tconstructor(\n\t\tpublic readonly modelPosition: IPosition | null,\n\t\tpublic readonly viewPosition: Position | null\n\t) { }\n}\n\nclass Coordinate implements IContentWidgetRenderedCoordinate {\n\t_coordinateBrand: void = undefined;\n\n\tconstructor(\n\t\tpublic readonly top: number,\n\t\tpublic readonly left: number\n\t) { }\n}\n\nclass AnchorCoordinate {\n\t_anchorCoordinateBrand: void = undefined;\n\n\tconstructor(\n\t\tpublic readonly top: number,\n\t\tpublic readonly left: number,\n\t\tpublic readonly height: number\n\t) { }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction safeInvoke<T extends (...args: any[]) => any>(fn: T, thisArg: ThisParameterType<T>, ...args: Parameters<T>): ReturnType<T> | null {\n\ttry {\n\t\treturn fn.call(thisArg, ...args);\n\t} catch {\n\t\t// ignore\n\t\treturn null;\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as dom from '../../../../base/browser/dom.js';\nimport { FastDomNode, createFastDomNode } from '../../../../base/browser/fastDomNode.js';\nimport { ContentWidgetPositionPreference, IContentWidget, IContentWidgetRenderedCoordinate } from '../../editorBrowser.js';\nimport { PartFingerprint, PartFingerprints, ViewPart } from '../../view/viewPart.js';\nimport { RenderingContext, RestrictedRenderingContext } from '../../view/renderingContext.js';\nimport { ViewContext } from '../../../common/viewModel/viewContext.js';\nimport * as viewEvents from '../../../common/viewEvents.js';\nimport { ViewportData } from '../../../common/viewLayout/viewLinesViewportData.js';\nimport { EditorOption } from '../../../common/config/editorOptions.js';\nimport { IDimension } from '../../../common/core/2d/dimension.js';\nimport { PositionAffinity } from '../../../common/model.js';\nimport { IPosition, Position } from '../../../common/core/position.js';\nimport { IViewModel } from '../../../common/viewModel.js';\n\n/**\n * This view part is responsible for rendering the content widgets, which are\n * used for rendering elements that are associated to an editor position,\n * such as suggestions or the parameter hints.\n */\nexport class ViewContentWidgets extends ViewPart {\n\n\tprivate readonly _viewDomNode: FastDomNode<HTMLElement>;\n\tprivate _widgets: { [key: string]: Widget };\n\n\tpublic domNode: FastDomNode<HTMLElement>;\n\tpublic overflowingContentWidgetsDomNode: FastDomNode<HTMLElement>;\n\n\tconstructor(context: ViewContext, viewDomNode: FastDomNode<HTMLElement>) {\n\t\tsuper(context);\n\t\tthis._viewDomNode = viewDomNode;\n\t\tthis._widgets = {};\n\n\t\tthis.domNode = createFastDomNode(document.createElement('div'));\n\t\tPartFingerprints.write(this.domNode, PartFingerprint.ContentWidgets);\n\t\tthis.domNode.setClassName('contentWidgets');\n\t\tthis.domNode.setPosition('absolute');\n\t\tthis.domNode.setTop(0);\n\n\t\tthis.overflowingContentWidgetsDomNode = createFastDomNode(document.createElement('div'));\n\t\tPartFingerprints.write(this.overflowingContentWidgetsDomNode, PartFingerprint.OverflowingContentWidgets);\n\t\tthis.overflowingContentWidgetsDomNode.setClassName('overflowingContentWidgets');\n\t}\n\n\tpublic override dispose(): void {\n\t\tsuper.dispose();\n\t\t// Widgets outlive the view, so detach their dom nodes to not keep this view's DOM alive (#146841)\n\t\tfor (const widget of Object.values(this._widgets)) {\n\t\t\tconst domNode = widget.domNode.domNode;\n\t\t\tif (domNode.parentElement === this.domNode.domNode || domNode.parentElement === this.overflowingContentWidgetsDomNode.domNode) {\n\t\t\t\tdomNode.remove();\n\t\t\t\tdomNode.removeAttribute('monaco-visible-content-widget');\n\t\t\t}\n\t\t}\n\t\tthis._widgets = {};\n\t}\n\n\t// --- begin event handlers\n\n\tpublic override onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): boolean {\n\t\tconst keys = Object.keys(this._widgets);\n\t\tfor (const widgetId of keys) {\n\t\t\tthis._widgets[widgetId].onConfigurationChanged(e);\n\t\t}\n\t\treturn true;\n\t}\n\tpublic override onDecorationsChanged(e: viewEvents.ViewDecorationsChangedEvent): boolean {\n\t\t// true for inline decorations that can end up relayouting text\n\t\treturn true;\n\t}\n\tpublic override onFlushed(e: viewEvents.ViewFlushedEvent): boolean {\n\t\treturn true;\n\t}\n\tpublic override onLineMappingChanged(e: viewEvents.ViewLineMappingChangedEvent): boolean {\n\t\tthis._updateAnchorsViewPositions();\n\t\treturn true;\n\t}\n\tpublic override onLinesChanged(e: viewEvents.ViewLinesChangedEvent): boolean {\n\t\tthis._updateAnchorsViewPositions();\n\t\treturn true;\n\t}\n\tpublic override onLinesDeleted(e: viewEvents.ViewLinesDeletedEvent): boolean {\n\t\tthis._updateAnchorsViewPositions();\n\t\treturn true;\n\t}\n\tpublic override onLinesInserted(e: viewEvents.ViewLinesInsertedEvent): boolean {\n\t\tthis._updateAnchorsViewPositions();\n\t\treturn true;\n\t}\n\tpublic override onScrollChanged(e: viewEvents.ViewScrollChangedEvent): boolean {\n\t\treturn true;\n\t}\n\tpublic override onZonesChanged(e: viewEvents.ViewZonesChangedEvent): boolean {\n\t\treturn true;\n\t}\n\n\t// ---- end view event handlers\n\n\tprivate _updateAnchorsViewPositions(): void {\n\t\tconst keys = Object.keys(this._widgets);\n\t\tfor (const widgetId of keys) {\n\t\t\tthis._widgets[widgetId].updateAnchorViewPosition();\n\t\t}\n\t}\n\n\tpublic addWidget(_widget: IContentWidget): void {\n\t\tconst myWidget = new Widget(this._context, this._viewDomNode, _widget);\n\t\tthis._widgets[myWidget.id] = myWidget;\n\n\t\tif (myWidget.allowEditorOverflow) {\n\t\t\tthis.overflowingContentWidgetsDomNode.appendChild(myWidget.domNode);\n\t\t} else {\n\t\t\tthis.domNode.appendChild(myWidget.domNode);\n\t\t}\n\n\t\tthis.setShouldRender();\n\t}\n\n\tpublic setWidgetPosition(widget: IContentWidget, primaryAnchor: IPosition | null, secondaryAnchor: IPosition | null, preference: ContentWidgetPositionPreference[] | null, affinity: PositionAffinity | null): void {\n\t\tconst myWidget = this._widgets[widget.getId()];\n\t\tmyWidget.setPosition(primaryAnchor, secondaryAnchor, preference, affinity);\n\n\t\tif (!myWidget.useDisplayNone) {\n\t\t\tthis.setShouldRender();\n\t\t}\n\t}\n\n\tpublic removeWidget(widget: IContentWidget): void {\n\t\tconst widgetId = widget.getId();\n\t\tif (this._widgets.hasOwnProperty(widgetId)) {\n\t\t\tconst myWidget = this._widgets[widgetId];\n\t\t\tdelete this._widgets[widgetId];\n\n\t\t\tconst domNode = myWidget.domNode.domNode;\n\t\t\tdomNode.remove();\n\t\t\tdomNode.removeAttribute('monaco-visible-content-widget');\n\n\t\t\tthis.setShouldRender();\n\t\t}\n\t}\n\n\tpublic shouldSuppressMouseDownOnWidget(widgetId: string): boolean {\n\t\tif (this._widgets.hasOwnProperty(widgetId)) {\n\t\t\treturn this._widgets[widgetId].suppressMouseDown;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic override onBeforeRender(viewportData: ViewportData): void {\n\t\tconst keys = Object.keys(this._widgets);\n\t\tfor (const widgetId of keys) {\n\t\t\tthis._widgets[widgetId].onBeforeRender(viewportData);\n\t\t}\n\t}\n\n\tpublic prepareRender(ctx: RenderingContext): void {\n\t\tconst keys = Object.keys(this._widgets);\n\t\tfor (const widgetId of keys) {\n\t\t\tthis._widgets[widgetId].prepareRender(ctx);\n\t\t}\n\t}\n\n\tpublic render(ctx: RestrictedRenderingContext): void {\n\t\tconst keys = Object.keys(this._widgets);\n\t\tfor (const widgetId of keys) {\n\t\t\tthis._widgets[widgetId].render(ctx);\n\t\t}\n\t}\n}\n\ninterface IBoxLayoutResult {\n\tfitsAbove: boolean;\n\taboveTop: number;\n\n\tfitsBelow: boolean;\n\tbelowTop: number;\n\n\tleft: number;\n}\n\ninterface IOffViewportRenderData {\n\tkind: 'offViewport';\n\tpreserveFocus: boolean;\n}\n\ninterface IInViewportRenderData {\n\tkind: 'inViewport';\n\tcoordinate: Coordinate;\n\tposition: ContentWidgetPositionPreference;\n}\n\ntype IRenderData = IInViewportRenderData | IOffViewportRenderData;\n\nclass Widget {\n\tprivate readonly _context: ViewContext;\n\tprivate readonly _viewDomNode: FastDomNode<HTMLElement>;\n\tprivate readonly _actual: IContentWidget;\n\n\tpublic readonly domNode: FastDomNode<HTMLElement>;\n\tpublic readonly id: string;\n\tpublic readonly allowEditorOverflow: boolean;\n\tpublic readonly suppressMouseDown: boolean;\n\n\tprivate readonly _fixedOverflowWidgets: boolean;\n\tprivate _contentWidth: number;\n\tprivate _contentLeft: number;\n\n\tprivate _primaryAnchor: PositionPair = new PositionPair(null, null);\n\tprivate _secondaryAnchor: PositionPair = new PositionPair(null, null);\n\tprivate _affinity: PositionAffinity | null;\n\tprivate _preference: ContentWidgetPositionPreference[] | null;\n\tprivate _cachedDomNodeOffsetWidth: number;\n\tprivate _cachedDomNodeOffsetHeight: number;\n\tprivate _maxWidth: number;\n\tprivate _isVisible: boolean;\n\n\tprivate _renderData: IRenderData | null;\n\tpublic readonly useDisplayNone: boolean;\n\n\tconstructor(context: ViewContext, viewDomNode: FastDomNode<HTMLElement>, actual: IContentWidget) {\n\t\tthis._context = context;\n\t\tthis._viewDomNode = viewDomNode;\n\t\tthis._actual = actual;\n\n\t\tconst options = this._context.configuration.options;\n\t\tconst layoutInfo = options.get(EditorOption.layoutInfo);\n\t\tconst allowOverflow = options.get(EditorOption.allowOverflow);\n\n\t\tthis.domNode = createFastDomNode(this._actual.getDomNode());\n\t\tthis.id = this._actual.getId();\n\t\tthis.allowEditorOverflow = (this._actual.allowEditorOverflow || false) && allowOverflow;\n\t\tthis.suppressMouseDown = this._actual.suppressMouseDown || false;\n\t\tthis.useDisplayNone = this._actual.useDisplayNone || false;\n\n\t\tthis._fixedOverflowWidgets = options.get(EditorOption.fixedOverflowWidgets);\n\t\tthis._contentWidth = layoutInfo.contentWidth;\n\t\tthis._contentLeft = layoutInfo.contentLeft;\n\n\t\tthis._affinity = null;\n\t\tthis._preference = [];\n\t\tthis._cachedDomNodeOffsetWidth = -1;\n\t\tthis._cachedDomNodeOffsetHeight = -1;\n\t\tthis._maxWidth = this._getMaxWidth();\n\t\tthis._isVisible = false;\n\t\tthis._renderData = null;\n\n\t\tthis.domNode.setPosition((this._fixedOverflowWidgets && this.allowEditorOverflow) ? 'fixed' : 'absolute');\n\t\tthis.domNode.setDisplay('none');\n\t\tthis.domNode.setVisibility('hidden');\n\t\tthis.domNode.setAttribute('widgetId', this.id);\n\t\tthis.domNode.setMaxWidth(this._maxWidth);\n\t}\n\n\tpublic onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): void {\n\t\tconst options = this._context.configuration.options;\n\t\tif (e.hasChanged(EditorOption.layoutInfo)) {\n\t\t\tconst layoutInfo = options.get(EditorOption.layoutInfo);\n\t\t\tthis._contentLeft = layoutInfo.contentLeft;\n\t\t\tthis._contentWidth = layoutInfo.contentWidth;\n\t\t\tthis._maxWidth = this._getMaxWidth();\n\t\t}\n\t}\n\n\tpublic updateAnchorViewPosition(): void {\n\t\tthis._setPosition(this._affinity, this._primaryAnchor.modelPosition, this._secondaryAnchor.modelPosition);\n\t}\n\n\tprivate _setPosition(affinity: PositionAffinity | null, primaryAnchor: IPosition | null, secondaryAnchor: IPosition | null): void {\n\t\tthis._affinity = affinity;\n\t\tthis._primaryAnchor = getValidPositionPair(primaryAnchor, this._context.viewModel, this._affinity);\n\t\tthis._secondaryAnchor = getValidPositionPair(secondaryAnchor, this._context.viewModel, this._affinity);\n\n\t\tfunction getValidPositionPair(position: IPosition | null, viewModel: IViewModel, affinity: PositionAffinity | null): PositionPair {\n\t\t\tif (!position) {\n\t\t\t\treturn new PositionPair(null, null);\n\t\t\t}\n\t\t\t// Do not trust that widgets give a valid position\n\t\t\tconst validModelPosition = viewModel.model.validatePosition(position);\n\t\t\tif (viewModel.coordinatesConverter.modelPositionIsVisible(validModelPosition)) {\n\t\t\t\tconst viewPosition = viewModel.coordinatesConverter.convertModelPositionToViewPosition(validModelPosition, affinity ?? undefined);\n\t\t\t\treturn new PositionPair(position, viewPosition);\n\t\t\t}\n\t\t\treturn new PositionPair(position, null);\n\t\t}\n\t}\n\n\tprivate _getMaxWidth(): number {\n\t\tconst elDocument = this.domNode.domNode.ownerDocument;\n\t\tconst elWindow = elDocument.defaultView;\n\t\treturn (\n\t\t\tthis.allowEditorOverflow\n\t\t\t\t? elWindow?.innerWidth || elDocument.documentElement.offsetWidth || elDocument.body.offsetWidth\n\t\t\t\t: this._contentWidth\n\t\t);\n\t}\n\n\tpublic setPosition(primaryAnchor: IPosition | null, secondaryAnchor: IPosition | null, preference: ContentWidgetPositionPreference[] | null, affinity: PositionAffinity | null): void {\n\t\tthis._setPosition(affinity, primaryAnchor, secondaryAnchor);\n\t\tthis._preference = preference;\n\t\tif (!this.useDisplayNone && this._primaryAnchor.viewPosition && this._preference && this._preference.length > 0) {\n\t\t\t// this content widget would like to be visible if possible\n\t\t\t// we change it from `display:none` to `display:block` even if it\n\t\t\t// might be outside the viewport such that we can measure its size\n\t\t\t// in `prepareRender`\n\t\t\tthis.domNode.setDisplay('block');\n\t\t} else {\n\t\t\tthis.domNode.setDisplay('none');\n\t\t}\n\t\tthis._cachedDomNodeOffsetWidth = -1;\n\t\tthis._cachedDomNodeOffsetHeight = -1;\n\t}\n\n\tprivate _layoutBoxInViewport(anchor: AnchorCoordinate, width: number, height: number, ctx: RenderingContext): IBoxLayoutResult {\n\t\t// Our visible box is split horizontally by the current line => 2 boxes\n\n\t\t// a) the box above the line\n\t\tconst aboveLineTop = anchor.top;\n\t\tconst heightAvailableAboveLine = aboveLineTop;\n\n\t\t// b) the box under the line\n\t\tconst underLineTop = anchor.top + anchor.height;\n\t\tconst heightAvailableUnderLine = ctx.viewportHeight - underLineTop;\n\n\t\tconst aboveTop = aboveLineTop - height;\n\t\tconst fitsAbove = (heightAvailableAboveLine >= height);\n\t\tconst belowTop = underLineTop;\n\t\tconst fitsBelow = (heightAvailableUnderLine >= height);\n\n\t\t// And its left\n\t\tlet left = anchor.left;\n\t\tif (left + width > ctx.scrollLeft + ctx.viewportWidth) {\n\t\t\tleft = ctx.scrollLeft + ctx.viewportWidth - width;\n\t\t}\n\t\tif (left < ctx.scrollLeft) {\n\t\t\tleft = ctx.scrollLeft;\n\t\t}\n\n\t\treturn { fitsAbove, aboveTop, fitsBelow, belowTop, left };\n\t}\n\n\tprivate _layoutHorizontalSegmentInPage(windowSize: dom.Dimension, domNodePosition: dom.IDomNodePagePosition, left: number, width: number): [number, number] {\n\t\t// Leave some clearance to the left/right\n\t\tconst LEFT_PADDING = 15;\n\t\tconst RIGHT_PADDING = 15;\n\n\t\t// Initially, the limits are defined as the dom node limits\n\t\tconst MIN_LIMIT = Math.max(LEFT_PADDING, domNodePosition.left - width);\n\t\tconst MAX_LIMIT = Math.min(domNodePosition.left + domNodePosition.width + width, windowSize.width - RIGHT_PADDING);\n\n\t\tconst elDocument = this._viewDomNode.domNode.ownerDocument;\n\t\tconst elWindow = elDocument.defaultView;\n\t\tlet absoluteLeft = domNodePosition.left + left - (elWindow?.scrollX ?? 0);\n\n\t\tif (absoluteLeft + width > MAX_LIMIT) {\n\t\t\tconst delta = absoluteLeft - (MAX_LIMIT - width);\n\t\t\tabsoluteLeft -= delta;\n\t\t\tleft -= delta;\n\t\t}\n\n\t\tif (absoluteLeft < MIN_LIMIT) {\n\t\t\tconst delta = absoluteLeft - MIN_LIMIT;\n\t\t\tabsoluteLeft -= delta;\n\t\t\tleft -= delta;\n\t\t}\n\n\t\treturn [left, absoluteLeft];\n\t}\n\n\tprivate _layoutBoxInPage(anchor: AnchorCoordinate, width: number, height: number, ctx: RenderingContext): IBoxLayoutResult | null {\n\t\tconst aboveTop = anchor.top - height;\n\t\tconst belowTop = anchor.top + anchor.height;\n\n\t\tconst domNodePosition = dom.getDomNodePagePosition(this._viewDomNode.domNode);\n\t\tconst elDocument = this._viewDomNode.domNode.ownerDocument;\n\t\tconst elWindow = elDocument.defaultView;\n\t\tconst absoluteAboveTop = domNodePosition.top + aboveTop - (elWindow?.scrollY ?? 0);\n\t\tconst absoluteBelowTop = domNodePosition.top + belowTop - (elWindow?.scrollY ?? 0);\n\n\t\tconst windowSize = dom.getClientArea(elDocument.body);\n\t\tconst [left, absoluteAboveLeft] = this._layoutHorizontalSegmentInPage(windowSize, domNodePosition, anchor.left - ctx.scrollLeft + this._contentLeft, width);\n\n\t\t// Leave some clearance to the top/bottom\n\t\tconst TOP_PADDING = 22;\n\t\tconst BOTTOM_PADDING = 22;\n\n\t\tconst fitsAbove = (absoluteAboveTop >= TOP_PADDING);\n\t\tconst fitsBelow = (absoluteBelowTop + height <= windowSize.height - BOTTOM_PADDING);\n\n\t\tif (this._fixedOverflowWidgets) {\n\t\t\treturn {\n\t\t\t\tfitsAbove,\n\t\t\t\taboveTop: Math.max(absoluteAboveTop, TOP_PADDING),\n\t\t\t\tfitsBelow,\n\t\t\t\tbelowTop: absoluteBelowTop,\n\t\t\t\tleft: absoluteAboveLeft\n\t\t\t};\n\t\t}\n\n\t\treturn { fitsAbove, aboveTop, fitsBelow, belowTop, left };\n\t}\n\n\tprivate _prepareRenderWidgetAtExactPositionOverflowing(topLeft: Coordinate): Coordinate {\n\t\treturn new Coordinate(topLeft.top, topLeft.left + this._contentLeft);\n\t}\n\n\t/**\n\t * Compute the coordinates above and below the primary and secondary anchors.\n\t * The content widget *must* touch the primary anchor.\n\t * The content widget should touch if possible the secondary anchor.\n\t */\n\tprivate _getAnchorsCoordinates(ctx: RenderingContext): { primary: AnchorCoordinate | null; secondary: AnchorCoordinate | null } {\n\t\tconst primary = getCoordinates(this._primaryAnchor.viewPosition, this._affinity);\n\t\tconst secondaryViewPosition = (this._secondaryAnchor.viewPosition?.lineNumber === this._primaryAnchor.viewPosition?.lineNumber ? this._secondaryAnchor.viewPosition : null);\n\t\tconst secondary = getCoordinates(secondaryViewPosition, this._affinity);\n\t\treturn { primary, secondary };\n\n\t\tfunction getCoordinates(position: Position | null, affinity: PositionAffinity | null): AnchorCoordinate | null {\n\t\t\tif (!position) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst horizontalPosition = ctx.visibleRangeForPosition(position);\n\t\t\tif (!horizontalPosition) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\t// Left-align widgets that should appear :before content\n\t\t\tconst left = (position.column === 1 && affinity === PositionAffinity.LeftOfInjectedText ? 0 : horizontalPosition.left);\n\t\t\tconst top = ctx.getVerticalOffsetForLineNumber(position.lineNumber) - ctx.scrollTop;\n\t\t\tconst lineHeight = ctx.getLineHeightForLineNumber(position.lineNumber);\n\t\t\treturn new AnchorCoordinate(top, left, lineHeight);\n\t\t}\n\t}\n\n\tprivate _reduceAnchorCoordinates(primary: AnchorCoordinate, secondary: AnchorCoordinate | null, width: number): AnchorCoordinate {\n\t\tif (!secondary) {\n\t\t\treturn primary;\n\t\t}\n\n\t\tconst fontInfo = this._context.configuration.options.get(EditorOption.fontInfo);\n\n\t\tlet left = secondary.left;\n\t\tif (left < primary.left) {\n\t\t\tleft = Math.max(left, primary.left - width + fontInfo.typicalFullwidthCharacterWidth);\n\t\t} else {\n\t\t\tleft = Math.min(left, primary.left + width - fontInfo.typicalFullwidthCharacterWidth);\n\t\t}\n\t\treturn new AnchorCoordinate(primary.top, left, primary.height);\n\t}\n\n\tprivate _prepareRenderWidget(ctx: RenderingContext): IRenderData | null {\n\t\tif (!this._preference || this._preference.length === 0) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst { primary, secondary } = this._getAnchorsCoordinates(ctx);\n\t\tif (!primary) {\n\t\t\treturn {\n\t\t\t\tkind: 'offViewport',\n\t\t\t\tpreserveFocus: this.domNode.domNode.contains(this.domNode.domNode.ownerDocument.activeElement)\n\t\t\t};\n\t\t\t// return null;\n\t\t}\n\n\t\tif (this._cachedDomNodeOffsetWidth === -1 || this._cachedDomNodeOffsetHeight === -1) {\n\n\t\t\tlet preferredDimensions: IDimension | null = null;\n\t\t\tif (typeof this._actual.beforeRender === 'function') {\n\t\t\t\tpreferredDimensions = safeInvoke(this._actual.beforeRender, this._actual);\n\t\t\t}\n\t\t\tif (preferredDimensions) {\n\t\t\t\tthis._cachedDomNodeOffsetWidth = preferredDimensions.width;\n\t\t\t\tthis._cachedDomNodeOffsetHeight = preferredDimensions.height;\n\t\t\t} else {\n\t\t\t\tconst domNode = this.domNode.domNode;\n\t\t\t\tconst clientRect = domNode.getBoundingClientRect();\n\t\t\t\tthis._cachedDomNodeOffsetWidth = Math.round(clientRect.width);\n\t\t\t\tthis._cachedDomNodeOffsetHeight = Math.round(clientRect.height);\n\t\t\t}\n\t\t}\n\n\t\tconst anchor = this._reduceAnchorCoordinates(primary, secondary, this._cachedDomNodeOffsetWidth);\n\n\t\tlet placement: IBoxLayoutResult | null;\n\t\tif (this.allowEditorOverflow) {\n\t\t\tplacement = this._layoutBoxInPage(anchor, this._cachedDomNodeOffsetWidth, this._cachedDomNodeOffsetHeight, ctx);\n\t\t} else {\n\t\t\tplacement = this._layoutBoxInViewport(anchor, this._cachedDomNodeOffsetWidth, this._cachedDomNodeOffsetHeight, ctx);\n\t\t}\n\n\t\t// Do two passes, first for perfect fit, second picks first option\n\t\tfor (let pass = 1; pass <= 2; pass++) {\n\t\t\tfor (const pref of this._preference) {\n\t\t\t\t// placement\n\t\t\t\tif (pref === ContentWidgetPositionPreference.ABOVE) {\n\t\t\t\t\tif (!placement) {\n\t\t\t\t\t\t// Widget outside of viewport\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\tif (pass === 2 || placement.fitsAbove) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tkind: 'inViewport',\n\t\t\t\t\t\t\tcoordinate: new Coordinate(placement.aboveTop, placement.left),\n\t\t\t\t\t\t\tposition: ContentWidgetPositionPreference.ABOVE\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t} else if (pref === ContentWidgetPositionPreference.BELOW) {\n\t\t\t\t\tif (!placement) {\n\t\t\t\t\t\t// Widget outside of viewport\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\tif (pass === 2 || placement.fitsBelow) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tkind: 'inViewport',\n\t\t\t\t\t\t\tcoordinate: new Coordinate(placement.belowTop, placement.left),\n\t\t\t\t\t\t\tposition: ContentWidgetPositionPreference.BELOW\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (this.allowEditorOverflow) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tkind: 'inViewport',\n\t\t\t\t\t\t\tcoordinate: this._prepareRenderWidgetAtExactPositionOverflowing(new Coordinate(anchor.top, anchor.left)),\n\t\t\t\t\t\t\tposition: ContentWidgetPositionPreference.EXACT\n\t\t\t\t\t\t};\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tkind: 'inViewport',\n\t\t\t\t\t\t\tcoordinate: new Coordinate(anchor.top, anchor.left),\n\t\t\t\t\t\t\tposition: ContentWidgetPositionPreference.EXACT\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t}\n\n\t/**\n\t * On this first pass, we ensure that the content widget (if it is in the viewport) has the max width set correctly.\n\t */\n\tpublic onBeforeRender(viewportData: ViewportData): void {\n\t\tif (!this._primaryAnchor.viewPosition || !this._preference) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._primaryAnchor.viewPosition.lineNumber < viewportData.startLineNumber || this._primaryAnchor.viewPosition.lineNumber > viewportData.endLineNumber) {\n\t\t\t// Outside of viewport\n\t\t\treturn;\n\t\t}\n\n\t\tthis.domNode.setMaxWidth(this._maxWidth);\n\t}\n\n\tpublic prepareRender(ctx: RenderingContext): void {\n\t\tthis._renderData = this._prepareRenderWidget(ctx);\n\t}\n\n\tpublic render(ctx: RestrictedRenderingContext): void {\n\t\tif (!this._renderData || this._renderData.kind === 'offViewport') {\n\t\t\t// This widget should be invisible\n\t\t\tif (this._isVisible) {\n\t\t\t\tthis.domNode.removeAttribute('monaco-visible-content-widget');\n\t\t\t\tthis._isVisible = false;\n\n\t\t\t\tif (this._renderData?.kind === 'offViewport' && this._renderData.preserveFocus) {\n\t\t\t\t\t// widget wants to be shown, but it is outside of the viewport and it\n\t\t\t\t\t// has focus which we need to preserve\n\t\t\t\t\tthis.domNode.setTop(-1000);\n\t\t\t\t} else {\n\t\t\t\t\tthis.domNode.setVisibility('hidden');\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (typeof this._actual.afterRender === 'function') {\n\t\t\t\tsafeInvoke(this._actual.afterRender, this._actual, null, null);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// This widget should be visible\n\t\tif (this.allowEditorOverflow) {\n\t\t\tthis.domNode.setTop(this._renderData.coordinate.top);\n\t\t\tthis.domNode.setLeft(this._renderData.coordinate.left);\n\t\t} else {\n\t\t\tthis.domNode.setTop(this._renderData.coordinate.top + ctx.scrollTop - ctx.bigNumbersDelta);\n\t\t\tthis.domNode.setLeft(this._renderData.coordinate.left);\n\t\t}\n\n\t\tif (!this._isVisible) {\n\t\t\tthis.domNode.setVisibility('inherit');\n\t\t\tthis.domNode.setAttribute('monaco-visible-content-widget', 'true');\n\t\t\tthis._isVisible = true;\n\t\t}\n\n\t\tif (typeof this._actual.afterRender === 'function') {\n\t\t\tsafeInvoke(this._actual.afterRender, this._actual, this._renderData.position, this._renderData.coordinate);\n\t\t}\n\t}\n}\n\nclass PositionPair {\n\tconstructor(\n\t\tpublic readonly modelPosition: IPosition | null,\n\t\tpublic readonly viewPosition: Position | null\n\t) { }\n}\n\nclass Coordinate implements IContentWidgetRenderedCoordinate {\n\t_coordinateBrand: void = undefined;\n\n\tconstructor(\n\t\tpublic readonly top: number,\n\t\tpublic readonly left: number\n\t) { }\n}\n\nclass AnchorCoordinate {\n\t_anchorCoordinateBrand: void = undefined;\n\n\tconstructor(\n\t\tpublic readonly top: number,\n\t\tpublic readonly left: number,\n\t\tpublic readonly height: number\n\t) { }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction safeInvoke<T extends (...args: any[]) => any>(fn: T, thisArg: ThisParameterType<T>, ...args: Parameters<T>): ReturnType<T> | null {\n\ttry {\n\t\treturn fn.call(thisArg, ...args);\n\t} catch {\n\t\t// ignore\n\t\treturn null;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/browser/viewParts/contentWidgets/contentWidgets.ts","vs/editor/browser/viewParts/contentWidgets/contentWidgets.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,GAAG,MAAM,i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,YAAY,CAAiB;IAC1C,CAAC;CACL;AAED,MAAM,UAAU;IAGf,YACiB,GAAW,EACX,IAAY;QADZ,QAAG,GAAH,GAAG,CAAQ;QACX,SAAI,GAAJ,IAAI,CAAQ;QAJ7B,qBAAgB,GAAS,SAAS,CAAC;IAK/B,CAAC;CACL;AAED,MAAM,gBAAgB;IAGrB,YACiB,GAAW,EACX,IAAY,EACZ,MAAc;QAFd,QAAG,GAAH,GAAG,CAAQ;QACX,SAAI,GAAJ,IAAI,CAAQ;QACZ,WAAM,GAAN,MAAM,CAAQ;QAL/B,2BAAsB,GAAS,SAAS,CAAC;IAMrC,CAAC;CACL;AAED,8DAA8D;AAC9D,SAAS,UAAU,CAAoC,EAAK,EAAE,OAA6B,EAAE,GAAG,IAAmB;IAClH,IAAI,CAAC;QACJ,OAAO,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;IAClC,CAAC;IAAC,MAAM,CAAC;QACR,SAAS;QACT,OAAO,IAAI,CAAC;IACb,CAAC;AACF,CAAC","file":"contentWidgets.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 * as dom from '../../../../base/browser/dom.js';\nimport { FastDomNode, createFastDomNode } from '../../../../base/browser/fastDomNode.js';\nimport { ContentWidgetPositionPreference, IContentWidget, IContentWidgetRenderedCoordinate } from '../../editorBrowser.js';\nimport { PartFingerprint, PartFingerprints, ViewPart } from '../../view/viewPart.js';\nimport { RenderingContext, RestrictedRenderingContext } from '../../view/renderingContext.js';\nimport { ViewContext } from '../../../common/viewModel/viewContext.js';\nimport * as viewEvents from '../../../common/viewEvents.js';\nimport { ViewportData } from '../../../common/viewLayout/viewLinesViewportData.js';\nimport { EditorOption } from '../../../common/config/editorOptions.js';\nimport { IDimension } from '../../../common/core/2d/dimension.js';\nimport { PositionAffinity } from '../../../common/model.js';\nimport { IPosition, Position } from '../../../common/core/position.js';\nimport { IViewModel } from '../../../common/viewModel.js';\n\n/**\n * Clearance kept between a widget overflowing the editor and the left/right edges of the window.\n */\nconst OVERFLOWING_WIDGET_WINDOW_PADDING = 15;\n\n/**\n * This view part is responsible for rendering the content widgets, which are\n * used for rendering elements that are associated to an editor position,\n * such as suggestions or the parameter hints.\n */\nexport class ViewContentWidgets extends ViewPart {\n\n\tprivate readonly _viewDomNode: FastDomNode<HTMLElement>;\n\tprivate _widgets: { [key: string]: Widget };\n\n\tpublic domNode: FastDomNode<HTMLElement>;\n\tpublic overflowingContentWidgetsDomNode: FastDomNode<HTMLElement>;\n\n\tconstructor(context: ViewContext, viewDomNode: FastDomNode<HTMLElement>) {\n\t\tsuper(context);\n\t\tthis._viewDomNode = viewDomNode;\n\t\tthis._widgets = {};\n\n\t\tthis.domNode = createFastDomNode(document.createElement('div'));\n\t\tPartFingerprints.write(this.domNode, PartFingerprint.ContentWidgets);\n\t\tthis.domNode.setClassName('contentWidgets');\n\t\tthis.domNode.setPosition('absolute');\n\t\tthis.domNode.setTop(0);\n\n\t\tthis.overflowingContentWidgetsDomNode = createFastDomNode(document.createElement('div'));\n\t\tPartFingerprints.write(this.overflowingContentWidgetsDomNode, PartFingerprint.OverflowingContentWidgets);\n\t\tthis.overflowingContentWidgetsDomNode.setClassName('overflowingContentWidgets');\n\t}\n\n\tpublic override dispose(): void {\n\t\tsuper.dispose();\n\t\t// Widgets outlive the view, so detach their dom nodes to not keep this view's DOM alive (#146841)\n\t\tfor (const widget of Object.values(this._widgets)) {\n\t\t\tconst domNode = widget.domNode.domNode;\n\t\t\tif (domNode.parentElement === this.domNode.domNode || domNode.parentElement === this.overflowingContentWidgetsDomNode.domNode) {\n\t\t\t\tdomNode.remove();\n\t\t\t\tdomNode.removeAttribute('monaco-visible-content-widget');\n\t\t\t}\n\t\t}\n\t\tthis._widgets = {};\n\t}\n\n\t// --- begin event handlers\n\n\tpublic override onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): boolean {\n\t\tconst keys = Object.keys(this._widgets);\n\t\tfor (const widgetId of keys) {\n\t\t\tthis._widgets[widgetId].onConfigurationChanged(e);\n\t\t}\n\t\treturn true;\n\t}\n\tpublic override onDecorationsChanged(e: viewEvents.ViewDecorationsChangedEvent): boolean {\n\t\t// true for inline decorations that can end up relayouting text\n\t\treturn true;\n\t}\n\tpublic override onFlushed(e: viewEvents.ViewFlushedEvent): boolean {\n\t\treturn true;\n\t}\n\tpublic override onLineMappingChanged(e: viewEvents.ViewLineMappingChangedEvent): boolean {\n\t\tthis._updateAnchorsViewPositions();\n\t\treturn true;\n\t}\n\tpublic override onLinesChanged(e: viewEvents.ViewLinesChangedEvent): boolean {\n\t\tthis._updateAnchorsViewPositions();\n\t\treturn true;\n\t}\n\tpublic override onLinesDeleted(e: viewEvents.ViewLinesDeletedEvent): boolean {\n\t\tthis._updateAnchorsViewPositions();\n\t\treturn true;\n\t}\n\tpublic override onLinesInserted(e: viewEvents.ViewLinesInsertedEvent): boolean {\n\t\tthis._updateAnchorsViewPositions();\n\t\treturn true;\n\t}\n\tpublic override onScrollChanged(e: viewEvents.ViewScrollChangedEvent): boolean {\n\t\treturn true;\n\t}\n\tpublic override onZonesChanged(e: viewEvents.ViewZonesChangedEvent): boolean {\n\t\treturn true;\n\t}\n\n\t// ---- end view event handlers\n\n\tprivate _updateAnchorsViewPositions(): void {\n\t\tconst keys = Object.keys(this._widgets);\n\t\tfor (const widgetId of keys) {\n\t\t\tthis._widgets[widgetId].updateAnchorViewPosition();\n\t\t}\n\t}\n\n\tpublic addWidget(_widget: IContentWidget): void {\n\t\tconst myWidget = new Widget(this._context, this._viewDomNode, _widget);\n\t\tthis._widgets[myWidget.id] = myWidget;\n\n\t\tif (myWidget.allowEditorOverflow) {\n\t\t\tthis.overflowingContentWidgetsDomNode.appendChild(myWidget.domNode);\n\t\t} else {\n\t\t\tthis.domNode.appendChild(myWidget.domNode);\n\t\t}\n\n\t\tthis.setShouldRender();\n\t}\n\n\tpublic setWidgetPosition(widget: IContentWidget, primaryAnchor: IPosition | null, secondaryAnchor: IPosition | null, preference: ContentWidgetPositionPreference[] | null, affinity: PositionAffinity | null): void {\n\t\tconst myWidget = this._widgets[widget.getId()];\n\t\tmyWidget.setPosition(primaryAnchor, secondaryAnchor, preference, affinity);\n\n\t\tif (!myWidget.useDisplayNone) {\n\t\t\tthis.setShouldRender();\n\t\t}\n\t}\n\n\tpublic removeWidget(widget: IContentWidget): void {\n\t\tconst widgetId = widget.getId();\n\t\tif (this._widgets.hasOwnProperty(widgetId)) {\n\t\t\tconst myWidget = this._widgets[widgetId];\n\t\t\tdelete this._widgets[widgetId];\n\n\t\t\tconst domNode = myWidget.domNode.domNode;\n\t\t\tdomNode.remove();\n\t\t\tdomNode.removeAttribute('monaco-visible-content-widget');\n\n\t\t\tthis.setShouldRender();\n\t\t}\n\t}\n\n\tpublic shouldSuppressMouseDownOnWidget(widgetId: string): boolean {\n\t\tif (this._widgets.hasOwnProperty(widgetId)) {\n\t\t\treturn this._widgets[widgetId].suppressMouseDown;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic override onBeforeRender(viewportData: ViewportData): void {\n\t\tconst keys = Object.keys(this._widgets);\n\t\tfor (const widgetId of keys) {\n\t\t\tthis._widgets[widgetId].onBeforeRender(viewportData);\n\t\t}\n\t}\n\n\tpublic prepareRender(ctx: RenderingContext): void {\n\t\tconst keys = Object.keys(this._widgets);\n\t\tfor (const widgetId of keys) {\n\t\t\tthis._widgets[widgetId].prepareRender(ctx);\n\t\t}\n\t}\n\n\tpublic render(ctx: RestrictedRenderingContext): void {\n\t\tconst keys = Object.keys(this._widgets);\n\t\tfor (const widgetId of keys) {\n\t\t\tthis._widgets[widgetId].render(ctx);\n\t\t}\n\t}\n}\n\ninterface IBoxLayoutResult {\n\tfitsAbove: boolean;\n\taboveTop: number;\n\n\tfitsBelow: boolean;\n\tbelowTop: number;\n\n\tleft: number;\n}\n\ninterface IOffViewportRenderData {\n\tkind: 'offViewport';\n\tpreserveFocus: boolean;\n}\n\ninterface IInViewportRenderData {\n\tkind: 'inViewport';\n\tcoordinate: Coordinate;\n\tposition: ContentWidgetPositionPreference;\n}\n\ntype IRenderData = IInViewportRenderData | IOffViewportRenderData;\n\nclass Widget {\n\tprivate readonly _context: ViewContext;\n\tprivate readonly _viewDomNode: FastDomNode<HTMLElement>;\n\tprivate readonly _actual: IContentWidget;\n\n\tpublic readonly domNode: FastDomNode<HTMLElement>;\n\tpublic readonly id: string;\n\tpublic readonly allowEditorOverflow: boolean;\n\tpublic readonly suppressMouseDown: boolean;\n\n\tprivate readonly _fixedOverflowWidgets: boolean;\n\tprivate _contentWidth: number;\n\tprivate _contentLeft: number;\n\n\tprivate _primaryAnchor: PositionPair = new PositionPair(null, null);\n\tprivate _secondaryAnchor: PositionPair = new PositionPair(null, null);\n\tprivate _affinity: PositionAffinity | null;\n\tprivate _preference: ContentWidgetPositionPreference[] | null;\n\tprivate _cachedDomNodeOffsetWidth: number;\n\tprivate _cachedDomNodeOffsetHeight: number;\n\tprivate _maxWidth: number;\n\tprivate _isVisible: boolean;\n\n\tprivate _renderData: IRenderData | null;\n\tpublic readonly useDisplayNone: boolean;\n\n\tconstructor(context: ViewContext, viewDomNode: FastDomNode<HTMLElement>, actual: IContentWidget) {\n\t\tthis._context = context;\n\t\tthis._viewDomNode = viewDomNode;\n\t\tthis._actual = actual;\n\n\t\tconst options = this._context.configuration.options;\n\t\tconst layoutInfo = options.get(EditorOption.layoutInfo);\n\t\tconst allowOverflow = options.get(EditorOption.allowOverflow);\n\n\t\tthis.domNode = createFastDomNode(this._actual.getDomNode());\n\t\tthis.id = this._actual.getId();\n\t\tthis.allowEditorOverflow = (this._actual.allowEditorOverflow || false) && allowOverflow;\n\t\tthis.suppressMouseDown = this._actual.suppressMouseDown || false;\n\t\tthis.useDisplayNone = this._actual.useDisplayNone || false;\n\n\t\tthis._fixedOverflowWidgets = options.get(EditorOption.fixedOverflowWidgets);\n\t\tthis._contentWidth = layoutInfo.contentWidth;\n\t\tthis._contentLeft = layoutInfo.contentLeft;\n\n\t\tthis._affinity = null;\n\t\tthis._preference = [];\n\t\tthis._cachedDomNodeOffsetWidth = -1;\n\t\tthis._cachedDomNodeOffsetHeight = -1;\n\t\tthis._maxWidth = this._getMaxWidth();\n\t\tthis._isVisible = false;\n\t\tthis._renderData = null;\n\n\t\tthis.domNode.setPosition((this._fixedOverflowWidgets && this.allowEditorOverflow) ? 'fixed' : 'absolute');\n\t\tthis.domNode.setDisplay('none');\n\t\tthis.domNode.setVisibility('hidden');\n\t\tthis.domNode.setAttribute('widgetId', this.id);\n\t\tthis.domNode.setMaxWidth(this._maxWidth);\n\t}\n\n\tpublic onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): void {\n\t\tconst options = this._context.configuration.options;\n\t\tif (e.hasChanged(EditorOption.layoutInfo)) {\n\t\t\tconst layoutInfo = options.get(EditorOption.layoutInfo);\n\t\t\tthis._contentLeft = layoutInfo.contentLeft;\n\t\t\tthis._contentWidth = layoutInfo.contentWidth;\n\t\t\tthis._maxWidth = this._getMaxWidth();\n\t\t}\n\t}\n\n\tpublic updateAnchorViewPosition(): void {\n\t\tthis._setPosition(this._affinity, this._primaryAnchor.modelPosition, this._secondaryAnchor.modelPosition);\n\t}\n\n\tprivate _setPosition(affinity: PositionAffinity | null, primaryAnchor: IPosition | null, secondaryAnchor: IPosition | null): void {\n\t\tthis._affinity = affinity;\n\t\tthis._primaryAnchor = getValidPositionPair(primaryAnchor, this._context.viewModel, this._affinity);\n\t\tthis._secondaryAnchor = getValidPositionPair(secondaryAnchor, this._context.viewModel, this._affinity);\n\n\t\tfunction getValidPositionPair(position: IPosition | null, viewModel: IViewModel, affinity: PositionAffinity | null): PositionPair {\n\t\t\tif (!position) {\n\t\t\t\treturn new PositionPair(null, null);\n\t\t\t}\n\t\t\t// Do not trust that widgets give a valid position\n\t\t\tconst validModelPosition = viewModel.model.validatePosition(position);\n\t\t\tif (viewModel.coordinatesConverter.modelPositionIsVisible(validModelPosition)) {\n\t\t\t\tconst viewPosition = viewModel.coordinatesConverter.convertModelPositionToViewPosition(validModelPosition, affinity ?? undefined);\n\t\t\t\treturn new PositionPair(position, viewPosition);\n\t\t\t}\n\t\t\treturn new PositionPair(position, null);\n\t\t}\n\t}\n\n\tprivate _getMaxWidth(): number {\n\t\tconst elDocument = this.domNode.domNode.ownerDocument;\n\t\tconst elWindow = elDocument.defaultView;\n\t\tif (!this.allowEditorOverflow) {\n\t\t\treturn this._contentWidth;\n\t\t}\n\t\tconst windowWidth = elWindow?.innerWidth || elDocument.documentElement.offsetWidth || elDocument.body.offsetWidth;\n\t\t// A wider widget cannot keep the padding on both sides of the window, see _layoutHorizontalSegmentInPage\n\t\treturn Math.max(0, windowWidth - 2 * OVERFLOWING_WIDGET_WINDOW_PADDING);\n\t}\n\n\tpublic setPosition(primaryAnchor: IPosition | null, secondaryAnchor: IPosition | null, preference: ContentWidgetPositionPreference[] | null, affinity: PositionAffinity | null): void {\n\t\tthis._setPosition(affinity, primaryAnchor, secondaryAnchor);\n\t\tthis._preference = preference;\n\t\tif (!this.useDisplayNone && this._primaryAnchor.viewPosition && this._preference && this._preference.length > 0) {\n\t\t\t// this content widget would like to be visible if possible\n\t\t\t// we change it from `display:none` to `display:block` even if it\n\t\t\t// might be outside the viewport such that we can measure its size\n\t\t\t// in `prepareRender`\n\t\t\tthis.domNode.setDisplay('block');\n\t\t} else {\n\t\t\tthis.domNode.setDisplay('none');\n\t\t}\n\t\tthis._cachedDomNodeOffsetWidth = -1;\n\t\tthis._cachedDomNodeOffsetHeight = -1;\n\t}\n\n\tprivate _layoutBoxInViewport(anchor: AnchorCoordinate, width: number, height: number, ctx: RenderingContext): IBoxLayoutResult {\n\t\t// Our visible box is split horizontally by the current line => 2 boxes\n\n\t\t// a) the box above the line\n\t\tconst aboveLineTop = anchor.top;\n\t\tconst heightAvailableAboveLine = aboveLineTop;\n\n\t\t// b) the box under the line\n\t\tconst underLineTop = anchor.top + anchor.height;\n\t\tconst heightAvailableUnderLine = ctx.viewportHeight - underLineTop;\n\n\t\tconst aboveTop = aboveLineTop - height;\n\t\tconst fitsAbove = (heightAvailableAboveLine >= height);\n\t\tconst belowTop = underLineTop;\n\t\tconst fitsBelow = (heightAvailableUnderLine >= height);\n\n\t\t// And its left\n\t\tlet left = anchor.left;\n\t\tif (left + width > ctx.scrollLeft + ctx.viewportWidth) {\n\t\t\tleft = ctx.scrollLeft + ctx.viewportWidth - width;\n\t\t}\n\t\tif (left < ctx.scrollLeft) {\n\t\t\tleft = ctx.scrollLeft;\n\t\t}\n\n\t\treturn { fitsAbove, aboveTop, fitsBelow, belowTop, left };\n\t}\n\n\tprivate _layoutHorizontalSegmentInPage(windowSize: dom.Dimension, domNodePosition: dom.IDomNodePagePosition, left: number, width: number): [number, number] {\n\t\t// Initially, the limits are defined as the dom node limits\n\t\tconst MIN_LIMIT = Math.max(OVERFLOWING_WIDGET_WINDOW_PADDING, domNodePosition.left - width);\n\t\tconst MAX_LIMIT = Math.min(domNodePosition.left + domNodePosition.width + width, windowSize.width - OVERFLOWING_WIDGET_WINDOW_PADDING);\n\n\t\tconst elDocument = this._viewDomNode.domNode.ownerDocument;\n\t\tconst elWindow = elDocument.defaultView;\n\t\tlet absoluteLeft = domNodePosition.left + left - (elWindow?.scrollX ?? 0);\n\n\t\tif (absoluteLeft + width > MAX_LIMIT) {\n\t\t\tconst delta = absoluteLeft - (MAX_LIMIT - width);\n\t\t\tabsoluteLeft -= delta;\n\t\t\tleft -= delta;\n\t\t}\n\n\t\tif (absoluteLeft < MIN_LIMIT) {\n\t\t\tconst delta = absoluteLeft - MIN_LIMIT;\n\t\t\tabsoluteLeft -= delta;\n\t\t\tleft -= delta;\n\t\t}\n\n\t\treturn [left, absoluteLeft];\n\t}\n\n\tprivate _layoutBoxInPage(anchor: AnchorCoordinate, width: number, height: number, ctx: RenderingContext): IBoxLayoutResult | null {\n\t\tconst aboveTop = anchor.top - height;\n\t\tconst belowTop = anchor.top + anchor.height;\n\n\t\tconst domNodePosition = dom.getDomNodePagePosition(this._viewDomNode.domNode);\n\t\tconst elDocument = this._viewDomNode.domNode.ownerDocument;\n\t\tconst elWindow = elDocument.defaultView;\n\t\tconst absoluteAboveTop = domNodePosition.top + aboveTop - (elWindow?.scrollY ?? 0);\n\t\tconst absoluteBelowTop = domNodePosition.top + belowTop - (elWindow?.scrollY ?? 0);\n\n\t\tconst windowSize = dom.getClientArea(elDocument.body);\n\t\tconst [left, absoluteAboveLeft] = this._layoutHorizontalSegmentInPage(windowSize, domNodePosition, anchor.left - ctx.scrollLeft + this._contentLeft, width);\n\n\t\t// Leave some clearance to the top/bottom\n\t\tconst TOP_PADDING = 22;\n\t\tconst BOTTOM_PADDING = 22;\n\n\t\tconst fitsAbove = (absoluteAboveTop >= TOP_PADDING);\n\t\tconst fitsBelow = (absoluteBelowTop + height <= windowSize.height - BOTTOM_PADDING);\n\n\t\tif (this._fixedOverflowWidgets) {\n\t\t\treturn {\n\t\t\t\tfitsAbove,\n\t\t\t\taboveTop: Math.max(absoluteAboveTop, TOP_PADDING),\n\t\t\t\tfitsBelow,\n\t\t\t\tbelowTop: absoluteBelowTop,\n\t\t\t\tleft: absoluteAboveLeft\n\t\t\t};\n\t\t}\n\n\t\treturn { fitsAbove, aboveTop, fitsBelow, belowTop, left };\n\t}\n\n\tprivate _prepareRenderWidgetAtExactPositionOverflowing(topLeft: Coordinate): Coordinate {\n\t\treturn new Coordinate(topLeft.top, topLeft.left + this._contentLeft);\n\t}\n\n\t/**\n\t * Compute the coordinates above and below the primary and secondary anchors.\n\t * The content widget *must* touch the primary anchor.\n\t * The content widget should touch if possible the secondary anchor.\n\t */\n\tprivate _getAnchorsCoordinates(ctx: RenderingContext): { primary: AnchorCoordinate | null; secondary: AnchorCoordinate | null } {\n\t\tconst primary = getCoordinates(this._primaryAnchor.viewPosition, this._affinity);\n\t\tconst secondaryViewPosition = (this._secondaryAnchor.viewPosition?.lineNumber === this._primaryAnchor.viewPosition?.lineNumber ? this._secondaryAnchor.viewPosition : null);\n\t\tconst secondary = getCoordinates(secondaryViewPosition, this._affinity);\n\t\treturn { primary, secondary };\n\n\t\tfunction getCoordinates(position: Position | null, affinity: PositionAffinity | null): AnchorCoordinate | null {\n\t\t\tif (!position) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst horizontalPosition = ctx.visibleRangeForPosition(position);\n\t\t\tif (!horizontalPosition) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\t// Left-align widgets that should appear :before content\n\t\t\tconst left = (position.column === 1 && affinity === PositionAffinity.LeftOfInjectedText ? 0 : horizontalPosition.left);\n\t\t\tconst top = ctx.getVerticalOffsetForLineNumber(position.lineNumber) - ctx.scrollTop;\n\t\t\tconst lineHeight = ctx.getLineHeightForLineNumber(position.lineNumber);\n\t\t\treturn new AnchorCoordinate(top, left, lineHeight);\n\t\t}\n\t}\n\n\tprivate _reduceAnchorCoordinates(primary: AnchorCoordinate, secondary: AnchorCoordinate | null, width: number): AnchorCoordinate {\n\t\tif (!secondary) {\n\t\t\treturn primary;\n\t\t}\n\n\t\tconst fontInfo = this._context.configuration.options.get(EditorOption.fontInfo);\n\n\t\tlet left = secondary.left;\n\t\tif (left < primary.left) {\n\t\t\tleft = Math.max(left, primary.left - width + fontInfo.typicalFullwidthCharacterWidth);\n\t\t} else {\n\t\t\tleft = Math.min(left, primary.left + width - fontInfo.typicalFullwidthCharacterWidth);\n\t\t}\n\t\treturn new AnchorCoordinate(primary.top, left, primary.height);\n\t}\n\n\tprivate _prepareRenderWidget(ctx: RenderingContext): IRenderData | null {\n\t\tif (!this._preference || this._preference.length === 0) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst { primary, secondary } = this._getAnchorsCoordinates(ctx);\n\t\tif (!primary) {\n\t\t\treturn {\n\t\t\t\tkind: 'offViewport',\n\t\t\t\tpreserveFocus: this.domNode.domNode.contains(this.domNode.domNode.ownerDocument.activeElement)\n\t\t\t};\n\t\t\t// return null;\n\t\t}\n\n\t\tif (this._cachedDomNodeOffsetWidth === -1 || this._cachedDomNodeOffsetHeight === -1) {\n\n\t\t\tlet preferredDimensions: IDimension | null = null;\n\t\t\tif (typeof this._actual.beforeRender === 'function') {\n\t\t\t\tpreferredDimensions = safeInvoke(this._actual.beforeRender, this._actual);\n\t\t\t}\n\t\t\tif (preferredDimensions) {\n\t\t\t\tthis._cachedDomNodeOffsetWidth = preferredDimensions.width;\n\t\t\t\tthis._cachedDomNodeOffsetHeight = preferredDimensions.height;\n\t\t\t} else {\n\t\t\t\tconst domNode = this.domNode.domNode;\n\t\t\t\tconst clientRect = domNode.getBoundingClientRect();\n\t\t\t\tthis._cachedDomNodeOffsetWidth = Math.round(clientRect.width);\n\t\t\t\tthis._cachedDomNodeOffsetHeight = Math.round(clientRect.height);\n\t\t\t}\n\t\t}\n\n\t\tconst anchor = this._reduceAnchorCoordinates(primary, secondary, this._cachedDomNodeOffsetWidth);\n\n\t\tlet placement: IBoxLayoutResult | null;\n\t\tif (this.allowEditorOverflow) {\n\t\t\tplacement = this._layoutBoxInPage(anchor, this._cachedDomNodeOffsetWidth, this._cachedDomNodeOffsetHeight, ctx);\n\t\t} else {\n\t\t\tplacement = this._layoutBoxInViewport(anchor, this._cachedDomNodeOffsetWidth, this._cachedDomNodeOffsetHeight, ctx);\n\t\t}\n\n\t\t// Do two passes, first for perfect fit, second picks first option\n\t\tfor (let pass = 1; pass <= 2; pass++) {\n\t\t\tfor (const pref of this._preference) {\n\t\t\t\t// placement\n\t\t\t\tif (pref === ContentWidgetPositionPreference.ABOVE) {\n\t\t\t\t\tif (!placement) {\n\t\t\t\t\t\t// Widget outside of viewport\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\tif (pass === 2 || placement.fitsAbove) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tkind: 'inViewport',\n\t\t\t\t\t\t\tcoordinate: new Coordinate(placement.aboveTop, placement.left),\n\t\t\t\t\t\t\tposition: ContentWidgetPositionPreference.ABOVE\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t} else if (pref === ContentWidgetPositionPreference.BELOW) {\n\t\t\t\t\tif (!placement) {\n\t\t\t\t\t\t// Widget outside of viewport\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\tif (pass === 2 || placement.fitsBelow) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tkind: 'inViewport',\n\t\t\t\t\t\t\tcoordinate: new Coordinate(placement.belowTop, placement.left),\n\t\t\t\t\t\t\tposition: ContentWidgetPositionPreference.BELOW\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (this.allowEditorOverflow) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tkind: 'inViewport',\n\t\t\t\t\t\t\tcoordinate: this._prepareRenderWidgetAtExactPositionOverflowing(new Coordinate(anchor.top, anchor.left)),\n\t\t\t\t\t\t\tposition: ContentWidgetPositionPreference.EXACT\n\t\t\t\t\t\t};\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tkind: 'inViewport',\n\t\t\t\t\t\t\tcoordinate: new Coordinate(anchor.top, anchor.left),\n\t\t\t\t\t\t\tposition: ContentWidgetPositionPreference.EXACT\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t}\n\n\t/**\n\t * On this first pass, we ensure that the content widget (if it is in the viewport) has the max width set correctly.\n\t */\n\tpublic onBeforeRender(viewportData: ViewportData): void {\n\t\tif (!this._primaryAnchor.viewPosition || !this._preference) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._primaryAnchor.viewPosition.lineNumber < viewportData.startLineNumber || this._primaryAnchor.viewPosition.lineNumber > viewportData.endLineNumber) {\n\t\t\t// Outside of viewport\n\t\t\treturn;\n\t\t}\n\n\t\tthis.domNode.setMaxWidth(this._maxWidth);\n\t}\n\n\tpublic prepareRender(ctx: RenderingContext): void {\n\t\tthis._renderData = this._prepareRenderWidget(ctx);\n\t}\n\n\tpublic render(ctx: RestrictedRenderingContext): void {\n\t\tif (!this._renderData || this._renderData.kind === 'offViewport') {\n\t\t\t// This widget should be invisible\n\t\t\tif (this._isVisible) {\n\t\t\t\tthis.domNode.removeAttribute('monaco-visible-content-widget');\n\t\t\t\tthis._isVisible = false;\n\n\t\t\t\tif (this._renderData?.kind === 'offViewport' && this._renderData.preserveFocus) {\n\t\t\t\t\t// widget wants to be shown, but it is outside of the viewport and it\n\t\t\t\t\t// has focus which we need to preserve\n\t\t\t\t\tthis.domNode.setTop(-1000);\n\t\t\t\t} else {\n\t\t\t\t\tthis.domNode.setVisibility('hidden');\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (typeof this._actual.afterRender === 'function') {\n\t\t\t\tsafeInvoke(this._actual.afterRender, this._actual, null, null);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// This widget should be visible\n\t\tif (this.allowEditorOverflow) {\n\t\t\tthis.domNode.setTop(this._renderData.coordinate.top);\n\t\t\tthis.domNode.setLeft(this._renderData.coordinate.left);\n\t\t} else {\n\t\t\tthis.domNode.setTop(this._renderData.coordinate.top + ctx.scrollTop - ctx.bigNumbersDelta);\n\t\t\tthis.domNode.setLeft(this._renderData.coordinate.left);\n\t\t}\n\n\t\tif (!this._isVisible) {\n\t\t\tthis.domNode.setVisibility('inherit');\n\t\t\tthis.domNode.setAttribute('monaco-visible-content-widget', 'true');\n\t\t\tthis._isVisible = true;\n\t\t}\n\n\t\tif (typeof this._actual.afterRender === 'function') {\n\t\t\tsafeInvoke(this._actual.afterRender, this._actual, this._renderData.position, this._renderData.coordinate);\n\t\t}\n\t}\n}\n\nclass PositionPair {\n\tconstructor(\n\t\tpublic readonly modelPosition: IPosition | null,\n\t\tpublic readonly viewPosition: Position | null\n\t) { }\n}\n\nclass Coordinate implements IContentWidgetRenderedCoordinate {\n\t_coordinateBrand: void = undefined;\n\n\tconstructor(\n\t\tpublic readonly top: number,\n\t\tpublic readonly left: number\n\t) { }\n}\n\nclass AnchorCoordinate {\n\t_anchorCoordinateBrand: void = undefined;\n\n\tconstructor(\n\t\tpublic readonly top: number,\n\t\tpublic readonly left: number,\n\t\tpublic readonly height: number\n\t) { }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction safeInvoke<T extends (...args: any[]) => any>(fn: T, thisArg: ThisParameterType<T>, ...args: Parameters<T>): ReturnType<T> | null {\n\ttry {\n\t\treturn fn.call(thisArg, ...args);\n\t} catch {\n\t\t// ignore\n\t\treturn null;\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as dom from '../../../../base/browser/dom.js';\nimport { FastDomNode, createFastDomNode } from '../../../../base/browser/fastDomNode.js';\nimport { ContentWidgetPositionPreference, IContentWidget, IContentWidgetRenderedCoordinate } from '../../editorBrowser.js';\nimport { PartFingerprint, PartFingerprints, ViewPart } from '../../view/viewPart.js';\nimport { RenderingContext, RestrictedRenderingContext } from '../../view/renderingContext.js';\nimport { ViewContext } from '../../../common/viewModel/viewContext.js';\nimport * as viewEvents from '../../../common/viewEvents.js';\nimport { ViewportData } from '../../../common/viewLayout/viewLinesViewportData.js';\nimport { EditorOption } from '../../../common/config/editorOptions.js';\nimport { IDimension } from '../../../common/core/2d/dimension.js';\nimport { PositionAffinity } from '../../../common/model.js';\nimport { IPosition, Position } from '../../../common/core/position.js';\nimport { IViewModel } from '../../../common/viewModel.js';\n\n/**\n * Clearance kept between a widget overflowing the editor and the left/right edges of the window.\n */\nconst OVERFLOWING_WIDGET_WINDOW_PADDING = 15;\n\n/**\n * This view part is responsible for rendering the content widgets, which are\n * used for rendering elements that are associated to an editor position,\n * such as suggestions or the parameter hints.\n */\nexport class ViewContentWidgets extends ViewPart {\n\n\tprivate readonly _viewDomNode: FastDomNode<HTMLElement>;\n\tprivate _widgets: { [key: string]: Widget };\n\n\tpublic domNode: FastDomNode<HTMLElement>;\n\tpublic overflowingContentWidgetsDomNode: FastDomNode<HTMLElement>;\n\n\tconstructor(context: ViewContext, viewDomNode: FastDomNode<HTMLElement>) {\n\t\tsuper(context);\n\t\tthis._viewDomNode = viewDomNode;\n\t\tthis._widgets = {};\n\n\t\tthis.domNode = createFastDomNode(document.createElement('div'));\n\t\tPartFingerprints.write(this.domNode, PartFingerprint.ContentWidgets);\n\t\tthis.domNode.setClassName('contentWidgets');\n\t\tthis.domNode.setPosition('absolute');\n\t\tthis.domNode.setTop(0);\n\n\t\tthis.overflowingContentWidgetsDomNode = createFastDomNode(document.createElement('div'));\n\t\tPartFingerprints.write(this.overflowingContentWidgetsDomNode, PartFingerprint.OverflowingContentWidgets);\n\t\tthis.overflowingContentWidgetsDomNode.setClassName('overflowingContentWidgets');\n\t}\n\n\tpublic override dispose(): void {\n\t\tsuper.dispose();\n\t\t// Widgets outlive the view, so detach their dom nodes to not keep this view's DOM alive (#146841)\n\t\tfor (const widget of Object.values(this._widgets)) {\n\t\t\tconst domNode = widget.domNode.domNode;\n\t\t\tif (domNode.parentElement === this.domNode.domNode || domNode.parentElement === this.overflowingContentWidgetsDomNode.domNode) {\n\t\t\t\tdomNode.remove();\n\t\t\t\tdomNode.removeAttribute('monaco-visible-content-widget');\n\t\t\t}\n\t\t}\n\t\tthis._widgets = {};\n\t}\n\n\t// --- begin event handlers\n\n\tpublic override onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): boolean {\n\t\tconst keys = Object.keys(this._widgets);\n\t\tfor (const widgetId of keys) {\n\t\t\tthis._widgets[widgetId].onConfigurationChanged(e);\n\t\t}\n\t\treturn true;\n\t}\n\tpublic override onDecorationsChanged(e: viewEvents.ViewDecorationsChangedEvent): boolean {\n\t\t// true for inline decorations that can end up relayouting text\n\t\treturn true;\n\t}\n\tpublic override onFlushed(e: viewEvents.ViewFlushedEvent): boolean {\n\t\treturn true;\n\t}\n\tpublic override onLineMappingChanged(e: viewEvents.ViewLineMappingChangedEvent): boolean {\n\t\tthis._updateAnchorsViewPositions();\n\t\treturn true;\n\t}\n\tpublic override onLinesChanged(e: viewEvents.ViewLinesChangedEvent): boolean {\n\t\tthis._updateAnchorsViewPositions();\n\t\treturn true;\n\t}\n\tpublic override onLinesDeleted(e: viewEvents.ViewLinesDeletedEvent): boolean {\n\t\tthis._updateAnchorsViewPositions();\n\t\treturn true;\n\t}\n\tpublic override onLinesInserted(e: viewEvents.ViewLinesInsertedEvent): boolean {\n\t\tthis._updateAnchorsViewPositions();\n\t\treturn true;\n\t}\n\tpublic override onScrollChanged(e: viewEvents.ViewScrollChangedEvent): boolean {\n\t\treturn true;\n\t}\n\tpublic override onZonesChanged(e: viewEvents.ViewZonesChangedEvent): boolean {\n\t\treturn true;\n\t}\n\n\t// ---- end view event handlers\n\n\tprivate _updateAnchorsViewPositions(): void {\n\t\tconst keys = Object.keys(this._widgets);\n\t\tfor (const widgetId of keys) {\n\t\t\tthis._widgets[widgetId].updateAnchorViewPosition();\n\t\t}\n\t}\n\n\tpublic addWidget(_widget: IContentWidget): void {\n\t\tconst myWidget = new Widget(this._context, this._viewDomNode, _widget);\n\t\tthis._widgets[myWidget.id] = myWidget;\n\n\t\tif (myWidget.allowEditorOverflow) {\n\t\t\tthis.overflowingContentWidgetsDomNode.appendChild(myWidget.domNode);\n\t\t} else {\n\t\t\tthis.domNode.appendChild(myWidget.domNode);\n\t\t}\n\n\t\tthis.setShouldRender();\n\t}\n\n\tpublic setWidgetPosition(widget: IContentWidget, primaryAnchor: IPosition | null, secondaryAnchor: IPosition | null, preference: ContentWidgetPositionPreference[] | null, affinity: PositionAffinity | null): void {\n\t\tconst myWidget = this._widgets[widget.getId()];\n\t\tmyWidget.setPosition(primaryAnchor, secondaryAnchor, preference, affinity);\n\n\t\tif (!myWidget.useDisplayNone) {\n\t\t\tthis.setShouldRender();\n\t\t}\n\t}\n\n\tpublic removeWidget(widget: IContentWidget): void {\n\t\tconst widgetId = widget.getId();\n\t\tif (this._widgets.hasOwnProperty(widgetId)) {\n\t\t\tconst myWidget = this._widgets[widgetId];\n\t\t\tdelete this._widgets[widgetId];\n\n\t\t\tconst domNode = myWidget.domNode.domNode;\n\t\t\tdomNode.remove();\n\t\t\tdomNode.removeAttribute('monaco-visible-content-widget');\n\n\t\t\tthis.setShouldRender();\n\t\t}\n\t}\n\n\tpublic shouldSuppressMouseDownOnWidget(widgetId: string): boolean {\n\t\tif (this._widgets.hasOwnProperty(widgetId)) {\n\t\t\treturn this._widgets[widgetId].suppressMouseDown;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic override onBeforeRender(viewportData: ViewportData): void {\n\t\tconst keys = Object.keys(this._widgets);\n\t\tfor (const widgetId of keys) {\n\t\t\tthis._widgets[widgetId].onBeforeRender(viewportData);\n\t\t}\n\t}\n\n\tpublic prepareRender(ctx: RenderingContext): void {\n\t\tconst keys = Object.keys(this._widgets);\n\t\tfor (const widgetId of keys) {\n\t\t\tthis._widgets[widgetId].prepareRender(ctx);\n\t\t}\n\t}\n\n\tpublic render(ctx: RestrictedRenderingContext): void {\n\t\tconst keys = Object.keys(this._widgets);\n\t\tfor (const widgetId of keys) {\n\t\t\tthis._widgets[widgetId].render(ctx);\n\t\t}\n\t}\n}\n\ninterface IBoxLayoutResult {\n\tfitsAbove: boolean;\n\taboveTop: number;\n\n\tfitsBelow: boolean;\n\tbelowTop: number;\n\n\tleft: number;\n}\n\ninterface IOffViewportRenderData {\n\tkind: 'offViewport';\n\tpreserveFocus: boolean;\n}\n\ninterface IInViewportRenderData {\n\tkind: 'inViewport';\n\tcoordinate: Coordinate;\n\tposition: ContentWidgetPositionPreference;\n}\n\ntype IRenderData = IInViewportRenderData | IOffViewportRenderData;\n\nclass Widget {\n\tprivate readonly _context: ViewContext;\n\tprivate readonly _viewDomNode: FastDomNode<HTMLElement>;\n\tprivate readonly _actual: IContentWidget;\n\n\tpublic readonly domNode: FastDomNode<HTMLElement>;\n\tpublic readonly id: string;\n\tpublic readonly allowEditorOverflow: boolean;\n\tpublic readonly suppressMouseDown: boolean;\n\n\tprivate readonly _fixedOverflowWidgets: boolean;\n\tprivate _contentWidth: number;\n\tprivate _contentLeft: number;\n\n\tprivate _primaryAnchor: PositionPair = new PositionPair(null, null);\n\tprivate _secondaryAnchor: PositionPair = new PositionPair(null, null);\n\tprivate _affinity: PositionAffinity | null;\n\tprivate _preference: ContentWidgetPositionPreference[] | null;\n\tprivate _cachedDomNodeOffsetWidth: number;\n\tprivate _cachedDomNodeOffsetHeight: number;\n\tprivate _maxWidth: number;\n\tprivate _isVisible: boolean;\n\n\tprivate _renderData: IRenderData | null;\n\tpublic readonly useDisplayNone: boolean;\n\n\tconstructor(context: ViewContext, viewDomNode: FastDomNode<HTMLElement>, actual: IContentWidget) {\n\t\tthis._context = context;\n\t\tthis._viewDomNode = viewDomNode;\n\t\tthis._actual = actual;\n\n\t\tconst options = this._context.configuration.options;\n\t\tconst layoutInfo = options.get(EditorOption.layoutInfo);\n\t\tconst allowOverflow = options.get(EditorOption.allowOverflow);\n\n\t\tthis.domNode = createFastDomNode(this._actual.getDomNode());\n\t\tthis.id = this._actual.getId();\n\t\tthis.allowEditorOverflow = (this._actual.allowEditorOverflow || false) && allowOverflow;\n\t\tthis.suppressMouseDown = this._actual.suppressMouseDown || false;\n\t\tthis.useDisplayNone = this._actual.useDisplayNone || false;\n\n\t\tthis._fixedOverflowWidgets = options.get(EditorOption.fixedOverflowWidgets);\n\t\tthis._contentWidth = layoutInfo.contentWidth;\n\t\tthis._contentLeft = layoutInfo.contentLeft;\n\n\t\tthis._affinity = null;\n\t\tthis._preference = [];\n\t\tthis._cachedDomNodeOffsetWidth = -1;\n\t\tthis._cachedDomNodeOffsetHeight = -1;\n\t\tthis._maxWidth = this._getMaxWidth();\n\t\tthis._isVisible = false;\n\t\tthis._renderData = null;\n\n\t\tthis.domNode.setPosition((this._fixedOverflowWidgets && this.allowEditorOverflow) ? 'fixed' : 'absolute');\n\t\tthis.domNode.setDisplay('none');\n\t\tthis.domNode.setVisibility('hidden');\n\t\tthis.domNode.setAttribute('widgetId', this.id);\n\t\tthis.domNode.setMaxWidth(this._maxWidth);\n\t}\n\n\tpublic onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): void {\n\t\tconst options = this._context.configuration.options;\n\t\tif (e.hasChanged(EditorOption.layoutInfo)) {\n\t\t\tconst layoutInfo = options.get(EditorOption.layoutInfo);\n\t\t\tthis._contentLeft = layoutInfo.contentLeft;\n\t\t\tthis._contentWidth = layoutInfo.contentWidth;\n\t\t\tthis._maxWidth = this._getMaxWidth();\n\t\t}\n\t}\n\n\tpublic updateAnchorViewPosition(): void {\n\t\tthis._setPosition(this._affinity, this._primaryAnchor.modelPosition, this._secondaryAnchor.modelPosition);\n\t}\n\n\tprivate _setPosition(affinity: PositionAffinity | null, primaryAnchor: IPosition | null, secondaryAnchor: IPosition | null): void {\n\t\tthis._affinity = affinity;\n\t\tthis._primaryAnchor = getValidPositionPair(primaryAnchor, this._context.viewModel, this._affinity);\n\t\tthis._secondaryAnchor = getValidPositionPair(secondaryAnchor, this._context.viewModel, this._affinity);\n\n\t\tfunction getValidPositionPair(position: IPosition | null, viewModel: IViewModel, affinity: PositionAffinity | null): PositionPair {\n\t\t\tif (!position) {\n\t\t\t\treturn new PositionPair(null, null);\n\t\t\t}\n\t\t\t// Do not trust that widgets give a valid position\n\t\t\tconst validModelPosition = viewModel.model.validatePosition(position);\n\t\t\tif (viewModel.coordinatesConverter.modelPositionIsVisible(validModelPosition)) {\n\t\t\t\tconst viewPosition = viewModel.coordinatesConverter.convertModelPositionToViewPosition(validModelPosition, affinity ?? undefined);\n\t\t\t\treturn new PositionPair(position, viewPosition);\n\t\t\t}\n\t\t\treturn new PositionPair(position, null);\n\t\t}\n\t}\n\n\tprivate _getMaxWidth(): number {\n\t\tconst elDocument = this.domNode.domNode.ownerDocument;\n\t\tconst elWindow = elDocument.defaultView;\n\t\tif (!this.allowEditorOverflow) {\n\t\t\treturn this._contentWidth;\n\t\t}\n\t\tconst windowWidth = elWindow?.innerWidth || elDocument.documentElement.offsetWidth || elDocument.body.offsetWidth;\n\t\t// A wider widget cannot keep the padding on both sides of the window, see _layoutHorizontalSegmentInPage\n\t\treturn Math.max(0, windowWidth - 2 * OVERFLOWING_WIDGET_WINDOW_PADDING);\n\t}\n\n\tpublic setPosition(primaryAnchor: IPosition | null, secondaryAnchor: IPosition | null, preference: ContentWidgetPositionPreference[] | null, affinity: PositionAffinity | null): void {\n\t\tthis._setPosition(affinity, primaryAnchor, secondaryAnchor);\n\t\tthis._preference = preference;\n\t\tif (!this.useDisplayNone && this._primaryAnchor.viewPosition && this._preference && this._preference.length > 0) {\n\t\t\t// this content widget would like to be visible if possible\n\t\t\t// we change it from `display:none` to `display:block` even if it\n\t\t\t// might be outside the viewport such that we can measure its size\n\t\t\t// in `prepareRender`\n\t\t\tthis.domNode.setDisplay('block');\n\t\t} else {\n\t\t\tthis.domNode.setDisplay('none');\n\t\t}\n\t\tthis._cachedDomNodeOffsetWidth = -1;\n\t\tthis._cachedDomNodeOffsetHeight = -1;\n\t}\n\n\tprivate _layoutBoxInViewport(anchor: AnchorCoordinate, width: number, height: number, ctx: RenderingContext): IBoxLayoutResult {\n\t\t// Our visible box is split horizontally by the current line => 2 boxes\n\n\t\t// a) the box above the line\n\t\tconst aboveLineTop = anchor.top;\n\t\tconst heightAvailableAboveLine = aboveLineTop;\n\n\t\t// b) the box under the line\n\t\tconst underLineTop = anchor.top + anchor.height;\n\t\tconst heightAvailableUnderLine = ctx.viewportHeight - underLineTop;\n\n\t\tconst aboveTop = aboveLineTop - height;\n\t\tconst fitsAbove = (heightAvailableAboveLine >= height);\n\t\tconst belowTop = underLineTop;\n\t\tconst fitsBelow = (heightAvailableUnderLine >= height);\n\n\t\t// And its left\n\t\tlet left = anchor.left;\n\t\tif (left + width > ctx.scrollLeft + ctx.viewportWidth) {\n\t\t\tleft = ctx.scrollLeft + ctx.viewportWidth - width;\n\t\t}\n\t\tif (left < ctx.scrollLeft) {\n\t\t\tleft = ctx.scrollLeft;\n\t\t}\n\n\t\treturn { fitsAbove, aboveTop, fitsBelow, belowTop, left };\n\t}\n\n\tprivate _layoutHorizontalSegmentInPage(windowSize: dom.Dimension, domNodePosition: dom.IDomNodePagePosition, left: number, width: number): [number, number] {\n\t\t// Initially, the limits are defined as the dom node limits\n\t\tconst MIN_LIMIT = Math.max(OVERFLOWING_WIDGET_WINDOW_PADDING, domNodePosition.left - width);\n\t\tconst MAX_LIMIT = Math.min(domNodePosition.left + domNodePosition.width + width, windowSize.width - OVERFLOWING_WIDGET_WINDOW_PADDING);\n\n\t\tconst elDocument = this._viewDomNode.domNode.ownerDocument;\n\t\tconst elWindow = elDocument.defaultView;\n\t\tlet absoluteLeft = domNodePosition.left + left - (elWindow?.scrollX ?? 0);\n\n\t\tif (absoluteLeft + width > MAX_LIMIT) {\n\t\t\tconst delta = absoluteLeft - (MAX_LIMIT - width);\n\t\t\tabsoluteLeft -= delta;\n\t\t\tleft -= delta;\n\t\t}\n\n\t\tif (absoluteLeft < MIN_LIMIT) {\n\t\t\tconst delta = absoluteLeft - MIN_LIMIT;\n\t\t\tabsoluteLeft -= delta;\n\t\t\tleft -= delta;\n\t\t}\n\n\t\treturn [left, absoluteLeft];\n\t}\n\n\tprivate _layoutBoxInPage(anchor: AnchorCoordinate, width: number, height: number, ctx: RenderingContext): IBoxLayoutResult | null {\n\t\tconst aboveTop = anchor.top - height;\n\t\tconst belowTop = anchor.top + anchor.height;\n\n\t\tconst domNodePosition = dom.getDomNodePagePosition(this._viewDomNode.domNode);\n\t\tconst elDocument = this._viewDomNode.domNode.ownerDocument;\n\t\tconst elWindow = elDocument.defaultView;\n\t\tconst absoluteAboveTop = domNodePosition.top + aboveTop - (elWindow?.scrollY ?? 0);\n\t\tconst absoluteBelowTop = domNodePosition.top + belowTop - (elWindow?.scrollY ?? 0);\n\n\t\tconst windowSize = dom.getClientArea(elDocument.body);\n\t\tconst [left, absoluteAboveLeft] = this._layoutHorizontalSegmentInPage(windowSize, domNodePosition, anchor.left - ctx.scrollLeft + this._contentLeft, width);\n\n\t\t// Leave some clearance to the top/bottom\n\t\tconst TOP_PADDING = 22;\n\t\tconst BOTTOM_PADDING = 22;\n\n\t\tconst fitsAbove = (absoluteAboveTop >= TOP_PADDING);\n\t\tconst fitsBelow = (absoluteBelowTop + height <= windowSize.height - BOTTOM_PADDING);\n\n\t\tif (this._fixedOverflowWidgets) {\n\t\t\treturn {\n\t\t\t\tfitsAbove,\n\t\t\t\taboveTop: Math.max(absoluteAboveTop, TOP_PADDING),\n\t\t\t\tfitsBelow,\n\t\t\t\tbelowTop: absoluteBelowTop,\n\t\t\t\tleft: absoluteAboveLeft\n\t\t\t};\n\t\t}\n\n\t\treturn { fitsAbove, aboveTop, fitsBelow, belowTop, left };\n\t}\n\n\tprivate _prepareRenderWidgetAtExactPositionOverflowing(topLeft: Coordinate): Coordinate {\n\t\treturn new Coordinate(topLeft.top, topLeft.left + this._contentLeft);\n\t}\n\n\t/**\n\t * Compute the coordinates above and below the primary and secondary anchors.\n\t * The content widget *must* touch the primary anchor.\n\t * The content widget should touch if possible the secondary anchor.\n\t */\n\tprivate _getAnchorsCoordinates(ctx: RenderingContext): { primary: AnchorCoordinate | null; secondary: AnchorCoordinate | null } {\n\t\tconst primary = getCoordinates(this._primaryAnchor.viewPosition, this._affinity);\n\t\tconst secondaryViewPosition = (this._secondaryAnchor.viewPosition?.lineNumber === this._primaryAnchor.viewPosition?.lineNumber ? this._secondaryAnchor.viewPosition : null);\n\t\tconst secondary = getCoordinates(secondaryViewPosition, this._affinity);\n\t\treturn { primary, secondary };\n\n\t\tfunction getCoordinates(position: Position | null, affinity: PositionAffinity | null): AnchorCoordinate | null {\n\t\t\tif (!position) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst horizontalPosition = ctx.visibleRangeForPosition(position);\n\t\t\tif (!horizontalPosition) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\t// Left-align widgets that should appear :before content\n\t\t\tconst left = (position.column === 1 && affinity === PositionAffinity.LeftOfInjectedText ? 0 : horizontalPosition.left);\n\t\t\tconst top = ctx.getVerticalOffsetForLineNumber(position.lineNumber) - ctx.scrollTop;\n\t\t\tconst lineHeight = ctx.getLineHeightForLineNumber(position.lineNumber);\n\t\t\treturn new AnchorCoordinate(top, left, lineHeight);\n\t\t}\n\t}\n\n\tprivate _reduceAnchorCoordinates(primary: AnchorCoordinate, secondary: AnchorCoordinate | null, width: number): AnchorCoordinate {\n\t\tif (!secondary) {\n\t\t\treturn primary;\n\t\t}\n\n\t\tconst fontInfo = this._context.configuration.options.get(EditorOption.fontInfo);\n\n\t\tlet left = secondary.left;\n\t\tif (left < primary.left) {\n\t\t\tleft = Math.max(left, primary.left - width + fontInfo.typicalFullwidthCharacterWidth);\n\t\t} else {\n\t\t\tleft = Math.min(left, primary.left + width - fontInfo.typicalFullwidthCharacterWidth);\n\t\t}\n\t\treturn new AnchorCoordinate(primary.top, left, primary.height);\n\t}\n\n\tprivate _prepareRenderWidget(ctx: RenderingContext): IRenderData | null {\n\t\tif (!this._preference || this._preference.length === 0) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst { primary, secondary } = this._getAnchorsCoordinates(ctx);\n\t\tif (!primary) {\n\t\t\treturn {\n\t\t\t\tkind: 'offViewport',\n\t\t\t\tpreserveFocus: this.domNode.domNode.contains(this.domNode.domNode.ownerDocument.activeElement)\n\t\t\t};\n\t\t\t// return null;\n\t\t}\n\n\t\tif (this._cachedDomNodeOffsetWidth === -1 || this._cachedDomNodeOffsetHeight === -1) {\n\n\t\t\tlet preferredDimensions: IDimension | null = null;\n\t\t\tif (typeof this._actual.beforeRender === 'function') {\n\t\t\t\tpreferredDimensions = safeInvoke(this._actual.beforeRender, this._actual);\n\t\t\t}\n\t\t\tif (preferredDimensions) {\n\t\t\t\tthis._cachedDomNodeOffsetWidth = preferredDimensions.width;\n\t\t\t\tthis._cachedDomNodeOffsetHeight = preferredDimensions.height;\n\t\t\t} else {\n\t\t\t\tconst domNode = this.domNode.domNode;\n\t\t\t\tconst clientRect = domNode.getBoundingClientRect();\n\t\t\t\tthis._cachedDomNodeOffsetWidth = Math.round(clientRect.width);\n\t\t\t\tthis._cachedDomNodeOffsetHeight = Math.round(clientRect.height);\n\t\t\t}\n\t\t}\n\n\t\tconst anchor = this._reduceAnchorCoordinates(primary, secondary, this._cachedDomNodeOffsetWidth);\n\n\t\tlet placement: IBoxLayoutResult | null;\n\t\tif (this.allowEditorOverflow) {\n\t\t\tplacement = this._layoutBoxInPage(anchor, this._cachedDomNodeOffsetWidth, this._cachedDomNodeOffsetHeight, ctx);\n\t\t} else {\n\t\t\tplacement = this._layoutBoxInViewport(anchor, this._cachedDomNodeOffsetWidth, this._cachedDomNodeOffsetHeight, ctx);\n\t\t}\n\n\t\t// Do two passes, first for perfect fit, second picks first option\n\t\tfor (let pass = 1; pass <= 2; pass++) {\n\t\t\tfor (const pref of this._preference) {\n\t\t\t\t// placement\n\t\t\t\tif (pref === ContentWidgetPositionPreference.ABOVE) {\n\t\t\t\t\tif (!placement) {\n\t\t\t\t\t\t// Widget outside of viewport\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\tif (pass === 2 || placement.fitsAbove) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tkind: 'inViewport',\n\t\t\t\t\t\t\tcoordinate: new Coordinate(placement.aboveTop, placement.left),\n\t\t\t\t\t\t\tposition: ContentWidgetPositionPreference.ABOVE\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t} else if (pref === ContentWidgetPositionPreference.BELOW) {\n\t\t\t\t\tif (!placement) {\n\t\t\t\t\t\t// Widget outside of viewport\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\tif (pass === 2 || placement.fitsBelow) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tkind: 'inViewport',\n\t\t\t\t\t\t\tcoordinate: new Coordinate(placement.belowTop, placement.left),\n\t\t\t\t\t\t\tposition: ContentWidgetPositionPreference.BELOW\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (this.allowEditorOverflow) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tkind: 'inViewport',\n\t\t\t\t\t\t\tcoordinate: this._prepareRenderWidgetAtExactPositionOverflowing(new Coordinate(anchor.top, anchor.left)),\n\t\t\t\t\t\t\tposition: ContentWidgetPositionPreference.EXACT\n\t\t\t\t\t\t};\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tkind: 'inViewport',\n\t\t\t\t\t\t\tcoordinate: new Coordinate(anchor.top, anchor.left),\n\t\t\t\t\t\t\tposition: ContentWidgetPositionPreference.EXACT\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t}\n\n\t/**\n\t * On this first pass, we ensure that the content widget (if it is in the viewport) has the max width set correctly.\n\t */\n\tpublic onBeforeRender(viewportData: ViewportData): void {\n\t\tif (!this._primaryAnchor.viewPosition || !this._preference) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._primaryAnchor.viewPosition.lineNumber < viewportData.startLineNumber || this._primaryAnchor.viewPosition.lineNumber > viewportData.endLineNumber) {\n\t\t\t// Outside of viewport\n\t\t\treturn;\n\t\t}\n\n\t\tthis.domNode.setMaxWidth(this._maxWidth);\n\t}\n\n\tpublic prepareRender(ctx: RenderingContext): void {\n\t\tthis._renderData = this._prepareRenderWidget(ctx);\n\t}\n\n\tpublic render(ctx: RestrictedRenderingContext): void {\n\t\tif (!this._renderData || this._renderData.kind === 'offViewport') {\n\t\t\t// This widget should be invisible\n\t\t\tif (this._isVisible) {\n\t\t\t\tthis.domNode.removeAttribute('monaco-visible-content-widget');\n\t\t\t\tthis._isVisible = false;\n\n\t\t\t\tif (this._renderData?.kind === 'offViewport' && this._renderData.preserveFocus) {\n\t\t\t\t\t// widget wants to be shown, but it is outside of the viewport and it\n\t\t\t\t\t// has focus which we need to preserve\n\t\t\t\t\tthis.domNode.setTop(-1000);\n\t\t\t\t} else {\n\t\t\t\t\tthis.domNode.setVisibility('hidden');\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (typeof this._actual.afterRender === 'function') {\n\t\t\t\tsafeInvoke(this._actual.afterRender, this._actual, null, null);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// This widget should be visible\n\t\tif (this.allowEditorOverflow) {\n\t\t\tthis.domNode.setTop(this._renderData.coordinate.top);\n\t\t\tthis.domNode.setLeft(this._renderData.coordinate.left);\n\t\t} else {\n\t\t\tthis.domNode.setTop(this._renderData.coordinate.top + ctx.scrollTop - ctx.bigNumbersDelta);\n\t\t\tthis.domNode.setLeft(this._renderData.coordinate.left);\n\t\t}\n\n\t\tif (!this._isVisible) {\n\t\t\tthis.domNode.setVisibility('inherit');\n\t\t\tthis.domNode.setAttribute('monaco-visible-content-widget', 'true');\n\t\t\tthis._isVisible = true;\n\t\t}\n\n\t\tif (typeof this._actual.afterRender === 'function') {\n\t\t\tsafeInvoke(this._actual.afterRender, this._actual, this._renderData.position, this._renderData.coordinate);\n\t\t}\n\t}\n}\n\nclass PositionPair {\n\tconstructor(\n\t\tpublic readonly modelPosition: IPosition | null,\n\t\tpublic readonly viewPosition: Position | null\n\t) { }\n}\n\nclass Coordinate implements IContentWidgetRenderedCoordinate {\n\t_coordinateBrand: void = undefined;\n\n\tconstructor(\n\t\tpublic readonly top: number,\n\t\tpublic readonly left: number\n\t) { }\n}\n\nclass AnchorCoordinate {\n\t_anchorCoordinateBrand: void = undefined;\n\n\tconstructor(\n\t\tpublic readonly top: number,\n\t\tpublic readonly left: number,\n\t\tpublic readonly height: number\n\t) { }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction safeInvoke<T extends (...args: any[]) => any>(fn: T, thisArg: ThisParameterType<T>, ...args: Parameters<T>): ReturnType<T> | null {\n\ttry {\n\t\treturn fn.call(thisArg, ...args);\n\t} catch {\n\t\t// ignore\n\t\treturn null;\n\t}\n}\n"]}
|
|
@@ -430,8 +430,8 @@ class RenderedViewLine {
|
|
|
430
430
|
}
|
|
431
431
|
}
|
|
432
432
|
_readPixelOffset(domNode, lineNumber, column, context) {
|
|
433
|
-
if (this.input.isLTR && this.
|
|
434
|
-
// This line has no content
|
|
433
|
+
if (this.input.isLTR && this.input.lineContent.length === 0) {
|
|
434
|
+
// This line has no content, but it might contain inline decorations
|
|
435
435
|
if (this._containsForeignElements === 0 /* ForeignElementType.None */) {
|
|
436
436
|
// We can assume the line is really empty
|
|
437
437
|
return 0;
|
|
@@ -444,15 +444,11 @@ class RenderedViewLine {
|
|
|
444
444
|
// We have foreign elements before the (empty) line
|
|
445
445
|
return this.getWidth(context);
|
|
446
446
|
}
|
|
447
|
-
// We have foreign elements before & after the (empty) line
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
}
|
|
453
|
-
else {
|
|
454
|
-
return 0;
|
|
455
|
-
}
|
|
447
|
+
// We have foreign elements before & after the (empty) line.
|
|
448
|
+
// The cursor sits at the left edge of the first after decoration.
|
|
449
|
+
const firstAfterIndex = this._characterMapping.getDomPosition(column).partIndex;
|
|
450
|
+
const r = RangeUtil.readHorizontalRangeForElement(this._getReadingTarget(domNode), firstAfterIndex, context);
|
|
451
|
+
return r ? r.left : 0;
|
|
456
452
|
}
|
|
457
453
|
if (this._pixelOffsetCache !== null) {
|
|
458
454
|
// the text is guaranteed to be LTR
|