monaco-editor-core 0.55.0-dev-20251102 → 0.55.0-dev-20251103
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/nls.messages.cs.js +1 -1
- package/esm/nls.messages.de.js +1 -1
- package/esm/nls.messages.es.js +1 -1
- package/esm/nls.messages.fr.js +1 -1
- package/esm/nls.messages.it.js +1 -1
- package/esm/nls.messages.ja.js +1 -1
- package/esm/nls.messages.ko.js +1 -1
- package/esm/nls.messages.pl.js +1 -1
- package/esm/nls.messages.pt-br.js +1 -1
- package/esm/nls.messages.ru.js +1 -1
- package/esm/nls.messages.tr.js +1 -1
- package/esm/nls.messages.zh-cn.js +1 -1
- package/esm/nls.messages.zh-tw.js +1 -1
- package/esm/vs/base/browser/dom.js.map +1 -1
- package/esm/vs/base/browser/markdownRenderer.js.map +1 -1
- package/esm/vs/base/browser/ui/list/listView.js.map +1 -1
- package/esm/vs/base/browser/ui/tree/abstractTree.js +2 -0
- package/esm/vs/base/browser/ui/tree/abstractTree.js.map +1 -1
- package/esm/vs/base/browser/ui/tree/asyncDataTree.js +2 -0
- package/esm/vs/base/browser/ui/tree/asyncDataTree.js.map +1 -1
- package/esm/vs/base/common/arrays.js.map +1 -1
- package/esm/vs/base/common/event.js.map +1 -1
- package/esm/vs/base/common/glob.js.map +1 -1
- package/esm/vs/base/common/lifecycle.js.map +1 -1
- package/esm/vs/base/common/network.js.map +1 -1
- package/esm/vs/base/common/ternarySearchTree.js.map +1 -1
- package/esm/vs/editor/browser/controller/mouseHandler.js.map +1 -1
- package/esm/vs/editor/browser/controller/mouseTarget.js.map +1 -1
- package/esm/vs/editor/browser/dataTransfer.js.map +1 -1
- package/esm/vs/editor/browser/viewParts/viewLines/viewLine.js.map +1 -1
- package/esm/vs/editor/browser/viewParts/viewLinesGpu/viewLinesGpu.js.map +1 -1
- package/esm/vs/editor/browser/widget/codeEditor/codeEditorWidget.js.map +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/components/accessibleDiffViewer.js.map +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/diffEditorViewModel.js.map +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/diffEditorWidget.js.map +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/features/gutterFeature.js.map +1 -1
- package/esm/vs/editor/common/config/editorOptions.js.map +1 -1
- package/esm/vs/editor/common/core/edits/edit.js.map +1 -1
- package/esm/vs/editor/common/languages/defaultDocumentColorsComputer.js.map +1 -1
- package/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/ast.js.map +1 -1
- package/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/concat23Trees.js.map +1 -1
- package/esm/vs/editor/common/model/tokens/treeSitter/tokenStore.js.map +1 -1
- package/esm/vs/editor/common/model/tokens/treeSitter/treeSitterTree.js.map +1 -1
- package/esm/vs/editor/common/viewModel/viewModelLines.js.map +1 -1
- package/esm/vs/editor/contrib/editorState/browser/editorState.js.map +1 -1
- package/esm/vs/editor/contrib/find/browser/findDecorations.js.map +1 -1
- package/esm/vs/editor/contrib/find/browser/findModel.js.map +1 -1
- package/esm/vs/editor/contrib/folding/browser/folding.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/commands.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/suggestWidgetAdapter.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/originalEditorInlineDiffView.js.map +1 -1
- package/esm/vs/editor/contrib/links/browser/links.js.map +1 -1
- package/esm/vs/editor/contrib/rename/browser/renameWidget.js.map +1 -1
- package/esm/vs/editor/contrib/snippet/browser/snippetParser.js.map +1 -1
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollController.js.map +1 -1
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollModelProvider.js.map +1 -1
- package/esm/vs/editor/standalone/browser/standaloneEditor.js.map +1 -1
- package/esm/vs/editor/standalone/common/monarch/monarchCompile.js.map +1 -1
- package/esm/vs/platform/configuration/common/configurationRegistry.js.map +1 -1
- package/esm/vs/platform/contextkey/common/contextkey.js +0 -4
- package/esm/vs/platform/contextkey/common/contextkey.js.map +1 -1
- package/esm/vs/platform/hover/browser/hoverService.js.map +1 -1
- package/esm/vs/platform/observable/common/wrapInHotClass.js.map +1 -1
- package/esm/vs/platform/observable/common/wrapInReloadableClass.js +0 -1
- package/esm/vs/platform/observable/common/wrapInReloadableClass.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/commandsQuickAccess.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/quickInput.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/quickInputController.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/quickInputList.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/stickyScroll/browser/stickyScrollController.ts","vs/editor/contrib/stickyScroll/browser/stickyScrollController.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;;AAEhG,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAGjG,OAAO,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AAExF,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACtF,OAAO,EAAgC,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAEtG,OAAO,EAAE,qBAAqB,EAAE,MAAM,4DAA4D,CAAC;AACnG,OAAO,EAAE,mBAAmB,EAAE,MAAM,yDAAyD,CAAC;AAC9F,OAAO,EAAE,MAAM,EAAE,MAAM,gDAAgD,CAAC;AACxE,OAAO,EAAe,kBAAkB,EAAE,MAAM,sDAAsD,CAAC;AACvG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE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ChC,WAAA,mBAAmB,CAAA;IACnB,WAAA,wBAAwB,CAAA;IACxB,WAAA,qBAAqB,CAAA;IACrB,WAAA,6BAA6B,CAAA;IAC7B,WAAA,+BAA+B,CAAA;IAC/B,WAAA,kBAAkB,CAAA;GAvCR,sBAAsB,CA6jBlC","file":"stickyScrollController.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 { Disposable, DisposableStore, toDisposable } from '../../../../base/common/lifecycle.js';\nimport { IActiveCodeEditor, ICodeEditor, MouseTargetType } from '../../../browser/editorBrowser.js';\nimport { IEditorContribution, ScrollType } from '../../../common/editorCommon.js';\nimport { ILanguageFeaturesService } from '../../../common/services/languageFeatures.js';\nimport { EditorOption, RenderLineNumbersType, ConfigurationChangedEvent } from '../../../common/config/editorOptions.js';\nimport { StickyScrollWidget, StickyScrollWidgetState } from './stickyScrollWidget.js';\nimport { IStickyLineCandidateProvider, StickyLineCandidateProvider } from './stickyScrollProvider.js';\nimport { IModelTokensChangedEvent } from '../../../common/textModelEvents.js';\nimport { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';\nimport { IContextMenuService } from '../../../../platform/contextview/browser/contextView.js';\nimport { MenuId } from '../../../../platform/actions/common/actions.js';\nimport { IContextKey, IContextKeyService } from '../../../../platform/contextkey/common/contextkey.js';\nimport { EditorContextKeys } from '../../../common/editorContextKeys.js';\nimport { ClickLinkGesture, ClickLinkMouseEvent } from '../../gotoSymbol/browser/link/clickLinkGesture.js';\nimport { IRange, Range } from '../../../common/core/range.js';\nimport { getDefinitionsAtPosition } from '../../gotoSymbol/browser/goToSymbol.js';\nimport { goToDefinitionWithLocation } from '../../inlayHints/browser/inlayHintsLocations.js';\nimport { IPosition, Position } from '../../../common/core/position.js';\nimport { CancellationTokenSource } from '../../../../base/common/cancellation.js';\nimport { ILanguageConfigurationService } from '../../../common/languages/languageConfigurationRegistry.js';\nimport { ILanguageFeatureDebounceService } from '../../../common/services/languageFeatureDebounce.js';\nimport * as dom from '../../../../base/browser/dom.js';\nimport { StickyRange } from './stickyScrollElement.js';\nimport { IMouseEvent, StandardMouseEvent } from '../../../../base/browser/mouseEvent.js';\nimport { FoldingController } from '../../folding/browser/folding.js';\nimport { FoldingModel, toggleCollapseState } from '../../folding/browser/foldingModel.js';\nimport { Emitter, Event } from '../../../../base/common/event.js';\nimport { mainWindow } from '../../../../base/browser/window.js';\n\nexport interface IStickyScrollController {\n\treadonly stickyScrollWidgetHeight: number;\n\tisFocused(): boolean;\n\tfocus(): void;\n\tfocusNext(): void;\n\tfocusPrevious(): void;\n\tgoToFocused(): void;\n\tdispose(): void;\n\tselectEditor(): void;\n\treadonly onDidChangeStickyScrollHeight: Event<{ height: number }>;\n}\n\nexport class StickyScrollController extends Disposable implements IEditorContribution, IStickyScrollController {\n\n\tstatic readonly ID = 'store.contrib.stickyScrollController';\n\n\tprivate readonly _stickyScrollWidget: StickyScrollWidget;\n\tprivate readonly _stickyLineCandidateProvider: IStickyLineCandidateProvider;\n\tprivate readonly _sessionStore: DisposableStore = new DisposableStore();\n\n\tprivate _widgetState: StickyScrollWidgetState;\n\tprivate _foldingModel: FoldingModel | undefined;\n\tprivate _maxStickyLines: number = Number.MAX_SAFE_INTEGER;\n\n\tprivate _stickyRangeProjectedOnEditor: IRange | undefined;\n\tprivate _candidateDefinitionsLength: number = -1;\n\n\tprivate _stickyScrollFocusedContextKey: IContextKey<boolean>;\n\tprivate _stickyScrollVisibleContextKey: IContextKey<boolean>;\n\n\tprivate _focusDisposableStore: DisposableStore | undefined;\n\tprivate _focusedStickyElementIndex: number = -1;\n\tprivate _enabled = false;\n\tprivate _focused = false;\n\tprivate _positionRevealed = false;\n\tprivate _onMouseDown = false;\n\tprivate _endLineNumbers: number[] = [];\n\tprivate _showEndForLine: number | undefined;\n\tprivate _minRebuildFromLine: number | undefined;\n\tprivate _mouseTarget: EventTarget | null = null;\n\n\tprivate readonly _onDidChangeStickyScrollHeight = this._register(new Emitter<{ height: number }>());\n\tpublic readonly onDidChangeStickyScrollHeight = this._onDidChangeStickyScrollHeight.event;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\t@IContextMenuService private readonly _contextMenuService: IContextMenuService,\n\t\t@ILanguageFeaturesService private readonly _languageFeaturesService: ILanguageFeaturesService,\n\t\t@IInstantiationService private readonly _instaService: IInstantiationService,\n\t\t@ILanguageConfigurationService _languageConfigurationService: ILanguageConfigurationService,\n\t\t@ILanguageFeatureDebounceService _languageFeatureDebounceService: ILanguageFeatureDebounceService,\n\t\t@IContextKeyService private readonly _contextKeyService: IContextKeyService\n\t) {\n\t\tsuper();\n\t\tthis._stickyScrollWidget = new StickyScrollWidget(this._editor);\n\t\tthis._stickyLineCandidateProvider = new StickyLineCandidateProvider(this._editor, _languageFeaturesService, _languageConfigurationService);\n\t\tthis._register(this._stickyScrollWidget);\n\t\tthis._register(this._stickyLineCandidateProvider);\n\n\t\tthis._widgetState = StickyScrollWidgetState.Empty;\n\t\tconst stickyScrollDomNode = this._stickyScrollWidget.getDomNode();\n\t\tthis._register(this._editor.onDidChangeLineHeight((e) => {\n\t\t\te.changes.forEach((change) => {\n\t\t\t\tconst lineNumber = change.lineNumber;\n\t\t\t\tif (this._widgetState.startLineNumbers.includes(lineNumber)) {\n\t\t\t\t\tthis._renderStickyScroll(lineNumber);\n\t\t\t\t}\n\t\t\t});\n\t\t}));\n\t\tthis._register(this._editor.onDidChangeFont((e) => {\n\t\t\te.changes.forEach((change) => {\n\t\t\t\tconst lineNumber = change.lineNumber;\n\t\t\t\tif (this._widgetState.startLineNumbers.includes(lineNumber)) {\n\t\t\t\t\tthis._renderStickyScroll(lineNumber);\n\t\t\t\t}\n\t\t\t});\n\t\t}));\n\t\tthis._register(this._editor.onDidChangeConfiguration(e => {\n\t\t\tthis._readConfigurationChange(e);\n\t\t}));\n\t\tthis._register(dom.addDisposableListener(stickyScrollDomNode, dom.EventType.CONTEXT_MENU, async (event: MouseEvent) => {\n\t\t\tthis._onContextMenu(dom.getWindow(stickyScrollDomNode), event);\n\t\t}));\n\t\tthis._stickyScrollFocusedContextKey = EditorContextKeys.stickyScrollFocused.bindTo(this._contextKeyService);\n\t\tthis._stickyScrollVisibleContextKey = EditorContextKeys.stickyScrollVisible.bindTo(this._contextKeyService);\n\t\tconst focusTracker = this._register(dom.trackFocus(stickyScrollDomNode));\n\t\tthis._register(focusTracker.onDidBlur(_ => {\n\t\t\t// Suppose that the blurring is caused by scrolling, then keep the focus on the sticky scroll\n\t\t\t// This is determined by the fact that the height of the widget has become zero and there has been no position revealing\n\t\t\tif (this._positionRevealed === false && stickyScrollDomNode.clientHeight === 0) {\n\t\t\t\tthis._focusedStickyElementIndex = -1;\n\t\t\t\tthis.focus();\n\n\t\t\t}\n\t\t\t// In all other casees, dispose the focus on the sticky scroll\n\t\t\telse {\n\t\t\t\tthis._disposeFocusStickyScrollStore();\n\t\t\t}\n\t\t}));\n\t\tthis._register(focusTracker.onDidFocus(_ => {\n\t\t\tthis.focus();\n\t\t}));\n\t\tthis._registerMouseListeners();\n\t\t// Suppose that mouse down on the sticky scroll, then do not focus on the sticky scroll because this will be followed by the revealing of a position\n\t\tthis._register(dom.addDisposableListener(stickyScrollDomNode, dom.EventType.MOUSE_DOWN, (e) => {\n\t\t\tthis._onMouseDown = true;\n\t\t}));\n\t\tthis._register(this._stickyScrollWidget.onDidChangeStickyScrollHeight((e) => {\n\t\t\tthis._onDidChangeStickyScrollHeight.fire(e);\n\t\t}));\n\t\tthis._onDidResize();\n\t\tthis._readConfiguration();\n\t}\n\n\tget stickyScrollWidgetHeight(): number {\n\t\treturn this._stickyScrollWidget.height;\n\t}\n\n\tpublic static get(editor: ICodeEditor): IStickyScrollController | null {\n\t\treturn editor.getContribution<StickyScrollController>(StickyScrollController.ID);\n\t}\n\n\tprivate _disposeFocusStickyScrollStore() {\n\t\tthis._stickyScrollFocusedContextKey.set(false);\n\t\tthis._focusDisposableStore?.dispose();\n\t\tthis._focused = false;\n\t\tthis._positionRevealed = false;\n\t\tthis._onMouseDown = false;\n\t}\n\n\tpublic isFocused(): boolean {\n\t\treturn this._focused;\n\t}\n\n\tpublic focus(): void {\n\t\t// If the mouse is down, do not focus on the sticky scroll\n\t\tif (this._onMouseDown) {\n\t\t\tthis._onMouseDown = false;\n\t\t\tthis._editor.focus();\n\t\t\treturn;\n\t\t}\n\t\tconst focusState = this._stickyScrollFocusedContextKey.get();\n\t\tif (focusState === true) {\n\t\t\treturn;\n\t\t}\n\t\tthis._focused = true;\n\t\tthis._focusDisposableStore = new DisposableStore();\n\t\tthis._stickyScrollFocusedContextKey.set(true);\n\t\tthis._focusedStickyElementIndex = this._stickyScrollWidget.lineNumbers.length - 1;\n\t\tthis._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex);\n\t}\n\n\tpublic focusNext(): void {\n\t\tif (this._focusedStickyElementIndex < this._stickyScrollWidget.lineNumberCount - 1) {\n\t\t\tthis._focusNav(true);\n\t\t}\n\t}\n\n\tpublic focusPrevious(): void {\n\t\tif (this._focusedStickyElementIndex > 0) {\n\t\t\tthis._focusNav(false);\n\t\t}\n\t}\n\n\tpublic selectEditor(): void {\n\t\tthis._editor.focus();\n\t}\n\n\t// True is next, false is previous\n\tprivate _focusNav(direction: boolean): void {\n\t\tthis._focusedStickyElementIndex = direction ? this._focusedStickyElementIndex + 1 : this._focusedStickyElementIndex - 1;\n\t\tthis._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex);\n\t}\n\n\tpublic goToFocused(): void {\n\t\tconst lineNumbers = this._stickyScrollWidget.lineNumbers;\n\t\tthis._disposeFocusStickyScrollStore();\n\t\tthis._revealPosition({ lineNumber: lineNumbers[this._focusedStickyElementIndex], column: 1 });\n\t}\n\n\tprivate _revealPosition(position: IPosition): void {\n\t\tthis._reveaInEditor(position, () => this._editor.revealPosition(position));\n\t}\n\n\tprivate _revealLineInCenterIfOutsideViewport(position: IPosition): void {\n\t\tthis._reveaInEditor(position, () => this._editor.revealLineInCenterIfOutsideViewport(position.lineNumber, ScrollType.Smooth));\n\t}\n\n\tprivate _reveaInEditor(position: IPosition, revealFunction: () => void): void {\n\t\tif (this._focused) {\n\t\t\tthis._disposeFocusStickyScrollStore();\n\t\t}\n\t\tthis._positionRevealed = true;\n\t\trevealFunction();\n\t\tthis._editor.setSelection(Range.fromPositions(position));\n\t\tthis._editor.focus();\n\t}\n\n\tprivate _registerMouseListeners(): void {\n\n\t\tconst sessionStore = this._register(new DisposableStore());\n\t\tconst gesture = this._register(new ClickLinkGesture(this._editor, {\n\t\t\textractLineNumberFromMouseEvent: (e) => {\n\t\t\t\tconst position = this._stickyScrollWidget.getEditorPositionFromNode(e.target.element);\n\t\t\t\treturn position ? position.lineNumber : 0;\n\t\t\t}\n\t\t}));\n\n\t\tconst getMouseEventTarget = (mouseEvent: ClickLinkMouseEvent): { range: Range; textElement: HTMLElement } | null => {\n\t\t\tif (!this._editor.hasModel()) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tif (mouseEvent.target.type !== MouseTargetType.OVERLAY_WIDGET || mouseEvent.target.detail !== this._stickyScrollWidget.getId()) {\n\t\t\t\t// not hovering over our widget\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst mouseTargetElement = mouseEvent.target.element;\n\t\t\tif (!mouseTargetElement || mouseTargetElement.innerText !== mouseTargetElement.innerHTML) {\n\t\t\t\t// not on a span element rendering text\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst position = this._stickyScrollWidget.getEditorPositionFromNode(mouseTargetElement);\n\t\t\tif (!position) {\n\t\t\t\t// not hovering a sticky scroll line\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\trange: new Range(position.lineNumber, position.column, position.lineNumber, position.column + mouseTargetElement.innerText.length),\n\t\t\t\ttextElement: mouseTargetElement\n\t\t\t};\n\t\t};\n\n\t\tconst stickyScrollWidgetDomNode = this._stickyScrollWidget.getDomNode();\n\t\tthis._register(dom.addStandardDisposableListener(stickyScrollWidgetDomNode, dom.EventType.CLICK, (mouseEvent: IMouseEvent) => {\n\t\t\tif (mouseEvent.ctrlKey || mouseEvent.altKey || mouseEvent.metaKey) {\n\t\t\t\t// modifier pressed\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (!mouseEvent.leftButton) {\n\t\t\t\t// not left click\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (mouseEvent.shiftKey) {\n\t\t\t\t// shift click\n\t\t\t\tconst lineIndex = this._stickyScrollWidget.getLineIndexFromChildDomNode(mouseEvent.target);\n\t\t\t\tif (lineIndex === null) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst position = new Position(this._endLineNumbers[lineIndex], 1);\n\t\t\t\tthis._revealLineInCenterIfOutsideViewport(position);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst isInFoldingIconDomNode = this._stickyScrollWidget.isInFoldingIconDomNode(mouseEvent.target);\n\t\t\tif (isInFoldingIconDomNode) {\n\t\t\t\t// clicked on folding icon\n\t\t\t\tconst lineNumber = this._stickyScrollWidget.getLineNumberFromChildDomNode(mouseEvent.target);\n\t\t\t\tthis._toggleFoldingRegionForLine(lineNumber);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst isInStickyLine = this._stickyScrollWidget.isInStickyLine(mouseEvent.target);\n\t\t\tif (!isInStickyLine) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// normal click\n\t\t\tlet position = this._stickyScrollWidget.getEditorPositionFromNode(mouseEvent.target);\n\t\t\tif (!position) {\n\t\t\t\tconst lineNumber = this._stickyScrollWidget.getLineNumberFromChildDomNode(mouseEvent.target);\n\t\t\t\tif (lineNumber === null) {\n\t\t\t\t\t// not hovering a sticky scroll line\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tposition = new Position(lineNumber, 1);\n\t\t\t}\n\t\t\tthis._revealPosition(position);\n\t\t}));\n\t\tthis._register(dom.addDisposableListener(mainWindow, dom.EventType.MOUSE_MOVE, mouseEvent => {\n\t\t\tthis._mouseTarget = mouseEvent.target;\n\t\t\tthis._onMouseMoveOrKeyDown(mouseEvent);\n\t\t}));\n\t\tthis._register(dom.addDisposableListener(mainWindow, dom.EventType.KEY_DOWN, mouseEvent => {\n\t\t\tthis._onMouseMoveOrKeyDown(mouseEvent);\n\t\t}));\n\t\tthis._register(dom.addDisposableListener(mainWindow, dom.EventType.KEY_UP, () => {\n\t\t\tif (this._showEndForLine !== undefined) {\n\t\t\t\tthis._showEndForLine = undefined;\n\t\t\t\tthis._renderStickyScroll();\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(gesture.onMouseMoveOrRelevantKeyDown(([mouseEvent, _keyboardEvent]) => {\n\t\t\tconst mouseTarget = getMouseEventTarget(mouseEvent);\n\t\t\tif (!mouseTarget || !mouseEvent.hasTriggerModifier || !this._editor.hasModel()) {\n\t\t\t\tsessionStore.clear();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst { range, textElement } = mouseTarget;\n\n\t\t\tif (!range.equalsRange(this._stickyRangeProjectedOnEditor)) {\n\t\t\t\tthis._stickyRangeProjectedOnEditor = range;\n\t\t\t\tsessionStore.clear();\n\t\t\t} else if (textElement.style.textDecoration === 'underline') {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst cancellationToken = new CancellationTokenSource();\n\t\t\tsessionStore.add(toDisposable(() => cancellationToken.dispose(true)));\n\n\t\t\tlet currentHTMLChild: HTMLElement;\n\n\t\t\tgetDefinitionsAtPosition(this._languageFeaturesService.definitionProvider, this._editor.getModel(), new Position(range.startLineNumber, range.startColumn + 1), false, cancellationToken.token).then((candidateDefinitions => {\n\t\t\t\tif (cancellationToken.token.isCancellationRequested) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (candidateDefinitions.length !== 0) {\n\t\t\t\t\tthis._candidateDefinitionsLength = candidateDefinitions.length;\n\t\t\t\t\tconst childHTML: HTMLElement = textElement;\n\t\t\t\t\tif (currentHTMLChild !== childHTML) {\n\t\t\t\t\t\tsessionStore.clear();\n\t\t\t\t\t\tcurrentHTMLChild = childHTML;\n\t\t\t\t\t\tcurrentHTMLChild.style.textDecoration = 'underline';\n\t\t\t\t\t\tsessionStore.add(toDisposable(() => {\n\t\t\t\t\t\t\tcurrentHTMLChild.style.textDecoration = 'none';\n\t\t\t\t\t\t}));\n\t\t\t\t\t} else if (!currentHTMLChild) {\n\t\t\t\t\t\tcurrentHTMLChild = childHTML;\n\t\t\t\t\t\tcurrentHTMLChild.style.textDecoration = 'underline';\n\t\t\t\t\t\tsessionStore.add(toDisposable(() => {\n\t\t\t\t\t\t\tcurrentHTMLChild.style.textDecoration = 'none';\n\t\t\t\t\t\t}));\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tsessionStore.clear();\n\t\t\t\t}\n\t\t\t}));\n\t\t}));\n\t\tthis._register(gesture.onCancel(() => {\n\t\t\tsessionStore.clear();\n\t\t}));\n\t\tthis._register(gesture.onExecute(async e => {\n\t\t\tif (e.target.type !== MouseTargetType.OVERLAY_WIDGET || e.target.detail !== this._stickyScrollWidget.getId()) {\n\t\t\t\t// not hovering over our widget\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst position = this._stickyScrollWidget.getEditorPositionFromNode(e.target.element);\n\t\t\tif (!position) {\n\t\t\t\t// not hovering a sticky scroll line\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (!this._editor.hasModel() || !this._stickyRangeProjectedOnEditor) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (this._candidateDefinitionsLength > 1) {\n\t\t\t\tif (this._focused) {\n\t\t\t\t\tthis._disposeFocusStickyScrollStore();\n\t\t\t\t}\n\t\t\t\tthis._revealPosition({ lineNumber: position.lineNumber, column: 1 });\n\t\t\t}\n\t\t\tthis._instaService.invokeFunction(goToDefinitionWithLocation, e, this._editor as IActiveCodeEditor, { uri: this._editor.getModel().uri, range: this._stickyRangeProjectedOnEditor });\n\t\t}));\n\t}\n\n\tprivate _onContextMenu(targetWindow: Window, e: MouseEvent) {\n\t\tconst event = new StandardMouseEvent(targetWindow, e);\n\n\t\tthis._contextMenuService.showContextMenu({\n\t\t\tmenuId: MenuId.StickyScrollContext,\n\t\t\tgetAnchor: () => event,\n\t\t});\n\t}\n\n\tprivate _onMouseMoveOrKeyDown(mouseEvent: KeyboardEvent | MouseEvent): void {\n\t\tif (!mouseEvent.shiftKey) {\n\t\t\treturn;\n\t\t}\n\t\tif (!this._mouseTarget || !dom.isHTMLElement(this._mouseTarget)) {\n\t\t\treturn;\n\t\t}\n\t\tconst currentEndForLineIndex = this._stickyScrollWidget.getLineIndexFromChildDomNode(this._mouseTarget);\n\t\tif (currentEndForLineIndex === null || this._showEndForLine === currentEndForLineIndex) {\n\t\t\treturn;\n\t\t}\n\t\tthis._showEndForLine = currentEndForLineIndex;\n\t\tthis._renderStickyScroll();\n\t}\n\n\tprivate _toggleFoldingRegionForLine(line: number | null) {\n\t\tif (!this._foldingModel || line === null) {\n\t\t\treturn;\n\t\t}\n\t\tconst stickyLine = this._stickyScrollWidget.getRenderedStickyLine(line);\n\t\tconst foldingIcon = stickyLine?.foldingIcon;\n\t\tif (!foldingIcon) {\n\t\t\treturn;\n\t\t}\n\t\ttoggleCollapseState(this._foldingModel, 1, [line]);\n\t\tfoldingIcon.isCollapsed = !foldingIcon.isCollapsed;\n\t\tconst scrollTop = (foldingIcon.isCollapsed ?\n\t\t\tthis._editor.getTopForLineNumber(foldingIcon.foldingEndLine)\n\t\t\t: this._editor.getTopForLineNumber(foldingIcon.foldingStartLine))\n\t\t\t- this._editor.getOption(EditorOption.lineHeight) * stickyLine.index + 1;\n\t\tthis._editor.setScrollTop(scrollTop);\n\t\tthis._renderStickyScroll(line);\n\t}\n\n\tprivate _readConfiguration() {\n\t\tconst options = this._editor.getOption(EditorOption.stickyScroll);\n\t\tif (options.enabled === false) {\n\t\t\tthis._editor.removeOverlayWidget(this._stickyScrollWidget);\n\t\t\tthis._resetState();\n\t\t\tthis._sessionStore.clear();\n\t\t\tthis._enabled = false;\n\t\t\treturn;\n\t\t} else if (options.enabled && !this._enabled) {\n\t\t\t// When sticky scroll was just enabled, add the listeners on the sticky scroll\n\t\t\tthis._editor.addOverlayWidget(this._stickyScrollWidget);\n\t\t\tthis._sessionStore.add(this._editor.onDidScrollChange((e) => {\n\t\t\t\tif (e.scrollTopChanged) {\n\t\t\t\t\tthis._showEndForLine = undefined;\n\t\t\t\t\tthis._renderStickyScroll();\n\t\t\t\t}\n\t\t\t}));\n\t\t\tthis._sessionStore.add(this._editor.onDidLayoutChange(() => this._onDidResize()));\n\t\t\tthis._sessionStore.add(this._editor.onDidChangeModelTokens((e) => this._onTokensChange(e)));\n\t\t\tthis._sessionStore.add(this._stickyLineCandidateProvider.onDidChangeStickyScroll(() => {\n\t\t\t\tthis._showEndForLine = undefined;\n\t\t\t\tthis._renderStickyScroll();\n\t\t\t}));\n\t\t\tthis._enabled = true;\n\t\t}\n\n\t\tconst lineNumberOption = this._editor.getOption(EditorOption.lineNumbers);\n\t\tif (lineNumberOption.renderType === RenderLineNumbersType.Relative) {\n\t\t\tthis._sessionStore.add(this._editor.onDidChangeCursorPosition(() => {\n\t\t\t\tthis._showEndForLine = undefined;\n\t\t\t\tthis._renderStickyScroll(0);\n\t\t\t}));\n\t\t}\n\t}\n\n\tprivate _readConfigurationChange(event: ConfigurationChangedEvent) {\n\t\tif (\n\t\t\tevent.hasChanged(EditorOption.stickyScroll)\n\t\t\t|| event.hasChanged(EditorOption.minimap)\n\t\t\t|| event.hasChanged(EditorOption.lineHeight)\n\t\t\t|| event.hasChanged(EditorOption.showFoldingControls)\n\t\t\t|| event.hasChanged(EditorOption.lineNumbers)\n\t\t) {\n\t\t\tthis._readConfiguration();\n\t\t}\n\n\t\tif (event.hasChanged(EditorOption.lineNumbers) || event.hasChanged(EditorOption.folding) || event.hasChanged(EditorOption.showFoldingControls)) {\n\t\t\tthis._renderStickyScroll(0);\n\t\t}\n\t}\n\n\tprivate _needsUpdate(event: IModelTokensChangedEvent) {\n\t\tconst stickyLineNumbers = this._stickyScrollWidget.getCurrentLines();\n\t\tfor (const stickyLineNumber of stickyLineNumbers) {\n\t\t\tfor (const range of event.ranges) {\n\t\t\t\tif (stickyLineNumber >= range.fromLineNumber && stickyLineNumber <= range.toLineNumber) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tprivate _onTokensChange(event: IModelTokensChangedEvent) {\n\t\tif (this._needsUpdate(event)) {\n\t\t\t// Rebuilding the whole widget from line 0\n\t\t\tthis._renderStickyScroll(0);\n\t\t}\n\t}\n\n\tprivate _onDidResize() {\n\t\tconst layoutInfo = this._editor.getLayoutInfo();\n\t\t// Make sure sticky scroll doesn't take up more than 25% of the editor\n\t\tconst theoreticalLines = layoutInfo.height / this._editor.getOption(EditorOption.lineHeight);\n\t\tthis._maxStickyLines = Math.round(theoreticalLines * .25);\n\t\tthis._renderStickyScroll(0);\n\t}\n\n\tprivate async _renderStickyScroll(rebuildFromLine?: number): Promise<void> {\n\t\tconst model = this._editor.getModel();\n\t\tif (!model || model.isTooLargeForTokenization()) {\n\t\t\tthis._resetState();\n\t\t\treturn;\n\t\t}\n\t\tconst nextRebuildFromLine = this._updateAndGetMinRebuildFromLine(rebuildFromLine);\n\t\tconst stickyWidgetVersion = this._stickyLineCandidateProvider.getVersionId();\n\t\tconst shouldUpdateState = stickyWidgetVersion === undefined || stickyWidgetVersion === model.getVersionId();\n\t\tif (shouldUpdateState) {\n\t\t\tif (!this._focused) {\n\t\t\t\tawait this._updateState(nextRebuildFromLine);\n\t\t\t} else {\n\t\t\t\t// Suppose that previously the sticky scroll widget had height 0, then if there are visible lines, set the last line as focused\n\t\t\t\tif (this._focusedStickyElementIndex === -1) {\n\t\t\t\t\tawait this._updateState(nextRebuildFromLine);\n\t\t\t\t\tthis._focusedStickyElementIndex = this._stickyScrollWidget.lineNumberCount - 1;\n\t\t\t\t\tif (this._focusedStickyElementIndex !== -1) {\n\t\t\t\t\t\tthis._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconst focusedStickyElementLineNumber = this._stickyScrollWidget.lineNumbers[this._focusedStickyElementIndex];\n\t\t\t\t\tawait this._updateState(nextRebuildFromLine);\n\t\t\t\t\t// Suppose that after setting the state, there are no sticky lines, set the focused index to -1\n\t\t\t\t\tif (this._stickyScrollWidget.lineNumberCount === 0) {\n\t\t\t\t\t\tthis._focusedStickyElementIndex = -1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst previousFocusedLineNumberExists = this._stickyScrollWidget.lineNumbers.includes(focusedStickyElementLineNumber);\n\n\t\t\t\t\t\t// If the line number is still there, do not change anything\n\t\t\t\t\t\t// If the line number is not there, set the new focused line to be the last line\n\t\t\t\t\t\tif (!previousFocusedLineNumberExists) {\n\t\t\t\t\t\t\tthis._focusedStickyElementIndex = this._stickyScrollWidget.lineNumberCount - 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate _updateAndGetMinRebuildFromLine(rebuildFromLine: number | undefined): number | undefined {\n\t\tif (rebuildFromLine !== undefined) {\n\t\t\tconst minRebuildFromLineOrInfinity = this._minRebuildFromLine !== undefined ? this._minRebuildFromLine : Infinity;\n\t\t\tthis._minRebuildFromLine = Math.min(rebuildFromLine, minRebuildFromLineOrInfinity);\n\t\t}\n\t\treturn this._minRebuildFromLine;\n\t}\n\n\tprivate async _updateState(rebuildFromLine?: number): Promise<void> {\n\t\tthis._minRebuildFromLine = undefined;\n\t\tthis._foldingModel = await FoldingController.get(this._editor)?.getFoldingModel() ?? undefined;\n\t\tthis._widgetState = this.findScrollWidgetState();\n\t\tconst stickyWidgetHasLines = this._widgetState.startLineNumbers.length > 0;\n\t\tthis._stickyScrollVisibleContextKey.set(stickyWidgetHasLines);\n\t\tthis._stickyScrollWidget.setState(this._widgetState, this._foldingModel, rebuildFromLine);\n\t}\n\n\tprivate async _resetState(): Promise<void> {\n\t\tthis._minRebuildFromLine = undefined;\n\t\tthis._foldingModel = undefined;\n\t\tthis._widgetState = StickyScrollWidgetState.Empty;\n\t\tthis._stickyScrollVisibleContextKey.set(false);\n\t\tthis._stickyScrollWidget.setState(undefined, undefined);\n\t}\n\n\tfindScrollWidgetState(): StickyScrollWidgetState {\n\t\tconst maxNumberStickyLines = Math.min(this._maxStickyLines, this._editor.getOption(EditorOption.stickyScroll).maxLineCount);\n\t\tconst scrollTop: number = this._editor.getScrollTop();\n\t\tlet lastLineRelativePosition: number = 0;\n\t\tconst startLineNumbers: number[] = [];\n\t\tconst endLineNumbers: number[] = [];\n\t\tconst arrayVisibleRanges = this._editor.getVisibleRanges();\n\t\tif (arrayVisibleRanges.length !== 0) {\n\t\t\tconst fullVisibleRange = new StickyRange(arrayVisibleRanges[0].startLineNumber, arrayVisibleRanges[arrayVisibleRanges.length - 1].endLineNumber);\n\t\t\tconst candidateRanges = this._stickyLineCandidateProvider.getCandidateStickyLinesIntersecting(fullVisibleRange);\n\t\t\tfor (const range of candidateRanges) {\n\t\t\t\tconst start = range.startLineNumber;\n\t\t\t\tconst end = range.endLineNumber;\n\t\t\t\tconst topOfElement = range.top;\n\t\t\t\tconst bottomOfElement = topOfElement + range.height;\n\t\t\t\tconst topOfBeginningLine = this._editor.getTopForLineNumber(start) - scrollTop;\n\t\t\t\tconst bottomOfEndLine = this._editor.getBottomForLineNumber(end) - scrollTop;\n\t\t\t\tif (topOfElement > topOfBeginningLine && topOfElement <= bottomOfEndLine) {\n\t\t\t\t\tstartLineNumbers.push(start);\n\t\t\t\t\tendLineNumbers.push(end + 1);\n\t\t\t\t\tif (bottomOfElement > bottomOfEndLine) {\n\t\t\t\t\t\tlastLineRelativePosition = bottomOfEndLine - bottomOfElement;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (startLineNumbers.length === maxNumberStickyLines) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthis._endLineNumbers = endLineNumbers;\n\t\treturn new StickyScrollWidgetState(startLineNumbers, endLineNumbers, lastLineRelativePosition, this._showEndForLine);\n\t}\n\n\toverride dispose(): void {\n\t\tsuper.dispose();\n\t\tthis._sessionStore.dispose();\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 { Disposable, DisposableStore, toDisposable } from '../../../../base/common/lifecycle.js';\nimport { IActiveCodeEditor, ICodeEditor, MouseTargetType } from '../../../browser/editorBrowser.js';\nimport { IEditorContribution, ScrollType } from '../../../common/editorCommon.js';\nimport { ILanguageFeaturesService } from '../../../common/services/languageFeatures.js';\nimport { EditorOption, RenderLineNumbersType, ConfigurationChangedEvent } from '../../../common/config/editorOptions.js';\nimport { StickyScrollWidget, StickyScrollWidgetState } from './stickyScrollWidget.js';\nimport { IStickyLineCandidateProvider, StickyLineCandidateProvider } from './stickyScrollProvider.js';\nimport { IModelTokensChangedEvent } from '../../../common/textModelEvents.js';\nimport { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';\nimport { IContextMenuService } from '../../../../platform/contextview/browser/contextView.js';\nimport { MenuId } from '../../../../platform/actions/common/actions.js';\nimport { IContextKey, IContextKeyService } from '../../../../platform/contextkey/common/contextkey.js';\nimport { EditorContextKeys } from '../../../common/editorContextKeys.js';\nimport { ClickLinkGesture, ClickLinkMouseEvent } from '../../gotoSymbol/browser/link/clickLinkGesture.js';\nimport { IRange, Range } from '../../../common/core/range.js';\nimport { getDefinitionsAtPosition } from '../../gotoSymbol/browser/goToSymbol.js';\nimport { goToDefinitionWithLocation } from '../../inlayHints/browser/inlayHintsLocations.js';\nimport { IPosition, Position } from '../../../common/core/position.js';\nimport { CancellationTokenSource } from '../../../../base/common/cancellation.js';\nimport { ILanguageConfigurationService } from '../../../common/languages/languageConfigurationRegistry.js';\nimport { ILanguageFeatureDebounceService } from '../../../common/services/languageFeatureDebounce.js';\nimport * as dom from '../../../../base/browser/dom.js';\nimport { StickyRange } from './stickyScrollElement.js';\nimport { IMouseEvent, StandardMouseEvent } from '../../../../base/browser/mouseEvent.js';\nimport { FoldingController } from '../../folding/browser/folding.js';\nimport { FoldingModel, toggleCollapseState } from '../../folding/browser/foldingModel.js';\nimport { Emitter, Event } from '../../../../base/common/event.js';\nimport { mainWindow } from '../../../../base/browser/window.js';\n\nexport interface IStickyScrollController {\n\treadonly stickyScrollWidgetHeight: number;\n\tisFocused(): boolean;\n\tfocus(): void;\n\tfocusNext(): void;\n\tfocusPrevious(): void;\n\tgoToFocused(): void;\n\tdispose(): void;\n\tselectEditor(): void;\n\treadonly onDidChangeStickyScrollHeight: Event<{ height: number }>;\n}\n\nexport class StickyScrollController extends Disposable implements IEditorContribution, IStickyScrollController {\n\n\tstatic readonly ID = 'store.contrib.stickyScrollController';\n\n\tprivate readonly _stickyScrollWidget: StickyScrollWidget;\n\tprivate readonly _stickyLineCandidateProvider: IStickyLineCandidateProvider;\n\tprivate readonly _sessionStore: DisposableStore = new DisposableStore();\n\n\tprivate _widgetState: StickyScrollWidgetState;\n\tprivate _foldingModel: FoldingModel | undefined;\n\tprivate _maxStickyLines: number = Number.MAX_SAFE_INTEGER;\n\n\tprivate _stickyRangeProjectedOnEditor: IRange | undefined;\n\tprivate _candidateDefinitionsLength: number = -1;\n\n\tprivate _stickyScrollFocusedContextKey: IContextKey<boolean>;\n\tprivate _stickyScrollVisibleContextKey: IContextKey<boolean>;\n\n\tprivate _focusDisposableStore: DisposableStore | undefined;\n\tprivate _focusedStickyElementIndex: number = -1;\n\tprivate _enabled = false;\n\tprivate _focused = false;\n\tprivate _positionRevealed = false;\n\tprivate _onMouseDown = false;\n\tprivate _endLineNumbers: number[] = [];\n\tprivate _showEndForLine: number | undefined;\n\tprivate _minRebuildFromLine: number | undefined;\n\tprivate _mouseTarget: EventTarget | null = null;\n\n\tprivate readonly _onDidChangeStickyScrollHeight = this._register(new Emitter<{ height: number }>());\n\tpublic readonly onDidChangeStickyScrollHeight = this._onDidChangeStickyScrollHeight.event;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\t@IContextMenuService private readonly _contextMenuService: IContextMenuService,\n\t\t@ILanguageFeaturesService private readonly _languageFeaturesService: ILanguageFeaturesService,\n\t\t@IInstantiationService private readonly _instaService: IInstantiationService,\n\t\t@ILanguageConfigurationService _languageConfigurationService: ILanguageConfigurationService,\n\t\t@ILanguageFeatureDebounceService _languageFeatureDebounceService: ILanguageFeatureDebounceService,\n\t\t@IContextKeyService private readonly _contextKeyService: IContextKeyService\n\t) {\n\t\tsuper();\n\t\tthis._stickyScrollWidget = new StickyScrollWidget(this._editor);\n\t\tthis._stickyLineCandidateProvider = new StickyLineCandidateProvider(this._editor, _languageFeaturesService, _languageConfigurationService);\n\t\tthis._register(this._stickyScrollWidget);\n\t\tthis._register(this._stickyLineCandidateProvider);\n\n\t\tthis._widgetState = StickyScrollWidgetState.Empty;\n\t\tconst stickyScrollDomNode = this._stickyScrollWidget.getDomNode();\n\t\tthis._register(this._editor.onDidChangeLineHeight((e) => {\n\t\t\te.changes.forEach((change) => {\n\t\t\t\tconst lineNumber = change.lineNumber;\n\t\t\t\tif (this._widgetState.startLineNumbers.includes(lineNumber)) {\n\t\t\t\t\tthis._renderStickyScroll(lineNumber);\n\t\t\t\t}\n\t\t\t});\n\t\t}));\n\t\tthis._register(this._editor.onDidChangeFont((e) => {\n\t\t\te.changes.forEach((change) => {\n\t\t\t\tconst lineNumber = change.lineNumber;\n\t\t\t\tif (this._widgetState.startLineNumbers.includes(lineNumber)) {\n\t\t\t\t\tthis._renderStickyScroll(lineNumber);\n\t\t\t\t}\n\t\t\t});\n\t\t}));\n\t\tthis._register(this._editor.onDidChangeConfiguration(e => {\n\t\t\tthis._readConfigurationChange(e);\n\t\t}));\n\t\tthis._register(dom.addDisposableListener(stickyScrollDomNode, dom.EventType.CONTEXT_MENU, async (event: MouseEvent) => {\n\t\t\tthis._onContextMenu(dom.getWindow(stickyScrollDomNode), event);\n\t\t}));\n\t\tthis._stickyScrollFocusedContextKey = EditorContextKeys.stickyScrollFocused.bindTo(this._contextKeyService);\n\t\tthis._stickyScrollVisibleContextKey = EditorContextKeys.stickyScrollVisible.bindTo(this._contextKeyService);\n\t\tconst focusTracker = this._register(dom.trackFocus(stickyScrollDomNode));\n\t\tthis._register(focusTracker.onDidBlur(_ => {\n\t\t\t// Suppose that the blurring is caused by scrolling, then keep the focus on the sticky scroll\n\t\t\t// This is determined by the fact that the height of the widget has become zero and there has been no position revealing\n\t\t\tif (this._positionRevealed === false && stickyScrollDomNode.clientHeight === 0) {\n\t\t\t\tthis._focusedStickyElementIndex = -1;\n\t\t\t\tthis.focus();\n\n\t\t\t}\n\t\t\t// In all other casees, dispose the focus on the sticky scroll\n\t\t\telse {\n\t\t\t\tthis._disposeFocusStickyScrollStore();\n\t\t\t}\n\t\t}));\n\t\tthis._register(focusTracker.onDidFocus(_ => {\n\t\t\tthis.focus();\n\t\t}));\n\t\tthis._registerMouseListeners();\n\t\t// Suppose that mouse down on the sticky scroll, then do not focus on the sticky scroll because this will be followed by the revealing of a position\n\t\tthis._register(dom.addDisposableListener(stickyScrollDomNode, dom.EventType.MOUSE_DOWN, (e) => {\n\t\t\tthis._onMouseDown = true;\n\t\t}));\n\t\tthis._register(this._stickyScrollWidget.onDidChangeStickyScrollHeight((e) => {\n\t\t\tthis._onDidChangeStickyScrollHeight.fire(e);\n\t\t}));\n\t\tthis._onDidResize();\n\t\tthis._readConfiguration();\n\t}\n\n\tget stickyScrollWidgetHeight(): number {\n\t\treturn this._stickyScrollWidget.height;\n\t}\n\n\tpublic static get(editor: ICodeEditor): IStickyScrollController | null {\n\t\treturn editor.getContribution<StickyScrollController>(StickyScrollController.ID);\n\t}\n\n\tprivate _disposeFocusStickyScrollStore() {\n\t\tthis._stickyScrollFocusedContextKey.set(false);\n\t\tthis._focusDisposableStore?.dispose();\n\t\tthis._focused = false;\n\t\tthis._positionRevealed = false;\n\t\tthis._onMouseDown = false;\n\t}\n\n\tpublic isFocused(): boolean {\n\t\treturn this._focused;\n\t}\n\n\tpublic focus(): void {\n\t\t// If the mouse is down, do not focus on the sticky scroll\n\t\tif (this._onMouseDown) {\n\t\t\tthis._onMouseDown = false;\n\t\t\tthis._editor.focus();\n\t\t\treturn;\n\t\t}\n\t\tconst focusState = this._stickyScrollFocusedContextKey.get();\n\t\tif (focusState === true) {\n\t\t\treturn;\n\t\t}\n\t\tthis._focused = true;\n\t\tthis._focusDisposableStore = new DisposableStore();\n\t\tthis._stickyScrollFocusedContextKey.set(true);\n\t\tthis._focusedStickyElementIndex = this._stickyScrollWidget.lineNumbers.length - 1;\n\t\tthis._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex);\n\t}\n\n\tpublic focusNext(): void {\n\t\tif (this._focusedStickyElementIndex < this._stickyScrollWidget.lineNumberCount - 1) {\n\t\t\tthis._focusNav(true);\n\t\t}\n\t}\n\n\tpublic focusPrevious(): void {\n\t\tif (this._focusedStickyElementIndex > 0) {\n\t\t\tthis._focusNav(false);\n\t\t}\n\t}\n\n\tpublic selectEditor(): void {\n\t\tthis._editor.focus();\n\t}\n\n\t// True is next, false is previous\n\tprivate _focusNav(direction: boolean): void {\n\t\tthis._focusedStickyElementIndex = direction ? this._focusedStickyElementIndex + 1 : this._focusedStickyElementIndex - 1;\n\t\tthis._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex);\n\t}\n\n\tpublic goToFocused(): void {\n\t\tconst lineNumbers = this._stickyScrollWidget.lineNumbers;\n\t\tthis._disposeFocusStickyScrollStore();\n\t\tthis._revealPosition({ lineNumber: lineNumbers[this._focusedStickyElementIndex], column: 1 });\n\t}\n\n\tprivate _revealPosition(position: IPosition): void {\n\t\tthis._reveaInEditor(position, () => this._editor.revealPosition(position));\n\t}\n\n\tprivate _revealLineInCenterIfOutsideViewport(position: IPosition): void {\n\t\tthis._reveaInEditor(position, () => this._editor.revealLineInCenterIfOutsideViewport(position.lineNumber, ScrollType.Smooth));\n\t}\n\n\tprivate _reveaInEditor(position: IPosition, revealFunction: () => void): void {\n\t\tif (this._focused) {\n\t\t\tthis._disposeFocusStickyScrollStore();\n\t\t}\n\t\tthis._positionRevealed = true;\n\t\trevealFunction();\n\t\tthis._editor.setSelection(Range.fromPositions(position));\n\t\tthis._editor.focus();\n\t}\n\n\tprivate _registerMouseListeners(): void {\n\n\t\tconst sessionStore = this._register(new DisposableStore());\n\t\tconst gesture = this._register(new ClickLinkGesture(this._editor, {\n\t\t\textractLineNumberFromMouseEvent: (e) => {\n\t\t\t\tconst position = this._stickyScrollWidget.getEditorPositionFromNode(e.target.element);\n\t\t\t\treturn position ? position.lineNumber : 0;\n\t\t\t}\n\t\t}));\n\n\t\tconst getMouseEventTarget = (mouseEvent: ClickLinkMouseEvent): { range: Range; textElement: HTMLElement } | null => {\n\t\t\tif (!this._editor.hasModel()) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tif (mouseEvent.target.type !== MouseTargetType.OVERLAY_WIDGET || mouseEvent.target.detail !== this._stickyScrollWidget.getId()) {\n\t\t\t\t// not hovering over our widget\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst mouseTargetElement = mouseEvent.target.element;\n\t\t\tif (!mouseTargetElement || mouseTargetElement.innerText !== mouseTargetElement.innerHTML) {\n\t\t\t\t// not on a span element rendering text\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst position = this._stickyScrollWidget.getEditorPositionFromNode(mouseTargetElement);\n\t\t\tif (!position) {\n\t\t\t\t// not hovering a sticky scroll line\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\trange: new Range(position.lineNumber, position.column, position.lineNumber, position.column + mouseTargetElement.innerText.length),\n\t\t\t\ttextElement: mouseTargetElement\n\t\t\t};\n\t\t};\n\n\t\tconst stickyScrollWidgetDomNode = this._stickyScrollWidget.getDomNode();\n\t\tthis._register(dom.addStandardDisposableListener(stickyScrollWidgetDomNode, dom.EventType.CLICK, (mouseEvent: IMouseEvent) => {\n\t\t\tif (mouseEvent.ctrlKey || mouseEvent.altKey || mouseEvent.metaKey) {\n\t\t\t\t// modifier pressed\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (!mouseEvent.leftButton) {\n\t\t\t\t// not left click\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (mouseEvent.shiftKey) {\n\t\t\t\t// shift click\n\t\t\t\tconst lineIndex = this._stickyScrollWidget.getLineIndexFromChildDomNode(mouseEvent.target);\n\t\t\t\tif (lineIndex === null) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst position = new Position(this._endLineNumbers[lineIndex], 1);\n\t\t\t\tthis._revealLineInCenterIfOutsideViewport(position);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst isInFoldingIconDomNode = this._stickyScrollWidget.isInFoldingIconDomNode(mouseEvent.target);\n\t\t\tif (isInFoldingIconDomNode) {\n\t\t\t\t// clicked on folding icon\n\t\t\t\tconst lineNumber = this._stickyScrollWidget.getLineNumberFromChildDomNode(mouseEvent.target);\n\t\t\t\tthis._toggleFoldingRegionForLine(lineNumber);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst isInStickyLine = this._stickyScrollWidget.isInStickyLine(mouseEvent.target);\n\t\t\tif (!isInStickyLine) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// normal click\n\t\t\tlet position = this._stickyScrollWidget.getEditorPositionFromNode(mouseEvent.target);\n\t\t\tif (!position) {\n\t\t\t\tconst lineNumber = this._stickyScrollWidget.getLineNumberFromChildDomNode(mouseEvent.target);\n\t\t\t\tif (lineNumber === null) {\n\t\t\t\t\t// not hovering a sticky scroll line\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tposition = new Position(lineNumber, 1);\n\t\t\t}\n\t\t\tthis._revealPosition(position);\n\t\t}));\n\t\tthis._register(dom.addDisposableListener(mainWindow, dom.EventType.MOUSE_MOVE, mouseEvent => {\n\t\t\tthis._mouseTarget = mouseEvent.target;\n\t\t\tthis._onMouseMoveOrKeyDown(mouseEvent);\n\t\t}));\n\t\tthis._register(dom.addDisposableListener(mainWindow, dom.EventType.KEY_DOWN, mouseEvent => {\n\t\t\tthis._onMouseMoveOrKeyDown(mouseEvent);\n\t\t}));\n\t\tthis._register(dom.addDisposableListener(mainWindow, dom.EventType.KEY_UP, () => {\n\t\t\tif (this._showEndForLine !== undefined) {\n\t\t\t\tthis._showEndForLine = undefined;\n\t\t\t\tthis._renderStickyScroll();\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(gesture.onMouseMoveOrRelevantKeyDown(([mouseEvent, _keyboardEvent]) => {\n\t\t\tconst mouseTarget = getMouseEventTarget(mouseEvent);\n\t\t\tif (!mouseTarget || !mouseEvent.hasTriggerModifier || !this._editor.hasModel()) {\n\t\t\t\tsessionStore.clear();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst { range, textElement } = mouseTarget;\n\n\t\t\tif (!range.equalsRange(this._stickyRangeProjectedOnEditor)) {\n\t\t\t\tthis._stickyRangeProjectedOnEditor = range;\n\t\t\t\tsessionStore.clear();\n\t\t\t} else if (textElement.style.textDecoration === 'underline') {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst cancellationToken = new CancellationTokenSource();\n\t\t\tsessionStore.add(toDisposable(() => cancellationToken.dispose(true)));\n\n\t\t\tlet currentHTMLChild: HTMLElement;\n\n\t\t\tgetDefinitionsAtPosition(this._languageFeaturesService.definitionProvider, this._editor.getModel(), new Position(range.startLineNumber, range.startColumn + 1), false, cancellationToken.token).then((candidateDefinitions => {\n\t\t\t\tif (cancellationToken.token.isCancellationRequested) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (candidateDefinitions.length !== 0) {\n\t\t\t\t\tthis._candidateDefinitionsLength = candidateDefinitions.length;\n\t\t\t\t\tconst childHTML: HTMLElement = textElement;\n\t\t\t\t\tif (currentHTMLChild !== childHTML) {\n\t\t\t\t\t\tsessionStore.clear();\n\t\t\t\t\t\tcurrentHTMLChild = childHTML;\n\t\t\t\t\t\tcurrentHTMLChild.style.textDecoration = 'underline';\n\t\t\t\t\t\tsessionStore.add(toDisposable(() => {\n\t\t\t\t\t\t\tcurrentHTMLChild.style.textDecoration = 'none';\n\t\t\t\t\t\t}));\n\t\t\t\t\t} else if (!currentHTMLChild) {\n\t\t\t\t\t\tcurrentHTMLChild = childHTML;\n\t\t\t\t\t\tcurrentHTMLChild.style.textDecoration = 'underline';\n\t\t\t\t\t\tsessionStore.add(toDisposable(() => {\n\t\t\t\t\t\t\tcurrentHTMLChild.style.textDecoration = 'none';\n\t\t\t\t\t\t}));\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tsessionStore.clear();\n\t\t\t\t}\n\t\t\t}));\n\t\t}));\n\t\tthis._register(gesture.onCancel(() => {\n\t\t\tsessionStore.clear();\n\t\t}));\n\t\tthis._register(gesture.onExecute(async e => {\n\t\t\tif (e.target.type !== MouseTargetType.OVERLAY_WIDGET || e.target.detail !== this._stickyScrollWidget.getId()) {\n\t\t\t\t// not hovering over our widget\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst position = this._stickyScrollWidget.getEditorPositionFromNode(e.target.element);\n\t\t\tif (!position) {\n\t\t\t\t// not hovering a sticky scroll line\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (!this._editor.hasModel() || !this._stickyRangeProjectedOnEditor) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (this._candidateDefinitionsLength > 1) {\n\t\t\t\tif (this._focused) {\n\t\t\t\t\tthis._disposeFocusStickyScrollStore();\n\t\t\t\t}\n\t\t\t\tthis._revealPosition({ lineNumber: position.lineNumber, column: 1 });\n\t\t\t}\n\t\t\tthis._instaService.invokeFunction(goToDefinitionWithLocation, e, this._editor as IActiveCodeEditor, { uri: this._editor.getModel().uri, range: this._stickyRangeProjectedOnEditor });\n\t\t}));\n\t}\n\n\tprivate _onContextMenu(targetWindow: Window, e: MouseEvent) {\n\t\tconst event = new StandardMouseEvent(targetWindow, e);\n\n\t\tthis._contextMenuService.showContextMenu({\n\t\t\tmenuId: MenuId.StickyScrollContext,\n\t\t\tgetAnchor: () => event,\n\t\t});\n\t}\n\n\tprivate _onMouseMoveOrKeyDown(mouseEvent: KeyboardEvent | MouseEvent): void {\n\t\tif (!mouseEvent.shiftKey) {\n\t\t\treturn;\n\t\t}\n\t\tif (!this._mouseTarget || !dom.isHTMLElement(this._mouseTarget)) {\n\t\t\treturn;\n\t\t}\n\t\tconst currentEndForLineIndex = this._stickyScrollWidget.getLineIndexFromChildDomNode(this._mouseTarget);\n\t\tif (currentEndForLineIndex === null || this._showEndForLine === currentEndForLineIndex) {\n\t\t\treturn;\n\t\t}\n\t\tthis._showEndForLine = currentEndForLineIndex;\n\t\tthis._renderStickyScroll();\n\t}\n\n\tprivate _toggleFoldingRegionForLine(line: number | null) {\n\t\tif (!this._foldingModel || line === null) {\n\t\t\treturn;\n\t\t}\n\t\tconst stickyLine = this._stickyScrollWidget.getRenderedStickyLine(line);\n\t\tconst foldingIcon = stickyLine?.foldingIcon;\n\t\tif (!foldingIcon) {\n\t\t\treturn;\n\t\t}\n\t\ttoggleCollapseState(this._foldingModel, 1, [line]);\n\t\tfoldingIcon.isCollapsed = !foldingIcon.isCollapsed;\n\t\tconst scrollTop = (foldingIcon.isCollapsed ?\n\t\t\tthis._editor.getTopForLineNumber(foldingIcon.foldingEndLine)\n\t\t\t: this._editor.getTopForLineNumber(foldingIcon.foldingStartLine))\n\t\t\t- this._editor.getOption(EditorOption.lineHeight) * stickyLine.index + 1;\n\t\tthis._editor.setScrollTop(scrollTop);\n\t\tthis._renderStickyScroll(line);\n\t}\n\n\tprivate _readConfiguration() {\n\t\tconst options = this._editor.getOption(EditorOption.stickyScroll);\n\t\tif (options.enabled === false) {\n\t\t\tthis._editor.removeOverlayWidget(this._stickyScrollWidget);\n\t\t\tthis._resetState();\n\t\t\tthis._sessionStore.clear();\n\t\t\tthis._enabled = false;\n\t\t\treturn;\n\t\t} else if (options.enabled && !this._enabled) {\n\t\t\t// When sticky scroll was just enabled, add the listeners on the sticky scroll\n\t\t\tthis._editor.addOverlayWidget(this._stickyScrollWidget);\n\t\t\tthis._sessionStore.add(this._editor.onDidScrollChange((e) => {\n\t\t\t\tif (e.scrollTopChanged) {\n\t\t\t\t\tthis._showEndForLine = undefined;\n\t\t\t\t\tthis._renderStickyScroll();\n\t\t\t\t}\n\t\t\t}));\n\t\t\tthis._sessionStore.add(this._editor.onDidLayoutChange(() => this._onDidResize()));\n\t\t\tthis._sessionStore.add(this._editor.onDidChangeModelTokens((e) => this._onTokensChange(e)));\n\t\t\tthis._sessionStore.add(this._stickyLineCandidateProvider.onDidChangeStickyScroll(() => {\n\t\t\t\tthis._showEndForLine = undefined;\n\t\t\t\tthis._renderStickyScroll();\n\t\t\t}));\n\t\t\tthis._enabled = true;\n\t\t}\n\n\t\tconst lineNumberOption = this._editor.getOption(EditorOption.lineNumbers);\n\t\tif (lineNumberOption.renderType === RenderLineNumbersType.Relative) {\n\t\t\tthis._sessionStore.add(this._editor.onDidChangeCursorPosition(() => {\n\t\t\t\tthis._showEndForLine = undefined;\n\t\t\t\tthis._renderStickyScroll(0);\n\t\t\t}));\n\t\t}\n\t}\n\n\tprivate _readConfigurationChange(event: ConfigurationChangedEvent) {\n\t\tif (\n\t\t\tevent.hasChanged(EditorOption.stickyScroll)\n\t\t\t|| event.hasChanged(EditorOption.minimap)\n\t\t\t|| event.hasChanged(EditorOption.lineHeight)\n\t\t\t|| event.hasChanged(EditorOption.showFoldingControls)\n\t\t\t|| event.hasChanged(EditorOption.lineNumbers)\n\t\t) {\n\t\t\tthis._readConfiguration();\n\t\t}\n\n\t\tif (event.hasChanged(EditorOption.lineNumbers) || event.hasChanged(EditorOption.folding) || event.hasChanged(EditorOption.showFoldingControls)) {\n\t\t\tthis._renderStickyScroll(0);\n\t\t}\n\t}\n\n\tprivate _needsUpdate(event: IModelTokensChangedEvent) {\n\t\tconst stickyLineNumbers = this._stickyScrollWidget.getCurrentLines();\n\t\tfor (const stickyLineNumber of stickyLineNumbers) {\n\t\t\tfor (const range of event.ranges) {\n\t\t\t\tif (stickyLineNumber >= range.fromLineNumber && stickyLineNumber <= range.toLineNumber) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tprivate _onTokensChange(event: IModelTokensChangedEvent) {\n\t\tif (this._needsUpdate(event)) {\n\t\t\t// Rebuilding the whole widget from line 0\n\t\t\tthis._renderStickyScroll(0);\n\t\t}\n\t}\n\n\tprivate _onDidResize() {\n\t\tconst layoutInfo = this._editor.getLayoutInfo();\n\t\t// Make sure sticky scroll doesn't take up more than 25% of the editor\n\t\tconst theoreticalLines = layoutInfo.height / this._editor.getOption(EditorOption.lineHeight);\n\t\tthis._maxStickyLines = Math.round(theoreticalLines * .25);\n\t\tthis._renderStickyScroll(0);\n\t}\n\n\tprivate async _renderStickyScroll(rebuildFromLine?: number): Promise<void> {\n\t\tconst model = this._editor.getModel();\n\t\tif (!model || model.isTooLargeForTokenization()) {\n\t\t\tthis._resetState();\n\t\t\treturn;\n\t\t}\n\t\tconst nextRebuildFromLine = this._updateAndGetMinRebuildFromLine(rebuildFromLine);\n\t\tconst stickyWidgetVersion = this._stickyLineCandidateProvider.getVersionId();\n\t\tconst shouldUpdateState = stickyWidgetVersion === undefined || stickyWidgetVersion === model.getVersionId();\n\t\tif (shouldUpdateState) {\n\t\t\tif (!this._focused) {\n\t\t\t\tawait this._updateState(nextRebuildFromLine);\n\t\t\t} else {\n\t\t\t\t// Suppose that previously the sticky scroll widget had height 0, then if there are visible lines, set the last line as focused\n\t\t\t\tif (this._focusedStickyElementIndex === -1) {\n\t\t\t\t\tawait this._updateState(nextRebuildFromLine);\n\t\t\t\t\tthis._focusedStickyElementIndex = this._stickyScrollWidget.lineNumberCount - 1;\n\t\t\t\t\tif (this._focusedStickyElementIndex !== -1) {\n\t\t\t\t\t\tthis._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconst focusedStickyElementLineNumber = this._stickyScrollWidget.lineNumbers[this._focusedStickyElementIndex];\n\t\t\t\t\tawait this._updateState(nextRebuildFromLine);\n\t\t\t\t\t// Suppose that after setting the state, there are no sticky lines, set the focused index to -1\n\t\t\t\t\tif (this._stickyScrollWidget.lineNumberCount === 0) {\n\t\t\t\t\t\tthis._focusedStickyElementIndex = -1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst previousFocusedLineNumberExists = this._stickyScrollWidget.lineNumbers.includes(focusedStickyElementLineNumber);\n\n\t\t\t\t\t\t// If the line number is still there, do not change anything\n\t\t\t\t\t\t// If the line number is not there, set the new focused line to be the last line\n\t\t\t\t\t\tif (!previousFocusedLineNumberExists) {\n\t\t\t\t\t\t\tthis._focusedStickyElementIndex = this._stickyScrollWidget.lineNumberCount - 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate _updateAndGetMinRebuildFromLine(rebuildFromLine: number | undefined): number | undefined {\n\t\tif (rebuildFromLine !== undefined) {\n\t\t\tconst minRebuildFromLineOrInfinity = this._minRebuildFromLine !== undefined ? this._minRebuildFromLine : Infinity;\n\t\t\tthis._minRebuildFromLine = Math.min(rebuildFromLine, minRebuildFromLineOrInfinity);\n\t\t}\n\t\treturn this._minRebuildFromLine;\n\t}\n\n\tprivate async _updateState(rebuildFromLine?: number): Promise<void> {\n\t\tthis._minRebuildFromLine = undefined;\n\t\tthis._foldingModel = await FoldingController.get(this._editor)?.getFoldingModel() ?? undefined;\n\t\tthis._widgetState = this.findScrollWidgetState();\n\t\tconst stickyWidgetHasLines = this._widgetState.startLineNumbers.length > 0;\n\t\tthis._stickyScrollVisibleContextKey.set(stickyWidgetHasLines);\n\t\tthis._stickyScrollWidget.setState(this._widgetState, this._foldingModel, rebuildFromLine);\n\t}\n\n\tprivate async _resetState(): Promise<void> {\n\t\tthis._minRebuildFromLine = undefined;\n\t\tthis._foldingModel = undefined;\n\t\tthis._widgetState = StickyScrollWidgetState.Empty;\n\t\tthis._stickyScrollVisibleContextKey.set(false);\n\t\tthis._stickyScrollWidget.setState(undefined, undefined);\n\t}\n\n\tfindScrollWidgetState(): StickyScrollWidgetState {\n\t\tconst maxNumberStickyLines = Math.min(this._maxStickyLines, this._editor.getOption(EditorOption.stickyScroll).maxLineCount);\n\t\tconst scrollTop: number = this._editor.getScrollTop();\n\t\tlet lastLineRelativePosition: number = 0;\n\t\tconst startLineNumbers: number[] = [];\n\t\tconst endLineNumbers: number[] = [];\n\t\tconst arrayVisibleRanges = this._editor.getVisibleRanges();\n\t\tif (arrayVisibleRanges.length !== 0) {\n\t\t\tconst fullVisibleRange = new StickyRange(arrayVisibleRanges[0].startLineNumber, arrayVisibleRanges[arrayVisibleRanges.length - 1].endLineNumber);\n\t\t\tconst candidateRanges = this._stickyLineCandidateProvider.getCandidateStickyLinesIntersecting(fullVisibleRange);\n\t\t\tfor (const range of candidateRanges) {\n\t\t\t\tconst start = range.startLineNumber;\n\t\t\t\tconst end = range.endLineNumber;\n\t\t\t\tconst topOfElement = range.top;\n\t\t\t\tconst bottomOfElement = topOfElement + range.height;\n\t\t\t\tconst topOfBeginningLine = this._editor.getTopForLineNumber(start) - scrollTop;\n\t\t\t\tconst bottomOfEndLine = this._editor.getBottomForLineNumber(end) - scrollTop;\n\t\t\t\tif (topOfElement > topOfBeginningLine && topOfElement <= bottomOfEndLine) {\n\t\t\t\t\tstartLineNumbers.push(start);\n\t\t\t\t\tendLineNumbers.push(end + 1);\n\t\t\t\t\tif (bottomOfElement > bottomOfEndLine) {\n\t\t\t\t\t\tlastLineRelativePosition = bottomOfEndLine - bottomOfElement;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (startLineNumbers.length === maxNumberStickyLines) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthis._endLineNumbers = endLineNumbers;\n\t\treturn new StickyScrollWidgetState(startLineNumbers, endLineNumbers, lastLineRelativePosition, this._showEndForLine);\n\t}\n\n\toverride dispose(): void {\n\t\tsuper.dispose();\n\t\tthis._sessionStore.dispose();\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/stickyScroll/browser/stickyScrollController.ts","vs/editor/contrib/stickyScroll/browser/stickyScrollController.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;;AAEhG,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAGjG,OAAO,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AAExF,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACtF,OAAO,EAAgC,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAEtG,OAAO,EAAE,qBAAqB,EAAE,MAAM,4DAA4D,CAAC;AACnG,OAAO,EAAE,mBAAmB,EAAE,MAAM,yDAAyD,CAAC;AAC9F,OAAO,EAAE,MAAM,EAAE,MAAM,gDAAgD,CAAC;AACxE,OAAO,EAAe,kBAAkB,EAAE,MAAM,sDAAsD,CAAC;AACvG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CA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sB;IAkChC,WAAA,mBAAmB,CAAA;IACnB,WAAA,wBAAwB,CAAA;IACxB,WAAA,qBAAqB,CAAA;IACrB,WAAA,6BAA6B,CAAA;IAC7B,WAAA,+BAA+B,CAAA;IAC/B,WAAA,kBAAkB,CAAA;GAvCR,sBAAsB,CA6jBlC","file":"stickyScrollController.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 { Disposable, DisposableStore, toDisposable } from '../../../../base/common/lifecycle.js';\nimport { ICodeEditor, MouseTargetType } from '../../../browser/editorBrowser.js';\nimport { IEditorContribution, ScrollType } from '../../../common/editorCommon.js';\nimport { ILanguageFeaturesService } from '../../../common/services/languageFeatures.js';\nimport { EditorOption, RenderLineNumbersType, ConfigurationChangedEvent } from '../../../common/config/editorOptions.js';\nimport { StickyScrollWidget, StickyScrollWidgetState } from './stickyScrollWidget.js';\nimport { IStickyLineCandidateProvider, StickyLineCandidateProvider } from './stickyScrollProvider.js';\nimport { IModelTokensChangedEvent } from '../../../common/textModelEvents.js';\nimport { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';\nimport { IContextMenuService } from '../../../../platform/contextview/browser/contextView.js';\nimport { MenuId } from '../../../../platform/actions/common/actions.js';\nimport { IContextKey, IContextKeyService } from '../../../../platform/contextkey/common/contextkey.js';\nimport { EditorContextKeys } from '../../../common/editorContextKeys.js';\nimport { ClickLinkGesture, ClickLinkMouseEvent } from '../../gotoSymbol/browser/link/clickLinkGesture.js';\nimport { IRange, Range } from '../../../common/core/range.js';\nimport { getDefinitionsAtPosition } from '../../gotoSymbol/browser/goToSymbol.js';\nimport { goToDefinitionWithLocation } from '../../inlayHints/browser/inlayHintsLocations.js';\nimport { IPosition, Position } from '../../../common/core/position.js';\nimport { CancellationTokenSource } from '../../../../base/common/cancellation.js';\nimport { ILanguageConfigurationService } from '../../../common/languages/languageConfigurationRegistry.js';\nimport { ILanguageFeatureDebounceService } from '../../../common/services/languageFeatureDebounce.js';\nimport * as dom from '../../../../base/browser/dom.js';\nimport { StickyRange } from './stickyScrollElement.js';\nimport { IMouseEvent, StandardMouseEvent } from '../../../../base/browser/mouseEvent.js';\nimport { FoldingController } from '../../folding/browser/folding.js';\nimport { FoldingModel, toggleCollapseState } from '../../folding/browser/foldingModel.js';\nimport { Emitter, Event } from '../../../../base/common/event.js';\nimport { mainWindow } from '../../../../base/browser/window.js';\n\nexport interface IStickyScrollController {\n\treadonly stickyScrollWidgetHeight: number;\n\tisFocused(): boolean;\n\tfocus(): void;\n\tfocusNext(): void;\n\tfocusPrevious(): void;\n\tgoToFocused(): void;\n\tdispose(): void;\n\tselectEditor(): void;\n\treadonly onDidChangeStickyScrollHeight: Event<{ height: number }>;\n}\n\nexport class StickyScrollController extends Disposable implements IEditorContribution, IStickyScrollController {\n\n\tstatic readonly ID = 'store.contrib.stickyScrollController';\n\n\tprivate readonly _stickyScrollWidget: StickyScrollWidget;\n\tprivate readonly _stickyLineCandidateProvider: IStickyLineCandidateProvider;\n\tprivate readonly _sessionStore: DisposableStore = new DisposableStore();\n\n\tprivate _widgetState: StickyScrollWidgetState;\n\tprivate _foldingModel: FoldingModel | undefined;\n\tprivate _maxStickyLines: number = Number.MAX_SAFE_INTEGER;\n\n\tprivate _stickyRangeProjectedOnEditor: IRange | undefined;\n\tprivate _candidateDefinitionsLength: number = -1;\n\n\tprivate _stickyScrollFocusedContextKey: IContextKey<boolean>;\n\tprivate _stickyScrollVisibleContextKey: IContextKey<boolean>;\n\n\tprivate _focusDisposableStore: DisposableStore | undefined;\n\tprivate _focusedStickyElementIndex: number = -1;\n\tprivate _enabled = false;\n\tprivate _focused = false;\n\tprivate _positionRevealed = false;\n\tprivate _onMouseDown = false;\n\tprivate _endLineNumbers: number[] = [];\n\tprivate _showEndForLine: number | undefined;\n\tprivate _minRebuildFromLine: number | undefined;\n\tprivate _mouseTarget: EventTarget | null = null;\n\n\tprivate readonly _onDidChangeStickyScrollHeight = this._register(new Emitter<{ height: number }>());\n\tpublic readonly onDidChangeStickyScrollHeight = this._onDidChangeStickyScrollHeight.event;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\t@IContextMenuService private readonly _contextMenuService: IContextMenuService,\n\t\t@ILanguageFeaturesService private readonly _languageFeaturesService: ILanguageFeaturesService,\n\t\t@IInstantiationService private readonly _instaService: IInstantiationService,\n\t\t@ILanguageConfigurationService _languageConfigurationService: ILanguageConfigurationService,\n\t\t@ILanguageFeatureDebounceService _languageFeatureDebounceService: ILanguageFeatureDebounceService,\n\t\t@IContextKeyService private readonly _contextKeyService: IContextKeyService\n\t) {\n\t\tsuper();\n\t\tthis._stickyScrollWidget = new StickyScrollWidget(this._editor);\n\t\tthis._stickyLineCandidateProvider = new StickyLineCandidateProvider(this._editor, _languageFeaturesService, _languageConfigurationService);\n\t\tthis._register(this._stickyScrollWidget);\n\t\tthis._register(this._stickyLineCandidateProvider);\n\n\t\tthis._widgetState = StickyScrollWidgetState.Empty;\n\t\tconst stickyScrollDomNode = this._stickyScrollWidget.getDomNode();\n\t\tthis._register(this._editor.onDidChangeLineHeight((e) => {\n\t\t\te.changes.forEach((change) => {\n\t\t\t\tconst lineNumber = change.lineNumber;\n\t\t\t\tif (this._widgetState.startLineNumbers.includes(lineNumber)) {\n\t\t\t\t\tthis._renderStickyScroll(lineNumber);\n\t\t\t\t}\n\t\t\t});\n\t\t}));\n\t\tthis._register(this._editor.onDidChangeFont((e) => {\n\t\t\te.changes.forEach((change) => {\n\t\t\t\tconst lineNumber = change.lineNumber;\n\t\t\t\tif (this._widgetState.startLineNumbers.includes(lineNumber)) {\n\t\t\t\t\tthis._renderStickyScroll(lineNumber);\n\t\t\t\t}\n\t\t\t});\n\t\t}));\n\t\tthis._register(this._editor.onDidChangeConfiguration(e => {\n\t\t\tthis._readConfigurationChange(e);\n\t\t}));\n\t\tthis._register(dom.addDisposableListener(stickyScrollDomNode, dom.EventType.CONTEXT_MENU, async (event: MouseEvent) => {\n\t\t\tthis._onContextMenu(dom.getWindow(stickyScrollDomNode), event);\n\t\t}));\n\t\tthis._stickyScrollFocusedContextKey = EditorContextKeys.stickyScrollFocused.bindTo(this._contextKeyService);\n\t\tthis._stickyScrollVisibleContextKey = EditorContextKeys.stickyScrollVisible.bindTo(this._contextKeyService);\n\t\tconst focusTracker = this._register(dom.trackFocus(stickyScrollDomNode));\n\t\tthis._register(focusTracker.onDidBlur(_ => {\n\t\t\t// Suppose that the blurring is caused by scrolling, then keep the focus on the sticky scroll\n\t\t\t// This is determined by the fact that the height of the widget has become zero and there has been no position revealing\n\t\t\tif (this._positionRevealed === false && stickyScrollDomNode.clientHeight === 0) {\n\t\t\t\tthis._focusedStickyElementIndex = -1;\n\t\t\t\tthis.focus();\n\n\t\t\t}\n\t\t\t// In all other casees, dispose the focus on the sticky scroll\n\t\t\telse {\n\t\t\t\tthis._disposeFocusStickyScrollStore();\n\t\t\t}\n\t\t}));\n\t\tthis._register(focusTracker.onDidFocus(_ => {\n\t\t\tthis.focus();\n\t\t}));\n\t\tthis._registerMouseListeners();\n\t\t// Suppose that mouse down on the sticky scroll, then do not focus on the sticky scroll because this will be followed by the revealing of a position\n\t\tthis._register(dom.addDisposableListener(stickyScrollDomNode, dom.EventType.MOUSE_DOWN, (e) => {\n\t\t\tthis._onMouseDown = true;\n\t\t}));\n\t\tthis._register(this._stickyScrollWidget.onDidChangeStickyScrollHeight((e) => {\n\t\t\tthis._onDidChangeStickyScrollHeight.fire(e);\n\t\t}));\n\t\tthis._onDidResize();\n\t\tthis._readConfiguration();\n\t}\n\n\tget stickyScrollWidgetHeight(): number {\n\t\treturn this._stickyScrollWidget.height;\n\t}\n\n\tpublic static get(editor: ICodeEditor): IStickyScrollController | null {\n\t\treturn editor.getContribution<StickyScrollController>(StickyScrollController.ID);\n\t}\n\n\tprivate _disposeFocusStickyScrollStore() {\n\t\tthis._stickyScrollFocusedContextKey.set(false);\n\t\tthis._focusDisposableStore?.dispose();\n\t\tthis._focused = false;\n\t\tthis._positionRevealed = false;\n\t\tthis._onMouseDown = false;\n\t}\n\n\tpublic isFocused(): boolean {\n\t\treturn this._focused;\n\t}\n\n\tpublic focus(): void {\n\t\t// If the mouse is down, do not focus on the sticky scroll\n\t\tif (this._onMouseDown) {\n\t\t\tthis._onMouseDown = false;\n\t\t\tthis._editor.focus();\n\t\t\treturn;\n\t\t}\n\t\tconst focusState = this._stickyScrollFocusedContextKey.get();\n\t\tif (focusState === true) {\n\t\t\treturn;\n\t\t}\n\t\tthis._focused = true;\n\t\tthis._focusDisposableStore = new DisposableStore();\n\t\tthis._stickyScrollFocusedContextKey.set(true);\n\t\tthis._focusedStickyElementIndex = this._stickyScrollWidget.lineNumbers.length - 1;\n\t\tthis._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex);\n\t}\n\n\tpublic focusNext(): void {\n\t\tif (this._focusedStickyElementIndex < this._stickyScrollWidget.lineNumberCount - 1) {\n\t\t\tthis._focusNav(true);\n\t\t}\n\t}\n\n\tpublic focusPrevious(): void {\n\t\tif (this._focusedStickyElementIndex > 0) {\n\t\t\tthis._focusNav(false);\n\t\t}\n\t}\n\n\tpublic selectEditor(): void {\n\t\tthis._editor.focus();\n\t}\n\n\t// True is next, false is previous\n\tprivate _focusNav(direction: boolean): void {\n\t\tthis._focusedStickyElementIndex = direction ? this._focusedStickyElementIndex + 1 : this._focusedStickyElementIndex - 1;\n\t\tthis._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex);\n\t}\n\n\tpublic goToFocused(): void {\n\t\tconst lineNumbers = this._stickyScrollWidget.lineNumbers;\n\t\tthis._disposeFocusStickyScrollStore();\n\t\tthis._revealPosition({ lineNumber: lineNumbers[this._focusedStickyElementIndex], column: 1 });\n\t}\n\n\tprivate _revealPosition(position: IPosition): void {\n\t\tthis._reveaInEditor(position, () => this._editor.revealPosition(position));\n\t}\n\n\tprivate _revealLineInCenterIfOutsideViewport(position: IPosition): void {\n\t\tthis._reveaInEditor(position, () => this._editor.revealLineInCenterIfOutsideViewport(position.lineNumber, ScrollType.Smooth));\n\t}\n\n\tprivate _reveaInEditor(position: IPosition, revealFunction: () => void): void {\n\t\tif (this._focused) {\n\t\t\tthis._disposeFocusStickyScrollStore();\n\t\t}\n\t\tthis._positionRevealed = true;\n\t\trevealFunction();\n\t\tthis._editor.setSelection(Range.fromPositions(position));\n\t\tthis._editor.focus();\n\t}\n\n\tprivate _registerMouseListeners(): void {\n\n\t\tconst sessionStore = this._register(new DisposableStore());\n\t\tconst gesture = this._register(new ClickLinkGesture(this._editor, {\n\t\t\textractLineNumberFromMouseEvent: (e) => {\n\t\t\t\tconst position = this._stickyScrollWidget.getEditorPositionFromNode(e.target.element);\n\t\t\t\treturn position ? position.lineNumber : 0;\n\t\t\t}\n\t\t}));\n\n\t\tconst getMouseEventTarget = (mouseEvent: ClickLinkMouseEvent): { range: Range; textElement: HTMLElement } | null => {\n\t\t\tif (!this._editor.hasModel()) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tif (mouseEvent.target.type !== MouseTargetType.OVERLAY_WIDGET || mouseEvent.target.detail !== this._stickyScrollWidget.getId()) {\n\t\t\t\t// not hovering over our widget\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst mouseTargetElement = mouseEvent.target.element;\n\t\t\tif (!mouseTargetElement || mouseTargetElement.innerText !== mouseTargetElement.innerHTML) {\n\t\t\t\t// not on a span element rendering text\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst position = this._stickyScrollWidget.getEditorPositionFromNode(mouseTargetElement);\n\t\t\tif (!position) {\n\t\t\t\t// not hovering a sticky scroll line\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\trange: new Range(position.lineNumber, position.column, position.lineNumber, position.column + mouseTargetElement.innerText.length),\n\t\t\t\ttextElement: mouseTargetElement\n\t\t\t};\n\t\t};\n\n\t\tconst stickyScrollWidgetDomNode = this._stickyScrollWidget.getDomNode();\n\t\tthis._register(dom.addStandardDisposableListener(stickyScrollWidgetDomNode, dom.EventType.CLICK, (mouseEvent: IMouseEvent) => {\n\t\t\tif (mouseEvent.ctrlKey || mouseEvent.altKey || mouseEvent.metaKey) {\n\t\t\t\t// modifier pressed\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (!mouseEvent.leftButton) {\n\t\t\t\t// not left click\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (mouseEvent.shiftKey) {\n\t\t\t\t// shift click\n\t\t\t\tconst lineIndex = this._stickyScrollWidget.getLineIndexFromChildDomNode(mouseEvent.target);\n\t\t\t\tif (lineIndex === null) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst position = new Position(this._endLineNumbers[lineIndex], 1);\n\t\t\t\tthis._revealLineInCenterIfOutsideViewport(position);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst isInFoldingIconDomNode = this._stickyScrollWidget.isInFoldingIconDomNode(mouseEvent.target);\n\t\t\tif (isInFoldingIconDomNode) {\n\t\t\t\t// clicked on folding icon\n\t\t\t\tconst lineNumber = this._stickyScrollWidget.getLineNumberFromChildDomNode(mouseEvent.target);\n\t\t\t\tthis._toggleFoldingRegionForLine(lineNumber);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst isInStickyLine = this._stickyScrollWidget.isInStickyLine(mouseEvent.target);\n\t\t\tif (!isInStickyLine) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// normal click\n\t\t\tlet position = this._stickyScrollWidget.getEditorPositionFromNode(mouseEvent.target);\n\t\t\tif (!position) {\n\t\t\t\tconst lineNumber = this._stickyScrollWidget.getLineNumberFromChildDomNode(mouseEvent.target);\n\t\t\t\tif (lineNumber === null) {\n\t\t\t\t\t// not hovering a sticky scroll line\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tposition = new Position(lineNumber, 1);\n\t\t\t}\n\t\t\tthis._revealPosition(position);\n\t\t}));\n\t\tthis._register(dom.addDisposableListener(mainWindow, dom.EventType.MOUSE_MOVE, mouseEvent => {\n\t\t\tthis._mouseTarget = mouseEvent.target;\n\t\t\tthis._onMouseMoveOrKeyDown(mouseEvent);\n\t\t}));\n\t\tthis._register(dom.addDisposableListener(mainWindow, dom.EventType.KEY_DOWN, mouseEvent => {\n\t\t\tthis._onMouseMoveOrKeyDown(mouseEvent);\n\t\t}));\n\t\tthis._register(dom.addDisposableListener(mainWindow, dom.EventType.KEY_UP, () => {\n\t\t\tif (this._showEndForLine !== undefined) {\n\t\t\t\tthis._showEndForLine = undefined;\n\t\t\t\tthis._renderStickyScroll();\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(gesture.onMouseMoveOrRelevantKeyDown(([mouseEvent, _keyboardEvent]) => {\n\t\t\tconst mouseTarget = getMouseEventTarget(mouseEvent);\n\t\t\tif (!mouseTarget || !mouseEvent.hasTriggerModifier || !this._editor.hasModel()) {\n\t\t\t\tsessionStore.clear();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst { range, textElement } = mouseTarget;\n\n\t\t\tif (!range.equalsRange(this._stickyRangeProjectedOnEditor)) {\n\t\t\t\tthis._stickyRangeProjectedOnEditor = range;\n\t\t\t\tsessionStore.clear();\n\t\t\t} else if (textElement.style.textDecoration === 'underline') {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst cancellationToken = new CancellationTokenSource();\n\t\t\tsessionStore.add(toDisposable(() => cancellationToken.dispose(true)));\n\n\t\t\tlet currentHTMLChild: HTMLElement;\n\n\t\t\tgetDefinitionsAtPosition(this._languageFeaturesService.definitionProvider, this._editor.getModel(), new Position(range.startLineNumber, range.startColumn + 1), false, cancellationToken.token).then((candidateDefinitions => {\n\t\t\t\tif (cancellationToken.token.isCancellationRequested) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (candidateDefinitions.length !== 0) {\n\t\t\t\t\tthis._candidateDefinitionsLength = candidateDefinitions.length;\n\t\t\t\t\tconst childHTML: HTMLElement = textElement;\n\t\t\t\t\tif (currentHTMLChild !== childHTML) {\n\t\t\t\t\t\tsessionStore.clear();\n\t\t\t\t\t\tcurrentHTMLChild = childHTML;\n\t\t\t\t\t\tcurrentHTMLChild.style.textDecoration = 'underline';\n\t\t\t\t\t\tsessionStore.add(toDisposable(() => {\n\t\t\t\t\t\t\tcurrentHTMLChild.style.textDecoration = 'none';\n\t\t\t\t\t\t}));\n\t\t\t\t\t} else if (!currentHTMLChild) {\n\t\t\t\t\t\tcurrentHTMLChild = childHTML;\n\t\t\t\t\t\tcurrentHTMLChild.style.textDecoration = 'underline';\n\t\t\t\t\t\tsessionStore.add(toDisposable(() => {\n\t\t\t\t\t\t\tcurrentHTMLChild.style.textDecoration = 'none';\n\t\t\t\t\t\t}));\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tsessionStore.clear();\n\t\t\t\t}\n\t\t\t}));\n\t\t}));\n\t\tthis._register(gesture.onCancel(() => {\n\t\t\tsessionStore.clear();\n\t\t}));\n\t\tthis._register(gesture.onExecute(async e => {\n\t\t\tif (e.target.type !== MouseTargetType.OVERLAY_WIDGET || e.target.detail !== this._stickyScrollWidget.getId()) {\n\t\t\t\t// not hovering over our widget\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst position = this._stickyScrollWidget.getEditorPositionFromNode(e.target.element);\n\t\t\tif (!position) {\n\t\t\t\t// not hovering a sticky scroll line\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (!this._editor.hasModel() || !this._stickyRangeProjectedOnEditor) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (this._candidateDefinitionsLength > 1) {\n\t\t\t\tif (this._focused) {\n\t\t\t\t\tthis._disposeFocusStickyScrollStore();\n\t\t\t\t}\n\t\t\t\tthis._revealPosition({ lineNumber: position.lineNumber, column: 1 });\n\t\t\t}\n\t\t\tthis._instaService.invokeFunction(goToDefinitionWithLocation, e, this._editor, { uri: this._editor.getModel().uri, range: this._stickyRangeProjectedOnEditor });\n\t\t}));\n\t}\n\n\tprivate _onContextMenu(targetWindow: Window, e: MouseEvent) {\n\t\tconst event = new StandardMouseEvent(targetWindow, e);\n\n\t\tthis._contextMenuService.showContextMenu({\n\t\t\tmenuId: MenuId.StickyScrollContext,\n\t\t\tgetAnchor: () => event,\n\t\t});\n\t}\n\n\tprivate _onMouseMoveOrKeyDown(mouseEvent: KeyboardEvent | MouseEvent): void {\n\t\tif (!mouseEvent.shiftKey) {\n\t\t\treturn;\n\t\t}\n\t\tif (!this._mouseTarget || !dom.isHTMLElement(this._mouseTarget)) {\n\t\t\treturn;\n\t\t}\n\t\tconst currentEndForLineIndex = this._stickyScrollWidget.getLineIndexFromChildDomNode(this._mouseTarget);\n\t\tif (currentEndForLineIndex === null || this._showEndForLine === currentEndForLineIndex) {\n\t\t\treturn;\n\t\t}\n\t\tthis._showEndForLine = currentEndForLineIndex;\n\t\tthis._renderStickyScroll();\n\t}\n\n\tprivate _toggleFoldingRegionForLine(line: number | null) {\n\t\tif (!this._foldingModel || line === null) {\n\t\t\treturn;\n\t\t}\n\t\tconst stickyLine = this._stickyScrollWidget.getRenderedStickyLine(line);\n\t\tconst foldingIcon = stickyLine?.foldingIcon;\n\t\tif (!foldingIcon) {\n\t\t\treturn;\n\t\t}\n\t\ttoggleCollapseState(this._foldingModel, 1, [line]);\n\t\tfoldingIcon.isCollapsed = !foldingIcon.isCollapsed;\n\t\tconst scrollTop = (foldingIcon.isCollapsed ?\n\t\t\tthis._editor.getTopForLineNumber(foldingIcon.foldingEndLine)\n\t\t\t: this._editor.getTopForLineNumber(foldingIcon.foldingStartLine))\n\t\t\t- this._editor.getOption(EditorOption.lineHeight) * stickyLine.index + 1;\n\t\tthis._editor.setScrollTop(scrollTop);\n\t\tthis._renderStickyScroll(line);\n\t}\n\n\tprivate _readConfiguration() {\n\t\tconst options = this._editor.getOption(EditorOption.stickyScroll);\n\t\tif (options.enabled === false) {\n\t\t\tthis._editor.removeOverlayWidget(this._stickyScrollWidget);\n\t\t\tthis._resetState();\n\t\t\tthis._sessionStore.clear();\n\t\t\tthis._enabled = false;\n\t\t\treturn;\n\t\t} else if (options.enabled && !this._enabled) {\n\t\t\t// When sticky scroll was just enabled, add the listeners on the sticky scroll\n\t\t\tthis._editor.addOverlayWidget(this._stickyScrollWidget);\n\t\t\tthis._sessionStore.add(this._editor.onDidScrollChange((e) => {\n\t\t\t\tif (e.scrollTopChanged) {\n\t\t\t\t\tthis._showEndForLine = undefined;\n\t\t\t\t\tthis._renderStickyScroll();\n\t\t\t\t}\n\t\t\t}));\n\t\t\tthis._sessionStore.add(this._editor.onDidLayoutChange(() => this._onDidResize()));\n\t\t\tthis._sessionStore.add(this._editor.onDidChangeModelTokens((e) => this._onTokensChange(e)));\n\t\t\tthis._sessionStore.add(this._stickyLineCandidateProvider.onDidChangeStickyScroll(() => {\n\t\t\t\tthis._showEndForLine = undefined;\n\t\t\t\tthis._renderStickyScroll();\n\t\t\t}));\n\t\t\tthis._enabled = true;\n\t\t}\n\n\t\tconst lineNumberOption = this._editor.getOption(EditorOption.lineNumbers);\n\t\tif (lineNumberOption.renderType === RenderLineNumbersType.Relative) {\n\t\t\tthis._sessionStore.add(this._editor.onDidChangeCursorPosition(() => {\n\t\t\t\tthis._showEndForLine = undefined;\n\t\t\t\tthis._renderStickyScroll(0);\n\t\t\t}));\n\t\t}\n\t}\n\n\tprivate _readConfigurationChange(event: ConfigurationChangedEvent) {\n\t\tif (\n\t\t\tevent.hasChanged(EditorOption.stickyScroll)\n\t\t\t|| event.hasChanged(EditorOption.minimap)\n\t\t\t|| event.hasChanged(EditorOption.lineHeight)\n\t\t\t|| event.hasChanged(EditorOption.showFoldingControls)\n\t\t\t|| event.hasChanged(EditorOption.lineNumbers)\n\t\t) {\n\t\t\tthis._readConfiguration();\n\t\t}\n\n\t\tif (event.hasChanged(EditorOption.lineNumbers) || event.hasChanged(EditorOption.folding) || event.hasChanged(EditorOption.showFoldingControls)) {\n\t\t\tthis._renderStickyScroll(0);\n\t\t}\n\t}\n\n\tprivate _needsUpdate(event: IModelTokensChangedEvent) {\n\t\tconst stickyLineNumbers = this._stickyScrollWidget.getCurrentLines();\n\t\tfor (const stickyLineNumber of stickyLineNumbers) {\n\t\t\tfor (const range of event.ranges) {\n\t\t\t\tif (stickyLineNumber >= range.fromLineNumber && stickyLineNumber <= range.toLineNumber) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tprivate _onTokensChange(event: IModelTokensChangedEvent) {\n\t\tif (this._needsUpdate(event)) {\n\t\t\t// Rebuilding the whole widget from line 0\n\t\t\tthis._renderStickyScroll(0);\n\t\t}\n\t}\n\n\tprivate _onDidResize() {\n\t\tconst layoutInfo = this._editor.getLayoutInfo();\n\t\t// Make sure sticky scroll doesn't take up more than 25% of the editor\n\t\tconst theoreticalLines = layoutInfo.height / this._editor.getOption(EditorOption.lineHeight);\n\t\tthis._maxStickyLines = Math.round(theoreticalLines * .25);\n\t\tthis._renderStickyScroll(0);\n\t}\n\n\tprivate async _renderStickyScroll(rebuildFromLine?: number): Promise<void> {\n\t\tconst model = this._editor.getModel();\n\t\tif (!model || model.isTooLargeForTokenization()) {\n\t\t\tthis._resetState();\n\t\t\treturn;\n\t\t}\n\t\tconst nextRebuildFromLine = this._updateAndGetMinRebuildFromLine(rebuildFromLine);\n\t\tconst stickyWidgetVersion = this._stickyLineCandidateProvider.getVersionId();\n\t\tconst shouldUpdateState = stickyWidgetVersion === undefined || stickyWidgetVersion === model.getVersionId();\n\t\tif (shouldUpdateState) {\n\t\t\tif (!this._focused) {\n\t\t\t\tawait this._updateState(nextRebuildFromLine);\n\t\t\t} else {\n\t\t\t\t// Suppose that previously the sticky scroll widget had height 0, then if there are visible lines, set the last line as focused\n\t\t\t\tif (this._focusedStickyElementIndex === -1) {\n\t\t\t\t\tawait this._updateState(nextRebuildFromLine);\n\t\t\t\t\tthis._focusedStickyElementIndex = this._stickyScrollWidget.lineNumberCount - 1;\n\t\t\t\t\tif (this._focusedStickyElementIndex !== -1) {\n\t\t\t\t\t\tthis._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconst focusedStickyElementLineNumber = this._stickyScrollWidget.lineNumbers[this._focusedStickyElementIndex];\n\t\t\t\t\tawait this._updateState(nextRebuildFromLine);\n\t\t\t\t\t// Suppose that after setting the state, there are no sticky lines, set the focused index to -1\n\t\t\t\t\tif (this._stickyScrollWidget.lineNumberCount === 0) {\n\t\t\t\t\t\tthis._focusedStickyElementIndex = -1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst previousFocusedLineNumberExists = this._stickyScrollWidget.lineNumbers.includes(focusedStickyElementLineNumber);\n\n\t\t\t\t\t\t// If the line number is still there, do not change anything\n\t\t\t\t\t\t// If the line number is not there, set the new focused line to be the last line\n\t\t\t\t\t\tif (!previousFocusedLineNumberExists) {\n\t\t\t\t\t\t\tthis._focusedStickyElementIndex = this._stickyScrollWidget.lineNumberCount - 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate _updateAndGetMinRebuildFromLine(rebuildFromLine: number | undefined): number | undefined {\n\t\tif (rebuildFromLine !== undefined) {\n\t\t\tconst minRebuildFromLineOrInfinity = this._minRebuildFromLine !== undefined ? this._minRebuildFromLine : Infinity;\n\t\t\tthis._minRebuildFromLine = Math.min(rebuildFromLine, minRebuildFromLineOrInfinity);\n\t\t}\n\t\treturn this._minRebuildFromLine;\n\t}\n\n\tprivate async _updateState(rebuildFromLine?: number): Promise<void> {\n\t\tthis._minRebuildFromLine = undefined;\n\t\tthis._foldingModel = await FoldingController.get(this._editor)?.getFoldingModel() ?? undefined;\n\t\tthis._widgetState = this.findScrollWidgetState();\n\t\tconst stickyWidgetHasLines = this._widgetState.startLineNumbers.length > 0;\n\t\tthis._stickyScrollVisibleContextKey.set(stickyWidgetHasLines);\n\t\tthis._stickyScrollWidget.setState(this._widgetState, this._foldingModel, rebuildFromLine);\n\t}\n\n\tprivate async _resetState(): Promise<void> {\n\t\tthis._minRebuildFromLine = undefined;\n\t\tthis._foldingModel = undefined;\n\t\tthis._widgetState = StickyScrollWidgetState.Empty;\n\t\tthis._stickyScrollVisibleContextKey.set(false);\n\t\tthis._stickyScrollWidget.setState(undefined, undefined);\n\t}\n\n\tfindScrollWidgetState(): StickyScrollWidgetState {\n\t\tconst maxNumberStickyLines = Math.min(this._maxStickyLines, this._editor.getOption(EditorOption.stickyScroll).maxLineCount);\n\t\tconst scrollTop: number = this._editor.getScrollTop();\n\t\tlet lastLineRelativePosition: number = 0;\n\t\tconst startLineNumbers: number[] = [];\n\t\tconst endLineNumbers: number[] = [];\n\t\tconst arrayVisibleRanges = this._editor.getVisibleRanges();\n\t\tif (arrayVisibleRanges.length !== 0) {\n\t\t\tconst fullVisibleRange = new StickyRange(arrayVisibleRanges[0].startLineNumber, arrayVisibleRanges[arrayVisibleRanges.length - 1].endLineNumber);\n\t\t\tconst candidateRanges = this._stickyLineCandidateProvider.getCandidateStickyLinesIntersecting(fullVisibleRange);\n\t\t\tfor (const range of candidateRanges) {\n\t\t\t\tconst start = range.startLineNumber;\n\t\t\t\tconst end = range.endLineNumber;\n\t\t\t\tconst topOfElement = range.top;\n\t\t\t\tconst bottomOfElement = topOfElement + range.height;\n\t\t\t\tconst topOfBeginningLine = this._editor.getTopForLineNumber(start) - scrollTop;\n\t\t\t\tconst bottomOfEndLine = this._editor.getBottomForLineNumber(end) - scrollTop;\n\t\t\t\tif (topOfElement > topOfBeginningLine && topOfElement <= bottomOfEndLine) {\n\t\t\t\t\tstartLineNumbers.push(start);\n\t\t\t\t\tendLineNumbers.push(end + 1);\n\t\t\t\t\tif (bottomOfElement > bottomOfEndLine) {\n\t\t\t\t\t\tlastLineRelativePosition = bottomOfEndLine - bottomOfElement;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (startLineNumbers.length === maxNumberStickyLines) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthis._endLineNumbers = endLineNumbers;\n\t\treturn new StickyScrollWidgetState(startLineNumbers, endLineNumbers, lastLineRelativePosition, this._showEndForLine);\n\t}\n\n\toverride dispose(): void {\n\t\tsuper.dispose();\n\t\tthis._sessionStore.dispose();\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 { Disposable, DisposableStore, toDisposable } from '../../../../base/common/lifecycle.js';\nimport { ICodeEditor, MouseTargetType } from '../../../browser/editorBrowser.js';\nimport { IEditorContribution, ScrollType } from '../../../common/editorCommon.js';\nimport { ILanguageFeaturesService } from '../../../common/services/languageFeatures.js';\nimport { EditorOption, RenderLineNumbersType, ConfigurationChangedEvent } from '../../../common/config/editorOptions.js';\nimport { StickyScrollWidget, StickyScrollWidgetState } from './stickyScrollWidget.js';\nimport { IStickyLineCandidateProvider, StickyLineCandidateProvider } from './stickyScrollProvider.js';\nimport { IModelTokensChangedEvent } from '../../../common/textModelEvents.js';\nimport { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';\nimport { IContextMenuService } from '../../../../platform/contextview/browser/contextView.js';\nimport { MenuId } from '../../../../platform/actions/common/actions.js';\nimport { IContextKey, IContextKeyService } from '../../../../platform/contextkey/common/contextkey.js';\nimport { EditorContextKeys } from '../../../common/editorContextKeys.js';\nimport { ClickLinkGesture, ClickLinkMouseEvent } from '../../gotoSymbol/browser/link/clickLinkGesture.js';\nimport { IRange, Range } from '../../../common/core/range.js';\nimport { getDefinitionsAtPosition } from '../../gotoSymbol/browser/goToSymbol.js';\nimport { goToDefinitionWithLocation } from '../../inlayHints/browser/inlayHintsLocations.js';\nimport { IPosition, Position } from '../../../common/core/position.js';\nimport { CancellationTokenSource } from '../../../../base/common/cancellation.js';\nimport { ILanguageConfigurationService } from '../../../common/languages/languageConfigurationRegistry.js';\nimport { ILanguageFeatureDebounceService } from '../../../common/services/languageFeatureDebounce.js';\nimport * as dom from '../../../../base/browser/dom.js';\nimport { StickyRange } from './stickyScrollElement.js';\nimport { IMouseEvent, StandardMouseEvent } from '../../../../base/browser/mouseEvent.js';\nimport { FoldingController } from '../../folding/browser/folding.js';\nimport { FoldingModel, toggleCollapseState } from '../../folding/browser/foldingModel.js';\nimport { Emitter, Event } from '../../../../base/common/event.js';\nimport { mainWindow } from '../../../../base/browser/window.js';\n\nexport interface IStickyScrollController {\n\treadonly stickyScrollWidgetHeight: number;\n\tisFocused(): boolean;\n\tfocus(): void;\n\tfocusNext(): void;\n\tfocusPrevious(): void;\n\tgoToFocused(): void;\n\tdispose(): void;\n\tselectEditor(): void;\n\treadonly onDidChangeStickyScrollHeight: Event<{ height: number }>;\n}\n\nexport class StickyScrollController extends Disposable implements IEditorContribution, IStickyScrollController {\n\n\tstatic readonly ID = 'store.contrib.stickyScrollController';\n\n\tprivate readonly _stickyScrollWidget: StickyScrollWidget;\n\tprivate readonly _stickyLineCandidateProvider: IStickyLineCandidateProvider;\n\tprivate readonly _sessionStore: DisposableStore = new DisposableStore();\n\n\tprivate _widgetState: StickyScrollWidgetState;\n\tprivate _foldingModel: FoldingModel | undefined;\n\tprivate _maxStickyLines: number = Number.MAX_SAFE_INTEGER;\n\n\tprivate _stickyRangeProjectedOnEditor: IRange | undefined;\n\tprivate _candidateDefinitionsLength: number = -1;\n\n\tprivate _stickyScrollFocusedContextKey: IContextKey<boolean>;\n\tprivate _stickyScrollVisibleContextKey: IContextKey<boolean>;\n\n\tprivate _focusDisposableStore: DisposableStore | undefined;\n\tprivate _focusedStickyElementIndex: number = -1;\n\tprivate _enabled = false;\n\tprivate _focused = false;\n\tprivate _positionRevealed = false;\n\tprivate _onMouseDown = false;\n\tprivate _endLineNumbers: number[] = [];\n\tprivate _showEndForLine: number | undefined;\n\tprivate _minRebuildFromLine: number | undefined;\n\tprivate _mouseTarget: EventTarget | null = null;\n\n\tprivate readonly _onDidChangeStickyScrollHeight = this._register(new Emitter<{ height: number }>());\n\tpublic readonly onDidChangeStickyScrollHeight = this._onDidChangeStickyScrollHeight.event;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\t@IContextMenuService private readonly _contextMenuService: IContextMenuService,\n\t\t@ILanguageFeaturesService private readonly _languageFeaturesService: ILanguageFeaturesService,\n\t\t@IInstantiationService private readonly _instaService: IInstantiationService,\n\t\t@ILanguageConfigurationService _languageConfigurationService: ILanguageConfigurationService,\n\t\t@ILanguageFeatureDebounceService _languageFeatureDebounceService: ILanguageFeatureDebounceService,\n\t\t@IContextKeyService private readonly _contextKeyService: IContextKeyService\n\t) {\n\t\tsuper();\n\t\tthis._stickyScrollWidget = new StickyScrollWidget(this._editor);\n\t\tthis._stickyLineCandidateProvider = new StickyLineCandidateProvider(this._editor, _languageFeaturesService, _languageConfigurationService);\n\t\tthis._register(this._stickyScrollWidget);\n\t\tthis._register(this._stickyLineCandidateProvider);\n\n\t\tthis._widgetState = StickyScrollWidgetState.Empty;\n\t\tconst stickyScrollDomNode = this._stickyScrollWidget.getDomNode();\n\t\tthis._register(this._editor.onDidChangeLineHeight((e) => {\n\t\t\te.changes.forEach((change) => {\n\t\t\t\tconst lineNumber = change.lineNumber;\n\t\t\t\tif (this._widgetState.startLineNumbers.includes(lineNumber)) {\n\t\t\t\t\tthis._renderStickyScroll(lineNumber);\n\t\t\t\t}\n\t\t\t});\n\t\t}));\n\t\tthis._register(this._editor.onDidChangeFont((e) => {\n\t\t\te.changes.forEach((change) => {\n\t\t\t\tconst lineNumber = change.lineNumber;\n\t\t\t\tif (this._widgetState.startLineNumbers.includes(lineNumber)) {\n\t\t\t\t\tthis._renderStickyScroll(lineNumber);\n\t\t\t\t}\n\t\t\t});\n\t\t}));\n\t\tthis._register(this._editor.onDidChangeConfiguration(e => {\n\t\t\tthis._readConfigurationChange(e);\n\t\t}));\n\t\tthis._register(dom.addDisposableListener(stickyScrollDomNode, dom.EventType.CONTEXT_MENU, async (event: MouseEvent) => {\n\t\t\tthis._onContextMenu(dom.getWindow(stickyScrollDomNode), event);\n\t\t}));\n\t\tthis._stickyScrollFocusedContextKey = EditorContextKeys.stickyScrollFocused.bindTo(this._contextKeyService);\n\t\tthis._stickyScrollVisibleContextKey = EditorContextKeys.stickyScrollVisible.bindTo(this._contextKeyService);\n\t\tconst focusTracker = this._register(dom.trackFocus(stickyScrollDomNode));\n\t\tthis._register(focusTracker.onDidBlur(_ => {\n\t\t\t// Suppose that the blurring is caused by scrolling, then keep the focus on the sticky scroll\n\t\t\t// This is determined by the fact that the height of the widget has become zero and there has been no position revealing\n\t\t\tif (this._positionRevealed === false && stickyScrollDomNode.clientHeight === 0) {\n\t\t\t\tthis._focusedStickyElementIndex = -1;\n\t\t\t\tthis.focus();\n\n\t\t\t}\n\t\t\t// In all other casees, dispose the focus on the sticky scroll\n\t\t\telse {\n\t\t\t\tthis._disposeFocusStickyScrollStore();\n\t\t\t}\n\t\t}));\n\t\tthis._register(focusTracker.onDidFocus(_ => {\n\t\t\tthis.focus();\n\t\t}));\n\t\tthis._registerMouseListeners();\n\t\t// Suppose that mouse down on the sticky scroll, then do not focus on the sticky scroll because this will be followed by the revealing of a position\n\t\tthis._register(dom.addDisposableListener(stickyScrollDomNode, dom.EventType.MOUSE_DOWN, (e) => {\n\t\t\tthis._onMouseDown = true;\n\t\t}));\n\t\tthis._register(this._stickyScrollWidget.onDidChangeStickyScrollHeight((e) => {\n\t\t\tthis._onDidChangeStickyScrollHeight.fire(e);\n\t\t}));\n\t\tthis._onDidResize();\n\t\tthis._readConfiguration();\n\t}\n\n\tget stickyScrollWidgetHeight(): number {\n\t\treturn this._stickyScrollWidget.height;\n\t}\n\n\tpublic static get(editor: ICodeEditor): IStickyScrollController | null {\n\t\treturn editor.getContribution<StickyScrollController>(StickyScrollController.ID);\n\t}\n\n\tprivate _disposeFocusStickyScrollStore() {\n\t\tthis._stickyScrollFocusedContextKey.set(false);\n\t\tthis._focusDisposableStore?.dispose();\n\t\tthis._focused = false;\n\t\tthis._positionRevealed = false;\n\t\tthis._onMouseDown = false;\n\t}\n\n\tpublic isFocused(): boolean {\n\t\treturn this._focused;\n\t}\n\n\tpublic focus(): void {\n\t\t// If the mouse is down, do not focus on the sticky scroll\n\t\tif (this._onMouseDown) {\n\t\t\tthis._onMouseDown = false;\n\t\t\tthis._editor.focus();\n\t\t\treturn;\n\t\t}\n\t\tconst focusState = this._stickyScrollFocusedContextKey.get();\n\t\tif (focusState === true) {\n\t\t\treturn;\n\t\t}\n\t\tthis._focused = true;\n\t\tthis._focusDisposableStore = new DisposableStore();\n\t\tthis._stickyScrollFocusedContextKey.set(true);\n\t\tthis._focusedStickyElementIndex = this._stickyScrollWidget.lineNumbers.length - 1;\n\t\tthis._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex);\n\t}\n\n\tpublic focusNext(): void {\n\t\tif (this._focusedStickyElementIndex < this._stickyScrollWidget.lineNumberCount - 1) {\n\t\t\tthis._focusNav(true);\n\t\t}\n\t}\n\n\tpublic focusPrevious(): void {\n\t\tif (this._focusedStickyElementIndex > 0) {\n\t\t\tthis._focusNav(false);\n\t\t}\n\t}\n\n\tpublic selectEditor(): void {\n\t\tthis._editor.focus();\n\t}\n\n\t// True is next, false is previous\n\tprivate _focusNav(direction: boolean): void {\n\t\tthis._focusedStickyElementIndex = direction ? this._focusedStickyElementIndex + 1 : this._focusedStickyElementIndex - 1;\n\t\tthis._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex);\n\t}\n\n\tpublic goToFocused(): void {\n\t\tconst lineNumbers = this._stickyScrollWidget.lineNumbers;\n\t\tthis._disposeFocusStickyScrollStore();\n\t\tthis._revealPosition({ lineNumber: lineNumbers[this._focusedStickyElementIndex], column: 1 });\n\t}\n\n\tprivate _revealPosition(position: IPosition): void {\n\t\tthis._reveaInEditor(position, () => this._editor.revealPosition(position));\n\t}\n\n\tprivate _revealLineInCenterIfOutsideViewport(position: IPosition): void {\n\t\tthis._reveaInEditor(position, () => this._editor.revealLineInCenterIfOutsideViewport(position.lineNumber, ScrollType.Smooth));\n\t}\n\n\tprivate _reveaInEditor(position: IPosition, revealFunction: () => void): void {\n\t\tif (this._focused) {\n\t\t\tthis._disposeFocusStickyScrollStore();\n\t\t}\n\t\tthis._positionRevealed = true;\n\t\trevealFunction();\n\t\tthis._editor.setSelection(Range.fromPositions(position));\n\t\tthis._editor.focus();\n\t}\n\n\tprivate _registerMouseListeners(): void {\n\n\t\tconst sessionStore = this._register(new DisposableStore());\n\t\tconst gesture = this._register(new ClickLinkGesture(this._editor, {\n\t\t\textractLineNumberFromMouseEvent: (e) => {\n\t\t\t\tconst position = this._stickyScrollWidget.getEditorPositionFromNode(e.target.element);\n\t\t\t\treturn position ? position.lineNumber : 0;\n\t\t\t}\n\t\t}));\n\n\t\tconst getMouseEventTarget = (mouseEvent: ClickLinkMouseEvent): { range: Range; textElement: HTMLElement } | null => {\n\t\t\tif (!this._editor.hasModel()) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tif (mouseEvent.target.type !== MouseTargetType.OVERLAY_WIDGET || mouseEvent.target.detail !== this._stickyScrollWidget.getId()) {\n\t\t\t\t// not hovering over our widget\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst mouseTargetElement = mouseEvent.target.element;\n\t\t\tif (!mouseTargetElement || mouseTargetElement.innerText !== mouseTargetElement.innerHTML) {\n\t\t\t\t// not on a span element rendering text\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst position = this._stickyScrollWidget.getEditorPositionFromNode(mouseTargetElement);\n\t\t\tif (!position) {\n\t\t\t\t// not hovering a sticky scroll line\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\trange: new Range(position.lineNumber, position.column, position.lineNumber, position.column + mouseTargetElement.innerText.length),\n\t\t\t\ttextElement: mouseTargetElement\n\t\t\t};\n\t\t};\n\n\t\tconst stickyScrollWidgetDomNode = this._stickyScrollWidget.getDomNode();\n\t\tthis._register(dom.addStandardDisposableListener(stickyScrollWidgetDomNode, dom.EventType.CLICK, (mouseEvent: IMouseEvent) => {\n\t\t\tif (mouseEvent.ctrlKey || mouseEvent.altKey || mouseEvent.metaKey) {\n\t\t\t\t// modifier pressed\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (!mouseEvent.leftButton) {\n\t\t\t\t// not left click\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (mouseEvent.shiftKey) {\n\t\t\t\t// shift click\n\t\t\t\tconst lineIndex = this._stickyScrollWidget.getLineIndexFromChildDomNode(mouseEvent.target);\n\t\t\t\tif (lineIndex === null) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst position = new Position(this._endLineNumbers[lineIndex], 1);\n\t\t\t\tthis._revealLineInCenterIfOutsideViewport(position);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst isInFoldingIconDomNode = this._stickyScrollWidget.isInFoldingIconDomNode(mouseEvent.target);\n\t\t\tif (isInFoldingIconDomNode) {\n\t\t\t\t// clicked on folding icon\n\t\t\t\tconst lineNumber = this._stickyScrollWidget.getLineNumberFromChildDomNode(mouseEvent.target);\n\t\t\t\tthis._toggleFoldingRegionForLine(lineNumber);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst isInStickyLine = this._stickyScrollWidget.isInStickyLine(mouseEvent.target);\n\t\t\tif (!isInStickyLine) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// normal click\n\t\t\tlet position = this._stickyScrollWidget.getEditorPositionFromNode(mouseEvent.target);\n\t\t\tif (!position) {\n\t\t\t\tconst lineNumber = this._stickyScrollWidget.getLineNumberFromChildDomNode(mouseEvent.target);\n\t\t\t\tif (lineNumber === null) {\n\t\t\t\t\t// not hovering a sticky scroll line\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tposition = new Position(lineNumber, 1);\n\t\t\t}\n\t\t\tthis._revealPosition(position);\n\t\t}));\n\t\tthis._register(dom.addDisposableListener(mainWindow, dom.EventType.MOUSE_MOVE, mouseEvent => {\n\t\t\tthis._mouseTarget = mouseEvent.target;\n\t\t\tthis._onMouseMoveOrKeyDown(mouseEvent);\n\t\t}));\n\t\tthis._register(dom.addDisposableListener(mainWindow, dom.EventType.KEY_DOWN, mouseEvent => {\n\t\t\tthis._onMouseMoveOrKeyDown(mouseEvent);\n\t\t}));\n\t\tthis._register(dom.addDisposableListener(mainWindow, dom.EventType.KEY_UP, () => {\n\t\t\tif (this._showEndForLine !== undefined) {\n\t\t\t\tthis._showEndForLine = undefined;\n\t\t\t\tthis._renderStickyScroll();\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(gesture.onMouseMoveOrRelevantKeyDown(([mouseEvent, _keyboardEvent]) => {\n\t\t\tconst mouseTarget = getMouseEventTarget(mouseEvent);\n\t\t\tif (!mouseTarget || !mouseEvent.hasTriggerModifier || !this._editor.hasModel()) {\n\t\t\t\tsessionStore.clear();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst { range, textElement } = mouseTarget;\n\n\t\t\tif (!range.equalsRange(this._stickyRangeProjectedOnEditor)) {\n\t\t\t\tthis._stickyRangeProjectedOnEditor = range;\n\t\t\t\tsessionStore.clear();\n\t\t\t} else if (textElement.style.textDecoration === 'underline') {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst cancellationToken = new CancellationTokenSource();\n\t\t\tsessionStore.add(toDisposable(() => cancellationToken.dispose(true)));\n\n\t\t\tlet currentHTMLChild: HTMLElement;\n\n\t\t\tgetDefinitionsAtPosition(this._languageFeaturesService.definitionProvider, this._editor.getModel(), new Position(range.startLineNumber, range.startColumn + 1), false, cancellationToken.token).then((candidateDefinitions => {\n\t\t\t\tif (cancellationToken.token.isCancellationRequested) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (candidateDefinitions.length !== 0) {\n\t\t\t\t\tthis._candidateDefinitionsLength = candidateDefinitions.length;\n\t\t\t\t\tconst childHTML: HTMLElement = textElement;\n\t\t\t\t\tif (currentHTMLChild !== childHTML) {\n\t\t\t\t\t\tsessionStore.clear();\n\t\t\t\t\t\tcurrentHTMLChild = childHTML;\n\t\t\t\t\t\tcurrentHTMLChild.style.textDecoration = 'underline';\n\t\t\t\t\t\tsessionStore.add(toDisposable(() => {\n\t\t\t\t\t\t\tcurrentHTMLChild.style.textDecoration = 'none';\n\t\t\t\t\t\t}));\n\t\t\t\t\t} else if (!currentHTMLChild) {\n\t\t\t\t\t\tcurrentHTMLChild = childHTML;\n\t\t\t\t\t\tcurrentHTMLChild.style.textDecoration = 'underline';\n\t\t\t\t\t\tsessionStore.add(toDisposable(() => {\n\t\t\t\t\t\t\tcurrentHTMLChild.style.textDecoration = 'none';\n\t\t\t\t\t\t}));\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tsessionStore.clear();\n\t\t\t\t}\n\t\t\t}));\n\t\t}));\n\t\tthis._register(gesture.onCancel(() => {\n\t\t\tsessionStore.clear();\n\t\t}));\n\t\tthis._register(gesture.onExecute(async e => {\n\t\t\tif (e.target.type !== MouseTargetType.OVERLAY_WIDGET || e.target.detail !== this._stickyScrollWidget.getId()) {\n\t\t\t\t// not hovering over our widget\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst position = this._stickyScrollWidget.getEditorPositionFromNode(e.target.element);\n\t\t\tif (!position) {\n\t\t\t\t// not hovering a sticky scroll line\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (!this._editor.hasModel() || !this._stickyRangeProjectedOnEditor) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (this._candidateDefinitionsLength > 1) {\n\t\t\t\tif (this._focused) {\n\t\t\t\t\tthis._disposeFocusStickyScrollStore();\n\t\t\t\t}\n\t\t\t\tthis._revealPosition({ lineNumber: position.lineNumber, column: 1 });\n\t\t\t}\n\t\t\tthis._instaService.invokeFunction(goToDefinitionWithLocation, e, this._editor, { uri: this._editor.getModel().uri, range: this._stickyRangeProjectedOnEditor });\n\t\t}));\n\t}\n\n\tprivate _onContextMenu(targetWindow: Window, e: MouseEvent) {\n\t\tconst event = new StandardMouseEvent(targetWindow, e);\n\n\t\tthis._contextMenuService.showContextMenu({\n\t\t\tmenuId: MenuId.StickyScrollContext,\n\t\t\tgetAnchor: () => event,\n\t\t});\n\t}\n\n\tprivate _onMouseMoveOrKeyDown(mouseEvent: KeyboardEvent | MouseEvent): void {\n\t\tif (!mouseEvent.shiftKey) {\n\t\t\treturn;\n\t\t}\n\t\tif (!this._mouseTarget || !dom.isHTMLElement(this._mouseTarget)) {\n\t\t\treturn;\n\t\t}\n\t\tconst currentEndForLineIndex = this._stickyScrollWidget.getLineIndexFromChildDomNode(this._mouseTarget);\n\t\tif (currentEndForLineIndex === null || this._showEndForLine === currentEndForLineIndex) {\n\t\t\treturn;\n\t\t}\n\t\tthis._showEndForLine = currentEndForLineIndex;\n\t\tthis._renderStickyScroll();\n\t}\n\n\tprivate _toggleFoldingRegionForLine(line: number | null) {\n\t\tif (!this._foldingModel || line === null) {\n\t\t\treturn;\n\t\t}\n\t\tconst stickyLine = this._stickyScrollWidget.getRenderedStickyLine(line);\n\t\tconst foldingIcon = stickyLine?.foldingIcon;\n\t\tif (!foldingIcon) {\n\t\t\treturn;\n\t\t}\n\t\ttoggleCollapseState(this._foldingModel, 1, [line]);\n\t\tfoldingIcon.isCollapsed = !foldingIcon.isCollapsed;\n\t\tconst scrollTop = (foldingIcon.isCollapsed ?\n\t\t\tthis._editor.getTopForLineNumber(foldingIcon.foldingEndLine)\n\t\t\t: this._editor.getTopForLineNumber(foldingIcon.foldingStartLine))\n\t\t\t- this._editor.getOption(EditorOption.lineHeight) * stickyLine.index + 1;\n\t\tthis._editor.setScrollTop(scrollTop);\n\t\tthis._renderStickyScroll(line);\n\t}\n\n\tprivate _readConfiguration() {\n\t\tconst options = this._editor.getOption(EditorOption.stickyScroll);\n\t\tif (options.enabled === false) {\n\t\t\tthis._editor.removeOverlayWidget(this._stickyScrollWidget);\n\t\t\tthis._resetState();\n\t\t\tthis._sessionStore.clear();\n\t\t\tthis._enabled = false;\n\t\t\treturn;\n\t\t} else if (options.enabled && !this._enabled) {\n\t\t\t// When sticky scroll was just enabled, add the listeners on the sticky scroll\n\t\t\tthis._editor.addOverlayWidget(this._stickyScrollWidget);\n\t\t\tthis._sessionStore.add(this._editor.onDidScrollChange((e) => {\n\t\t\t\tif (e.scrollTopChanged) {\n\t\t\t\t\tthis._showEndForLine = undefined;\n\t\t\t\t\tthis._renderStickyScroll();\n\t\t\t\t}\n\t\t\t}));\n\t\t\tthis._sessionStore.add(this._editor.onDidLayoutChange(() => this._onDidResize()));\n\t\t\tthis._sessionStore.add(this._editor.onDidChangeModelTokens((e) => this._onTokensChange(e)));\n\t\t\tthis._sessionStore.add(this._stickyLineCandidateProvider.onDidChangeStickyScroll(() => {\n\t\t\t\tthis._showEndForLine = undefined;\n\t\t\t\tthis._renderStickyScroll();\n\t\t\t}));\n\t\t\tthis._enabled = true;\n\t\t}\n\n\t\tconst lineNumberOption = this._editor.getOption(EditorOption.lineNumbers);\n\t\tif (lineNumberOption.renderType === RenderLineNumbersType.Relative) {\n\t\t\tthis._sessionStore.add(this._editor.onDidChangeCursorPosition(() => {\n\t\t\t\tthis._showEndForLine = undefined;\n\t\t\t\tthis._renderStickyScroll(0);\n\t\t\t}));\n\t\t}\n\t}\n\n\tprivate _readConfigurationChange(event: ConfigurationChangedEvent) {\n\t\tif (\n\t\t\tevent.hasChanged(EditorOption.stickyScroll)\n\t\t\t|| event.hasChanged(EditorOption.minimap)\n\t\t\t|| event.hasChanged(EditorOption.lineHeight)\n\t\t\t|| event.hasChanged(EditorOption.showFoldingControls)\n\t\t\t|| event.hasChanged(EditorOption.lineNumbers)\n\t\t) {\n\t\t\tthis._readConfiguration();\n\t\t}\n\n\t\tif (event.hasChanged(EditorOption.lineNumbers) || event.hasChanged(EditorOption.folding) || event.hasChanged(EditorOption.showFoldingControls)) {\n\t\t\tthis._renderStickyScroll(0);\n\t\t}\n\t}\n\n\tprivate _needsUpdate(event: IModelTokensChangedEvent) {\n\t\tconst stickyLineNumbers = this._stickyScrollWidget.getCurrentLines();\n\t\tfor (const stickyLineNumber of stickyLineNumbers) {\n\t\t\tfor (const range of event.ranges) {\n\t\t\t\tif (stickyLineNumber >= range.fromLineNumber && stickyLineNumber <= range.toLineNumber) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tprivate _onTokensChange(event: IModelTokensChangedEvent) {\n\t\tif (this._needsUpdate(event)) {\n\t\t\t// Rebuilding the whole widget from line 0\n\t\t\tthis._renderStickyScroll(0);\n\t\t}\n\t}\n\n\tprivate _onDidResize() {\n\t\tconst layoutInfo = this._editor.getLayoutInfo();\n\t\t// Make sure sticky scroll doesn't take up more than 25% of the editor\n\t\tconst theoreticalLines = layoutInfo.height / this._editor.getOption(EditorOption.lineHeight);\n\t\tthis._maxStickyLines = Math.round(theoreticalLines * .25);\n\t\tthis._renderStickyScroll(0);\n\t}\n\n\tprivate async _renderStickyScroll(rebuildFromLine?: number): Promise<void> {\n\t\tconst model = this._editor.getModel();\n\t\tif (!model || model.isTooLargeForTokenization()) {\n\t\t\tthis._resetState();\n\t\t\treturn;\n\t\t}\n\t\tconst nextRebuildFromLine = this._updateAndGetMinRebuildFromLine(rebuildFromLine);\n\t\tconst stickyWidgetVersion = this._stickyLineCandidateProvider.getVersionId();\n\t\tconst shouldUpdateState = stickyWidgetVersion === undefined || stickyWidgetVersion === model.getVersionId();\n\t\tif (shouldUpdateState) {\n\t\t\tif (!this._focused) {\n\t\t\t\tawait this._updateState(nextRebuildFromLine);\n\t\t\t} else {\n\t\t\t\t// Suppose that previously the sticky scroll widget had height 0, then if there are visible lines, set the last line as focused\n\t\t\t\tif (this._focusedStickyElementIndex === -1) {\n\t\t\t\t\tawait this._updateState(nextRebuildFromLine);\n\t\t\t\t\tthis._focusedStickyElementIndex = this._stickyScrollWidget.lineNumberCount - 1;\n\t\t\t\t\tif (this._focusedStickyElementIndex !== -1) {\n\t\t\t\t\t\tthis._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconst focusedStickyElementLineNumber = this._stickyScrollWidget.lineNumbers[this._focusedStickyElementIndex];\n\t\t\t\t\tawait this._updateState(nextRebuildFromLine);\n\t\t\t\t\t// Suppose that after setting the state, there are no sticky lines, set the focused index to -1\n\t\t\t\t\tif (this._stickyScrollWidget.lineNumberCount === 0) {\n\t\t\t\t\t\tthis._focusedStickyElementIndex = -1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst previousFocusedLineNumberExists = this._stickyScrollWidget.lineNumbers.includes(focusedStickyElementLineNumber);\n\n\t\t\t\t\t\t// If the line number is still there, do not change anything\n\t\t\t\t\t\t// If the line number is not there, set the new focused line to be the last line\n\t\t\t\t\t\tif (!previousFocusedLineNumberExists) {\n\t\t\t\t\t\t\tthis._focusedStickyElementIndex = this._stickyScrollWidget.lineNumberCount - 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate _updateAndGetMinRebuildFromLine(rebuildFromLine: number | undefined): number | undefined {\n\t\tif (rebuildFromLine !== undefined) {\n\t\t\tconst minRebuildFromLineOrInfinity = this._minRebuildFromLine !== undefined ? this._minRebuildFromLine : Infinity;\n\t\t\tthis._minRebuildFromLine = Math.min(rebuildFromLine, minRebuildFromLineOrInfinity);\n\t\t}\n\t\treturn this._minRebuildFromLine;\n\t}\n\n\tprivate async _updateState(rebuildFromLine?: number): Promise<void> {\n\t\tthis._minRebuildFromLine = undefined;\n\t\tthis._foldingModel = await FoldingController.get(this._editor)?.getFoldingModel() ?? undefined;\n\t\tthis._widgetState = this.findScrollWidgetState();\n\t\tconst stickyWidgetHasLines = this._widgetState.startLineNumbers.length > 0;\n\t\tthis._stickyScrollVisibleContextKey.set(stickyWidgetHasLines);\n\t\tthis._stickyScrollWidget.setState(this._widgetState, this._foldingModel, rebuildFromLine);\n\t}\n\n\tprivate async _resetState(): Promise<void> {\n\t\tthis._minRebuildFromLine = undefined;\n\t\tthis._foldingModel = undefined;\n\t\tthis._widgetState = StickyScrollWidgetState.Empty;\n\t\tthis._stickyScrollVisibleContextKey.set(false);\n\t\tthis._stickyScrollWidget.setState(undefined, undefined);\n\t}\n\n\tfindScrollWidgetState(): StickyScrollWidgetState {\n\t\tconst maxNumberStickyLines = Math.min(this._maxStickyLines, this._editor.getOption(EditorOption.stickyScroll).maxLineCount);\n\t\tconst scrollTop: number = this._editor.getScrollTop();\n\t\tlet lastLineRelativePosition: number = 0;\n\t\tconst startLineNumbers: number[] = [];\n\t\tconst endLineNumbers: number[] = [];\n\t\tconst arrayVisibleRanges = this._editor.getVisibleRanges();\n\t\tif (arrayVisibleRanges.length !== 0) {\n\t\t\tconst fullVisibleRange = new StickyRange(arrayVisibleRanges[0].startLineNumber, arrayVisibleRanges[arrayVisibleRanges.length - 1].endLineNumber);\n\t\t\tconst candidateRanges = this._stickyLineCandidateProvider.getCandidateStickyLinesIntersecting(fullVisibleRange);\n\t\t\tfor (const range of candidateRanges) {\n\t\t\t\tconst start = range.startLineNumber;\n\t\t\t\tconst end = range.endLineNumber;\n\t\t\t\tconst topOfElement = range.top;\n\t\t\t\tconst bottomOfElement = topOfElement + range.height;\n\t\t\t\tconst topOfBeginningLine = this._editor.getTopForLineNumber(start) - scrollTop;\n\t\t\t\tconst bottomOfEndLine = this._editor.getBottomForLineNumber(end) - scrollTop;\n\t\t\t\tif (topOfElement > topOfBeginningLine && topOfElement <= bottomOfEndLine) {\n\t\t\t\t\tstartLineNumbers.push(start);\n\t\t\t\t\tendLineNumbers.push(end + 1);\n\t\t\t\t\tif (bottomOfElement > bottomOfEndLine) {\n\t\t\t\t\t\tlastLineRelativePosition = bottomOfEndLine - bottomOfElement;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (startLineNumbers.length === maxNumberStickyLines) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthis._endLineNumbers = endLineNumbers;\n\t\treturn new StickyScrollWidgetState(startLineNumbers, endLineNumbers, lastLineRelativePosition, this._showEndForLine);\n\t}\n\n\toverride dispose(): void {\n\t\tsuper.dispose();\n\t\tthis._sessionStore.dispose();\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/stickyScroll/browser/stickyScrollModelProvider.ts","vs/editor/contrib/stickyScroll/browser/stickyScrollModelProvider.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;AAEhG,OAAO,EAAE,UAAU,EAAE,eAAe,EAAe,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAEnH,OAAO,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAC;AAE3G,OAAO,EAAqB,uBAAuB,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AACvG,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAC1F,OAAO,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACnF,OAAO,EAAE,6BAA6B,EAAE,MAAM,4DAA4D,CAAC;AAE3G,OAAO,EAAE,iBAAiB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,CAAC,KAAK,GAAG,IAAI,mBAAmB,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,IAAI,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAC;IAC9I,CAAC;IAEkB,eAAe;QACjC,OAAO,IAAI,CAAC,QAAQ,KAAK,SAAS,CAAC;IACpC,CAAC;IAEkB,KAAK,CAAC,uBAAuB,CAAC,KAAwB;QACxE,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC;IACpD,CAAC;CACD,CAAA;AA/BK,6CAA6C;IAOhD,WAAA,wBAAwB,CAAA;GAPrB,6CAA6C,CA+BlD","file":"stickyScrollModelProvider.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 { Disposable, DisposableStore, IDisposable, MutableDisposable } from '../../../../base/common/lifecycle.js';\nimport { IActiveCodeEditor } from '../../../browser/editorBrowser.js';\nimport { ILanguageFeaturesService } from '../../../common/services/languageFeatures.js';\nimport { OutlineElement, OutlineGroup, OutlineModel } from '../../documentSymbols/browser/outlineModel.js';\nimport { CancellationToken } from '../../../../base/common/cancellation.js';\nimport { CancelablePromise, createCancelablePromise, Delayer } from '../../../../base/common/async.js';\nimport { FoldingController, RangesLimitReporter } from '../../folding/browser/folding.js';\nimport { SyntaxRangeProvider } from '../../folding/browser/syntaxRangeProvider.js';\nimport { IndentRangeProvider } from '../../folding/browser/indentRangeProvider.js';\nimport { ILanguageConfigurationService } from '../../../common/languages/languageConfigurationRegistry.js';\nimport { FoldingRegions } from '../../folding/browser/foldingRanges.js';\nimport { onUnexpectedError } from '../../../../base/common/errors.js';\nimport { StickyElement, StickyModel, StickyRange } from './stickyScrollElement.js';\nimport { Iterable } from '../../../../base/common/iterator.js';\nimport { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';\nimport { EditorOption } from '../../../common/config/editorOptions.js';\n\nenum ModelProvider {\n\tOUTLINE_MODEL = 'outlineModel',\n\tFOLDING_PROVIDER_MODEL = 'foldingProviderModel',\n\tINDENTATION_MODEL = 'indentationModel'\n}\n\nenum Status {\n\tVALID,\n\tINVALID,\n\tCANCELED\n}\n\nexport interface IStickyModelProvider extends IDisposable {\n\n\t/**\n\t * Method which updates the sticky model\n\t * @param token cancellation token\n\t * @returns the sticky model\n\t */\n\tupdate(token: CancellationToken): Promise<StickyModel | null>;\n}\n\nexport class StickyModelProvider extends Disposable implements IStickyModelProvider {\n\n\tprivate _modelProviders: IStickyModelCandidateProvider<any>[] = [];\n\tprivate _modelPromise: CancelablePromise<any | null> | null = null;\n\tprivate _updateScheduler: Delayer<StickyModel | null> = this._register(new Delayer<StickyModel | null>(300));\n\tprivate readonly _updateOperation: DisposableStore = this._register(new DisposableStore());\n\n\tconstructor(\n\t\tprivate readonly _editor: IActiveCodeEditor,\n\t\tonProviderUpdate: () => void,\n\t\t@IInstantiationService _languageConfigurationService: ILanguageConfigurationService,\n\t\t@ILanguageFeaturesService _languageFeaturesService: ILanguageFeaturesService,\n\t) {\n\t\tsuper();\n\n\t\tswitch (this._editor.getOption(EditorOption.stickyScroll).defaultModel) {\n\t\t\tcase ModelProvider.OUTLINE_MODEL:\n\t\t\t\tthis._modelProviders.push(new StickyModelFromCandidateOutlineProvider(this._editor, _languageFeaturesService));\n\t\t\t// fall through\n\t\t\tcase ModelProvider.FOLDING_PROVIDER_MODEL:\n\t\t\t\tthis._modelProviders.push(new StickyModelFromCandidateSyntaxFoldingProvider(this._editor, onProviderUpdate, _languageFeaturesService));\n\t\t\t// fall through\n\t\t\tcase ModelProvider.INDENTATION_MODEL:\n\t\t\t\tthis._modelProviders.push(new StickyModelFromCandidateIndentationFoldingProvider(this._editor, _languageConfigurationService));\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tpublic override dispose(): void {\n\t\tthis._modelProviders.forEach(provider => provider.dispose());\n\t\tthis._updateOperation.clear();\n\t\tthis._cancelModelPromise();\n\t\tsuper.dispose();\n\t}\n\n\tprivate _cancelModelPromise(): void {\n\t\tif (this._modelPromise) {\n\t\t\tthis._modelPromise.cancel();\n\t\t\tthis._modelPromise = null;\n\t\t}\n\t}\n\n\tpublic async update(token: CancellationToken): Promise<StickyModel | null> {\n\n\t\tthis._updateOperation.clear();\n\t\tthis._updateOperation.add({\n\t\t\tdispose: () => {\n\t\t\t\tthis._cancelModelPromise();\n\t\t\t\tthis._updateScheduler.cancel();\n\t\t\t}\n\t\t});\n\t\tthis._cancelModelPromise();\n\n\t\treturn await this._updateScheduler.trigger(async () => {\n\n\t\t\tfor (const modelProvider of this._modelProviders) {\n\t\t\t\tconst { statusPromise, modelPromise } = modelProvider.computeStickyModel(token);\n\t\t\t\tthis._modelPromise = modelPromise;\n\t\t\t\tconst status = await statusPromise;\n\t\t\t\tif (this._modelPromise !== modelPromise) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t\tswitch (status) {\n\t\t\t\t\tcase Status.CANCELED:\n\t\t\t\t\t\tthis._updateOperation.clear();\n\t\t\t\t\t\treturn null;\n\t\t\t\t\tcase Status.VALID:\n\t\t\t\t\t\treturn modelProvider.stickyModel;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn null;\n\t\t}).catch((error) => {\n\t\t\tonUnexpectedError(error);\n\t\t\treturn null;\n\t\t});\n\t}\n}\n\ninterface IStickyModelCandidateProvider<T> extends IDisposable {\n\tget stickyModel(): StickyModel | null;\n\n\t/**\n\t * Method which computes the sticky model and returns a status to signal whether the sticky model has been successfully found\n\t * @param token cancellation token\n\t * @returns a promise of a status indicating whether the sticky model has been successfully found as well as the model promise\n\t */\n\tcomputeStickyModel(token: CancellationToken): { statusPromise: Promise<Status> | Status; modelPromise: CancelablePromise<T | null> | null };\n}\n\nabstract class StickyModelCandidateProvider<T> extends Disposable implements IStickyModelCandidateProvider<T> {\n\n\tprotected _stickyModel: StickyModel | null = null;\n\n\tconstructor(protected readonly _editor: IActiveCodeEditor) {\n\t\tsuper();\n\t}\n\n\tget stickyModel(): StickyModel | null {\n\t\treturn this._stickyModel;\n\t}\n\n\tprivate _invalid(): Status {\n\t\tthis._stickyModel = null;\n\t\treturn Status.INVALID;\n\t}\n\n\tpublic computeStickyModel(token: CancellationToken): { statusPromise: Promise<Status> | Status; modelPromise: CancelablePromise<T | null> | null } {\n\t\tif (token.isCancellationRequested || !this.isProviderValid()) {\n\t\t\treturn { statusPromise: this._invalid(), modelPromise: null };\n\t\t}\n\t\tconst providerModelPromise = createCancelablePromise(token => this.createModelFromProvider(token));\n\n\t\treturn {\n\t\t\tstatusPromise: providerModelPromise.then(providerModel => {\n\t\t\t\tif (!this.isModelValid(providerModel)) {\n\t\t\t\t\treturn this._invalid();\n\n\t\t\t\t}\n\t\t\t\tif (token.isCancellationRequested) {\n\t\t\t\t\treturn Status.CANCELED;\n\t\t\t\t}\n\t\t\t\tthis._stickyModel = this.createStickyModel(token, providerModel);\n\t\t\t\treturn Status.VALID;\n\t\t\t}).then(undefined, (err) => {\n\t\t\t\tonUnexpectedError(err);\n\t\t\t\treturn Status.CANCELED;\n\t\t\t}),\n\t\t\tmodelPromise: providerModelPromise\n\t\t};\n\t}\n\n\t/**\n\t * Method which checks whether the model returned by the provider is valid and can be used to compute a sticky model.\n\t * This method by default returns true.\n\t * @param model model returned by the provider\n\t * @returns boolean indicating whether the model is valid\n\t */\n\tprotected isModelValid(model: T): boolean {\n\t\treturn true;\n\t}\n\n\t/**\n\t * Method which checks whether the provider is valid before applying it to find the provider model.\n\t * This method by default returns true.\n\t * @returns boolean indicating whether the provider is valid\n\t */\n\tprotected isProviderValid(): boolean {\n\t\treturn true;\n\t}\n\n\t/**\n\t * Abstract method which creates the model from the provider and returns the provider model\n\t * @param token cancellation token\n\t * @returns the model returned by the provider\n\t */\n\tprotected abstract createModelFromProvider(token: CancellationToken): Promise<T>;\n\n\t/**\n\t * Abstract method which computes the sticky model from the model returned by the provider and returns the sticky model\n\t * @param token cancellation token\n\t * @param model model returned by the provider\n\t * @returns the sticky model\n\t */\n\tprotected abstract createStickyModel(token: CancellationToken, model: T): StickyModel;\n}\n\nclass StickyModelFromCandidateOutlineProvider extends StickyModelCandidateProvider<OutlineModel> {\n\n\tconstructor(_editor: IActiveCodeEditor, @ILanguageFeaturesService private readonly _languageFeaturesService: ILanguageFeaturesService) {\n\t\tsuper(_editor);\n\t}\n\n\tprotected createModelFromProvider(token: CancellationToken): Promise<OutlineModel> {\n\t\treturn OutlineModel.create(this._languageFeaturesService.documentSymbolProvider, this._editor.getModel(), token);\n\t}\n\n\tprotected createStickyModel(token: CancellationToken, model: OutlineModel): StickyModel {\n\t\tconst { stickyOutlineElement, providerID } = this._stickyModelFromOutlineModel(model, this._stickyModel?.outlineProviderId);\n\t\tconst textModel = this._editor.getModel();\n\t\treturn new StickyModel(textModel.uri, textModel.getVersionId(), stickyOutlineElement, providerID);\n\t}\n\n\tprotected override isModelValid(model: OutlineModel): boolean {\n\t\treturn model && model.children.size > 0;\n\t}\n\n\tprivate _stickyModelFromOutlineModel(outlineModel: OutlineModel, preferredProvider: string | undefined): { stickyOutlineElement: StickyElement; providerID: string | undefined } {\n\n\t\tlet outlineElements: Map<string, OutlineElement>;\n\t\t// When several possible outline providers\n\t\tif (Iterable.first(outlineModel.children.values()) instanceof OutlineGroup) {\n\t\t\tconst provider = Iterable.find(outlineModel.children.values(), outlineGroupOfModel => outlineGroupOfModel.id === preferredProvider);\n\t\t\tif (provider) {\n\t\t\t\toutlineElements = provider.children;\n\t\t\t} else {\n\t\t\t\tlet tempID = '';\n\t\t\t\tlet maxTotalSumOfRanges = -1;\n\t\t\t\tlet optimalOutlineGroup = undefined;\n\t\t\t\tfor (const [_key, outlineGroup] of outlineModel.children.entries()) {\n\t\t\t\t\tconst totalSumRanges = this._findSumOfRangesOfGroup(outlineGroup);\n\t\t\t\t\tif (totalSumRanges > maxTotalSumOfRanges) {\n\t\t\t\t\t\toptimalOutlineGroup = outlineGroup;\n\t\t\t\t\t\tmaxTotalSumOfRanges = totalSumRanges;\n\t\t\t\t\t\ttempID = outlineGroup.id;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tpreferredProvider = tempID;\n\t\t\t\toutlineElements = optimalOutlineGroup!.children;\n\t\t\t}\n\t\t} else {\n\t\t\toutlineElements = outlineModel.children as Map<string, OutlineElement>;\n\t\t}\n\t\tconst stickyChildren: StickyElement[] = [];\n\t\tconst outlineElementsArray = Array.from(outlineElements.values()).sort((element1, element2) => {\n\t\t\tconst range1: StickyRange = new StickyRange(element1.symbol.range.startLineNumber, element1.symbol.range.endLineNumber);\n\t\t\tconst range2: StickyRange = new StickyRange(element2.symbol.range.startLineNumber, element2.symbol.range.endLineNumber);\n\t\t\treturn this._comparator(range1, range2);\n\t\t});\n\t\tfor (const outlineElement of outlineElementsArray) {\n\t\t\tstickyChildren.push(this._stickyModelFromOutlineElement(outlineElement, outlineElement.symbol.selectionRange.startLineNumber));\n\t\t}\n\t\tconst stickyOutlineElement = new StickyElement(undefined, stickyChildren, undefined);\n\n\t\treturn {\n\t\t\tstickyOutlineElement: stickyOutlineElement,\n\t\t\tproviderID: preferredProvider\n\t\t};\n\t}\n\n\tprivate _stickyModelFromOutlineElement(outlineElement: OutlineElement, previousStartLine: number): StickyElement {\n\t\tconst children: StickyElement[] = [];\n\t\tfor (const child of outlineElement.children.values()) {\n\t\t\tif (child.symbol.selectionRange.startLineNumber !== child.symbol.range.endLineNumber) {\n\t\t\t\tif (child.symbol.selectionRange.startLineNumber !== previousStartLine) {\n\t\t\t\t\tchildren.push(this._stickyModelFromOutlineElement(child, child.symbol.selectionRange.startLineNumber));\n\t\t\t\t} else {\n\t\t\t\t\tfor (const subchild of child.children.values()) {\n\t\t\t\t\t\tchildren.push(this._stickyModelFromOutlineElement(subchild, child.symbol.selectionRange.startLineNumber));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tchildren.sort((child1, child2) => this._comparator(child1.range!, child2.range!));\n\t\tconst range = new StickyRange(outlineElement.symbol.selectionRange.startLineNumber, outlineElement.symbol.range.endLineNumber);\n\t\treturn new StickyElement(range, children, undefined);\n\t}\n\n\tprivate _comparator(range1: StickyRange, range2: StickyRange): number {\n\t\tif (range1.startLineNumber !== range2.startLineNumber) {\n\t\t\treturn range1.startLineNumber - range2.startLineNumber;\n\t\t} else {\n\t\t\treturn range2.endLineNumber - range1.endLineNumber;\n\t\t}\n\t}\n\n\tprivate _findSumOfRangesOfGroup(outline: OutlineGroup | OutlineElement): number {\n\t\tlet res = 0;\n\t\tfor (const child of outline.children.values()) {\n\t\t\tres += this._findSumOfRangesOfGroup(child);\n\t\t}\n\t\tif (outline instanceof OutlineElement) {\n\t\t\treturn res + outline.symbol.range.endLineNumber - outline.symbol.selectionRange.startLineNumber;\n\t\t} else {\n\t\t\treturn res;\n\t\t}\n\t}\n}\n\nabstract class StickyModelFromCandidateFoldingProvider extends StickyModelCandidateProvider<FoldingRegions | null> {\n\n\tprotected _foldingLimitReporter: RangesLimitReporter;\n\n\tconstructor(editor: IActiveCodeEditor) {\n\t\tsuper(editor);\n\t\tthis._foldingLimitReporter = this._register(new RangesLimitReporter(editor));\n\t}\n\n\tprotected createStickyModel(token: CancellationToken, model: FoldingRegions): StickyModel {\n\t\tconst foldingElement = this._fromFoldingRegions(model);\n\t\tconst textModel = this._editor.getModel();\n\t\treturn new StickyModel(textModel.uri, textModel.getVersionId(), foldingElement, undefined);\n\t}\n\n\tprotected override isModelValid(model: FoldingRegions): boolean {\n\t\treturn model !== null;\n\t}\n\n\n\tprivate _fromFoldingRegions(foldingRegions: FoldingRegions): StickyElement {\n\t\tconst length = foldingRegions.length;\n\t\tconst orderedStickyElements: StickyElement[] = [];\n\n\t\t// The root sticky outline element\n\t\tconst stickyOutlineElement = new StickyElement(\n\t\t\tundefined,\n\t\t\t[],\n\t\t\tundefined\n\t\t);\n\n\t\tfor (let i = 0; i < length; i++) {\n\t\t\t// Finding the parent index of the current range\n\t\t\tconst parentIndex = foldingRegions.getParentIndex(i);\n\n\t\t\tlet parentNode;\n\t\t\tif (parentIndex !== -1) {\n\t\t\t\t// Access the reference of the parent node\n\t\t\t\tparentNode = orderedStickyElements[parentIndex];\n\t\t\t} else {\n\t\t\t\t// In that case the parent node is the root node\n\t\t\t\tparentNode = stickyOutlineElement;\n\t\t\t}\n\n\t\t\tconst child = new StickyElement(\n\t\t\t\tnew StickyRange(foldingRegions.getStartLineNumber(i), foldingRegions.getEndLineNumber(i) + 1),\n\t\t\t\t[],\n\t\t\t\tparentNode\n\t\t\t);\n\t\t\tparentNode.children.push(child);\n\t\t\torderedStickyElements.push(child);\n\t\t}\n\t\treturn stickyOutlineElement;\n\t}\n}\n\nclass StickyModelFromCandidateIndentationFoldingProvider extends StickyModelFromCandidateFoldingProvider {\n\n\tprivate readonly provider: IndentRangeProvider;\n\n\tconstructor(\n\t\teditor: IActiveCodeEditor,\n\t\t@ILanguageConfigurationService private readonly _languageConfigurationService: ILanguageConfigurationService) {\n\t\tsuper(editor);\n\n\t\tthis.provider = this._register(new IndentRangeProvider(editor.getModel(), this._languageConfigurationService, this._foldingLimitReporter));\n\t}\n\n\tprotected override async createModelFromProvider(token: CancellationToken): Promise<FoldingRegions> {\n\t\treturn this.provider.compute(token);\n\t}\n}\n\nclass StickyModelFromCandidateSyntaxFoldingProvider extends StickyModelFromCandidateFoldingProvider {\n\n\tprivate readonly provider: MutableDisposable<SyntaxRangeProvider> = this._register(new MutableDisposable<SyntaxRangeProvider>());\n\n\tconstructor(\n\t\teditor: IActiveCodeEditor,\n\t\tonProviderUpdate: () => void,\n\t\t@ILanguageFeaturesService private readonly _languageFeaturesService: ILanguageFeaturesService\n\t) {\n\t\tsuper(editor);\n\t\tthis._register(this._languageFeaturesService.foldingRangeProvider.onDidChange(() => {\n\t\t\tthis._updateProvider(editor, onProviderUpdate);\n\t\t}));\n\t\tthis._updateProvider(editor, onProviderUpdate);\n\t}\n\n\tprivate _updateProvider(editor: IActiveCodeEditor, onProviderUpdate: () => void): void {\n\t\tconst selectedProviders = FoldingController.getFoldingRangeProviders(this._languageFeaturesService, editor.getModel());\n\t\tif (selectedProviders.length === 0) {\n\t\t\treturn;\n\t\t}\n\t\tthis.provider.value = new SyntaxRangeProvider(editor.getModel(), selectedProviders, onProviderUpdate, this._foldingLimitReporter, undefined);\n\t}\n\n\tprotected override isProviderValid(): boolean {\n\t\treturn this.provider !== undefined;\n\t}\n\n\tprotected override async createModelFromProvider(token: CancellationToken): Promise<FoldingRegions | null> {\n\t\treturn this.provider.value?.compute(token) ?? 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 { Disposable, DisposableStore, IDisposable, MutableDisposable } from '../../../../base/common/lifecycle.js';\nimport { IActiveCodeEditor } from '../../../browser/editorBrowser.js';\nimport { ILanguageFeaturesService } from '../../../common/services/languageFeatures.js';\nimport { OutlineElement, OutlineGroup, OutlineModel } from '../../documentSymbols/browser/outlineModel.js';\nimport { CancellationToken } from '../../../../base/common/cancellation.js';\nimport { CancelablePromise, createCancelablePromise, Delayer } from '../../../../base/common/async.js';\nimport { FoldingController, RangesLimitReporter } from '../../folding/browser/folding.js';\nimport { SyntaxRangeProvider } from '../../folding/browser/syntaxRangeProvider.js';\nimport { IndentRangeProvider } from '../../folding/browser/indentRangeProvider.js';\nimport { ILanguageConfigurationService } from '../../../common/languages/languageConfigurationRegistry.js';\nimport { FoldingRegions } from '../../folding/browser/foldingRanges.js';\nimport { onUnexpectedError } from '../../../../base/common/errors.js';\nimport { StickyElement, StickyModel, StickyRange } from './stickyScrollElement.js';\nimport { Iterable } from '../../../../base/common/iterator.js';\nimport { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';\nimport { EditorOption } from '../../../common/config/editorOptions.js';\n\nenum ModelProvider {\n\tOUTLINE_MODEL = 'outlineModel',\n\tFOLDING_PROVIDER_MODEL = 'foldingProviderModel',\n\tINDENTATION_MODEL = 'indentationModel'\n}\n\nenum Status {\n\tVALID,\n\tINVALID,\n\tCANCELED\n}\n\nexport interface IStickyModelProvider extends IDisposable {\n\n\t/**\n\t * Method which updates the sticky model\n\t * @param token cancellation token\n\t * @returns the sticky model\n\t */\n\tupdate(token: CancellationToken): Promise<StickyModel | null>;\n}\n\nexport class StickyModelProvider extends Disposable implements IStickyModelProvider {\n\n\tprivate _modelProviders: IStickyModelCandidateProvider<any>[] = [];\n\tprivate _modelPromise: CancelablePromise<any | null> | null = null;\n\tprivate _updateScheduler: Delayer<StickyModel | null> = this._register(new Delayer<StickyModel | null>(300));\n\tprivate readonly _updateOperation: DisposableStore = this._register(new DisposableStore());\n\n\tconstructor(\n\t\tprivate readonly _editor: IActiveCodeEditor,\n\t\tonProviderUpdate: () => void,\n\t\t@IInstantiationService _languageConfigurationService: ILanguageConfigurationService,\n\t\t@ILanguageFeaturesService _languageFeaturesService: ILanguageFeaturesService,\n\t) {\n\t\tsuper();\n\n\t\tswitch (this._editor.getOption(EditorOption.stickyScroll).defaultModel) {\n\t\t\tcase ModelProvider.OUTLINE_MODEL:\n\t\t\t\tthis._modelProviders.push(new StickyModelFromCandidateOutlineProvider(this._editor, _languageFeaturesService));\n\t\t\t// fall through\n\t\t\tcase ModelProvider.FOLDING_PROVIDER_MODEL:\n\t\t\t\tthis._modelProviders.push(new StickyModelFromCandidateSyntaxFoldingProvider(this._editor, onProviderUpdate, _languageFeaturesService));\n\t\t\t// fall through\n\t\t\tcase ModelProvider.INDENTATION_MODEL:\n\t\t\t\tthis._modelProviders.push(new StickyModelFromCandidateIndentationFoldingProvider(this._editor, _languageConfigurationService));\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tpublic override dispose(): void {\n\t\tthis._modelProviders.forEach(provider => provider.dispose());\n\t\tthis._updateOperation.clear();\n\t\tthis._cancelModelPromise();\n\t\tsuper.dispose();\n\t}\n\n\tprivate _cancelModelPromise(): void {\n\t\tif (this._modelPromise) {\n\t\t\tthis._modelPromise.cancel();\n\t\t\tthis._modelPromise = null;\n\t\t}\n\t}\n\n\tpublic async update(token: CancellationToken): Promise<StickyModel | null> {\n\n\t\tthis._updateOperation.clear();\n\t\tthis._updateOperation.add({\n\t\t\tdispose: () => {\n\t\t\t\tthis._cancelModelPromise();\n\t\t\t\tthis._updateScheduler.cancel();\n\t\t\t}\n\t\t});\n\t\tthis._cancelModelPromise();\n\n\t\treturn await this._updateScheduler.trigger(async () => {\n\n\t\t\tfor (const modelProvider of this._modelProviders) {\n\t\t\t\tconst { statusPromise, modelPromise } = modelProvider.computeStickyModel(token);\n\t\t\t\tthis._modelPromise = modelPromise;\n\t\t\t\tconst status = await statusPromise;\n\t\t\t\tif (this._modelPromise !== modelPromise) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t\tswitch (status) {\n\t\t\t\t\tcase Status.CANCELED:\n\t\t\t\t\t\tthis._updateOperation.clear();\n\t\t\t\t\t\treturn null;\n\t\t\t\t\tcase Status.VALID:\n\t\t\t\t\t\treturn modelProvider.stickyModel;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn null;\n\t\t}).catch((error) => {\n\t\t\tonUnexpectedError(error);\n\t\t\treturn null;\n\t\t});\n\t}\n}\n\ninterface IStickyModelCandidateProvider<T> extends IDisposable {\n\tget stickyModel(): StickyModel | null;\n\n\t/**\n\t * Method which computes the sticky model and returns a status to signal whether the sticky model has been successfully found\n\t * @param token cancellation token\n\t * @returns a promise of a status indicating whether the sticky model has been successfully found as well as the model promise\n\t */\n\tcomputeStickyModel(token: CancellationToken): { statusPromise: Promise<Status> | Status; modelPromise: CancelablePromise<T | null> | null };\n}\n\nabstract class StickyModelCandidateProvider<T> extends Disposable implements IStickyModelCandidateProvider<T> {\n\n\tprotected _stickyModel: StickyModel | null = null;\n\n\tconstructor(protected readonly _editor: IActiveCodeEditor) {\n\t\tsuper();\n\t}\n\n\tget stickyModel(): StickyModel | null {\n\t\treturn this._stickyModel;\n\t}\n\n\tprivate _invalid(): Status {\n\t\tthis._stickyModel = null;\n\t\treturn Status.INVALID;\n\t}\n\n\tpublic computeStickyModel(token: CancellationToken): { statusPromise: Promise<Status> | Status; modelPromise: CancelablePromise<T | null> | null } {\n\t\tif (token.isCancellationRequested || !this.isProviderValid()) {\n\t\t\treturn { statusPromise: this._invalid(), modelPromise: null };\n\t\t}\n\t\tconst providerModelPromise = createCancelablePromise(token => this.createModelFromProvider(token));\n\n\t\treturn {\n\t\t\tstatusPromise: providerModelPromise.then(providerModel => {\n\t\t\t\tif (!this.isModelValid(providerModel)) {\n\t\t\t\t\treturn this._invalid();\n\n\t\t\t\t}\n\t\t\t\tif (token.isCancellationRequested) {\n\t\t\t\t\treturn Status.CANCELED;\n\t\t\t\t}\n\t\t\t\tthis._stickyModel = this.createStickyModel(token, providerModel);\n\t\t\t\treturn Status.VALID;\n\t\t\t}).then(undefined, (err) => {\n\t\t\t\tonUnexpectedError(err);\n\t\t\t\treturn Status.CANCELED;\n\t\t\t}),\n\t\t\tmodelPromise: providerModelPromise\n\t\t};\n\t}\n\n\t/**\n\t * Method which checks whether the model returned by the provider is valid and can be used to compute a sticky model.\n\t * This method by default returns true.\n\t * @param model model returned by the provider\n\t * @returns boolean indicating whether the model is valid\n\t */\n\tprotected isModelValid(model: T): boolean {\n\t\treturn true;\n\t}\n\n\t/**\n\t * Method which checks whether the provider is valid before applying it to find the provider model.\n\t * This method by default returns true.\n\t * @returns boolean indicating whether the provider is valid\n\t */\n\tprotected isProviderValid(): boolean {\n\t\treturn true;\n\t}\n\n\t/**\n\t * Abstract method which creates the model from the provider and returns the provider model\n\t * @param token cancellation token\n\t * @returns the model returned by the provider\n\t */\n\tprotected abstract createModelFromProvider(token: CancellationToken): Promise<T>;\n\n\t/**\n\t * Abstract method which computes the sticky model from the model returned by the provider and returns the sticky model\n\t * @param token cancellation token\n\t * @param model model returned by the provider\n\t * @returns the sticky model\n\t */\n\tprotected abstract createStickyModel(token: CancellationToken, model: T): StickyModel;\n}\n\nclass StickyModelFromCandidateOutlineProvider extends StickyModelCandidateProvider<OutlineModel> {\n\n\tconstructor(_editor: IActiveCodeEditor, @ILanguageFeaturesService private readonly _languageFeaturesService: ILanguageFeaturesService) {\n\t\tsuper(_editor);\n\t}\n\n\tprotected createModelFromProvider(token: CancellationToken): Promise<OutlineModel> {\n\t\treturn OutlineModel.create(this._languageFeaturesService.documentSymbolProvider, this._editor.getModel(), token);\n\t}\n\n\tprotected createStickyModel(token: CancellationToken, model: OutlineModel): StickyModel {\n\t\tconst { stickyOutlineElement, providerID } = this._stickyModelFromOutlineModel(model, this._stickyModel?.outlineProviderId);\n\t\tconst textModel = this._editor.getModel();\n\t\treturn new StickyModel(textModel.uri, textModel.getVersionId(), stickyOutlineElement, providerID);\n\t}\n\n\tprotected override isModelValid(model: OutlineModel): boolean {\n\t\treturn model && model.children.size > 0;\n\t}\n\n\tprivate _stickyModelFromOutlineModel(outlineModel: OutlineModel, preferredProvider: string | undefined): { stickyOutlineElement: StickyElement; providerID: string | undefined } {\n\n\t\tlet outlineElements: Map<string, OutlineElement>;\n\t\t// When several possible outline providers\n\t\tif (Iterable.first(outlineModel.children.values()) instanceof OutlineGroup) {\n\t\t\tconst provider = Iterable.find(outlineModel.children.values(), outlineGroupOfModel => outlineGroupOfModel.id === preferredProvider);\n\t\t\tif (provider) {\n\t\t\t\toutlineElements = provider.children;\n\t\t\t} else {\n\t\t\t\tlet tempID = '';\n\t\t\t\tlet maxTotalSumOfRanges = -1;\n\t\t\t\tlet optimalOutlineGroup = undefined;\n\t\t\t\tfor (const [_key, outlineGroup] of outlineModel.children.entries()) {\n\t\t\t\t\tconst totalSumRanges = this._findSumOfRangesOfGroup(outlineGroup);\n\t\t\t\t\tif (totalSumRanges > maxTotalSumOfRanges) {\n\t\t\t\t\t\toptimalOutlineGroup = outlineGroup;\n\t\t\t\t\t\tmaxTotalSumOfRanges = totalSumRanges;\n\t\t\t\t\t\ttempID = outlineGroup.id;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tpreferredProvider = tempID;\n\t\t\t\toutlineElements = optimalOutlineGroup!.children;\n\t\t\t}\n\t\t} else {\n\t\t\toutlineElements = outlineModel.children as Map<string, OutlineElement>;\n\t\t}\n\t\tconst stickyChildren: StickyElement[] = [];\n\t\tconst outlineElementsArray = Array.from(outlineElements.values()).sort((element1, element2) => {\n\t\t\tconst range1: StickyRange = new StickyRange(element1.symbol.range.startLineNumber, element1.symbol.range.endLineNumber);\n\t\t\tconst range2: StickyRange = new StickyRange(element2.symbol.range.startLineNumber, element2.symbol.range.endLineNumber);\n\t\t\treturn this._comparator(range1, range2);\n\t\t});\n\t\tfor (const outlineElement of outlineElementsArray) {\n\t\t\tstickyChildren.push(this._stickyModelFromOutlineElement(outlineElement, outlineElement.symbol.selectionRange.startLineNumber));\n\t\t}\n\t\tconst stickyOutlineElement = new StickyElement(undefined, stickyChildren, undefined);\n\n\t\treturn {\n\t\t\tstickyOutlineElement: stickyOutlineElement,\n\t\t\tproviderID: preferredProvider\n\t\t};\n\t}\n\n\tprivate _stickyModelFromOutlineElement(outlineElement: OutlineElement, previousStartLine: number): StickyElement {\n\t\tconst children: StickyElement[] = [];\n\t\tfor (const child of outlineElement.children.values()) {\n\t\t\tif (child.symbol.selectionRange.startLineNumber !== child.symbol.range.endLineNumber) {\n\t\t\t\tif (child.symbol.selectionRange.startLineNumber !== previousStartLine) {\n\t\t\t\t\tchildren.push(this._stickyModelFromOutlineElement(child, child.symbol.selectionRange.startLineNumber));\n\t\t\t\t} else {\n\t\t\t\t\tfor (const subchild of child.children.values()) {\n\t\t\t\t\t\tchildren.push(this._stickyModelFromOutlineElement(subchild, child.symbol.selectionRange.startLineNumber));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tchildren.sort((child1, child2) => this._comparator(child1.range!, child2.range!));\n\t\tconst range = new StickyRange(outlineElement.symbol.selectionRange.startLineNumber, outlineElement.symbol.range.endLineNumber);\n\t\treturn new StickyElement(range, children, undefined);\n\t}\n\n\tprivate _comparator(range1: StickyRange, range2: StickyRange): number {\n\t\tif (range1.startLineNumber !== range2.startLineNumber) {\n\t\t\treturn range1.startLineNumber - range2.startLineNumber;\n\t\t} else {\n\t\t\treturn range2.endLineNumber - range1.endLineNumber;\n\t\t}\n\t}\n\n\tprivate _findSumOfRangesOfGroup(outline: OutlineGroup | OutlineElement): number {\n\t\tlet res = 0;\n\t\tfor (const child of outline.children.values()) {\n\t\t\tres += this._findSumOfRangesOfGroup(child);\n\t\t}\n\t\tif (outline instanceof OutlineElement) {\n\t\t\treturn res + outline.symbol.range.endLineNumber - outline.symbol.selectionRange.startLineNumber;\n\t\t} else {\n\t\t\treturn res;\n\t\t}\n\t}\n}\n\nabstract class StickyModelFromCandidateFoldingProvider extends StickyModelCandidateProvider<FoldingRegions | null> {\n\n\tprotected _foldingLimitReporter: RangesLimitReporter;\n\n\tconstructor(editor: IActiveCodeEditor) {\n\t\tsuper(editor);\n\t\tthis._foldingLimitReporter = this._register(new RangesLimitReporter(editor));\n\t}\n\n\tprotected createStickyModel(token: CancellationToken, model: FoldingRegions): StickyModel {\n\t\tconst foldingElement = this._fromFoldingRegions(model);\n\t\tconst textModel = this._editor.getModel();\n\t\treturn new StickyModel(textModel.uri, textModel.getVersionId(), foldingElement, undefined);\n\t}\n\n\tprotected override isModelValid(model: FoldingRegions): boolean {\n\t\treturn model !== null;\n\t}\n\n\n\tprivate _fromFoldingRegions(foldingRegions: FoldingRegions): StickyElement {\n\t\tconst length = foldingRegions.length;\n\t\tconst orderedStickyElements: StickyElement[] = [];\n\n\t\t// The root sticky outline element\n\t\tconst stickyOutlineElement = new StickyElement(\n\t\t\tundefined,\n\t\t\t[],\n\t\t\tundefined\n\t\t);\n\n\t\tfor (let i = 0; i < length; i++) {\n\t\t\t// Finding the parent index of the current range\n\t\t\tconst parentIndex = foldingRegions.getParentIndex(i);\n\n\t\t\tlet parentNode;\n\t\t\tif (parentIndex !== -1) {\n\t\t\t\t// Access the reference of the parent node\n\t\t\t\tparentNode = orderedStickyElements[parentIndex];\n\t\t\t} else {\n\t\t\t\t// In that case the parent node is the root node\n\t\t\t\tparentNode = stickyOutlineElement;\n\t\t\t}\n\n\t\t\tconst child = new StickyElement(\n\t\t\t\tnew StickyRange(foldingRegions.getStartLineNumber(i), foldingRegions.getEndLineNumber(i) + 1),\n\t\t\t\t[],\n\t\t\t\tparentNode\n\t\t\t);\n\t\t\tparentNode.children.push(child);\n\t\t\torderedStickyElements.push(child);\n\t\t}\n\t\treturn stickyOutlineElement;\n\t}\n}\n\nclass StickyModelFromCandidateIndentationFoldingProvider extends StickyModelFromCandidateFoldingProvider {\n\n\tprivate readonly provider: IndentRangeProvider;\n\n\tconstructor(\n\t\teditor: IActiveCodeEditor,\n\t\t@ILanguageConfigurationService private readonly _languageConfigurationService: ILanguageConfigurationService) {\n\t\tsuper(editor);\n\n\t\tthis.provider = this._register(new IndentRangeProvider(editor.getModel(), this._languageConfigurationService, this._foldingLimitReporter));\n\t}\n\n\tprotected override async createModelFromProvider(token: CancellationToken): Promise<FoldingRegions> {\n\t\treturn this.provider.compute(token);\n\t}\n}\n\nclass StickyModelFromCandidateSyntaxFoldingProvider extends StickyModelFromCandidateFoldingProvider {\n\n\tprivate readonly provider: MutableDisposable<SyntaxRangeProvider> = this._register(new MutableDisposable<SyntaxRangeProvider>());\n\n\tconstructor(\n\t\teditor: IActiveCodeEditor,\n\t\tonProviderUpdate: () => void,\n\t\t@ILanguageFeaturesService private readonly _languageFeaturesService: ILanguageFeaturesService\n\t) {\n\t\tsuper(editor);\n\t\tthis._register(this._languageFeaturesService.foldingRangeProvider.onDidChange(() => {\n\t\t\tthis._updateProvider(editor, onProviderUpdate);\n\t\t}));\n\t\tthis._updateProvider(editor, onProviderUpdate);\n\t}\n\n\tprivate _updateProvider(editor: IActiveCodeEditor, onProviderUpdate: () => void): void {\n\t\tconst selectedProviders = FoldingController.getFoldingRangeProviders(this._languageFeaturesService, editor.getModel());\n\t\tif (selectedProviders.length === 0) {\n\t\t\treturn;\n\t\t}\n\t\tthis.provider.value = new SyntaxRangeProvider(editor.getModel(), selectedProviders, onProviderUpdate, this._foldingLimitReporter, undefined);\n\t}\n\n\tprotected override isProviderValid(): boolean {\n\t\treturn this.provider !== undefined;\n\t}\n\n\tprotected override async createModelFromProvider(token: CancellationToken): Promise<FoldingRegions | null> {\n\t\treturn this.provider.value?.compute(token) ?? null;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/stickyScroll/browser/stickyScrollModelProvider.ts","vs/editor/contrib/stickyScroll/browser/stickyScrollModelProvider.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;AAEhG,OAAO,EAAE,UAAU,EAAE,eAAe,EAAe,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAEnH,OAAO,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAC;AAE3G,OAAO,EAAqB,uBAAuB,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AACvG,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAC1F,OAAO,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACnF,OAAO,EAAE,6BAA6B,EAAE,MAAM,4DAA4D,CAAC;AAE3G,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM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E,gBAAgB,EAAE,IAAI,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAC;IAC9I,CAAC;IAEkB,eAAe;QACjC,OAAO,IAAI,CAAC,QAAQ,KAAK,SAAS,CAAC;IACpC,CAAC;IAEkB,KAAK,CAAC,uBAAuB,CAAC,KAAwB;QACxE,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC;IACpD,CAAC;CACD,CAAA;AA/BK,6CAA6C;IAOhD,WAAA,wBAAwB,CAAA;GAPrB,6CAA6C,CA+BlD","file":"stickyScrollModelProvider.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 { Disposable, DisposableStore, IDisposable, MutableDisposable } from '../../../../base/common/lifecycle.js';\nimport { IActiveCodeEditor } from '../../../browser/editorBrowser.js';\nimport { ILanguageFeaturesService } from '../../../common/services/languageFeatures.js';\nimport { OutlineElement, OutlineGroup, OutlineModel } from '../../documentSymbols/browser/outlineModel.js';\nimport { CancellationToken } from '../../../../base/common/cancellation.js';\nimport { CancelablePromise, createCancelablePromise, Delayer } from '../../../../base/common/async.js';\nimport { FoldingController, RangesLimitReporter } from '../../folding/browser/folding.js';\nimport { SyntaxRangeProvider } from '../../folding/browser/syntaxRangeProvider.js';\nimport { IndentRangeProvider } from '../../folding/browser/indentRangeProvider.js';\nimport { ILanguageConfigurationService } from '../../../common/languages/languageConfigurationRegistry.js';\nimport { FoldingRegions } from '../../folding/browser/foldingRanges.js';\nimport { onUnexpectedError } from '../../../../base/common/errors.js';\nimport { StickyElement, StickyModel, StickyRange } from './stickyScrollElement.js';\nimport { Iterable } from '../../../../base/common/iterator.js';\nimport { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';\nimport { EditorOption } from '../../../common/config/editorOptions.js';\n\nenum ModelProvider {\n\tOUTLINE_MODEL = 'outlineModel',\n\tFOLDING_PROVIDER_MODEL = 'foldingProviderModel',\n\tINDENTATION_MODEL = 'indentationModel'\n}\n\nenum Status {\n\tVALID,\n\tINVALID,\n\tCANCELED\n}\n\nexport interface IStickyModelProvider extends IDisposable {\n\n\t/**\n\t * Method which updates the sticky model\n\t * @param token cancellation token\n\t * @returns the sticky model\n\t */\n\tupdate(token: CancellationToken): Promise<StickyModel | null>;\n}\n\nexport class StickyModelProvider extends Disposable implements IStickyModelProvider {\n\n\tprivate _modelProviders: IStickyModelCandidateProvider<any>[] = [];\n\tprivate _modelPromise: CancelablePromise<any | null> | null = null;\n\tprivate _updateScheduler: Delayer<StickyModel | null> = this._register(new Delayer<StickyModel | null>(300));\n\tprivate readonly _updateOperation: DisposableStore = this._register(new DisposableStore());\n\n\tconstructor(\n\t\tprivate readonly _editor: IActiveCodeEditor,\n\t\tonProviderUpdate: () => void,\n\t\t@IInstantiationService _languageConfigurationService: ILanguageConfigurationService,\n\t\t@ILanguageFeaturesService _languageFeaturesService: ILanguageFeaturesService,\n\t) {\n\t\tsuper();\n\n\t\tswitch (this._editor.getOption(EditorOption.stickyScroll).defaultModel) {\n\t\t\tcase ModelProvider.OUTLINE_MODEL:\n\t\t\t\tthis._modelProviders.push(new StickyModelFromCandidateOutlineProvider(this._editor, _languageFeaturesService));\n\t\t\t// fall through\n\t\t\tcase ModelProvider.FOLDING_PROVIDER_MODEL:\n\t\t\t\tthis._modelProviders.push(new StickyModelFromCandidateSyntaxFoldingProvider(this._editor, onProviderUpdate, _languageFeaturesService));\n\t\t\t// fall through\n\t\t\tcase ModelProvider.INDENTATION_MODEL:\n\t\t\t\tthis._modelProviders.push(new StickyModelFromCandidateIndentationFoldingProvider(this._editor, _languageConfigurationService));\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tpublic override dispose(): void {\n\t\tthis._modelProviders.forEach(provider => provider.dispose());\n\t\tthis._updateOperation.clear();\n\t\tthis._cancelModelPromise();\n\t\tsuper.dispose();\n\t}\n\n\tprivate _cancelModelPromise(): void {\n\t\tif (this._modelPromise) {\n\t\t\tthis._modelPromise.cancel();\n\t\t\tthis._modelPromise = null;\n\t\t}\n\t}\n\n\tpublic async update(token: CancellationToken): Promise<StickyModel | null> {\n\n\t\tthis._updateOperation.clear();\n\t\tthis._updateOperation.add({\n\t\t\tdispose: () => {\n\t\t\t\tthis._cancelModelPromise();\n\t\t\t\tthis._updateScheduler.cancel();\n\t\t\t}\n\t\t});\n\t\tthis._cancelModelPromise();\n\n\t\treturn await this._updateScheduler.trigger(async () => {\n\n\t\t\tfor (const modelProvider of this._modelProviders) {\n\t\t\t\tconst { statusPromise, modelPromise } = modelProvider.computeStickyModel(token);\n\t\t\t\tthis._modelPromise = modelPromise;\n\t\t\t\tconst status = await statusPromise;\n\t\t\t\tif (this._modelPromise !== modelPromise) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t\tswitch (status) {\n\t\t\t\t\tcase Status.CANCELED:\n\t\t\t\t\t\tthis._updateOperation.clear();\n\t\t\t\t\t\treturn null;\n\t\t\t\t\tcase Status.VALID:\n\t\t\t\t\t\treturn modelProvider.stickyModel;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn null;\n\t\t}).catch((error) => {\n\t\t\tonUnexpectedError(error);\n\t\t\treturn null;\n\t\t});\n\t}\n}\n\ninterface IStickyModelCandidateProvider<T> extends IDisposable {\n\tget stickyModel(): StickyModel | null;\n\n\t/**\n\t * Method which computes the sticky model and returns a status to signal whether the sticky model has been successfully found\n\t * @param token cancellation token\n\t * @returns a promise of a status indicating whether the sticky model has been successfully found as well as the model promise\n\t */\n\tcomputeStickyModel(token: CancellationToken): { statusPromise: Promise<Status> | Status; modelPromise: CancelablePromise<T | null> | null };\n}\n\nabstract class StickyModelCandidateProvider<T> extends Disposable implements IStickyModelCandidateProvider<T> {\n\n\tprotected _stickyModel: StickyModel | null = null;\n\n\tconstructor(protected readonly _editor: IActiveCodeEditor) {\n\t\tsuper();\n\t}\n\n\tget stickyModel(): StickyModel | null {\n\t\treturn this._stickyModel;\n\t}\n\n\tprivate _invalid(): Status {\n\t\tthis._stickyModel = null;\n\t\treturn Status.INVALID;\n\t}\n\n\tpublic computeStickyModel(token: CancellationToken): { statusPromise: Promise<Status> | Status; modelPromise: CancelablePromise<T | null> | null } {\n\t\tif (token.isCancellationRequested || !this.isProviderValid()) {\n\t\t\treturn { statusPromise: this._invalid(), modelPromise: null };\n\t\t}\n\t\tconst providerModelPromise = createCancelablePromise(token => this.createModelFromProvider(token));\n\n\t\treturn {\n\t\t\tstatusPromise: providerModelPromise.then(providerModel => {\n\t\t\t\tif (!this.isModelValid(providerModel)) {\n\t\t\t\t\treturn this._invalid();\n\n\t\t\t\t}\n\t\t\t\tif (token.isCancellationRequested) {\n\t\t\t\t\treturn Status.CANCELED;\n\t\t\t\t}\n\t\t\t\tthis._stickyModel = this.createStickyModel(token, providerModel);\n\t\t\t\treturn Status.VALID;\n\t\t\t}).then(undefined, (err) => {\n\t\t\t\tonUnexpectedError(err);\n\t\t\t\treturn Status.CANCELED;\n\t\t\t}),\n\t\t\tmodelPromise: providerModelPromise\n\t\t};\n\t}\n\n\t/**\n\t * Method which checks whether the model returned by the provider is valid and can be used to compute a sticky model.\n\t * This method by default returns true.\n\t * @param model model returned by the provider\n\t * @returns boolean indicating whether the model is valid\n\t */\n\tprotected isModelValid(model: T): boolean {\n\t\treturn true;\n\t}\n\n\t/**\n\t * Method which checks whether the provider is valid before applying it to find the provider model.\n\t * This method by default returns true.\n\t * @returns boolean indicating whether the provider is valid\n\t */\n\tprotected isProviderValid(): boolean {\n\t\treturn true;\n\t}\n\n\t/**\n\t * Abstract method which creates the model from the provider and returns the provider model\n\t * @param token cancellation token\n\t * @returns the model returned by the provider\n\t */\n\tprotected abstract createModelFromProvider(token: CancellationToken): Promise<T>;\n\n\t/**\n\t * Abstract method which computes the sticky model from the model returned by the provider and returns the sticky model\n\t * @param token cancellation token\n\t * @param model model returned by the provider\n\t * @returns the sticky model\n\t */\n\tprotected abstract createStickyModel(token: CancellationToken, model: T): StickyModel;\n}\n\nclass StickyModelFromCandidateOutlineProvider extends StickyModelCandidateProvider<OutlineModel> {\n\n\tconstructor(_editor: IActiveCodeEditor, @ILanguageFeaturesService private readonly _languageFeaturesService: ILanguageFeaturesService) {\n\t\tsuper(_editor);\n\t}\n\n\tprotected createModelFromProvider(token: CancellationToken): Promise<OutlineModel> {\n\t\treturn OutlineModel.create(this._languageFeaturesService.documentSymbolProvider, this._editor.getModel(), token);\n\t}\n\n\tprotected createStickyModel(token: CancellationToken, model: OutlineModel): StickyModel {\n\t\tconst { stickyOutlineElement, providerID } = this._stickyModelFromOutlineModel(model, this._stickyModel?.outlineProviderId);\n\t\tconst textModel = this._editor.getModel();\n\t\treturn new StickyModel(textModel.uri, textModel.getVersionId(), stickyOutlineElement, providerID);\n\t}\n\n\tprotected override isModelValid(model: OutlineModel): boolean {\n\t\treturn model && model.children.size > 0;\n\t}\n\n\tprivate _stickyModelFromOutlineModel(outlineModel: OutlineModel, preferredProvider: string | undefined): { stickyOutlineElement: StickyElement; providerID: string | undefined } {\n\n\t\tlet outlineElements: Map<string, OutlineElement>;\n\t\t// When several possible outline providers\n\t\tif (Iterable.first(outlineModel.children.values()) instanceof OutlineGroup) {\n\t\t\tconst provider = Iterable.find(outlineModel.children.values(), outlineGroupOfModel => outlineGroupOfModel.id === preferredProvider);\n\t\t\tif (provider) {\n\t\t\t\toutlineElements = provider.children;\n\t\t\t} else {\n\t\t\t\tlet tempID = '';\n\t\t\t\tlet maxTotalSumOfRanges = -1;\n\t\t\t\tlet optimalOutlineGroup: OutlineGroup | OutlineElement | undefined = undefined;\n\t\t\t\tfor (const [_key, outlineGroup] of outlineModel.children.entries()) {\n\t\t\t\t\tconst totalSumRanges = this._findSumOfRangesOfGroup(outlineGroup);\n\t\t\t\t\tif (totalSumRanges > maxTotalSumOfRanges) {\n\t\t\t\t\t\toptimalOutlineGroup = outlineGroup;\n\t\t\t\t\t\tmaxTotalSumOfRanges = totalSumRanges;\n\t\t\t\t\t\ttempID = outlineGroup.id;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tpreferredProvider = tempID;\n\t\t\t\toutlineElements = optimalOutlineGroup!.children;\n\t\t\t}\n\t\t} else {\n\t\t\toutlineElements = outlineModel.children as Map<string, OutlineElement>;\n\t\t}\n\t\tconst stickyChildren: StickyElement[] = [];\n\t\tconst outlineElementsArray = Array.from(outlineElements.values()).sort((element1, element2) => {\n\t\t\tconst range1: StickyRange = new StickyRange(element1.symbol.range.startLineNumber, element1.symbol.range.endLineNumber);\n\t\t\tconst range2: StickyRange = new StickyRange(element2.symbol.range.startLineNumber, element2.symbol.range.endLineNumber);\n\t\t\treturn this._comparator(range1, range2);\n\t\t});\n\t\tfor (const outlineElement of outlineElementsArray) {\n\t\t\tstickyChildren.push(this._stickyModelFromOutlineElement(outlineElement, outlineElement.symbol.selectionRange.startLineNumber));\n\t\t}\n\t\tconst stickyOutlineElement = new StickyElement(undefined, stickyChildren, undefined);\n\n\t\treturn {\n\t\t\tstickyOutlineElement: stickyOutlineElement,\n\t\t\tproviderID: preferredProvider\n\t\t};\n\t}\n\n\tprivate _stickyModelFromOutlineElement(outlineElement: OutlineElement, previousStartLine: number): StickyElement {\n\t\tconst children: StickyElement[] = [];\n\t\tfor (const child of outlineElement.children.values()) {\n\t\t\tif (child.symbol.selectionRange.startLineNumber !== child.symbol.range.endLineNumber) {\n\t\t\t\tif (child.symbol.selectionRange.startLineNumber !== previousStartLine) {\n\t\t\t\t\tchildren.push(this._stickyModelFromOutlineElement(child, child.symbol.selectionRange.startLineNumber));\n\t\t\t\t} else {\n\t\t\t\t\tfor (const subchild of child.children.values()) {\n\t\t\t\t\t\tchildren.push(this._stickyModelFromOutlineElement(subchild, child.symbol.selectionRange.startLineNumber));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tchildren.sort((child1, child2) => this._comparator(child1.range!, child2.range!));\n\t\tconst range = new StickyRange(outlineElement.symbol.selectionRange.startLineNumber, outlineElement.symbol.range.endLineNumber);\n\t\treturn new StickyElement(range, children, undefined);\n\t}\n\n\tprivate _comparator(range1: StickyRange, range2: StickyRange): number {\n\t\tif (range1.startLineNumber !== range2.startLineNumber) {\n\t\t\treturn range1.startLineNumber - range2.startLineNumber;\n\t\t} else {\n\t\t\treturn range2.endLineNumber - range1.endLineNumber;\n\t\t}\n\t}\n\n\tprivate _findSumOfRangesOfGroup(outline: OutlineGroup | OutlineElement): number {\n\t\tlet res = 0;\n\t\tfor (const child of outline.children.values()) {\n\t\t\tres += this._findSumOfRangesOfGroup(child);\n\t\t}\n\t\tif (outline instanceof OutlineElement) {\n\t\t\treturn res + outline.symbol.range.endLineNumber - outline.symbol.selectionRange.startLineNumber;\n\t\t} else {\n\t\t\treturn res;\n\t\t}\n\t}\n}\n\nabstract class StickyModelFromCandidateFoldingProvider extends StickyModelCandidateProvider<FoldingRegions | null> {\n\n\tprotected _foldingLimitReporter: RangesLimitReporter;\n\n\tconstructor(editor: IActiveCodeEditor) {\n\t\tsuper(editor);\n\t\tthis._foldingLimitReporter = this._register(new RangesLimitReporter(editor));\n\t}\n\n\tprotected createStickyModel(token: CancellationToken, model: FoldingRegions): StickyModel {\n\t\tconst foldingElement = this._fromFoldingRegions(model);\n\t\tconst textModel = this._editor.getModel();\n\t\treturn new StickyModel(textModel.uri, textModel.getVersionId(), foldingElement, undefined);\n\t}\n\n\tprotected override isModelValid(model: FoldingRegions): boolean {\n\t\treturn model !== null;\n\t}\n\n\n\tprivate _fromFoldingRegions(foldingRegions: FoldingRegions): StickyElement {\n\t\tconst length = foldingRegions.length;\n\t\tconst orderedStickyElements: StickyElement[] = [];\n\n\t\t// The root sticky outline element\n\t\tconst stickyOutlineElement = new StickyElement(\n\t\t\tundefined,\n\t\t\t[],\n\t\t\tundefined\n\t\t);\n\n\t\tfor (let i = 0; i < length; i++) {\n\t\t\t// Finding the parent index of the current range\n\t\t\tconst parentIndex = foldingRegions.getParentIndex(i);\n\n\t\t\tlet parentNode;\n\t\t\tif (parentIndex !== -1) {\n\t\t\t\t// Access the reference of the parent node\n\t\t\t\tparentNode = orderedStickyElements[parentIndex];\n\t\t\t} else {\n\t\t\t\t// In that case the parent node is the root node\n\t\t\t\tparentNode = stickyOutlineElement;\n\t\t\t}\n\n\t\t\tconst child = new StickyElement(\n\t\t\t\tnew StickyRange(foldingRegions.getStartLineNumber(i), foldingRegions.getEndLineNumber(i) + 1),\n\t\t\t\t[],\n\t\t\t\tparentNode\n\t\t\t);\n\t\t\tparentNode.children.push(child);\n\t\t\torderedStickyElements.push(child);\n\t\t}\n\t\treturn stickyOutlineElement;\n\t}\n}\n\nclass StickyModelFromCandidateIndentationFoldingProvider extends StickyModelFromCandidateFoldingProvider {\n\n\tprivate readonly provider: IndentRangeProvider;\n\n\tconstructor(\n\t\teditor: IActiveCodeEditor,\n\t\t@ILanguageConfigurationService private readonly _languageConfigurationService: ILanguageConfigurationService) {\n\t\tsuper(editor);\n\n\t\tthis.provider = this._register(new IndentRangeProvider(editor.getModel(), this._languageConfigurationService, this._foldingLimitReporter));\n\t}\n\n\tprotected override async createModelFromProvider(token: CancellationToken): Promise<FoldingRegions> {\n\t\treturn this.provider.compute(token);\n\t}\n}\n\nclass StickyModelFromCandidateSyntaxFoldingProvider extends StickyModelFromCandidateFoldingProvider {\n\n\tprivate readonly provider: MutableDisposable<SyntaxRangeProvider> = this._register(new MutableDisposable<SyntaxRangeProvider>());\n\n\tconstructor(\n\t\teditor: IActiveCodeEditor,\n\t\tonProviderUpdate: () => void,\n\t\t@ILanguageFeaturesService private readonly _languageFeaturesService: ILanguageFeaturesService\n\t) {\n\t\tsuper(editor);\n\t\tthis._register(this._languageFeaturesService.foldingRangeProvider.onDidChange(() => {\n\t\t\tthis._updateProvider(editor, onProviderUpdate);\n\t\t}));\n\t\tthis._updateProvider(editor, onProviderUpdate);\n\t}\n\n\tprivate _updateProvider(editor: IActiveCodeEditor, onProviderUpdate: () => void): void {\n\t\tconst selectedProviders = FoldingController.getFoldingRangeProviders(this._languageFeaturesService, editor.getModel());\n\t\tif (selectedProviders.length === 0) {\n\t\t\treturn;\n\t\t}\n\t\tthis.provider.value = new SyntaxRangeProvider(editor.getModel(), selectedProviders, onProviderUpdate, this._foldingLimitReporter, undefined);\n\t}\n\n\tprotected override isProviderValid(): boolean {\n\t\treturn this.provider !== undefined;\n\t}\n\n\tprotected override async createModelFromProvider(token: CancellationToken): Promise<FoldingRegions | null> {\n\t\treturn this.provider.value?.compute(token) ?? 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 { Disposable, DisposableStore, IDisposable, MutableDisposable } from '../../../../base/common/lifecycle.js';\nimport { IActiveCodeEditor } from '../../../browser/editorBrowser.js';\nimport { ILanguageFeaturesService } from '../../../common/services/languageFeatures.js';\nimport { OutlineElement, OutlineGroup, OutlineModel } from '../../documentSymbols/browser/outlineModel.js';\nimport { CancellationToken } from '../../../../base/common/cancellation.js';\nimport { CancelablePromise, createCancelablePromise, Delayer } from '../../../../base/common/async.js';\nimport { FoldingController, RangesLimitReporter } from '../../folding/browser/folding.js';\nimport { SyntaxRangeProvider } from '../../folding/browser/syntaxRangeProvider.js';\nimport { IndentRangeProvider } from '../../folding/browser/indentRangeProvider.js';\nimport { ILanguageConfigurationService } from '../../../common/languages/languageConfigurationRegistry.js';\nimport { FoldingRegions } from '../../folding/browser/foldingRanges.js';\nimport { onUnexpectedError } from '../../../../base/common/errors.js';\nimport { StickyElement, StickyModel, StickyRange } from './stickyScrollElement.js';\nimport { Iterable } from '../../../../base/common/iterator.js';\nimport { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';\nimport { EditorOption } from '../../../common/config/editorOptions.js';\n\nenum ModelProvider {\n\tOUTLINE_MODEL = 'outlineModel',\n\tFOLDING_PROVIDER_MODEL = 'foldingProviderModel',\n\tINDENTATION_MODEL = 'indentationModel'\n}\n\nenum Status {\n\tVALID,\n\tINVALID,\n\tCANCELED\n}\n\nexport interface IStickyModelProvider extends IDisposable {\n\n\t/**\n\t * Method which updates the sticky model\n\t * @param token cancellation token\n\t * @returns the sticky model\n\t */\n\tupdate(token: CancellationToken): Promise<StickyModel | null>;\n}\n\nexport class StickyModelProvider extends Disposable implements IStickyModelProvider {\n\n\tprivate _modelProviders: IStickyModelCandidateProvider<any>[] = [];\n\tprivate _modelPromise: CancelablePromise<any | null> | null = null;\n\tprivate _updateScheduler: Delayer<StickyModel | null> = this._register(new Delayer<StickyModel | null>(300));\n\tprivate readonly _updateOperation: DisposableStore = this._register(new DisposableStore());\n\n\tconstructor(\n\t\tprivate readonly _editor: IActiveCodeEditor,\n\t\tonProviderUpdate: () => void,\n\t\t@IInstantiationService _languageConfigurationService: ILanguageConfigurationService,\n\t\t@ILanguageFeaturesService _languageFeaturesService: ILanguageFeaturesService,\n\t) {\n\t\tsuper();\n\n\t\tswitch (this._editor.getOption(EditorOption.stickyScroll).defaultModel) {\n\t\t\tcase ModelProvider.OUTLINE_MODEL:\n\t\t\t\tthis._modelProviders.push(new StickyModelFromCandidateOutlineProvider(this._editor, _languageFeaturesService));\n\t\t\t// fall through\n\t\t\tcase ModelProvider.FOLDING_PROVIDER_MODEL:\n\t\t\t\tthis._modelProviders.push(new StickyModelFromCandidateSyntaxFoldingProvider(this._editor, onProviderUpdate, _languageFeaturesService));\n\t\t\t// fall through\n\t\t\tcase ModelProvider.INDENTATION_MODEL:\n\t\t\t\tthis._modelProviders.push(new StickyModelFromCandidateIndentationFoldingProvider(this._editor, _languageConfigurationService));\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tpublic override dispose(): void {\n\t\tthis._modelProviders.forEach(provider => provider.dispose());\n\t\tthis._updateOperation.clear();\n\t\tthis._cancelModelPromise();\n\t\tsuper.dispose();\n\t}\n\n\tprivate _cancelModelPromise(): void {\n\t\tif (this._modelPromise) {\n\t\t\tthis._modelPromise.cancel();\n\t\t\tthis._modelPromise = null;\n\t\t}\n\t}\n\n\tpublic async update(token: CancellationToken): Promise<StickyModel | null> {\n\n\t\tthis._updateOperation.clear();\n\t\tthis._updateOperation.add({\n\t\t\tdispose: () => {\n\t\t\t\tthis._cancelModelPromise();\n\t\t\t\tthis._updateScheduler.cancel();\n\t\t\t}\n\t\t});\n\t\tthis._cancelModelPromise();\n\n\t\treturn await this._updateScheduler.trigger(async () => {\n\n\t\t\tfor (const modelProvider of this._modelProviders) {\n\t\t\t\tconst { statusPromise, modelPromise } = modelProvider.computeStickyModel(token);\n\t\t\t\tthis._modelPromise = modelPromise;\n\t\t\t\tconst status = await statusPromise;\n\t\t\t\tif (this._modelPromise !== modelPromise) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t\tswitch (status) {\n\t\t\t\t\tcase Status.CANCELED:\n\t\t\t\t\t\tthis._updateOperation.clear();\n\t\t\t\t\t\treturn null;\n\t\t\t\t\tcase Status.VALID:\n\t\t\t\t\t\treturn modelProvider.stickyModel;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn null;\n\t\t}).catch((error) => {\n\t\t\tonUnexpectedError(error);\n\t\t\treturn null;\n\t\t});\n\t}\n}\n\ninterface IStickyModelCandidateProvider<T> extends IDisposable {\n\tget stickyModel(): StickyModel | null;\n\n\t/**\n\t * Method which computes the sticky model and returns a status to signal whether the sticky model has been successfully found\n\t * @param token cancellation token\n\t * @returns a promise of a status indicating whether the sticky model has been successfully found as well as the model promise\n\t */\n\tcomputeStickyModel(token: CancellationToken): { statusPromise: Promise<Status> | Status; modelPromise: CancelablePromise<T | null> | null };\n}\n\nabstract class StickyModelCandidateProvider<T> extends Disposable implements IStickyModelCandidateProvider<T> {\n\n\tprotected _stickyModel: StickyModel | null = null;\n\n\tconstructor(protected readonly _editor: IActiveCodeEditor) {\n\t\tsuper();\n\t}\n\n\tget stickyModel(): StickyModel | null {\n\t\treturn this._stickyModel;\n\t}\n\n\tprivate _invalid(): Status {\n\t\tthis._stickyModel = null;\n\t\treturn Status.INVALID;\n\t}\n\n\tpublic computeStickyModel(token: CancellationToken): { statusPromise: Promise<Status> | Status; modelPromise: CancelablePromise<T | null> | null } {\n\t\tif (token.isCancellationRequested || !this.isProviderValid()) {\n\t\t\treturn { statusPromise: this._invalid(), modelPromise: null };\n\t\t}\n\t\tconst providerModelPromise = createCancelablePromise(token => this.createModelFromProvider(token));\n\n\t\treturn {\n\t\t\tstatusPromise: providerModelPromise.then(providerModel => {\n\t\t\t\tif (!this.isModelValid(providerModel)) {\n\t\t\t\t\treturn this._invalid();\n\n\t\t\t\t}\n\t\t\t\tif (token.isCancellationRequested) {\n\t\t\t\t\treturn Status.CANCELED;\n\t\t\t\t}\n\t\t\t\tthis._stickyModel = this.createStickyModel(token, providerModel);\n\t\t\t\treturn Status.VALID;\n\t\t\t}).then(undefined, (err) => {\n\t\t\t\tonUnexpectedError(err);\n\t\t\t\treturn Status.CANCELED;\n\t\t\t}),\n\t\t\tmodelPromise: providerModelPromise\n\t\t};\n\t}\n\n\t/**\n\t * Method which checks whether the model returned by the provider is valid and can be used to compute a sticky model.\n\t * This method by default returns true.\n\t * @param model model returned by the provider\n\t * @returns boolean indicating whether the model is valid\n\t */\n\tprotected isModelValid(model: T): boolean {\n\t\treturn true;\n\t}\n\n\t/**\n\t * Method which checks whether the provider is valid before applying it to find the provider model.\n\t * This method by default returns true.\n\t * @returns boolean indicating whether the provider is valid\n\t */\n\tprotected isProviderValid(): boolean {\n\t\treturn true;\n\t}\n\n\t/**\n\t * Abstract method which creates the model from the provider and returns the provider model\n\t * @param token cancellation token\n\t * @returns the model returned by the provider\n\t */\n\tprotected abstract createModelFromProvider(token: CancellationToken): Promise<T>;\n\n\t/**\n\t * Abstract method which computes the sticky model from the model returned by the provider and returns the sticky model\n\t * @param token cancellation token\n\t * @param model model returned by the provider\n\t * @returns the sticky model\n\t */\n\tprotected abstract createStickyModel(token: CancellationToken, model: T): StickyModel;\n}\n\nclass StickyModelFromCandidateOutlineProvider extends StickyModelCandidateProvider<OutlineModel> {\n\n\tconstructor(_editor: IActiveCodeEditor, @ILanguageFeaturesService private readonly _languageFeaturesService: ILanguageFeaturesService) {\n\t\tsuper(_editor);\n\t}\n\n\tprotected createModelFromProvider(token: CancellationToken): Promise<OutlineModel> {\n\t\treturn OutlineModel.create(this._languageFeaturesService.documentSymbolProvider, this._editor.getModel(), token);\n\t}\n\n\tprotected createStickyModel(token: CancellationToken, model: OutlineModel): StickyModel {\n\t\tconst { stickyOutlineElement, providerID } = this._stickyModelFromOutlineModel(model, this._stickyModel?.outlineProviderId);\n\t\tconst textModel = this._editor.getModel();\n\t\treturn new StickyModel(textModel.uri, textModel.getVersionId(), stickyOutlineElement, providerID);\n\t}\n\n\tprotected override isModelValid(model: OutlineModel): boolean {\n\t\treturn model && model.children.size > 0;\n\t}\n\n\tprivate _stickyModelFromOutlineModel(outlineModel: OutlineModel, preferredProvider: string | undefined): { stickyOutlineElement: StickyElement; providerID: string | undefined } {\n\n\t\tlet outlineElements: Map<string, OutlineElement>;\n\t\t// When several possible outline providers\n\t\tif (Iterable.first(outlineModel.children.values()) instanceof OutlineGroup) {\n\t\t\tconst provider = Iterable.find(outlineModel.children.values(), outlineGroupOfModel => outlineGroupOfModel.id === preferredProvider);\n\t\t\tif (provider) {\n\t\t\t\toutlineElements = provider.children;\n\t\t\t} else {\n\t\t\t\tlet tempID = '';\n\t\t\t\tlet maxTotalSumOfRanges = -1;\n\t\t\t\tlet optimalOutlineGroup: OutlineGroup | OutlineElement | undefined = undefined;\n\t\t\t\tfor (const [_key, outlineGroup] of outlineModel.children.entries()) {\n\t\t\t\t\tconst totalSumRanges = this._findSumOfRangesOfGroup(outlineGroup);\n\t\t\t\t\tif (totalSumRanges > maxTotalSumOfRanges) {\n\t\t\t\t\t\toptimalOutlineGroup = outlineGroup;\n\t\t\t\t\t\tmaxTotalSumOfRanges = totalSumRanges;\n\t\t\t\t\t\ttempID = outlineGroup.id;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tpreferredProvider = tempID;\n\t\t\t\toutlineElements = optimalOutlineGroup!.children;\n\t\t\t}\n\t\t} else {\n\t\t\toutlineElements = outlineModel.children as Map<string, OutlineElement>;\n\t\t}\n\t\tconst stickyChildren: StickyElement[] = [];\n\t\tconst outlineElementsArray = Array.from(outlineElements.values()).sort((element1, element2) => {\n\t\t\tconst range1: StickyRange = new StickyRange(element1.symbol.range.startLineNumber, element1.symbol.range.endLineNumber);\n\t\t\tconst range2: StickyRange = new StickyRange(element2.symbol.range.startLineNumber, element2.symbol.range.endLineNumber);\n\t\t\treturn this._comparator(range1, range2);\n\t\t});\n\t\tfor (const outlineElement of outlineElementsArray) {\n\t\t\tstickyChildren.push(this._stickyModelFromOutlineElement(outlineElement, outlineElement.symbol.selectionRange.startLineNumber));\n\t\t}\n\t\tconst stickyOutlineElement = new StickyElement(undefined, stickyChildren, undefined);\n\n\t\treturn {\n\t\t\tstickyOutlineElement: stickyOutlineElement,\n\t\t\tproviderID: preferredProvider\n\t\t};\n\t}\n\n\tprivate _stickyModelFromOutlineElement(outlineElement: OutlineElement, previousStartLine: number): StickyElement {\n\t\tconst children: StickyElement[] = [];\n\t\tfor (const child of outlineElement.children.values()) {\n\t\t\tif (child.symbol.selectionRange.startLineNumber !== child.symbol.range.endLineNumber) {\n\t\t\t\tif (child.symbol.selectionRange.startLineNumber !== previousStartLine) {\n\t\t\t\t\tchildren.push(this._stickyModelFromOutlineElement(child, child.symbol.selectionRange.startLineNumber));\n\t\t\t\t} else {\n\t\t\t\t\tfor (const subchild of child.children.values()) {\n\t\t\t\t\t\tchildren.push(this._stickyModelFromOutlineElement(subchild, child.symbol.selectionRange.startLineNumber));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tchildren.sort((child1, child2) => this._comparator(child1.range!, child2.range!));\n\t\tconst range = new StickyRange(outlineElement.symbol.selectionRange.startLineNumber, outlineElement.symbol.range.endLineNumber);\n\t\treturn new StickyElement(range, children, undefined);\n\t}\n\n\tprivate _comparator(range1: StickyRange, range2: StickyRange): number {\n\t\tif (range1.startLineNumber !== range2.startLineNumber) {\n\t\t\treturn range1.startLineNumber - range2.startLineNumber;\n\t\t} else {\n\t\t\treturn range2.endLineNumber - range1.endLineNumber;\n\t\t}\n\t}\n\n\tprivate _findSumOfRangesOfGroup(outline: OutlineGroup | OutlineElement): number {\n\t\tlet res = 0;\n\t\tfor (const child of outline.children.values()) {\n\t\t\tres += this._findSumOfRangesOfGroup(child);\n\t\t}\n\t\tif (outline instanceof OutlineElement) {\n\t\t\treturn res + outline.symbol.range.endLineNumber - outline.symbol.selectionRange.startLineNumber;\n\t\t} else {\n\t\t\treturn res;\n\t\t}\n\t}\n}\n\nabstract class StickyModelFromCandidateFoldingProvider extends StickyModelCandidateProvider<FoldingRegions | null> {\n\n\tprotected _foldingLimitReporter: RangesLimitReporter;\n\n\tconstructor(editor: IActiveCodeEditor) {\n\t\tsuper(editor);\n\t\tthis._foldingLimitReporter = this._register(new RangesLimitReporter(editor));\n\t}\n\n\tprotected createStickyModel(token: CancellationToken, model: FoldingRegions): StickyModel {\n\t\tconst foldingElement = this._fromFoldingRegions(model);\n\t\tconst textModel = this._editor.getModel();\n\t\treturn new StickyModel(textModel.uri, textModel.getVersionId(), foldingElement, undefined);\n\t}\n\n\tprotected override isModelValid(model: FoldingRegions): boolean {\n\t\treturn model !== null;\n\t}\n\n\n\tprivate _fromFoldingRegions(foldingRegions: FoldingRegions): StickyElement {\n\t\tconst length = foldingRegions.length;\n\t\tconst orderedStickyElements: StickyElement[] = [];\n\n\t\t// The root sticky outline element\n\t\tconst stickyOutlineElement = new StickyElement(\n\t\t\tundefined,\n\t\t\t[],\n\t\t\tundefined\n\t\t);\n\n\t\tfor (let i = 0; i < length; i++) {\n\t\t\t// Finding the parent index of the current range\n\t\t\tconst parentIndex = foldingRegions.getParentIndex(i);\n\n\t\t\tlet parentNode;\n\t\t\tif (parentIndex !== -1) {\n\t\t\t\t// Access the reference of the parent node\n\t\t\t\tparentNode = orderedStickyElements[parentIndex];\n\t\t\t} else {\n\t\t\t\t// In that case the parent node is the root node\n\t\t\t\tparentNode = stickyOutlineElement;\n\t\t\t}\n\n\t\t\tconst child = new StickyElement(\n\t\t\t\tnew StickyRange(foldingRegions.getStartLineNumber(i), foldingRegions.getEndLineNumber(i) + 1),\n\t\t\t\t[],\n\t\t\t\tparentNode\n\t\t\t);\n\t\t\tparentNode.children.push(child);\n\t\t\torderedStickyElements.push(child);\n\t\t}\n\t\treturn stickyOutlineElement;\n\t}\n}\n\nclass StickyModelFromCandidateIndentationFoldingProvider extends StickyModelFromCandidateFoldingProvider {\n\n\tprivate readonly provider: IndentRangeProvider;\n\n\tconstructor(\n\t\teditor: IActiveCodeEditor,\n\t\t@ILanguageConfigurationService private readonly _languageConfigurationService: ILanguageConfigurationService) {\n\t\tsuper(editor);\n\n\t\tthis.provider = this._register(new IndentRangeProvider(editor.getModel(), this._languageConfigurationService, this._foldingLimitReporter));\n\t}\n\n\tprotected override async createModelFromProvider(token: CancellationToken): Promise<FoldingRegions> {\n\t\treturn this.provider.compute(token);\n\t}\n}\n\nclass StickyModelFromCandidateSyntaxFoldingProvider extends StickyModelFromCandidateFoldingProvider {\n\n\tprivate readonly provider: MutableDisposable<SyntaxRangeProvider> = this._register(new MutableDisposable<SyntaxRangeProvider>());\n\n\tconstructor(\n\t\teditor: IActiveCodeEditor,\n\t\tonProviderUpdate: () => void,\n\t\t@ILanguageFeaturesService private readonly _languageFeaturesService: ILanguageFeaturesService\n\t) {\n\t\tsuper(editor);\n\t\tthis._register(this._languageFeaturesService.foldingRangeProvider.onDidChange(() => {\n\t\t\tthis._updateProvider(editor, onProviderUpdate);\n\t\t}));\n\t\tthis._updateProvider(editor, onProviderUpdate);\n\t}\n\n\tprivate _updateProvider(editor: IActiveCodeEditor, onProviderUpdate: () => void): void {\n\t\tconst selectedProviders = FoldingController.getFoldingRangeProviders(this._languageFeaturesService, editor.getModel());\n\t\tif (selectedProviders.length === 0) {\n\t\t\treturn;\n\t\t}\n\t\tthis.provider.value = new SyntaxRangeProvider(editor.getModel(), selectedProviders, onProviderUpdate, this._foldingLimitReporter, undefined);\n\t}\n\n\tprotected override isProviderValid(): boolean {\n\t\treturn this.provider !== undefined;\n\t}\n\n\tprotected override async createModelFromProvider(token: CancellationToken): Promise<FoldingRegions | null> {\n\t\treturn this.provider.value?.compute(token) ?? null;\n\t}\n}\n"]}
|