monaco-editor-core 0.55.0-dev-20251019 → 0.55.0-dev-20251021
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/ui/findinput/findInput.js +4 -5
- package/esm/vs/base/browser/ui/findinput/findInput.js.map +1 -1
- package/esm/vs/base/browser/ui/findinput/findInputToggles.js +3 -4
- package/esm/vs/base/browser/ui/findinput/findInputToggles.js.map +1 -1
- package/esm/vs/base/browser/ui/findinput/replaceInput.js +2 -2
- package/esm/vs/base/browser/ui/findinput/replaceInput.js.map +1 -1
- package/esm/vs/base/browser/ui/hover/hover.js.map +1 -1
- package/esm/vs/base/browser/ui/toggle/toggle.js +9 -6
- package/esm/vs/base/browser/ui/toggle/toggle.js.map +1 -1
- package/esm/vs/base/browser/ui/tree/abstractTree.js +7 -6
- package/esm/vs/base/browser/ui/tree/abstractTree.js.map +1 -1
- package/esm/vs/base/common/actions.js +5 -0
- package/esm/vs/base/common/actions.js.map +1 -1
- package/esm/vs/base/common/async.js +5 -5
- package/esm/vs/base/common/async.js.map +1 -1
- package/esm/vs/editor/browser/controller/editContext/native/nativeEditContext.js +20 -12
- package/esm/vs/editor/browser/controller/editContext/native/nativeEditContext.js.map +1 -1
- package/esm/vs/editor/browser/services/hoverService/hoverWidget.js +15 -0
- package/esm/vs/editor/browser/services/hoverService/hoverWidget.js.map +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/diffEditorWidget.js +6 -0
- package/esm/vs/editor/browser/widget/diffEditor/diffEditorWidget.js.map +1 -1
- package/esm/vs/editor/browser/widget/multiDiffEditor/diffEditorItemTemplate.js +1 -0
- package/esm/vs/editor/browser/widget/multiDiffEditor/diffEditorItemTemplate.js.map +1 -1
- package/esm/vs/editor/contrib/find/browser/findOptionsWidget.js +4 -5
- package/esm/vs/editor/contrib/find/browser/findOptionsWidget.js.map +1 -1
- package/esm/vs/editor/contrib/find/browser/findWidget.js +12 -12
- package/esm/vs/editor/contrib/find/browser/findWidget.js.map +1 -1
- package/esm/vs/editor/contrib/hover/browser/glyphHoverWidget.js +22 -2
- package/esm/vs/editor/contrib/hover/browser/glyphHoverWidget.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsSource.js +0 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsSource.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/telemetry.js.map +1 -1
- package/esm/vs/editor/contrib/rename/browser/renameWidget.js +1 -4
- package/esm/vs/editor/contrib/rename/browser/renameWidget.js.map +1 -1
- package/package.json +2 -2
- package/version.txt +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/hover/browser/glyphHoverWidget.ts","vs/editor/contrib/hover/browser/glyphHoverWidget.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;;AAEhG,OAAO,KAAK,GAAG,MAAM,iCAAiC,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,EAAE,wBAAwB,EAAE,MAAM,2DAA2D,CAAC;AAGrG,OAAO,EAAE,cAAc,EAA+B,MAAM,qBAAqB,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,MAAM,kDAAkD,CAAC;AAE/E,OAAO,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AC,CAAC,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1I,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,KAAK,CAAC,IAAI,GAAG,GAAG,IAAI,IAAI,CAAC;QACtD,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC;QAC7E,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,8CAA8C;IACjG,CAAC;IAEO,aAAa,CAAC,CAAa;QAClC,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;QAChD,MAAM,8BAA8B,GAAG,CAAC,aAAa,IAAI,CAAC,4BAA4B,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAChH,IAAI,8BAA8B,EAAE,CAAC;YACpC,IAAI,CAAC,IAAI,EAAE,CAAC;QACb,CAAC;IACF,CAAC;;AAxKW,gBAAgB;IAiB1B,WAAA,wBAAwB,CAAA;GAjBd,gBAAgB,CAyK5B","file":"glyphHoverWidget.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as dom from '../../../../base/browser/dom.js';\nimport { Disposable, DisposableStore } from '../../../../base/common/lifecycle.js';\nimport { IMarkdownRendererService } from '../../../../platform/markdown/browser/markdownRenderer.js';\nimport { ICodeEditor, IEditorMouseEvent, IOverlayWidget, IOverlayWidgetPosition, MouseTargetType } from '../../../browser/editorBrowser.js';\nimport { ConfigurationChangedEvent, EditorOption } from '../../../common/config/editorOptions.js';\nimport { HoverOperation, HoverResult, HoverStartMode } from './hoverOperation.js';\nimport { HoverWidget } from '../../../../base/browser/ui/hover/hoverWidget.js';\nimport { IHoverWidget } from './hoverTypes.js';\nimport { IHoverMessage, LaneOrLineNumber, GlyphHoverComputer, GlyphHoverComputerOptions } from './glyphHoverComputer.js';\nimport { isMousePositionWithinElement } from './hoverUtils.js';\n\nconst $ = dom.$;\n\nexport class GlyphHoverWidget extends Disposable implements IOverlayWidget, IHoverWidget {\n\n\tpublic static readonly ID = 'editor.contrib.modesGlyphHoverWidget';\n\n\tprivate readonly _editor: ICodeEditor;\n\tprivate readonly _hover: HoverWidget;\n\n\tprivate _isVisible: boolean;\n\tprivate _messages: IHoverMessage[];\n\n\tprivate readonly _hoverOperation: HoverOperation<GlyphHoverComputerOptions, IHoverMessage>;\n\tprivate readonly _renderDisposeables = this._register(new DisposableStore());\n\n\tprivate _hoverComputerOptions: GlyphHoverComputerOptions | undefined;\n\n\tconstructor(\n\t\teditor: ICodeEditor,\n\t\t@IMarkdownRendererService private readonly _markdownRendererService: IMarkdownRendererService,\n\t) {\n\t\tsuper();\n\t\tthis._editor = editor;\n\n\t\tthis._isVisible = false;\n\t\tthis._messages = [];\n\n\t\tthis._hover = this._register(new HoverWidget(true));\n\t\tthis._hover.containerDomNode.classList.toggle('hidden', !this._isVisible);\n\n\t\tthis._hoverOperation = this._register(new HoverOperation(this._editor, new GlyphHoverComputer(this._editor)));\n\t\tthis._register(this._hoverOperation.onResult((result) => this._withResult(result)));\n\n\t\tthis._register(this._editor.onDidChangeModelDecorations(() => this._onModelDecorationsChanged()));\n\t\tthis._register(this._editor.onDidChangeConfiguration((e: ConfigurationChangedEvent) => {\n\t\t\tif (e.hasChanged(EditorOption.fontInfo)) {\n\t\t\t\tthis._updateFont();\n\t\t\t}\n\t\t}));\n\t\tthis._register(dom.addStandardDisposableListener(this._hover.containerDomNode, 'mouseleave', (e) => {\n\t\t\tthis._onMouseLeave(e);\n\t\t}));\n\t\tthis._editor.addOverlayWidget(this);\n\t}\n\n\tpublic override dispose(): void {\n\t\tthis._hoverComputerOptions = undefined;\n\t\tthis._editor.removeOverlayWidget(this);\n\t\tsuper.dispose();\n\t}\n\n\tpublic getId(): string {\n\t\treturn GlyphHoverWidget.ID;\n\t}\n\n\tpublic getDomNode(): HTMLElement {\n\t\treturn this._hover.containerDomNode;\n\t}\n\n\tpublic getPosition(): IOverlayWidgetPosition | null {\n\t\treturn null;\n\t}\n\n\tprivate _updateFont(): void {\n\t\tconst codeClasses: HTMLElement[] = Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName('code'));\n\t\tcodeClasses.forEach(node => this._editor.applyFontInfo(node));\n\t}\n\n\tprivate _onModelDecorationsChanged(): void {\n\t\tif (this._isVisible && this._hoverComputerOptions) {\n\t\t\t// The decorations have changed and the hover is visible,\n\t\t\t// we need to recompute the displayed text\n\t\t\tthis._hoverOperation.cancel();\n\t\t\tthis._hoverOperation.start(HoverStartMode.Delayed, this._hoverComputerOptions);\n\t\t}\n\t}\n\n\tpublic showsOrWillShow(mouseEvent: IEditorMouseEvent): boolean {\n\t\tconst target = mouseEvent.target;\n\t\tif (target.type === MouseTargetType.GUTTER_GLYPH_MARGIN && target.detail.glyphMarginLane) {\n\t\t\tthis._startShowingAt(target.position.lineNumber, target.detail.glyphMarginLane);\n\t\t\treturn true;\n\t\t}\n\t\tif (target.type === MouseTargetType.GUTTER_LINE_NUMBERS) {\n\t\t\tthis._startShowingAt(target.position.lineNumber, 'lineNo');\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tprivate _startShowingAt(lineNumber: number, laneOrLine: LaneOrLineNumber): void {\n\t\tif (this._hoverComputerOptions\n\t\t\t&& this._hoverComputerOptions.lineNumber === lineNumber\n\t\t\t&& this._hoverComputerOptions.laneOrLine === laneOrLine) {\n\t\t\t// We have to show the widget at the exact same line number as before, so no work is needed\n\t\t\treturn;\n\t\t}\n\t\tthis._hoverOperation.cancel();\n\t\tthis.hide();\n\t\tthis._hoverComputerOptions = { lineNumber, laneOrLine };\n\t\tthis._hoverOperation.start(HoverStartMode.Delayed, this._hoverComputerOptions);\n\t}\n\n\tpublic hide(): void {\n\t\tthis._hoverComputerOptions = undefined;\n\t\tthis._hoverOperation.cancel();\n\t\tif (!this._isVisible) {\n\t\t\treturn;\n\t\t}\n\t\tthis._isVisible = false;\n\t\tthis._hover.containerDomNode.classList.toggle('hidden', !this._isVisible);\n\t}\n\n\tprivate _withResult(result: HoverResult<GlyphHoverComputerOptions, IHoverMessage>): void {\n\t\tthis._messages = result.value;\n\n\t\tif (this._messages.length > 0) {\n\t\t\tthis._renderMessages(result.options.lineNumber, result.options.laneOrLine, this._messages);\n\t\t} else {\n\t\t\tthis.hide();\n\t\t}\n\t}\n\n\tprivate _renderMessages(lineNumber: number, laneOrLine: LaneOrLineNumber, messages: IHoverMessage[]): void {\n\t\tthis._renderDisposeables.clear();\n\n\t\tconst fragment = document.createDocumentFragment();\n\n\t\tfor (const msg of messages) {\n\t\t\tconst markdownHoverElement = $('div.hover-row.markdown-hover');\n\t\t\tconst hoverContentsElement = dom.append(markdownHoverElement, $('div.hover-contents'));\n\t\t\tconst renderedContents = this._renderDisposeables.add(this._markdownRendererService.render(msg.value, { context: this._editor }));\n\t\t\thoverContentsElement.appendChild(renderedContents.element);\n\t\t\tfragment.appendChild(markdownHoverElement);\n\t\t}\n\n\t\tthis._updateContents(fragment);\n\t\tthis._showAt(lineNumber, laneOrLine);\n\t}\n\n\tprivate _updateContents(node: Node): void {\n\t\tthis._hover.contentsDomNode.textContent = '';\n\t\tthis._hover.contentsDomNode.appendChild(node);\n\t\tthis._updateFont();\n\t}\n\n\tprivate _showAt(lineNumber: number, laneOrLine: LaneOrLineNumber): void {\n\t\tif (!this._isVisible) {\n\t\t\tthis._isVisible = true;\n\t\t\tthis._hover.containerDomNode.classList.toggle('hidden', !this._isVisible);\n\t\t}\n\n\t\tconst editorLayout = this._editor.getLayoutInfo();\n\t\tconst topForLineNumber = this._editor.getTopForLineNumber(lineNumber);\n\t\tconst editorScrollTop = this._editor.getScrollTop();\n\t\tconst lineHeight = this._editor.getOption(EditorOption.lineHeight);\n\t\tconst nodeHeight = this._hover.containerDomNode.clientHeight;\n\t\tconst top = topForLineNumber - editorScrollTop - ((nodeHeight - lineHeight) / 2);\n\t\tconst left = editorLayout.glyphMarginLeft + editorLayout.glyphMarginWidth + (laneOrLine === 'lineNo' ? editorLayout.lineNumbersWidth : 0);\n\t\tthis._hover.containerDomNode.style.left = `${left}px`;\n\t\tthis._hover.containerDomNode.style.top = `${Math.max(Math.round(top), 0)}px`;\n\t\tthis._hover.containerDomNode.style.zIndex = '11'; // 1 more than the zone widget at 10 (#233819)\n\t}\n\n\tprivate _onMouseLeave(e: MouseEvent): void {\n\t\tconst editorDomNode = this._editor.getDomNode();\n\t\tconst isMousePositionOutsideOfEditor = !editorDomNode || !isMousePositionWithinElement(editorDomNode, e.x, e.y);\n\t\tif (isMousePositionOutsideOfEditor) {\n\t\t\tthis.hide();\n\t\t}\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as dom from '../../../../base/browser/dom.js';\nimport { Disposable, DisposableStore } from '../../../../base/common/lifecycle.js';\nimport { IMarkdownRendererService } from '../../../../platform/markdown/browser/markdownRenderer.js';\nimport { ICodeEditor, IEditorMouseEvent, IOverlayWidget, IOverlayWidgetPosition, MouseTargetType } from '../../../browser/editorBrowser.js';\nimport { ConfigurationChangedEvent, EditorOption } from '../../../common/config/editorOptions.js';\nimport { HoverOperation, HoverResult, HoverStartMode } from './hoverOperation.js';\nimport { HoverWidget } from '../../../../base/browser/ui/hover/hoverWidget.js';\nimport { IHoverWidget } from './hoverTypes.js';\nimport { IHoverMessage, LaneOrLineNumber, GlyphHoverComputer, GlyphHoverComputerOptions } from './glyphHoverComputer.js';\nimport { isMousePositionWithinElement } from './hoverUtils.js';\n\nconst $ = dom.$;\n\nexport class GlyphHoverWidget extends Disposable implements IOverlayWidget, IHoverWidget {\n\n\tpublic static readonly ID = 'editor.contrib.modesGlyphHoverWidget';\n\n\tprivate readonly _editor: ICodeEditor;\n\tprivate readonly _hover: HoverWidget;\n\n\tprivate _isVisible: boolean;\n\tprivate _messages: IHoverMessage[];\n\n\tprivate readonly _hoverOperation: HoverOperation<GlyphHoverComputerOptions, IHoverMessage>;\n\tprivate readonly _renderDisposeables = this._register(new DisposableStore());\n\n\tprivate _hoverComputerOptions: GlyphHoverComputerOptions | undefined;\n\n\tconstructor(\n\t\teditor: ICodeEditor,\n\t\t@IMarkdownRendererService private readonly _markdownRendererService: IMarkdownRendererService,\n\t) {\n\t\tsuper();\n\t\tthis._editor = editor;\n\n\t\tthis._isVisible = false;\n\t\tthis._messages = [];\n\n\t\tthis._hover = this._register(new HoverWidget(true));\n\t\tthis._hover.containerDomNode.classList.toggle('hidden', !this._isVisible);\n\n\t\tthis._hoverOperation = this._register(new HoverOperation(this._editor, new GlyphHoverComputer(this._editor)));\n\t\tthis._register(this._hoverOperation.onResult((result) => this._withResult(result)));\n\n\t\tthis._register(this._editor.onDidChangeModelDecorations(() => this._onModelDecorationsChanged()));\n\t\tthis._register(this._editor.onDidChangeConfiguration((e: ConfigurationChangedEvent) => {\n\t\t\tif (e.hasChanged(EditorOption.fontInfo)) {\n\t\t\t\tthis._updateFont();\n\t\t\t}\n\t\t}));\n\t\tthis._register(dom.addStandardDisposableListener(this._hover.containerDomNode, 'mouseleave', (e) => {\n\t\t\tthis._onMouseLeave(e);\n\t\t}));\n\t\tthis._editor.addOverlayWidget(this);\n\t}\n\n\tpublic override dispose(): void {\n\t\tthis._hoverComputerOptions = undefined;\n\t\tthis._editor.removeOverlayWidget(this);\n\t\tsuper.dispose();\n\t}\n\n\tpublic getId(): string {\n\t\treturn GlyphHoverWidget.ID;\n\t}\n\n\tpublic getDomNode(): HTMLElement {\n\t\treturn this._hover.containerDomNode;\n\t}\n\n\tpublic getPosition(): IOverlayWidgetPosition | null {\n\t\treturn null;\n\t}\n\n\tprivate _updateFont(): void {\n\t\tconst codeClasses: HTMLElement[] = Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName('code'));\n\t\tcodeClasses.forEach(node => this._editor.applyFontInfo(node));\n\t}\n\n\tprivate _onModelDecorationsChanged(): void {\n\t\tif (this._isVisible && this._hoverComputerOptions) {\n\t\t\t// The decorations have changed and the hover is visible,\n\t\t\t// we need to recompute the displayed text\n\t\t\tthis._hoverOperation.cancel();\n\t\t\tthis._hoverOperation.start(HoverStartMode.Delayed, this._hoverComputerOptions);\n\t\t}\n\t}\n\n\tpublic showsOrWillShow(mouseEvent: IEditorMouseEvent): boolean {\n\t\tconst target = mouseEvent.target;\n\t\tif (target.type === MouseTargetType.GUTTER_GLYPH_MARGIN && target.detail.glyphMarginLane) {\n\t\t\tthis._startShowingAt(target.position.lineNumber, target.detail.glyphMarginLane);\n\t\t\treturn true;\n\t\t}\n\t\tif (target.type === MouseTargetType.GUTTER_LINE_NUMBERS) {\n\t\t\tthis._startShowingAt(target.position.lineNumber, 'lineNo');\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tprivate _startShowingAt(lineNumber: number, laneOrLine: LaneOrLineNumber): void {\n\t\tif (this._hoverComputerOptions\n\t\t\t&& this._hoverComputerOptions.lineNumber === lineNumber\n\t\t\t&& this._hoverComputerOptions.laneOrLine === laneOrLine) {\n\t\t\t// We have to show the widget at the exact same line number as before, so no work is needed\n\t\t\treturn;\n\t\t}\n\t\tthis._hoverOperation.cancel();\n\t\tthis.hide();\n\t\tthis._hoverComputerOptions = { lineNumber, laneOrLine };\n\t\tthis._hoverOperation.start(HoverStartMode.Delayed, this._hoverComputerOptions);\n\t}\n\n\tpublic hide(): void {\n\t\tthis._hoverComputerOptions = undefined;\n\t\tthis._hoverOperation.cancel();\n\t\tif (!this._isVisible) {\n\t\t\treturn;\n\t\t}\n\t\tthis._isVisible = false;\n\t\tthis._hover.containerDomNode.classList.toggle('hidden', !this._isVisible);\n\t}\n\n\tprivate _withResult(result: HoverResult<GlyphHoverComputerOptions, IHoverMessage>): void {\n\t\tthis._messages = result.value;\n\n\t\tif (this._messages.length > 0) {\n\t\t\tthis._renderMessages(result.options.lineNumber, result.options.laneOrLine, this._messages);\n\t\t} else {\n\t\t\tthis.hide();\n\t\t}\n\t}\n\n\tprivate _renderMessages(lineNumber: number, laneOrLine: LaneOrLineNumber, messages: IHoverMessage[]): void {\n\t\tthis._renderDisposeables.clear();\n\n\t\tconst fragment = document.createDocumentFragment();\n\n\t\tfor (const msg of messages) {\n\t\t\tconst markdownHoverElement = $('div.hover-row.markdown-hover');\n\t\t\tconst hoverContentsElement = dom.append(markdownHoverElement, $('div.hover-contents'));\n\t\t\tconst renderedContents = this._renderDisposeables.add(this._markdownRendererService.render(msg.value, { context: this._editor }));\n\t\t\thoverContentsElement.appendChild(renderedContents.element);\n\t\t\tfragment.appendChild(markdownHoverElement);\n\t\t}\n\n\t\tthis._updateContents(fragment);\n\t\tthis._showAt(lineNumber, laneOrLine);\n\t}\n\n\tprivate _updateContents(node: Node): void {\n\t\tthis._hover.contentsDomNode.textContent = '';\n\t\tthis._hover.contentsDomNode.appendChild(node);\n\t\tthis._updateFont();\n\t}\n\n\tprivate _showAt(lineNumber: number, laneOrLine: LaneOrLineNumber): void {\n\t\tif (!this._isVisible) {\n\t\t\tthis._isVisible = true;\n\t\t\tthis._hover.containerDomNode.classList.toggle('hidden', !this._isVisible);\n\t\t}\n\n\t\tconst editorLayout = this._editor.getLayoutInfo();\n\t\tconst topForLineNumber = this._editor.getTopForLineNumber(lineNumber);\n\t\tconst editorScrollTop = this._editor.getScrollTop();\n\t\tconst lineHeight = this._editor.getOption(EditorOption.lineHeight);\n\t\tconst nodeHeight = this._hover.containerDomNode.clientHeight;\n\t\tconst top = topForLineNumber - editorScrollTop - ((nodeHeight - lineHeight) / 2);\n\t\tconst left = editorLayout.glyphMarginLeft + editorLayout.glyphMarginWidth + (laneOrLine === 'lineNo' ? editorLayout.lineNumbersWidth : 0);\n\t\tthis._hover.containerDomNode.style.left = `${left}px`;\n\t\tthis._hover.containerDomNode.style.top = `${Math.max(Math.round(top), 0)}px`;\n\t\tthis._hover.containerDomNode.style.zIndex = '11'; // 1 more than the zone widget at 10 (#233819)\n\t}\n\n\tprivate _onMouseLeave(e: MouseEvent): void {\n\t\tconst editorDomNode = this._editor.getDomNode();\n\t\tconst isMousePositionOutsideOfEditor = !editorDomNode || !isMousePositionWithinElement(editorDomNode, e.x, e.y);\n\t\tif (isMousePositionOutsideOfEditor) {\n\t\t\tthis.hide();\n\t\t}\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/hover/browser/glyphHoverWidget.ts","vs/editor/contrib/hover/browser/glyphHoverWidget.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;;AAEhG,OAAO,KAAK,GAAG,MAAM,iCAAiC,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,EAAE,wBAAwB,EAAE,MAAM,2DAA2D,CAAC;AAGrG,OAAO,EAAE,cAAc,EAA+B,MAAM,qBAAqB,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,MAAM,kDAAkD,CAAC;AAE/E,OAAO,EAAmC,kBAAkB,EAA6B,MAAM,yBAAyB,CAAC;AACzH,OAAO,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAE/D,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;AAET,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,UAAU;;aAExB,OAAE,GAAG,sCAAH,AAAyC,CAAC;IAcnE,YACC,MAAmB,EACO,wBAAmE;QAE7F,KAAK,EAAE,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AG,CAAC,aAAa,IAAI,CAAC,4BAA4B,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAChH,IAAI,8BAA8B,EAAE,CAAC;YACpC,IAAI,CAAC,IAAI,EAAE,CAAC;QACb,CAAC;IACF,CAAC;;AA7LW,gBAAgB;IAkB1B,WAAA,wBAAwB,CAAA;GAlBd,gBAAgB,CA8L5B","file":"glyphHoverWidget.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as dom from '../../../../base/browser/dom.js';\nimport { Disposable, DisposableStore } from '../../../../base/common/lifecycle.js';\nimport { IMarkdownRendererService } from '../../../../platform/markdown/browser/markdownRenderer.js';\nimport { ICodeEditor, IEditorMouseEvent, IOverlayWidget, IOverlayWidgetPosition, MouseTargetType } from '../../../browser/editorBrowser.js';\nimport { ConfigurationChangedEvent, EditorOption } from '../../../common/config/editorOptions.js';\nimport { HoverOperation, HoverResult, HoverStartMode } from './hoverOperation.js';\nimport { HoverWidget } from '../../../../base/browser/ui/hover/hoverWidget.js';\nimport { IHoverWidget } from './hoverTypes.js';\nimport { IHoverMessage, LaneOrLineNumber, GlyphHoverComputer, GlyphHoverComputerOptions } from './glyphHoverComputer.js';\nimport { isMousePositionWithinElement } from './hoverUtils.js';\n\nconst $ = dom.$;\n\nexport class GlyphHoverWidget extends Disposable implements IOverlayWidget, IHoverWidget {\n\n\tpublic static readonly ID = 'editor.contrib.modesGlyphHoverWidget';\n\tpublic readonly allowEditorOverflow = true;\n\n\tprivate readonly _editor: ICodeEditor;\n\tprivate readonly _hover: HoverWidget;\n\n\tprivate _isVisible: boolean;\n\tprivate _messages: IHoverMessage[];\n\n\tprivate readonly _hoverOperation: HoverOperation<GlyphHoverComputerOptions, IHoverMessage>;\n\tprivate readonly _renderDisposeables = this._register(new DisposableStore());\n\n\tprivate _hoverComputerOptions: GlyphHoverComputerOptions | undefined;\n\n\tconstructor(\n\t\teditor: ICodeEditor,\n\t\t@IMarkdownRendererService private readonly _markdownRendererService: IMarkdownRendererService,\n\t) {\n\t\tsuper();\n\t\tthis._editor = editor;\n\n\t\tthis._isVisible = false;\n\t\tthis._messages = [];\n\n\t\tthis._hover = this._register(new HoverWidget(true));\n\t\tthis._hover.containerDomNode.classList.toggle('hidden', !this._isVisible);\n\n\t\tthis._hoverOperation = this._register(new HoverOperation(this._editor, new GlyphHoverComputer(this._editor)));\n\t\tthis._register(this._hoverOperation.onResult((result) => this._withResult(result)));\n\n\t\tthis._register(this._editor.onDidChangeModelDecorations(() => this._onModelDecorationsChanged()));\n\t\tthis._register(this._editor.onDidChangeConfiguration((e: ConfigurationChangedEvent) => {\n\t\t\tif (e.hasChanged(EditorOption.fontInfo)) {\n\t\t\t\tthis._updateFont();\n\t\t\t}\n\t\t}));\n\t\tthis._register(dom.addStandardDisposableListener(this._hover.containerDomNode, 'mouseleave', (e) => {\n\t\t\tthis._onMouseLeave(e);\n\t\t}));\n\t\tthis._editor.addOverlayWidget(this);\n\t}\n\n\tpublic override dispose(): void {\n\t\tthis._hoverComputerOptions = undefined;\n\t\tthis._editor.removeOverlayWidget(this);\n\t\tsuper.dispose();\n\t}\n\n\tpublic getId(): string {\n\t\treturn GlyphHoverWidget.ID;\n\t}\n\n\tpublic getDomNode(): HTMLElement {\n\t\treturn this._hover.containerDomNode;\n\t}\n\n\tpublic getPosition(): IOverlayWidgetPosition | null {\n\t\treturn null;\n\t}\n\n\tprivate _updateFont(): void {\n\t\tconst codeClasses: HTMLElement[] = Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName('code'));\n\t\tcodeClasses.forEach(node => this._editor.applyFontInfo(node));\n\t}\n\n\tprivate _onModelDecorationsChanged(): void {\n\t\tif (this._isVisible && this._hoverComputerOptions) {\n\t\t\t// The decorations have changed and the hover is visible,\n\t\t\t// we need to recompute the displayed text\n\t\t\tthis._hoverOperation.cancel();\n\t\t\tthis._hoverOperation.start(HoverStartMode.Delayed, this._hoverComputerOptions);\n\t\t}\n\t}\n\n\tpublic showsOrWillShow(mouseEvent: IEditorMouseEvent): boolean {\n\t\tconst target = mouseEvent.target;\n\t\tif (target.type === MouseTargetType.GUTTER_GLYPH_MARGIN && target.detail.glyphMarginLane) {\n\t\t\tthis._startShowingAt(target.position.lineNumber, target.detail.glyphMarginLane);\n\t\t\treturn true;\n\t\t}\n\t\tif (target.type === MouseTargetType.GUTTER_LINE_NUMBERS) {\n\t\t\tthis._startShowingAt(target.position.lineNumber, 'lineNo');\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tprivate _startShowingAt(lineNumber: number, laneOrLine: LaneOrLineNumber): void {\n\t\tif (this._hoverComputerOptions\n\t\t\t&& this._hoverComputerOptions.lineNumber === lineNumber\n\t\t\t&& this._hoverComputerOptions.laneOrLine === laneOrLine) {\n\t\t\t// We have to show the widget at the exact same line number as before, so no work is needed\n\t\t\treturn;\n\t\t}\n\t\tthis._hoverOperation.cancel();\n\t\tthis.hide();\n\t\tthis._hoverComputerOptions = { lineNumber, laneOrLine };\n\t\tthis._hoverOperation.start(HoverStartMode.Delayed, this._hoverComputerOptions);\n\t}\n\n\tpublic hide(): void {\n\t\tthis._hoverComputerOptions = undefined;\n\t\tthis._hoverOperation.cancel();\n\t\tif (!this._isVisible) {\n\t\t\treturn;\n\t\t}\n\t\tthis._isVisible = false;\n\t\tthis._hover.containerDomNode.classList.toggle('hidden', !this._isVisible);\n\t}\n\n\tprivate _withResult(result: HoverResult<GlyphHoverComputerOptions, IHoverMessage>): void {\n\t\tthis._messages = result.value;\n\n\t\tif (this._messages.length > 0) {\n\t\t\tthis._renderMessages(result.options.lineNumber, result.options.laneOrLine, this._messages);\n\t\t} else {\n\t\t\tthis.hide();\n\t\t}\n\t}\n\n\tprivate _renderMessages(lineNumber: number, laneOrLine: LaneOrLineNumber, messages: IHoverMessage[]): void {\n\t\tthis._renderDisposeables.clear();\n\n\t\tconst fragment = document.createDocumentFragment();\n\n\t\tfor (const msg of messages) {\n\t\t\tconst markdownHoverElement = $('div.hover-row.markdown-hover');\n\t\t\tconst hoverContentsElement = dom.append(markdownHoverElement, $('div.hover-contents'));\n\t\t\tconst renderedContents = this._renderDisposeables.add(this._markdownRendererService.render(msg.value, { context: this._editor }));\n\t\t\thoverContentsElement.appendChild(renderedContents.element);\n\t\t\tfragment.appendChild(markdownHoverElement);\n\t\t}\n\n\t\tthis._updateContents(fragment);\n\t\tthis._showAt(lineNumber, laneOrLine);\n\t}\n\n\tprivate _updateContents(node: Node): void {\n\t\tthis._hover.contentsDomNode.textContent = '';\n\t\tthis._hover.contentsDomNode.appendChild(node);\n\t\tthis._updateFont();\n\t}\n\n\tprivate _showAt(lineNumber: number, laneOrLine: LaneOrLineNumber): void {\n\t\tif (!this._isVisible) {\n\t\t\tthis._isVisible = true;\n\t\t\tthis._hover.containerDomNode.classList.toggle('hidden', !this._isVisible);\n\t\t}\n\n\t\tconst editorLayout = this._editor.getLayoutInfo();\n\t\tconst topForLineNumber = this._editor.getTopForLineNumber(lineNumber);\n\t\tconst editorScrollTop = this._editor.getScrollTop();\n\t\tconst lineHeight = this._editor.getOption(EditorOption.lineHeight);\n\t\tconst nodeHeight = this._hover.containerDomNode.clientHeight;\n\t\tconst top = topForLineNumber - editorScrollTop - ((nodeHeight - lineHeight) / 2);\n\t\tconst left = editorLayout.glyphMarginLeft + editorLayout.glyphMarginWidth + (laneOrLine === 'lineNo' ? editorLayout.lineNumbersWidth : 0);\n\n\t\t// Constrain the hover widget to stay within the editor bounds\n\t\tconst editorHeight = editorLayout.height;\n\t\tconst maxTop = editorHeight - nodeHeight;\n\t\tconst constrainedTop = Math.max(0, Math.min(Math.round(top), maxTop));\n\n\t\tconst fixedOverflowWidgets = this._editor.getOption(EditorOption.fixedOverflowWidgets);\n\t\tif (fixedOverflowWidgets) {\n\t\t\t// Use fixed positioning relative to the viewport\n\t\t\tconst editorDomNode = this._editor.getDomNode();\n\t\t\tif (editorDomNode) {\n\t\t\t\tconst editorRect = dom.getDomNodePagePosition(editorDomNode);\n\t\t\t\tthis._hover.containerDomNode.style.position = 'fixed';\n\t\t\t\tthis._hover.containerDomNode.style.left = `${editorRect.left + left}px`;\n\t\t\t\tthis._hover.containerDomNode.style.top = `${editorRect.top + constrainedTop}px`;\n\t\t\t}\n\t\t} else {\n\t\t\t// Use absolute positioning relative to the editor\n\t\t\tthis._hover.containerDomNode.style.position = 'absolute';\n\t\t\tthis._hover.containerDomNode.style.left = `${left}px`;\n\t\t\tthis._hover.containerDomNode.style.top = `${constrainedTop}px`;\n\t\t}\n\t\tthis._hover.containerDomNode.style.zIndex = '11'; // 1 more than the zone widget at 10 (#233819)\n\t}\n\n\tprivate _onMouseLeave(e: MouseEvent): void {\n\t\tconst editorDomNode = this._editor.getDomNode();\n\t\tconst isMousePositionOutsideOfEditor = !editorDomNode || !isMousePositionWithinElement(editorDomNode, e.x, e.y);\n\t\tif (isMousePositionOutsideOfEditor) {\n\t\t\tthis.hide();\n\t\t}\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as dom from '../../../../base/browser/dom.js';\nimport { Disposable, DisposableStore } from '../../../../base/common/lifecycle.js';\nimport { IMarkdownRendererService } from '../../../../platform/markdown/browser/markdownRenderer.js';\nimport { ICodeEditor, IEditorMouseEvent, IOverlayWidget, IOverlayWidgetPosition, MouseTargetType } from '../../../browser/editorBrowser.js';\nimport { ConfigurationChangedEvent, EditorOption } from '../../../common/config/editorOptions.js';\nimport { HoverOperation, HoverResult, HoverStartMode } from './hoverOperation.js';\nimport { HoverWidget } from '../../../../base/browser/ui/hover/hoverWidget.js';\nimport { IHoverWidget } from './hoverTypes.js';\nimport { IHoverMessage, LaneOrLineNumber, GlyphHoverComputer, GlyphHoverComputerOptions } from './glyphHoverComputer.js';\nimport { isMousePositionWithinElement } from './hoverUtils.js';\n\nconst $ = dom.$;\n\nexport class GlyphHoverWidget extends Disposable implements IOverlayWidget, IHoverWidget {\n\n\tpublic static readonly ID = 'editor.contrib.modesGlyphHoverWidget';\n\tpublic readonly allowEditorOverflow = true;\n\n\tprivate readonly _editor: ICodeEditor;\n\tprivate readonly _hover: HoverWidget;\n\n\tprivate _isVisible: boolean;\n\tprivate _messages: IHoverMessage[];\n\n\tprivate readonly _hoverOperation: HoverOperation<GlyphHoverComputerOptions, IHoverMessage>;\n\tprivate readonly _renderDisposeables = this._register(new DisposableStore());\n\n\tprivate _hoverComputerOptions: GlyphHoverComputerOptions | undefined;\n\n\tconstructor(\n\t\teditor: ICodeEditor,\n\t\t@IMarkdownRendererService private readonly _markdownRendererService: IMarkdownRendererService,\n\t) {\n\t\tsuper();\n\t\tthis._editor = editor;\n\n\t\tthis._isVisible = false;\n\t\tthis._messages = [];\n\n\t\tthis._hover = this._register(new HoverWidget(true));\n\t\tthis._hover.containerDomNode.classList.toggle('hidden', !this._isVisible);\n\n\t\tthis._hoverOperation = this._register(new HoverOperation(this._editor, new GlyphHoverComputer(this._editor)));\n\t\tthis._register(this._hoverOperation.onResult((result) => this._withResult(result)));\n\n\t\tthis._register(this._editor.onDidChangeModelDecorations(() => this._onModelDecorationsChanged()));\n\t\tthis._register(this._editor.onDidChangeConfiguration((e: ConfigurationChangedEvent) => {\n\t\t\tif (e.hasChanged(EditorOption.fontInfo)) {\n\t\t\t\tthis._updateFont();\n\t\t\t}\n\t\t}));\n\t\tthis._register(dom.addStandardDisposableListener(this._hover.containerDomNode, 'mouseleave', (e) => {\n\t\t\tthis._onMouseLeave(e);\n\t\t}));\n\t\tthis._editor.addOverlayWidget(this);\n\t}\n\n\tpublic override dispose(): void {\n\t\tthis._hoverComputerOptions = undefined;\n\t\tthis._editor.removeOverlayWidget(this);\n\t\tsuper.dispose();\n\t}\n\n\tpublic getId(): string {\n\t\treturn GlyphHoverWidget.ID;\n\t}\n\n\tpublic getDomNode(): HTMLElement {\n\t\treturn this._hover.containerDomNode;\n\t}\n\n\tpublic getPosition(): IOverlayWidgetPosition | null {\n\t\treturn null;\n\t}\n\n\tprivate _updateFont(): void {\n\t\tconst codeClasses: HTMLElement[] = Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName('code'));\n\t\tcodeClasses.forEach(node => this._editor.applyFontInfo(node));\n\t}\n\n\tprivate _onModelDecorationsChanged(): void {\n\t\tif (this._isVisible && this._hoverComputerOptions) {\n\t\t\t// The decorations have changed and the hover is visible,\n\t\t\t// we need to recompute the displayed text\n\t\t\tthis._hoverOperation.cancel();\n\t\t\tthis._hoverOperation.start(HoverStartMode.Delayed, this._hoverComputerOptions);\n\t\t}\n\t}\n\n\tpublic showsOrWillShow(mouseEvent: IEditorMouseEvent): boolean {\n\t\tconst target = mouseEvent.target;\n\t\tif (target.type === MouseTargetType.GUTTER_GLYPH_MARGIN && target.detail.glyphMarginLane) {\n\t\t\tthis._startShowingAt(target.position.lineNumber, target.detail.glyphMarginLane);\n\t\t\treturn true;\n\t\t}\n\t\tif (target.type === MouseTargetType.GUTTER_LINE_NUMBERS) {\n\t\t\tthis._startShowingAt(target.position.lineNumber, 'lineNo');\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tprivate _startShowingAt(lineNumber: number, laneOrLine: LaneOrLineNumber): void {\n\t\tif (this._hoverComputerOptions\n\t\t\t&& this._hoverComputerOptions.lineNumber === lineNumber\n\t\t\t&& this._hoverComputerOptions.laneOrLine === laneOrLine) {\n\t\t\t// We have to show the widget at the exact same line number as before, so no work is needed\n\t\t\treturn;\n\t\t}\n\t\tthis._hoverOperation.cancel();\n\t\tthis.hide();\n\t\tthis._hoverComputerOptions = { lineNumber, laneOrLine };\n\t\tthis._hoverOperation.start(HoverStartMode.Delayed, this._hoverComputerOptions);\n\t}\n\n\tpublic hide(): void {\n\t\tthis._hoverComputerOptions = undefined;\n\t\tthis._hoverOperation.cancel();\n\t\tif (!this._isVisible) {\n\t\t\treturn;\n\t\t}\n\t\tthis._isVisible = false;\n\t\tthis._hover.containerDomNode.classList.toggle('hidden', !this._isVisible);\n\t}\n\n\tprivate _withResult(result: HoverResult<GlyphHoverComputerOptions, IHoverMessage>): void {\n\t\tthis._messages = result.value;\n\n\t\tif (this._messages.length > 0) {\n\t\t\tthis._renderMessages(result.options.lineNumber, result.options.laneOrLine, this._messages);\n\t\t} else {\n\t\t\tthis.hide();\n\t\t}\n\t}\n\n\tprivate _renderMessages(lineNumber: number, laneOrLine: LaneOrLineNumber, messages: IHoverMessage[]): void {\n\t\tthis._renderDisposeables.clear();\n\n\t\tconst fragment = document.createDocumentFragment();\n\n\t\tfor (const msg of messages) {\n\t\t\tconst markdownHoverElement = $('div.hover-row.markdown-hover');\n\t\t\tconst hoverContentsElement = dom.append(markdownHoverElement, $('div.hover-contents'));\n\t\t\tconst renderedContents = this._renderDisposeables.add(this._markdownRendererService.render(msg.value, { context: this._editor }));\n\t\t\thoverContentsElement.appendChild(renderedContents.element);\n\t\t\tfragment.appendChild(markdownHoverElement);\n\t\t}\n\n\t\tthis._updateContents(fragment);\n\t\tthis._showAt(lineNumber, laneOrLine);\n\t}\n\n\tprivate _updateContents(node: Node): void {\n\t\tthis._hover.contentsDomNode.textContent = '';\n\t\tthis._hover.contentsDomNode.appendChild(node);\n\t\tthis._updateFont();\n\t}\n\n\tprivate _showAt(lineNumber: number, laneOrLine: LaneOrLineNumber): void {\n\t\tif (!this._isVisible) {\n\t\t\tthis._isVisible = true;\n\t\t\tthis._hover.containerDomNode.classList.toggle('hidden', !this._isVisible);\n\t\t}\n\n\t\tconst editorLayout = this._editor.getLayoutInfo();\n\t\tconst topForLineNumber = this._editor.getTopForLineNumber(lineNumber);\n\t\tconst editorScrollTop = this._editor.getScrollTop();\n\t\tconst lineHeight = this._editor.getOption(EditorOption.lineHeight);\n\t\tconst nodeHeight = this._hover.containerDomNode.clientHeight;\n\t\tconst top = topForLineNumber - editorScrollTop - ((nodeHeight - lineHeight) / 2);\n\t\tconst left = editorLayout.glyphMarginLeft + editorLayout.glyphMarginWidth + (laneOrLine === 'lineNo' ? editorLayout.lineNumbersWidth : 0);\n\n\t\t// Constrain the hover widget to stay within the editor bounds\n\t\tconst editorHeight = editorLayout.height;\n\t\tconst maxTop = editorHeight - nodeHeight;\n\t\tconst constrainedTop = Math.max(0, Math.min(Math.round(top), maxTop));\n\n\t\tconst fixedOverflowWidgets = this._editor.getOption(EditorOption.fixedOverflowWidgets);\n\t\tif (fixedOverflowWidgets) {\n\t\t\t// Use fixed positioning relative to the viewport\n\t\t\tconst editorDomNode = this._editor.getDomNode();\n\t\t\tif (editorDomNode) {\n\t\t\t\tconst editorRect = dom.getDomNodePagePosition(editorDomNode);\n\t\t\t\tthis._hover.containerDomNode.style.position = 'fixed';\n\t\t\t\tthis._hover.containerDomNode.style.left = `${editorRect.left + left}px`;\n\t\t\t\tthis._hover.containerDomNode.style.top = `${editorRect.top + constrainedTop}px`;\n\t\t\t}\n\t\t} else {\n\t\t\t// Use absolute positioning relative to the editor\n\t\t\tthis._hover.containerDomNode.style.position = 'absolute';\n\t\t\tthis._hover.containerDomNode.style.left = `${left}px`;\n\t\t\tthis._hover.containerDomNode.style.top = `${constrainedTop}px`;\n\t\t}\n\t\tthis._hover.containerDomNode.style.zIndex = '11'; // 1 more than the zone widget at 10 (#233819)\n\t}\n\n\tprivate _onMouseLeave(e: MouseEvent): void {\n\t\tconst editorDomNode = this._editor.getDomNode();\n\t\tconst isMousePositionOutsideOfEditor = !editorDomNode || !isMousePositionWithinElement(editorDomNode, e.x, e.y);\n\t\tif (isMousePositionOutsideOfEditor) {\n\t\t\tthis.hide();\n\t\t}\n\t}\n}\n"]}
|
|
@@ -330,7 +330,6 @@ let InlineCompletionsSource = class InlineCompletionsSource extends Disposable {
|
|
|
330
330
|
return;
|
|
331
331
|
}
|
|
332
332
|
const emptyEndOfLifeEvent = {
|
|
333
|
-
id: requestResponseInfo.requestUuid,
|
|
334
333
|
opportunityId: requestResponseInfo.requestUuid,
|
|
335
334
|
noSuggestionReason: requestResponseInfo.noSuggestionReason ?? 'unknown',
|
|
336
335
|
extensionId: 'vscode-core',
|
package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsSource.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsSource.ts","vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsSource.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;;AAEhG,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAChI,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,4CAA4C,CAAC;AACrF,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,eAAe,EAAe,iBAAiB,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACpI,OAAO,EAAE,OAAO,EAAoD,eAAe,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AACtK,iEAAiE;AACjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,uEAAuE,CAAC;AAClH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,+DAA+D,CAAC;AACtG,OAAO,EAAE,kBAAkB,EAAE,MAAM,yDAAyD,CAAC;AAC7F,OAAO,E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O,KAAK,CAAC;AACd,CAAC","file":"inlineCompletionsSource.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 { booleanComparator, compareBy, compareUndefinedSmallest, numberComparator } from '../../../../../base/common/arrays.js';\nimport { findLastMax } from '../../../../../base/common/arraysFind.js';\nimport { RunOnceScheduler } from '../../../../../base/common/async.js';\nimport { CancellationTokenSource } from '../../../../../base/common/cancellation.js';\nimport { equalsIfDefined, itemEquals } from '../../../../../base/common/equals.js';\nimport { Disposable, DisposableStore, IDisposable, MutableDisposable, toDisposable } from '../../../../../base/common/lifecycle.js';\nimport { derived, IObservable, IObservableWithChange, ITransaction, observableValue, recordChangesLazy, transaction } from '../../../../../base/common/observable.js';\n// eslint-disable-next-line local/code-no-deep-import-of-internal\nimport { observableReducerSettable } from '../../../../../base/common/observableInternal/experimental/reducer.js';\nimport { isDefined, isObject } from '../../../../../base/common/types.js';\nimport { IConfigurationService } from '../../../../../platform/configuration/common/configuration.js';\nimport { IContextKeyService } from '../../../../../platform/contextkey/common/contextkey.js';\nimport { DataChannelForwardingTelemetryService, forwardToChannelIf, isCopilotLikeExtension } from '../../../../../platform/dataChannel/browser/forwardingTelemetryService.js';\nimport { IInstantiationService } from '../../../../../platform/instantiation/common/instantiation.js';\nimport { ILogService } from '../../../../../platform/log/common/log.js';\nimport { observableConfigValue } from '../../../../../platform/observable/common/platformObservableUtils.js';\nimport product from '../../../../../platform/product/common/product.js';\nimport { StringEdit } from '../../../../common/core/edits/stringEdit.js';\nimport { Position } from '../../../../common/core/position.js';\nimport { InlineCompletionEndOfLifeReasonKind, InlineCompletionTriggerKind, InlineCompletionsProvider } from '../../../../common/languages.js';\nimport { ILanguageConfigurationService } from '../../../../common/languages/languageConfigurationRegistry.js';\nimport { ITextModel } from '../../../../common/model.js';\nimport { offsetEditFromContentChanges } from '../../../../common/model/textModelStringEdit.js';\nimport { IFeatureDebounceInformation } from '../../../../common/services/languageFeatureDebounce.js';\nimport { IModelContentChangedEvent } from '../../../../common/textModelEvents.js';\nimport { formatRecordableLogEntry, IRecordableEditorLogEntry, IRecordableLogEntry, StructuredLogger } from '../structuredLogger.js';\nimport { InlineCompletionEndOfLifeEvent, sendInlineCompletionsEndOfLifeTelemetry } from '../telemetry.js';\nimport { wait } from '../utils.js';\nimport { InlineSuggestionIdentity, InlineSuggestionItem } from './inlineSuggestionItem.js';\nimport { InlineCompletionContextWithoutUuid, InlineSuggestRequestInfo, provideInlineCompletions, runWhenCancelled } from './provideInlineCompletions.js';\n\nexport class InlineCompletionsSource extends Disposable {\n\tprivate static _requestId = 0;\n\n\tprivate readonly _updateOperation = this._register(new MutableDisposable<UpdateOperation>());\n\n\tprivate readonly _loggingEnabled;\n\tprivate readonly _sendRequestData;\n\n\tprivate readonly _structuredFetchLogger;\n\n\tprivate readonly _state = observableReducerSettable(this, {\n\t\tinitial: () => ({\n\t\t\tinlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t\tsuggestWidgetInlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t}),\n\t\tdisposeFinal: (values) => {\n\t\t\tvalues.inlineCompletions.dispose();\n\t\t\tvalues.suggestWidgetInlineCompletions.dispose();\n\t\t},\n\t\tchangeTracker: recordChangesLazy(() => ({ versionId: this._versionId })),\n\t\tupdate: (reader, previousValue, changes) => {\n\t\t\tconst edit = StringEdit.compose(changes.changes.map(c => c.change ? offsetEditFromContentChanges(c.change.changes) : StringEdit.empty).filter(isDefined));\n\n\t\t\tif (edit.isEmpty()) {\n\t\t\t\treturn previousValue;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\treturn {\n\t\t\t\t\tinlineCompletions: previousValue.inlineCompletions.createStateWithAppliedEdit(edit, this._textModel),\n\t\t\t\t\tsuggestWidgetInlineCompletions: previousValue.suggestWidgetInlineCompletions.createStateWithAppliedEdit(edit, this._textModel),\n\t\t\t\t};\n\t\t\t} finally {\n\t\t\t\tpreviousValue.inlineCompletions.dispose();\n\t\t\t\tpreviousValue.suggestWidgetInlineCompletions.dispose();\n\t\t\t}\n\t\t}\n\t});\n\n\tpublic readonly inlineCompletions = this._state.map(this, v => v.inlineCompletions);\n\tpublic readonly suggestWidgetInlineCompletions = this._state.map(this, v => v.suggestWidgetInlineCompletions);\n\n\tprivate _completionsEnabled: Record<string, boolean> | undefined = undefined;\n\n\tconstructor(\n\t\tprivate readonly _textModel: ITextModel,\n\t\tprivate readonly _versionId: IObservableWithChange<number | null, IModelContentChangedEvent | undefined>,\n\t\tprivate readonly _debounceValue: IFeatureDebounceInformation,\n\t\tprivate readonly _cursorPosition: IObservable<Position>,\n\t\t@ILanguageConfigurationService private readonly _languageConfigurationService: ILanguageConfigurationService,\n\t\t@ILogService private readonly _logService: ILogService,\n\t\t@IConfigurationService private readonly _configurationService: IConfigurationService,\n\t\t@IInstantiationService private readonly _instantiationService: IInstantiationService,\n\t\t@IContextKeyService private readonly _contextKeyService: IContextKeyService,\n\t) {\n\t\tsuper();\n\t\tthis._loggingEnabled = observableConfigValue('editor.inlineSuggest.logFetch', false, this._configurationService).recomputeInitiallyAndOnChange(this._store);\n\t\tthis._sendRequestData = observableConfigValue('editor.inlineSuggest.emptyResponseInformation', true, this._configurationService).recomputeInitiallyAndOnChange(this._store);\n\t\tthis._structuredFetchLogger = this._register(this._instantiationService.createInstance(StructuredLogger.cast<\n\t\t\t{ kind: 'start'; requestId: number; context: unknown } & IRecordableEditorLogEntry\n\t\t\t| { kind: 'end'; error: unknown; durationMs: number; result: unknown; requestId: number } & IRecordableLogEntry\n\t\t>(),\n\t\t\t'editor.inlineSuggest.logFetch.commandId'\n\t\t));\n\n\t\tthis.clearOperationOnTextModelChange.recomputeInitiallyAndOnChange(this._store);\n\n\t\tconst enablementSetting = product.defaultChatAgent?.completionsEnablementSetting ?? undefined;\n\t\tif (enablementSetting) {\n\t\t\tthis._updateCompletionsEnablement(enablementSetting);\n\t\t\tthis._register(this._configurationService.onDidChangeConfiguration(e => {\n\t\t\t\tif (e.affectsConfiguration(enablementSetting)) {\n\t\t\t\t\tthis._updateCompletionsEnablement(enablementSetting);\n\t\t\t\t}\n\t\t\t}));\n\t\t}\n\t}\n\n\tprivate _updateCompletionsEnablement(enalementSetting: string) {\n\t\tconst result = this._configurationService.getValue<Record<string, boolean>>(enalementSetting);\n\t\tif (!isObject(result)) {\n\t\t\tthis._completionsEnabled = undefined;\n\t\t} else {\n\t\t\tthis._completionsEnabled = result;\n\t\t}\n\t}\n\n\tpublic readonly clearOperationOnTextModelChange = derived(this, reader => {\n\t\tthis._versionId.read(reader);\n\t\tthis._updateOperation.clear();\n\t\treturn undefined; // always constant\n\t});\n\n\tprivate _log(entry:\n\t\t{ sourceId: string; kind: 'start'; requestId: number; context: unknown; provider: string | undefined } & IRecordableEditorLogEntry\n\t\t| { sourceId: string; kind: 'end'; error: unknown; durationMs: number; result: unknown; requestId: number; didAllProvidersReturn: boolean } & IRecordableLogEntry\n\t) {\n\t\tif (this._loggingEnabled.get()) {\n\t\t\tthis._logService.info(formatRecordableLogEntry(entry));\n\t\t}\n\t\tthis._structuredFetchLogger.log(entry);\n\t}\n\n\tprivate readonly _loadingCount = observableValue(this, 0);\n\n\tpublic fetch(\n\t\tproviders: InlineCompletionsProvider[],\n\t\tprovidersLabel: string | undefined,\n\t\tcontext: InlineCompletionContextWithoutUuid,\n\t\tactiveInlineCompletion: InlineSuggestionIdentity | undefined,\n\t\twithDebounce: boolean,\n\t\tuserJumpedToActiveCompletion: IObservable<boolean>,\n\t\trequestInfo: InlineSuggestRequestInfo\n\t): Promise<boolean> {\n\t\tconst position = this._cursorPosition.get();\n\t\tconst request = new UpdateRequest(position, context, this._textModel.getVersionId(), new Set(providers));\n\n\t\tconst target = context.selectedSuggestionInfo ? this.suggestWidgetInlineCompletions.get() : this.inlineCompletions.get();\n\n\t\tif (this._updateOperation.value?.request.satisfies(request)) {\n\t\t\treturn this._updateOperation.value.promise;\n\t\t} else if (target?.request?.satisfies(request)) {\n\t\t\treturn Promise.resolve(true);\n\t\t}\n\n\t\tconst updateOngoing = !!this._updateOperation.value;\n\t\tthis._updateOperation.clear();\n\n\t\tconst source = new CancellationTokenSource();\n\n\t\tconst promise = (async () => {\n\t\t\tconst store = new DisposableStore();\n\n\t\t\tthis._loadingCount.set(this._loadingCount.get() + 1, undefined);\n\t\t\tlet didDecrease = false;\n\t\t\tconst decreaseLoadingCount = () => {\n\t\t\t\tif (!didDecrease) {\n\t\t\t\t\tdidDecrease = true;\n\t\t\t\t\tthis._loadingCount.set(this._loadingCount.get() - 1, undefined);\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst loadingReset = store.add(new RunOnceScheduler(() => decreaseLoadingCount(), 10 * 1000));\n\t\t\tloadingReset.schedule();\n\n\t\t\tconst inlineSuggestionsProviders = providers.filter(p => p.providerId);\n\t\t\tconst requestResponseInfo = new RequestResponseData(context, requestInfo, inlineSuggestionsProviders);\n\n\n\t\t\ttry {\n\t\t\t\tconst recommendedDebounceValue = this._debounceValue.get(this._textModel);\n\t\t\t\tconst debounceValue = findLastMax(\n\t\t\t\t\tproviders.map(p => p.debounceDelayMs),\n\t\t\t\t\tcompareUndefinedSmallest(numberComparator)\n\t\t\t\t) ?? recommendedDebounceValue;\n\n\t\t\t\t// Debounce in any case if update is ongoing\n\t\t\t\tconst shouldDebounce = updateOngoing || (withDebounce && context.triggerKind === InlineCompletionTriggerKind.Automatic);\n\t\t\t\tif (shouldDebounce) {\n\t\t\t\t\t// This debounces the operation\n\t\t\t\t\tawait wait(debounceValue, source.token);\n\t\t\t\t}\n\n\t\t\t\tif (source.token.isCancellationRequested || this._store.isDisposed || this._textModel.getVersionId() !== request.versionId) {\n\t\t\t\t\trequestResponseInfo.setNoSuggestionReasonIfNotSet('canceled:beforeFetch');\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tconst requestId = InlineCompletionsSource._requestId++;\n\t\t\t\tif (this._loggingEnabled.get() || this._structuredFetchLogger.isEnabled.get()) {\n\t\t\t\t\tthis._log({\n\t\t\t\t\t\tsourceId: 'InlineCompletions.fetch',\n\t\t\t\t\t\tkind: 'start',\n\t\t\t\t\t\trequestId,\n\t\t\t\t\t\tmodelUri: this._textModel.uri,\n\t\t\t\t\t\tmodelVersion: this._textModel.getVersionId(),\n\t\t\t\t\t\tcontext: { triggerKind: context.triggerKind, suggestInfo: context.selectedSuggestionInfo ? true : undefined },\n\t\t\t\t\t\ttime: Date.now(),\n\t\t\t\t\t\tprovider: providersLabel,\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tconst startTime = new Date();\n\t\t\t\tconst providerResult = provideInlineCompletions(providers, this._cursorPosition.get(), this._textModel, context, requestInfo, this._languageConfigurationService);\n\n\t\t\t\trunWhenCancelled(source.token, () => providerResult.cancelAndDispose({ kind: 'tokenCancellation' }));\n\n\t\t\t\tlet shouldStopEarly = false;\n\t\t\t\tlet producedSuggestion = false;\n\n\t\t\t\tconst suggestions: InlineSuggestionItem[] = [];\n\t\t\t\tfor await (const list of providerResult.lists) {\n\t\t\t\t\tif (!list) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tlist.addRef();\n\t\t\t\t\tstore.add(toDisposable(() => list.removeRef(list.inlineSuggestionsData.length === 0 ? { kind: 'empty' } : { kind: 'notTaken' })));\n\n\t\t\t\t\tfor (const item of list.inlineSuggestionsData) {\n\t\t\t\t\t\tproducedSuggestion = true;\n\t\t\t\t\t\tif (!context.includeInlineEdits && (item.isInlineEdit || item.showInlineEditMenu)) {\n\t\t\t\t\t\t\titem.setNotShownReason('notInlineEditRequested');\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!context.includeInlineCompletions && !(item.isInlineEdit || item.showInlineEditMenu)) {\n\t\t\t\t\t\t\titem.setNotShownReason('notInlineCompletionRequested');\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst i = InlineSuggestionItem.create(item, this._textModel);\n\t\t\t\t\t\tsuggestions.push(i);\n\t\t\t\t\t\t// Stop after first visible inline completion\n\t\t\t\t\t\tif (!i.isInlineEdit && !i.showInlineEditMenu && context.triggerKind === InlineCompletionTriggerKind.Automatic) {\n\t\t\t\t\t\t\tif (i.isVisible(this._textModel, this._cursorPosition.get())) {\n\t\t\t\t\t\t\t\tshouldStopEarly = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (shouldStopEarly) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tproviderResult.cancelAndDispose({ kind: 'lostRace' });\n\n\t\t\t\tif (this._loggingEnabled.get() || this._structuredFetchLogger.isEnabled.get()) {\n\t\t\t\t\tconst didAllProvidersReturn = providerResult.didAllProvidersReturn;\n\t\t\t\t\tlet error: string | undefined = undefined;\n\t\t\t\t\tif (source.token.isCancellationRequested || this._store.isDisposed || this._textModel.getVersionId() !== request.versionId) {\n\t\t\t\t\t\terror = 'canceled';\n\t\t\t\t\t}\n\t\t\t\t\tconst result = suggestions.map(c => ({\n\t\t\t\t\t\trange: c.editRange.toString(),\n\t\t\t\t\t\ttext: c.insertText,\n\t\t\t\t\t\tisInlineEdit: !!c.isInlineEdit,\n\t\t\t\t\t\tsource: c.source.provider.groupId,\n\t\t\t\t\t}));\n\t\t\t\t\tthis._log({ sourceId: 'InlineCompletions.fetch', kind: 'end', requestId, durationMs: (Date.now() - startTime.getTime()), error, result, time: Date.now(), didAllProvidersReturn });\n\t\t\t\t}\n\n\t\t\t\trequestResponseInfo.setRequestUuid(providerResult.contextWithUuid.requestUuid);\n\t\t\t\tif (producedSuggestion) {\n\t\t\t\t\trequestResponseInfo.setHasProducedSuggestion();\n\t\t\t\t\tif (suggestions.length > 0 && source.token.isCancellationRequested) {\n\t\t\t\t\t\tsuggestions.forEach(s => s.setNotShownReasonIfNotSet('canceled:whileAwaitingOtherProviders'));\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (source.token.isCancellationRequested) {\n\t\t\t\t\t\trequestResponseInfo.setNoSuggestionReasonIfNotSet('canceled:whileFetching');\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst completionsQuotaExceeded = this._contextKeyService.getContextKeyValue<boolean>('completionsQuotaExceeded');\n\t\t\t\t\t\trequestResponseInfo.setNoSuggestionReasonIfNotSet(completionsQuotaExceeded ? 'completionsQuotaExceeded' : 'noSuggestion');\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst remainingTimeToWait = context.earliestShownDateTime - Date.now();\n\t\t\t\tif (remainingTimeToWait > 0) {\n\t\t\t\t\tawait wait(remainingTimeToWait, source.token);\n\t\t\t\t}\n\n\t\t\t\tif (source.token.isCancellationRequested || this._store.isDisposed || this._textModel.getVersionId() !== request.versionId\n\t\t\t\t\t|| userJumpedToActiveCompletion.get() /* In the meantime the user showed interest for the active completion so dont hide it */) {\n\t\t\t\t\tconst notShownReason =\n\t\t\t\t\t\tsource.token.isCancellationRequested ? 'canceled:afterMinShowDelay' :\n\t\t\t\t\t\t\tthis._store.isDisposed ? 'canceled:disposed' :\n\t\t\t\t\t\t\t\tthis._textModel.getVersionId() !== request.versionId ? 'canceled:documentChanged' :\n\t\t\t\t\t\t\t\t\tuserJumpedToActiveCompletion.get() ? 'canceled:userJumped' :\n\t\t\t\t\t\t\t\t\t\t'unknown';\n\t\t\t\t\tsuggestions.forEach(s => s.setNotShownReasonIfNotSet(notShownReason));\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tconst endTime = new Date();\n\t\t\t\tthis._debounceValue.update(this._textModel, endTime.getTime() - startTime.getTime());\n\n\t\t\t\tconst cursorPosition = this._cursorPosition.get();\n\t\t\t\tthis._updateOperation.clear();\n\t\t\t\ttransaction(tx => {\n\t\t\t\t\t/** @description Update completions with provider result */\n\t\t\t\t\tconst v = this._state.get();\n\n\t\t\t\t\tif (context.selectedSuggestionInfo) {\n\t\t\t\t\t\tthis._state.set({\n\t\t\t\t\t\t\tinlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t\t\t\t\t\tsuggestWidgetInlineCompletions: v.suggestWidgetInlineCompletions.createStateWithAppliedResults(suggestions, request, this._textModel, cursorPosition, activeInlineCompletion),\n\t\t\t\t\t\t}, tx);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis._state.set({\n\t\t\t\t\t\t\tinlineCompletions: v.inlineCompletions.createStateWithAppliedResults(suggestions, request, this._textModel, cursorPosition, activeInlineCompletion),\n\t\t\t\t\t\t\tsuggestWidgetInlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t\t\t\t\t}, tx);\n\t\t\t\t\t}\n\n\t\t\t\t\tv.inlineCompletions.dispose();\n\t\t\t\t\tv.suggestWidgetInlineCompletions.dispose();\n\t\t\t\t});\n\t\t\t} finally {\n\t\t\t\tstore.dispose();\n\t\t\t\tdecreaseLoadingCount();\n\t\t\t\tthis.sendInlineCompletionsRequestTelemetry(requestResponseInfo);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t})();\n\n\t\tconst updateOperation = new UpdateOperation(request, source, promise);\n\t\tthis._updateOperation.value = updateOperation;\n\n\t\treturn promise;\n\t}\n\n\tpublic clear(tx: ITransaction): void {\n\t\tthis._updateOperation.clear();\n\t\tconst v = this._state.get();\n\t\tthis._state.set({\n\t\t\tinlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t\tsuggestWidgetInlineCompletions: InlineCompletionsState.createEmpty()\n\t\t}, tx);\n\t\tv.inlineCompletions.dispose();\n\t\tv.suggestWidgetInlineCompletions.dispose();\n\t}\n\n\tpublic seedInlineCompletionsWithSuggestWidget(): void {\n\t\tconst inlineCompletions = this.inlineCompletions.get();\n\t\tconst suggestWidgetInlineCompletions = this.suggestWidgetInlineCompletions.get();\n\t\tif (!suggestWidgetInlineCompletions) {\n\t\t\treturn;\n\t\t}\n\t\ttransaction(tx => {\n\t\t\t/** @description Seed inline completions with (newer) suggest widget inline completions */\n\t\t\tif (!inlineCompletions || (suggestWidgetInlineCompletions.request?.versionId ?? -1) > (inlineCompletions.request?.versionId ?? -1)) {\n\t\t\t\tinlineCompletions?.dispose();\n\t\t\t\tconst s = this._state.get();\n\t\t\t\tthis._state.set({\n\t\t\t\t\tinlineCompletions: suggestWidgetInlineCompletions.clone(),\n\t\t\t\t\tsuggestWidgetInlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t\t\t}, tx);\n\t\t\t\ts.inlineCompletions.dispose();\n\t\t\t\ts.suggestWidgetInlineCompletions.dispose();\n\t\t\t}\n\t\t\tthis.clearSuggestWidgetInlineCompletions(tx);\n\t\t});\n\t}\n\n\tprivate sendInlineCompletionsRequestTelemetry(\n\t\trequestResponseInfo: RequestResponseData\n\t): void {\n\t\tif (!this._sendRequestData.get() && !this._contextKeyService.getContextKeyValue<boolean>('isRunningUnificationExperiment')) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (requestResponseInfo.requestUuid === undefined || requestResponseInfo.hasProducedSuggestion) {\n\t\t\treturn;\n\t\t}\n\n\n\t\tif (!isCompletionsEnabled(this._completionsEnabled, this._textModel.getLanguageId())) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!requestResponseInfo.providers.some(p => isCopilotLikeExtension(p.providerId?.extensionId))) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst emptyEndOfLifeEvent: InlineCompletionEndOfLifeEvent = {\n\t\t\tid: requestResponseInfo.requestUuid,\n\t\t\topportunityId: requestResponseInfo.requestUuid,\n\t\t\tnoSuggestionReason: requestResponseInfo.noSuggestionReason ?? 'unknown',\n\t\t\textensionId: 'vscode-core',\n\t\t\textensionVersion: '0.0.0',\n\t\t\tgroupId: 'empty',\n\t\t\tshown: false,\n\t\t\teditorType: requestResponseInfo.requestInfo.editorType,\n\t\t\trequestReason: requestResponseInfo.requestInfo.reason,\n\t\t\ttypingInterval: requestResponseInfo.requestInfo.typingInterval,\n\t\t\ttypingIntervalCharacterCount: requestResponseInfo.requestInfo.typingIntervalCharacterCount,\n\t\t\tlanguageId: requestResponseInfo.requestInfo.languageId,\n\t\t\tselectedSuggestionInfo: !!requestResponseInfo.context.selectedSuggestionInfo,\n\t\t\tavailableProviders: requestResponseInfo.providers.map(p => p.providerId?.toString()).filter(isDefined).join(','),\n\t\t\t...forwardToChannelIf(requestResponseInfo.providers.some(p => isCopilotLikeExtension(p.providerId?.extensionId))),\n\t\t\ttimeUntilProviderRequest: undefined,\n\t\t\ttimeUntilProviderResponse: undefined,\n\t\t\tviewKind: undefined,\n\t\t\tpreceeded: undefined,\n\t\t\terror: undefined,\n\t\t\tsuperseded: undefined,\n\t\t\treason: undefined,\n\t\t\tcorrelationId: undefined,\n\t\t\tshownDuration: undefined,\n\t\t\tshownDurationUncollapsed: undefined,\n\t\t\ttimeUntilShown: undefined,\n\t\t\tpartiallyAccepted: undefined,\n\t\t\tpartiallyAcceptedCountSinceOriginal: undefined,\n\t\t\tpartiallyAcceptedRatioSinceOriginal: undefined,\n\t\t\tpartiallyAcceptedCharactersSinceOriginal: undefined,\n\t\t\tcursorColumnDistance: undefined,\n\t\t\tcursorLineDistance: undefined,\n\t\t\tlineCountOriginal: undefined,\n\t\t\tlineCountModified: undefined,\n\t\t\tcharacterCountOriginal: undefined,\n\t\t\tcharacterCountModified: undefined,\n\t\t\tdisjointReplacements: undefined,\n\t\t\tsameShapeReplacements: undefined,\n\t\t\tnotShownReason: undefined,\n\t\t};\n\n\t\tconst dataChannel = this._instantiationService.createInstance(DataChannelForwardingTelemetryService);\n\t\tsendInlineCompletionsEndOfLifeTelemetry(dataChannel, emptyEndOfLifeEvent);\n\t}\n\n\tpublic clearSuggestWidgetInlineCompletions(tx: ITransaction): void {\n\t\tif (this._updateOperation.value?.request.context.selectedSuggestionInfo) {\n\t\t\tthis._updateOperation.clear();\n\t\t}\n\t}\n\n\tpublic cancelUpdate(): void {\n\t\tthis._updateOperation.clear();\n\t}\n}\n\nclass UpdateRequest {\n\tconstructor(\n\t\tpublic readonly position: Position,\n\t\tpublic readonly context: InlineCompletionContextWithoutUuid,\n\t\tpublic readonly versionId: number,\n\t\tpublic readonly providers: Set<InlineCompletionsProvider>,\n\t) {\n\t}\n\n\tpublic satisfies(other: UpdateRequest): boolean {\n\t\treturn this.position.equals(other.position)\n\t\t\t&& equalsIfDefined(this.context.selectedSuggestionInfo, other.context.selectedSuggestionInfo, itemEquals())\n\t\t\t&& (other.context.triggerKind === InlineCompletionTriggerKind.Automatic\n\t\t\t\t|| this.context.triggerKind === InlineCompletionTriggerKind.Explicit)\n\t\t\t&& this.versionId === other.versionId\n\t\t\t&& isSubset(other.providers, this.providers);\n\t}\n}\n\nclass RequestResponseData {\n\tpublic requestUuid: string | undefined;\n\tpublic noSuggestionReason: string | undefined;\n\tpublic hasProducedSuggestion = false;\n\n\tconstructor(\n\t\tpublic readonly context: InlineCompletionContextWithoutUuid,\n\t\tpublic readonly requestInfo: InlineSuggestRequestInfo,\n\t\tpublic readonly providers: InlineCompletionsProvider[],\n\t) { }\n\n\tsetRequestUuid(uuid: string) {\n\t\tthis.requestUuid = uuid;\n\t}\n\n\tsetNoSuggestionReasonIfNotSet(type: string) {\n\t\tthis.noSuggestionReason ??= type;\n\t}\n\n\tsetHasProducedSuggestion() {\n\t\tthis.hasProducedSuggestion = true;\n\t}\n}\n\nfunction isSubset<T>(set1: Set<T>, set2: Set<T>): boolean {\n\treturn [...set1].every(item => set2.has(item));\n}\n\nfunction isCompletionsEnabled(completionsEnablementObject: Record<string, boolean> | undefined, modeId: string = '*'): boolean {\n\tif (completionsEnablementObject === undefined) {\n\t\treturn false; // default to disabled if setting is not available\n\t}\n\n\tif (typeof completionsEnablementObject[modeId] !== 'undefined') {\n\t\treturn Boolean(completionsEnablementObject[modeId]); // go with setting if explicitly defined\n\t}\n\n\treturn Boolean(completionsEnablementObject['*']); // fallback to global setting otherwise\n}\n\nclass UpdateOperation implements IDisposable {\n\tconstructor(\n\t\tpublic readonly request: UpdateRequest,\n\t\tpublic readonly cancellationTokenSource: CancellationTokenSource,\n\t\tpublic readonly promise: Promise<boolean>,\n\t) {\n\t}\n\n\tdispose() {\n\t\tthis.cancellationTokenSource.cancel();\n\t}\n}\n\nclass InlineCompletionsState extends Disposable {\n\tpublic static createEmpty(): InlineCompletionsState {\n\t\treturn new InlineCompletionsState([], undefined);\n\t}\n\n\tconstructor(\n\t\tpublic readonly inlineCompletions: readonly InlineSuggestionItem[],\n\t\tpublic readonly request: UpdateRequest | undefined,\n\t) {\n\t\tfor (const inlineCompletion of inlineCompletions) {\n\t\t\tinlineCompletion.addRef();\n\t\t}\n\n\t\tsuper();\n\n\t\tthis._register({\n\t\t\tdispose: () => {\n\t\t\t\tfor (const inlineCompletion of this.inlineCompletions) {\n\t\t\t\t\tinlineCompletion.removeRef();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate _findById(id: InlineSuggestionIdentity): InlineSuggestionItem | undefined {\n\t\treturn this.inlineCompletions.find(i => i.identity === id);\n\t}\n\n\tprivate _findByHash(hash: string): InlineSuggestionItem | undefined {\n\t\treturn this.inlineCompletions.find(i => i.hash === hash);\n\t}\n\n\t/**\n\t * Applies the edit on the state.\n\t*/\n\tpublic createStateWithAppliedEdit(edit: StringEdit, textModel: ITextModel): InlineCompletionsState {\n\t\tconst newInlineCompletions = this.inlineCompletions.map(i => i.withEdit(edit, textModel)).filter(isDefined);\n\t\treturn new InlineCompletionsState(newInlineCompletions, this.request);\n\t}\n\n\tpublic createStateWithAppliedResults(updatedSuggestions: InlineSuggestionItem[], request: UpdateRequest, textModel: ITextModel, cursorPosition: Position, itemIdToPreserveAtTop: InlineSuggestionIdentity | undefined): InlineCompletionsState {\n\t\tlet itemToPreserve: InlineSuggestionItem | undefined = undefined;\n\t\tif (itemIdToPreserveAtTop) {\n\t\t\tconst itemToPreserveCandidate = this._findById(itemIdToPreserveAtTop);\n\t\t\tif (itemToPreserveCandidate && itemToPreserveCandidate.canBeReused(textModel, request.position)) {\n\t\t\t\titemToPreserve = itemToPreserveCandidate;\n\n\t\t\t\tconst updatedItemToPreserve = updatedSuggestions.find(i => i.hash === itemToPreserveCandidate.hash);\n\t\t\t\tif (updatedItemToPreserve) {\n\t\t\t\t\tupdatedSuggestions = moveToFront(updatedItemToPreserve, updatedSuggestions);\n\t\t\t\t} else {\n\t\t\t\t\tupdatedSuggestions = [itemToPreserveCandidate, ...updatedSuggestions];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst preferInlineCompletions = itemToPreserve\n\t\t\t// itemToPreserve has precedence\n\t\t\t? !itemToPreserve.isInlineEdit\n\t\t\t// Otherwise: prefer inline completion if there is a visible one\n\t\t\t: updatedSuggestions.some(i => !i.isInlineEdit && i.isVisible(textModel, cursorPosition));\n\n\t\tlet updatedItems: InlineSuggestionItem[] = [];\n\t\tfor (const i of updatedSuggestions) {\n\t\t\tconst oldItem = this._findByHash(i.hash);\n\t\t\tlet item;\n\t\t\tif (oldItem && oldItem !== i) {\n\t\t\t\titem = i.withIdentity(oldItem.identity);\n\t\t\t\ti.setIsPreceeded(oldItem);\n\t\t\t\toldItem.setEndOfLifeReason({ kind: InlineCompletionEndOfLifeReasonKind.Ignored, userTypingDisagreed: false, supersededBy: i.getSourceCompletion() });\n\t\t\t} else {\n\t\t\t\titem = i;\n\t\t\t}\n\t\t\tif (preferInlineCompletions !== item.isInlineEdit) {\n\t\t\t\tupdatedItems.push(item);\n\t\t\t}\n\t\t}\n\n\t\tupdatedItems.sort(compareBy(i => i.showInlineEditMenu, booleanComparator));\n\t\tupdatedItems = distinctByKey(updatedItems, i => i.semanticId);\n\n\t\treturn new InlineCompletionsState(updatedItems, request);\n\t}\n\n\tpublic clone(): InlineCompletionsState {\n\t\treturn new InlineCompletionsState(this.inlineCompletions, this.request);\n\t}\n}\n\n/** Keeps the first item in case of duplicates. */\nfunction distinctByKey<T>(items: T[], key: (item: T) => unknown): T[] {\n\tconst seen = new Set();\n\treturn items.filter(item => {\n\t\tconst k = key(item);\n\t\tif (seen.has(k)) {\n\t\t\treturn false;\n\t\t}\n\t\tseen.add(k);\n\t\treturn true;\n\t});\n}\n\nfunction moveToFront<T>(item: T, items: T[]): T[] {\n\tconst index = items.indexOf(item);\n\tif (index > -1) {\n\t\treturn [item, ...items.slice(0, index), ...items.slice(index + 1)];\n\t}\n\treturn items;\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 { booleanComparator, compareBy, compareUndefinedSmallest, numberComparator } from '../../../../../base/common/arrays.js';\nimport { findLastMax } from '../../../../../base/common/arraysFind.js';\nimport { RunOnceScheduler } from '../../../../../base/common/async.js';\nimport { CancellationTokenSource } from '../../../../../base/common/cancellation.js';\nimport { equalsIfDefined, itemEquals } from '../../../../../base/common/equals.js';\nimport { Disposable, DisposableStore, IDisposable, MutableDisposable, toDisposable } from '../../../../../base/common/lifecycle.js';\nimport { derived, IObservable, IObservableWithChange, ITransaction, observableValue, recordChangesLazy, transaction } from '../../../../../base/common/observable.js';\n// eslint-disable-next-line local/code-no-deep-import-of-internal\nimport { observableReducerSettable } from '../../../../../base/common/observableInternal/experimental/reducer.js';\nimport { isDefined, isObject } from '../../../../../base/common/types.js';\nimport { IConfigurationService } from '../../../../../platform/configuration/common/configuration.js';\nimport { IContextKeyService } from '../../../../../platform/contextkey/common/contextkey.js';\nimport { DataChannelForwardingTelemetryService, forwardToChannelIf, isCopilotLikeExtension } from '../../../../../platform/dataChannel/browser/forwardingTelemetryService.js';\nimport { IInstantiationService } from '../../../../../platform/instantiation/common/instantiation.js';\nimport { ILogService } from '../../../../../platform/log/common/log.js';\nimport { observableConfigValue } from '../../../../../platform/observable/common/platformObservableUtils.js';\nimport product from '../../../../../platform/product/common/product.js';\nimport { StringEdit } from '../../../../common/core/edits/stringEdit.js';\nimport { Position } from '../../../../common/core/position.js';\nimport { InlineCompletionEndOfLifeReasonKind, InlineCompletionTriggerKind, InlineCompletionsProvider } from '../../../../common/languages.js';\nimport { ILanguageConfigurationService } from '../../../../common/languages/languageConfigurationRegistry.js';\nimport { ITextModel } from '../../../../common/model.js';\nimport { offsetEditFromContentChanges } from '../../../../common/model/textModelStringEdit.js';\nimport { IFeatureDebounceInformation } from '../../../../common/services/languageFeatureDebounce.js';\nimport { IModelContentChangedEvent } from '../../../../common/textModelEvents.js';\nimport { formatRecordableLogEntry, IRecordableEditorLogEntry, IRecordableLogEntry, StructuredLogger } from '../structuredLogger.js';\nimport { InlineCompletionEndOfLifeEvent, sendInlineCompletionsEndOfLifeTelemetry } from '../telemetry.js';\nimport { wait } from '../utils.js';\nimport { InlineSuggestionIdentity, InlineSuggestionItem } from './inlineSuggestionItem.js';\nimport { InlineCompletionContextWithoutUuid, InlineSuggestRequestInfo, provideInlineCompletions, runWhenCancelled } from './provideInlineCompletions.js';\n\nexport class InlineCompletionsSource extends Disposable {\n\tprivate static _requestId = 0;\n\n\tprivate readonly _updateOperation = this._register(new MutableDisposable<UpdateOperation>());\n\n\tprivate readonly _loggingEnabled;\n\tprivate readonly _sendRequestData;\n\n\tprivate readonly _structuredFetchLogger;\n\n\tprivate readonly _state = observableReducerSettable(this, {\n\t\tinitial: () => ({\n\t\t\tinlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t\tsuggestWidgetInlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t}),\n\t\tdisposeFinal: (values) => {\n\t\t\tvalues.inlineCompletions.dispose();\n\t\t\tvalues.suggestWidgetInlineCompletions.dispose();\n\t\t},\n\t\tchangeTracker: recordChangesLazy(() => ({ versionId: this._versionId })),\n\t\tupdate: (reader, previousValue, changes) => {\n\t\t\tconst edit = StringEdit.compose(changes.changes.map(c => c.change ? offsetEditFromContentChanges(c.change.changes) : StringEdit.empty).filter(isDefined));\n\n\t\t\tif (edit.isEmpty()) {\n\t\t\t\treturn previousValue;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\treturn {\n\t\t\t\t\tinlineCompletions: previousValue.inlineCompletions.createStateWithAppliedEdit(edit, this._textModel),\n\t\t\t\t\tsuggestWidgetInlineCompletions: previousValue.suggestWidgetInlineCompletions.createStateWithAppliedEdit(edit, this._textModel),\n\t\t\t\t};\n\t\t\t} finally {\n\t\t\t\tpreviousValue.inlineCompletions.dispose();\n\t\t\t\tpreviousValue.suggestWidgetInlineCompletions.dispose();\n\t\t\t}\n\t\t}\n\t});\n\n\tpublic readonly inlineCompletions = this._state.map(this, v => v.inlineCompletions);\n\tpublic readonly suggestWidgetInlineCompletions = this._state.map(this, v => v.suggestWidgetInlineCompletions);\n\n\tprivate _completionsEnabled: Record<string, boolean> | undefined = undefined;\n\n\tconstructor(\n\t\tprivate readonly _textModel: ITextModel,\n\t\tprivate readonly _versionId: IObservableWithChange<number | null, IModelContentChangedEvent | undefined>,\n\t\tprivate readonly _debounceValue: IFeatureDebounceInformation,\n\t\tprivate readonly _cursorPosition: IObservable<Position>,\n\t\t@ILanguageConfigurationService private readonly _languageConfigurationService: ILanguageConfigurationService,\n\t\t@ILogService private readonly _logService: ILogService,\n\t\t@IConfigurationService private readonly _configurationService: IConfigurationService,\n\t\t@IInstantiationService private readonly _instantiationService: IInstantiationService,\n\t\t@IContextKeyService private readonly _contextKeyService: IContextKeyService,\n\t) {\n\t\tsuper();\n\t\tthis._loggingEnabled = observableConfigValue('editor.inlineSuggest.logFetch', false, this._configurationService).recomputeInitiallyAndOnChange(this._store);\n\t\tthis._sendRequestData = observableConfigValue('editor.inlineSuggest.emptyResponseInformation', true, this._configurationService).recomputeInitiallyAndOnChange(this._store);\n\t\tthis._structuredFetchLogger = this._register(this._instantiationService.createInstance(StructuredLogger.cast<\n\t\t\t{ kind: 'start'; requestId: number; context: unknown } & IRecordableEditorLogEntry\n\t\t\t| { kind: 'end'; error: unknown; durationMs: number; result: unknown; requestId: number } & IRecordableLogEntry\n\t\t>(),\n\t\t\t'editor.inlineSuggest.logFetch.commandId'\n\t\t));\n\n\t\tthis.clearOperationOnTextModelChange.recomputeInitiallyAndOnChange(this._store);\n\n\t\tconst enablementSetting = product.defaultChatAgent?.completionsEnablementSetting ?? undefined;\n\t\tif (enablementSetting) {\n\t\t\tthis._updateCompletionsEnablement(enablementSetting);\n\t\t\tthis._register(this._configurationService.onDidChangeConfiguration(e => {\n\t\t\t\tif (e.affectsConfiguration(enablementSetting)) {\n\t\t\t\t\tthis._updateCompletionsEnablement(enablementSetting);\n\t\t\t\t}\n\t\t\t}));\n\t\t}\n\t}\n\n\tprivate _updateCompletionsEnablement(enalementSetting: string) {\n\t\tconst result = this._configurationService.getValue<Record<string, boolean>>(enalementSetting);\n\t\tif (!isObject(result)) {\n\t\t\tthis._completionsEnabled = undefined;\n\t\t} else {\n\t\t\tthis._completionsEnabled = result;\n\t\t}\n\t}\n\n\tpublic readonly clearOperationOnTextModelChange = derived(this, reader => {\n\t\tthis._versionId.read(reader);\n\t\tthis._updateOperation.clear();\n\t\treturn undefined; // always constant\n\t});\n\n\tprivate _log(entry:\n\t\t{ sourceId: string; kind: 'start'; requestId: number; context: unknown; provider: string | undefined } & IRecordableEditorLogEntry\n\t\t| { sourceId: string; kind: 'end'; error: unknown; durationMs: number; result: unknown; requestId: number; didAllProvidersReturn: boolean } & IRecordableLogEntry\n\t) {\n\t\tif (this._loggingEnabled.get()) {\n\t\t\tthis._logService.info(formatRecordableLogEntry(entry));\n\t\t}\n\t\tthis._structuredFetchLogger.log(entry);\n\t}\n\n\tprivate readonly _loadingCount = observableValue(this, 0);\n\n\tpublic fetch(\n\t\tproviders: InlineCompletionsProvider[],\n\t\tprovidersLabel: string | undefined,\n\t\tcontext: InlineCompletionContextWithoutUuid,\n\t\tactiveInlineCompletion: InlineSuggestionIdentity | undefined,\n\t\twithDebounce: boolean,\n\t\tuserJumpedToActiveCompletion: IObservable<boolean>,\n\t\trequestInfo: InlineSuggestRequestInfo\n\t): Promise<boolean> {\n\t\tconst position = this._cursorPosition.get();\n\t\tconst request = new UpdateRequest(position, context, this._textModel.getVersionId(), new Set(providers));\n\n\t\tconst target = context.selectedSuggestionInfo ? this.suggestWidgetInlineCompletions.get() : this.inlineCompletions.get();\n\n\t\tif (this._updateOperation.value?.request.satisfies(request)) {\n\t\t\treturn this._updateOperation.value.promise;\n\t\t} else if (target?.request?.satisfies(request)) {\n\t\t\treturn Promise.resolve(true);\n\t\t}\n\n\t\tconst updateOngoing = !!this._updateOperation.value;\n\t\tthis._updateOperation.clear();\n\n\t\tconst source = new CancellationTokenSource();\n\n\t\tconst promise = (async () => {\n\t\t\tconst store = new DisposableStore();\n\n\t\t\tthis._loadingCount.set(this._loadingCount.get() + 1, undefined);\n\t\t\tlet didDecrease = false;\n\t\t\tconst decreaseLoadingCount = () => {\n\t\t\t\tif (!didDecrease) {\n\t\t\t\t\tdidDecrease = true;\n\t\t\t\t\tthis._loadingCount.set(this._loadingCount.get() - 1, undefined);\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst loadingReset = store.add(new RunOnceScheduler(() => decreaseLoadingCount(), 10 * 1000));\n\t\t\tloadingReset.schedule();\n\n\t\t\tconst inlineSuggestionsProviders = providers.filter(p => p.providerId);\n\t\t\tconst requestResponseInfo = new RequestResponseData(context, requestInfo, inlineSuggestionsProviders);\n\n\n\t\t\ttry {\n\t\t\t\tconst recommendedDebounceValue = this._debounceValue.get(this._textModel);\n\t\t\t\tconst debounceValue = findLastMax(\n\t\t\t\t\tproviders.map(p => p.debounceDelayMs),\n\t\t\t\t\tcompareUndefinedSmallest(numberComparator)\n\t\t\t\t) ?? recommendedDebounceValue;\n\n\t\t\t\t// Debounce in any case if update is ongoing\n\t\t\t\tconst shouldDebounce = updateOngoing || (withDebounce && context.triggerKind === InlineCompletionTriggerKind.Automatic);\n\t\t\t\tif (shouldDebounce) {\n\t\t\t\t\t// This debounces the operation\n\t\t\t\t\tawait wait(debounceValue, source.token);\n\t\t\t\t}\n\n\t\t\t\tif (source.token.isCancellationRequested || this._store.isDisposed || this._textModel.getVersionId() !== request.versionId) {\n\t\t\t\t\trequestResponseInfo.setNoSuggestionReasonIfNotSet('canceled:beforeFetch');\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tconst requestId = InlineCompletionsSource._requestId++;\n\t\t\t\tif (this._loggingEnabled.get() || this._structuredFetchLogger.isEnabled.get()) {\n\t\t\t\t\tthis._log({\n\t\t\t\t\t\tsourceId: 'InlineCompletions.fetch',\n\t\t\t\t\t\tkind: 'start',\n\t\t\t\t\t\trequestId,\n\t\t\t\t\t\tmodelUri: this._textModel.uri,\n\t\t\t\t\t\tmodelVersion: this._textModel.getVersionId(),\n\t\t\t\t\t\tcontext: { triggerKind: context.triggerKind, suggestInfo: context.selectedSuggestionInfo ? true : undefined },\n\t\t\t\t\t\ttime: Date.now(),\n\t\t\t\t\t\tprovider: providersLabel,\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tconst startTime = new Date();\n\t\t\t\tconst providerResult = provideInlineCompletions(providers, this._cursorPosition.get(), this._textModel, context, requestInfo, this._languageConfigurationService);\n\n\t\t\t\trunWhenCancelled(source.token, () => providerResult.cancelAndDispose({ kind: 'tokenCancellation' }));\n\n\t\t\t\tlet shouldStopEarly = false;\n\t\t\t\tlet producedSuggestion = false;\n\n\t\t\t\tconst suggestions: InlineSuggestionItem[] = [];\n\t\t\t\tfor await (const list of providerResult.lists) {\n\t\t\t\t\tif (!list) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tlist.addRef();\n\t\t\t\t\tstore.add(toDisposable(() => list.removeRef(list.inlineSuggestionsData.length === 0 ? { kind: 'empty' } : { kind: 'notTaken' })));\n\n\t\t\t\t\tfor (const item of list.inlineSuggestionsData) {\n\t\t\t\t\t\tproducedSuggestion = true;\n\t\t\t\t\t\tif (!context.includeInlineEdits && (item.isInlineEdit || item.showInlineEditMenu)) {\n\t\t\t\t\t\t\titem.setNotShownReason('notInlineEditRequested');\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!context.includeInlineCompletions && !(item.isInlineEdit || item.showInlineEditMenu)) {\n\t\t\t\t\t\t\titem.setNotShownReason('notInlineCompletionRequested');\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst i = InlineSuggestionItem.create(item, this._textModel);\n\t\t\t\t\t\tsuggestions.push(i);\n\t\t\t\t\t\t// Stop after first visible inline completion\n\t\t\t\t\t\tif (!i.isInlineEdit && !i.showInlineEditMenu && context.triggerKind === InlineCompletionTriggerKind.Automatic) {\n\t\t\t\t\t\t\tif (i.isVisible(this._textModel, this._cursorPosition.get())) {\n\t\t\t\t\t\t\t\tshouldStopEarly = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (shouldStopEarly) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tproviderResult.cancelAndDispose({ kind: 'lostRace' });\n\n\t\t\t\tif (this._loggingEnabled.get() || this._structuredFetchLogger.isEnabled.get()) {\n\t\t\t\t\tconst didAllProvidersReturn = providerResult.didAllProvidersReturn;\n\t\t\t\t\tlet error: string | undefined = undefined;\n\t\t\t\t\tif (source.token.isCancellationRequested || this._store.isDisposed || this._textModel.getVersionId() !== request.versionId) {\n\t\t\t\t\t\terror = 'canceled';\n\t\t\t\t\t}\n\t\t\t\t\tconst result = suggestions.map(c => ({\n\t\t\t\t\t\trange: c.editRange.toString(),\n\t\t\t\t\t\ttext: c.insertText,\n\t\t\t\t\t\tisInlineEdit: !!c.isInlineEdit,\n\t\t\t\t\t\tsource: c.source.provider.groupId,\n\t\t\t\t\t}));\n\t\t\t\t\tthis._log({ sourceId: 'InlineCompletions.fetch', kind: 'end', requestId, durationMs: (Date.now() - startTime.getTime()), error, result, time: Date.now(), didAllProvidersReturn });\n\t\t\t\t}\n\n\t\t\t\trequestResponseInfo.setRequestUuid(providerResult.contextWithUuid.requestUuid);\n\t\t\t\tif (producedSuggestion) {\n\t\t\t\t\trequestResponseInfo.setHasProducedSuggestion();\n\t\t\t\t\tif (suggestions.length > 0 && source.token.isCancellationRequested) {\n\t\t\t\t\t\tsuggestions.forEach(s => s.setNotShownReasonIfNotSet('canceled:whileAwaitingOtherProviders'));\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (source.token.isCancellationRequested) {\n\t\t\t\t\t\trequestResponseInfo.setNoSuggestionReasonIfNotSet('canceled:whileFetching');\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst completionsQuotaExceeded = this._contextKeyService.getContextKeyValue<boolean>('completionsQuotaExceeded');\n\t\t\t\t\t\trequestResponseInfo.setNoSuggestionReasonIfNotSet(completionsQuotaExceeded ? 'completionsQuotaExceeded' : 'noSuggestion');\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst remainingTimeToWait = context.earliestShownDateTime - Date.now();\n\t\t\t\tif (remainingTimeToWait > 0) {\n\t\t\t\t\tawait wait(remainingTimeToWait, source.token);\n\t\t\t\t}\n\n\t\t\t\tif (source.token.isCancellationRequested || this._store.isDisposed || this._textModel.getVersionId() !== request.versionId\n\t\t\t\t\t|| userJumpedToActiveCompletion.get() /* In the meantime the user showed interest for the active completion so dont hide it */) {\n\t\t\t\t\tconst notShownReason =\n\t\t\t\t\t\tsource.token.isCancellationRequested ? 'canceled:afterMinShowDelay' :\n\t\t\t\t\t\t\tthis._store.isDisposed ? 'canceled:disposed' :\n\t\t\t\t\t\t\t\tthis._textModel.getVersionId() !== request.versionId ? 'canceled:documentChanged' :\n\t\t\t\t\t\t\t\t\tuserJumpedToActiveCompletion.get() ? 'canceled:userJumped' :\n\t\t\t\t\t\t\t\t\t\t'unknown';\n\t\t\t\t\tsuggestions.forEach(s => s.setNotShownReasonIfNotSet(notShownReason));\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tconst endTime = new Date();\n\t\t\t\tthis._debounceValue.update(this._textModel, endTime.getTime() - startTime.getTime());\n\n\t\t\t\tconst cursorPosition = this._cursorPosition.get();\n\t\t\t\tthis._updateOperation.clear();\n\t\t\t\ttransaction(tx => {\n\t\t\t\t\t/** @description Update completions with provider result */\n\t\t\t\t\tconst v = this._state.get();\n\n\t\t\t\t\tif (context.selectedSuggestionInfo) {\n\t\t\t\t\t\tthis._state.set({\n\t\t\t\t\t\t\tinlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t\t\t\t\t\tsuggestWidgetInlineCompletions: v.suggestWidgetInlineCompletions.createStateWithAppliedResults(suggestions, request, this._textModel, cursorPosition, activeInlineCompletion),\n\t\t\t\t\t\t}, tx);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis._state.set({\n\t\t\t\t\t\t\tinlineCompletions: v.inlineCompletions.createStateWithAppliedResults(suggestions, request, this._textModel, cursorPosition, activeInlineCompletion),\n\t\t\t\t\t\t\tsuggestWidgetInlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t\t\t\t\t}, tx);\n\t\t\t\t\t}\n\n\t\t\t\t\tv.inlineCompletions.dispose();\n\t\t\t\t\tv.suggestWidgetInlineCompletions.dispose();\n\t\t\t\t});\n\t\t\t} finally {\n\t\t\t\tstore.dispose();\n\t\t\t\tdecreaseLoadingCount();\n\t\t\t\tthis.sendInlineCompletionsRequestTelemetry(requestResponseInfo);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t})();\n\n\t\tconst updateOperation = new UpdateOperation(request, source, promise);\n\t\tthis._updateOperation.value = updateOperation;\n\n\t\treturn promise;\n\t}\n\n\tpublic clear(tx: ITransaction): void {\n\t\tthis._updateOperation.clear();\n\t\tconst v = this._state.get();\n\t\tthis._state.set({\n\t\t\tinlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t\tsuggestWidgetInlineCompletions: InlineCompletionsState.createEmpty()\n\t\t}, tx);\n\t\tv.inlineCompletions.dispose();\n\t\tv.suggestWidgetInlineCompletions.dispose();\n\t}\n\n\tpublic seedInlineCompletionsWithSuggestWidget(): void {\n\t\tconst inlineCompletions = this.inlineCompletions.get();\n\t\tconst suggestWidgetInlineCompletions = this.suggestWidgetInlineCompletions.get();\n\t\tif (!suggestWidgetInlineCompletions) {\n\t\t\treturn;\n\t\t}\n\t\ttransaction(tx => {\n\t\t\t/** @description Seed inline completions with (newer) suggest widget inline completions */\n\t\t\tif (!inlineCompletions || (suggestWidgetInlineCompletions.request?.versionId ?? -1) > (inlineCompletions.request?.versionId ?? -1)) {\n\t\t\t\tinlineCompletions?.dispose();\n\t\t\t\tconst s = this._state.get();\n\t\t\t\tthis._state.set({\n\t\t\t\t\tinlineCompletions: suggestWidgetInlineCompletions.clone(),\n\t\t\t\t\tsuggestWidgetInlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t\t\t}, tx);\n\t\t\t\ts.inlineCompletions.dispose();\n\t\t\t\ts.suggestWidgetInlineCompletions.dispose();\n\t\t\t}\n\t\t\tthis.clearSuggestWidgetInlineCompletions(tx);\n\t\t});\n\t}\n\n\tprivate sendInlineCompletionsRequestTelemetry(\n\t\trequestResponseInfo: RequestResponseData\n\t): void {\n\t\tif (!this._sendRequestData.get() && !this._contextKeyService.getContextKeyValue<boolean>('isRunningUnificationExperiment')) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (requestResponseInfo.requestUuid === undefined || requestResponseInfo.hasProducedSuggestion) {\n\t\t\treturn;\n\t\t}\n\n\n\t\tif (!isCompletionsEnabled(this._completionsEnabled, this._textModel.getLanguageId())) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!requestResponseInfo.providers.some(p => isCopilotLikeExtension(p.providerId?.extensionId))) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst emptyEndOfLifeEvent: InlineCompletionEndOfLifeEvent = {\n\t\t\tid: requestResponseInfo.requestUuid,\n\t\t\topportunityId: requestResponseInfo.requestUuid,\n\t\t\tnoSuggestionReason: requestResponseInfo.noSuggestionReason ?? 'unknown',\n\t\t\textensionId: 'vscode-core',\n\t\t\textensionVersion: '0.0.0',\n\t\t\tgroupId: 'empty',\n\t\t\tshown: false,\n\t\t\teditorType: requestResponseInfo.requestInfo.editorType,\n\t\t\trequestReason: requestResponseInfo.requestInfo.reason,\n\t\t\ttypingInterval: requestResponseInfo.requestInfo.typingInterval,\n\t\t\ttypingIntervalCharacterCount: requestResponseInfo.requestInfo.typingIntervalCharacterCount,\n\t\t\tlanguageId: requestResponseInfo.requestInfo.languageId,\n\t\t\tselectedSuggestionInfo: !!requestResponseInfo.context.selectedSuggestionInfo,\n\t\t\tavailableProviders: requestResponseInfo.providers.map(p => p.providerId?.toString()).filter(isDefined).join(','),\n\t\t\t...forwardToChannelIf(requestResponseInfo.providers.some(p => isCopilotLikeExtension(p.providerId?.extensionId))),\n\t\t\ttimeUntilProviderRequest: undefined,\n\t\t\ttimeUntilProviderResponse: undefined,\n\t\t\tviewKind: undefined,\n\t\t\tpreceeded: undefined,\n\t\t\terror: undefined,\n\t\t\tsuperseded: undefined,\n\t\t\treason: undefined,\n\t\t\tcorrelationId: undefined,\n\t\t\tshownDuration: undefined,\n\t\t\tshownDurationUncollapsed: undefined,\n\t\t\ttimeUntilShown: undefined,\n\t\t\tpartiallyAccepted: undefined,\n\t\t\tpartiallyAcceptedCountSinceOriginal: undefined,\n\t\t\tpartiallyAcceptedRatioSinceOriginal: undefined,\n\t\t\tpartiallyAcceptedCharactersSinceOriginal: undefined,\n\t\t\tcursorColumnDistance: undefined,\n\t\t\tcursorLineDistance: undefined,\n\t\t\tlineCountOriginal: undefined,\n\t\t\tlineCountModified: undefined,\n\t\t\tcharacterCountOriginal: undefined,\n\t\t\tcharacterCountModified: undefined,\n\t\t\tdisjointReplacements: undefined,\n\t\t\tsameShapeReplacements: undefined,\n\t\t\tnotShownReason: undefined,\n\t\t};\n\n\t\tconst dataChannel = this._instantiationService.createInstance(DataChannelForwardingTelemetryService);\n\t\tsendInlineCompletionsEndOfLifeTelemetry(dataChannel, emptyEndOfLifeEvent);\n\t}\n\n\tpublic clearSuggestWidgetInlineCompletions(tx: ITransaction): void {\n\t\tif (this._updateOperation.value?.request.context.selectedSuggestionInfo) {\n\t\t\tthis._updateOperation.clear();\n\t\t}\n\t}\n\n\tpublic cancelUpdate(): void {\n\t\tthis._updateOperation.clear();\n\t}\n}\n\nclass UpdateRequest {\n\tconstructor(\n\t\tpublic readonly position: Position,\n\t\tpublic readonly context: InlineCompletionContextWithoutUuid,\n\t\tpublic readonly versionId: number,\n\t\tpublic readonly providers: Set<InlineCompletionsProvider>,\n\t) {\n\t}\n\n\tpublic satisfies(other: UpdateRequest): boolean {\n\t\treturn this.position.equals(other.position)\n\t\t\t&& equalsIfDefined(this.context.selectedSuggestionInfo, other.context.selectedSuggestionInfo, itemEquals())\n\t\t\t&& (other.context.triggerKind === InlineCompletionTriggerKind.Automatic\n\t\t\t\t|| this.context.triggerKind === InlineCompletionTriggerKind.Explicit)\n\t\t\t&& this.versionId === other.versionId\n\t\t\t&& isSubset(other.providers, this.providers);\n\t}\n}\n\nclass RequestResponseData {\n\tpublic requestUuid: string | undefined;\n\tpublic noSuggestionReason: string | undefined;\n\tpublic hasProducedSuggestion = false;\n\n\tconstructor(\n\t\tpublic readonly context: InlineCompletionContextWithoutUuid,\n\t\tpublic readonly requestInfo: InlineSuggestRequestInfo,\n\t\tpublic readonly providers: InlineCompletionsProvider[],\n\t) { }\n\n\tsetRequestUuid(uuid: string) {\n\t\tthis.requestUuid = uuid;\n\t}\n\n\tsetNoSuggestionReasonIfNotSet(type: string) {\n\t\tthis.noSuggestionReason ??= type;\n\t}\n\n\tsetHasProducedSuggestion() {\n\t\tthis.hasProducedSuggestion = true;\n\t}\n}\n\nfunction isSubset<T>(set1: Set<T>, set2: Set<T>): boolean {\n\treturn [...set1].every(item => set2.has(item));\n}\n\nfunction isCompletionsEnabled(completionsEnablementObject: Record<string, boolean> | undefined, modeId: string = '*'): boolean {\n\tif (completionsEnablementObject === undefined) {\n\t\treturn false; // default to disabled if setting is not available\n\t}\n\n\tif (typeof completionsEnablementObject[modeId] !== 'undefined') {\n\t\treturn Boolean(completionsEnablementObject[modeId]); // go with setting if explicitly defined\n\t}\n\n\treturn Boolean(completionsEnablementObject['*']); // fallback to global setting otherwise\n}\n\nclass UpdateOperation implements IDisposable {\n\tconstructor(\n\t\tpublic readonly request: UpdateRequest,\n\t\tpublic readonly cancellationTokenSource: CancellationTokenSource,\n\t\tpublic readonly promise: Promise<boolean>,\n\t) {\n\t}\n\n\tdispose() {\n\t\tthis.cancellationTokenSource.cancel();\n\t}\n}\n\nclass InlineCompletionsState extends Disposable {\n\tpublic static createEmpty(): InlineCompletionsState {\n\t\treturn new InlineCompletionsState([], undefined);\n\t}\n\n\tconstructor(\n\t\tpublic readonly inlineCompletions: readonly InlineSuggestionItem[],\n\t\tpublic readonly request: UpdateRequest | undefined,\n\t) {\n\t\tfor (const inlineCompletion of inlineCompletions) {\n\t\t\tinlineCompletion.addRef();\n\t\t}\n\n\t\tsuper();\n\n\t\tthis._register({\n\t\t\tdispose: () => {\n\t\t\t\tfor (const inlineCompletion of this.inlineCompletions) {\n\t\t\t\t\tinlineCompletion.removeRef();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate _findById(id: InlineSuggestionIdentity): InlineSuggestionItem | undefined {\n\t\treturn this.inlineCompletions.find(i => i.identity === id);\n\t}\n\n\tprivate _findByHash(hash: string): InlineSuggestionItem | undefined {\n\t\treturn this.inlineCompletions.find(i => i.hash === hash);\n\t}\n\n\t/**\n\t * Applies the edit on the state.\n\t*/\n\tpublic createStateWithAppliedEdit(edit: StringEdit, textModel: ITextModel): InlineCompletionsState {\n\t\tconst newInlineCompletions = this.inlineCompletions.map(i => i.withEdit(edit, textModel)).filter(isDefined);\n\t\treturn new InlineCompletionsState(newInlineCompletions, this.request);\n\t}\n\n\tpublic createStateWithAppliedResults(updatedSuggestions: InlineSuggestionItem[], request: UpdateRequest, textModel: ITextModel, cursorPosition: Position, itemIdToPreserveAtTop: InlineSuggestionIdentity | undefined): InlineCompletionsState {\n\t\tlet itemToPreserve: InlineSuggestionItem | undefined = undefined;\n\t\tif (itemIdToPreserveAtTop) {\n\t\t\tconst itemToPreserveCandidate = this._findById(itemIdToPreserveAtTop);\n\t\t\tif (itemToPreserveCandidate && itemToPreserveCandidate.canBeReused(textModel, request.position)) {\n\t\t\t\titemToPreserve = itemToPreserveCandidate;\n\n\t\t\t\tconst updatedItemToPreserve = updatedSuggestions.find(i => i.hash === itemToPreserveCandidate.hash);\n\t\t\t\tif (updatedItemToPreserve) {\n\t\t\t\t\tupdatedSuggestions = moveToFront(updatedItemToPreserve, updatedSuggestions);\n\t\t\t\t} else {\n\t\t\t\t\tupdatedSuggestions = [itemToPreserveCandidate, ...updatedSuggestions];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst preferInlineCompletions = itemToPreserve\n\t\t\t// itemToPreserve has precedence\n\t\t\t? !itemToPreserve.isInlineEdit\n\t\t\t// Otherwise: prefer inline completion if there is a visible one\n\t\t\t: updatedSuggestions.some(i => !i.isInlineEdit && i.isVisible(textModel, cursorPosition));\n\n\t\tlet updatedItems: InlineSuggestionItem[] = [];\n\t\tfor (const i of updatedSuggestions) {\n\t\t\tconst oldItem = this._findByHash(i.hash);\n\t\t\tlet item;\n\t\t\tif (oldItem && oldItem !== i) {\n\t\t\t\titem = i.withIdentity(oldItem.identity);\n\t\t\t\ti.setIsPreceeded(oldItem);\n\t\t\t\toldItem.setEndOfLifeReason({ kind: InlineCompletionEndOfLifeReasonKind.Ignored, userTypingDisagreed: false, supersededBy: i.getSourceCompletion() });\n\t\t\t} else {\n\t\t\t\titem = i;\n\t\t\t}\n\t\t\tif (preferInlineCompletions !== item.isInlineEdit) {\n\t\t\t\tupdatedItems.push(item);\n\t\t\t}\n\t\t}\n\n\t\tupdatedItems.sort(compareBy(i => i.showInlineEditMenu, booleanComparator));\n\t\tupdatedItems = distinctByKey(updatedItems, i => i.semanticId);\n\n\t\treturn new InlineCompletionsState(updatedItems, request);\n\t}\n\n\tpublic clone(): InlineCompletionsState {\n\t\treturn new InlineCompletionsState(this.inlineCompletions, this.request);\n\t}\n}\n\n/** Keeps the first item in case of duplicates. */\nfunction distinctByKey<T>(items: T[], key: (item: T) => unknown): T[] {\n\tconst seen = new Set();\n\treturn items.filter(item => {\n\t\tconst k = key(item);\n\t\tif (seen.has(k)) {\n\t\t\treturn false;\n\t\t}\n\t\tseen.add(k);\n\t\treturn true;\n\t});\n}\n\nfunction moveToFront<T>(item: T, items: T[]): T[] {\n\tconst index = items.indexOf(item);\n\tif (index > -1) {\n\t\treturn [item, ...items.slice(0, index), ...items.slice(index + 1)];\n\t}\n\treturn items;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsSource.ts","vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsSource.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;;AAEhG,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAChI,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,4CAA4C,CAAC;AACrF,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,eAAe,EAAe,iBAAiB,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACpI,OAAO,EAAE,OAAO,EAAoD,eAAe,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AACtK,iEAAiE;A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C,CAAC,EAAE,CAAC;QAChB,OAAO,CAAC,IAAI,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;IACpE,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC","file":"inlineCompletionsSource.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 { booleanComparator, compareBy, compareUndefinedSmallest, numberComparator } from '../../../../../base/common/arrays.js';\nimport { findLastMax } from '../../../../../base/common/arraysFind.js';\nimport { RunOnceScheduler } from '../../../../../base/common/async.js';\nimport { CancellationTokenSource } from '../../../../../base/common/cancellation.js';\nimport { equalsIfDefined, itemEquals } from '../../../../../base/common/equals.js';\nimport { Disposable, DisposableStore, IDisposable, MutableDisposable, toDisposable } from '../../../../../base/common/lifecycle.js';\nimport { derived, IObservable, IObservableWithChange, ITransaction, observableValue, recordChangesLazy, transaction } from '../../../../../base/common/observable.js';\n// eslint-disable-next-line local/code-no-deep-import-of-internal\nimport { observableReducerSettable } from '../../../../../base/common/observableInternal/experimental/reducer.js';\nimport { isDefined, isObject } from '../../../../../base/common/types.js';\nimport { IConfigurationService } from '../../../../../platform/configuration/common/configuration.js';\nimport { IContextKeyService } from '../../../../../platform/contextkey/common/contextkey.js';\nimport { DataChannelForwardingTelemetryService, forwardToChannelIf, isCopilotLikeExtension } from '../../../../../platform/dataChannel/browser/forwardingTelemetryService.js';\nimport { IInstantiationService } from '../../../../../platform/instantiation/common/instantiation.js';\nimport { ILogService } from '../../../../../platform/log/common/log.js';\nimport { observableConfigValue } from '../../../../../platform/observable/common/platformObservableUtils.js';\nimport product from '../../../../../platform/product/common/product.js';\nimport { StringEdit } from '../../../../common/core/edits/stringEdit.js';\nimport { Position } from '../../../../common/core/position.js';\nimport { InlineCompletionEndOfLifeReasonKind, InlineCompletionTriggerKind, InlineCompletionsProvider } from '../../../../common/languages.js';\nimport { ILanguageConfigurationService } from '../../../../common/languages/languageConfigurationRegistry.js';\nimport { ITextModel } from '../../../../common/model.js';\nimport { offsetEditFromContentChanges } from '../../../../common/model/textModelStringEdit.js';\nimport { IFeatureDebounceInformation } from '../../../../common/services/languageFeatureDebounce.js';\nimport { IModelContentChangedEvent } from '../../../../common/textModelEvents.js';\nimport { formatRecordableLogEntry, IRecordableEditorLogEntry, IRecordableLogEntry, StructuredLogger } from '../structuredLogger.js';\nimport { InlineCompletionEndOfLifeEvent, sendInlineCompletionsEndOfLifeTelemetry } from '../telemetry.js';\nimport { wait } from '../utils.js';\nimport { InlineSuggestionIdentity, InlineSuggestionItem } from './inlineSuggestionItem.js';\nimport { InlineCompletionContextWithoutUuid, InlineSuggestRequestInfo, provideInlineCompletions, runWhenCancelled } from './provideInlineCompletions.js';\n\nexport class InlineCompletionsSource extends Disposable {\n\tprivate static _requestId = 0;\n\n\tprivate readonly _updateOperation = this._register(new MutableDisposable<UpdateOperation>());\n\n\tprivate readonly _loggingEnabled;\n\tprivate readonly _sendRequestData;\n\n\tprivate readonly _structuredFetchLogger;\n\n\tprivate readonly _state = observableReducerSettable(this, {\n\t\tinitial: () => ({\n\t\t\tinlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t\tsuggestWidgetInlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t}),\n\t\tdisposeFinal: (values) => {\n\t\t\tvalues.inlineCompletions.dispose();\n\t\t\tvalues.suggestWidgetInlineCompletions.dispose();\n\t\t},\n\t\tchangeTracker: recordChangesLazy(() => ({ versionId: this._versionId })),\n\t\tupdate: (reader, previousValue, changes) => {\n\t\t\tconst edit = StringEdit.compose(changes.changes.map(c => c.change ? offsetEditFromContentChanges(c.change.changes) : StringEdit.empty).filter(isDefined));\n\n\t\t\tif (edit.isEmpty()) {\n\t\t\t\treturn previousValue;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\treturn {\n\t\t\t\t\tinlineCompletions: previousValue.inlineCompletions.createStateWithAppliedEdit(edit, this._textModel),\n\t\t\t\t\tsuggestWidgetInlineCompletions: previousValue.suggestWidgetInlineCompletions.createStateWithAppliedEdit(edit, this._textModel),\n\t\t\t\t};\n\t\t\t} finally {\n\t\t\t\tpreviousValue.inlineCompletions.dispose();\n\t\t\t\tpreviousValue.suggestWidgetInlineCompletions.dispose();\n\t\t\t}\n\t\t}\n\t});\n\n\tpublic readonly inlineCompletions = this._state.map(this, v => v.inlineCompletions);\n\tpublic readonly suggestWidgetInlineCompletions = this._state.map(this, v => v.suggestWidgetInlineCompletions);\n\n\tprivate _completionsEnabled: Record<string, boolean> | undefined = undefined;\n\n\tconstructor(\n\t\tprivate readonly _textModel: ITextModel,\n\t\tprivate readonly _versionId: IObservableWithChange<number | null, IModelContentChangedEvent | undefined>,\n\t\tprivate readonly _debounceValue: IFeatureDebounceInformation,\n\t\tprivate readonly _cursorPosition: IObservable<Position>,\n\t\t@ILanguageConfigurationService private readonly _languageConfigurationService: ILanguageConfigurationService,\n\t\t@ILogService private readonly _logService: ILogService,\n\t\t@IConfigurationService private readonly _configurationService: IConfigurationService,\n\t\t@IInstantiationService private readonly _instantiationService: IInstantiationService,\n\t\t@IContextKeyService private readonly _contextKeyService: IContextKeyService,\n\t) {\n\t\tsuper();\n\t\tthis._loggingEnabled = observableConfigValue('editor.inlineSuggest.logFetch', false, this._configurationService).recomputeInitiallyAndOnChange(this._store);\n\t\tthis._sendRequestData = observableConfigValue('editor.inlineSuggest.emptyResponseInformation', true, this._configurationService).recomputeInitiallyAndOnChange(this._store);\n\t\tthis._structuredFetchLogger = this._register(this._instantiationService.createInstance(StructuredLogger.cast<\n\t\t\t{ kind: 'start'; requestId: number; context: unknown } & IRecordableEditorLogEntry\n\t\t\t| { kind: 'end'; error: unknown; durationMs: number; result: unknown; requestId: number } & IRecordableLogEntry\n\t\t>(),\n\t\t\t'editor.inlineSuggest.logFetch.commandId'\n\t\t));\n\n\t\tthis.clearOperationOnTextModelChange.recomputeInitiallyAndOnChange(this._store);\n\n\t\tconst enablementSetting = product.defaultChatAgent?.completionsEnablementSetting ?? undefined;\n\t\tif (enablementSetting) {\n\t\t\tthis._updateCompletionsEnablement(enablementSetting);\n\t\t\tthis._register(this._configurationService.onDidChangeConfiguration(e => {\n\t\t\t\tif (e.affectsConfiguration(enablementSetting)) {\n\t\t\t\t\tthis._updateCompletionsEnablement(enablementSetting);\n\t\t\t\t}\n\t\t\t}));\n\t\t}\n\t}\n\n\tprivate _updateCompletionsEnablement(enalementSetting: string) {\n\t\tconst result = this._configurationService.getValue<Record<string, boolean>>(enalementSetting);\n\t\tif (!isObject(result)) {\n\t\t\tthis._completionsEnabled = undefined;\n\t\t} else {\n\t\t\tthis._completionsEnabled = result;\n\t\t}\n\t}\n\n\tpublic readonly clearOperationOnTextModelChange = derived(this, reader => {\n\t\tthis._versionId.read(reader);\n\t\tthis._updateOperation.clear();\n\t\treturn undefined; // always constant\n\t});\n\n\tprivate _log(entry:\n\t\t{ sourceId: string; kind: 'start'; requestId: number; context: unknown; provider: string | undefined } & IRecordableEditorLogEntry\n\t\t| { sourceId: string; kind: 'end'; error: unknown; durationMs: number; result: unknown; requestId: number; didAllProvidersReturn: boolean } & IRecordableLogEntry\n\t) {\n\t\tif (this._loggingEnabled.get()) {\n\t\t\tthis._logService.info(formatRecordableLogEntry(entry));\n\t\t}\n\t\tthis._structuredFetchLogger.log(entry);\n\t}\n\n\tprivate readonly _loadingCount = observableValue(this, 0);\n\n\tpublic fetch(\n\t\tproviders: InlineCompletionsProvider[],\n\t\tprovidersLabel: string | undefined,\n\t\tcontext: InlineCompletionContextWithoutUuid,\n\t\tactiveInlineCompletion: InlineSuggestionIdentity | undefined,\n\t\twithDebounce: boolean,\n\t\tuserJumpedToActiveCompletion: IObservable<boolean>,\n\t\trequestInfo: InlineSuggestRequestInfo\n\t): Promise<boolean> {\n\t\tconst position = this._cursorPosition.get();\n\t\tconst request = new UpdateRequest(position, context, this._textModel.getVersionId(), new Set(providers));\n\n\t\tconst target = context.selectedSuggestionInfo ? this.suggestWidgetInlineCompletions.get() : this.inlineCompletions.get();\n\n\t\tif (this._updateOperation.value?.request.satisfies(request)) {\n\t\t\treturn this._updateOperation.value.promise;\n\t\t} else if (target?.request?.satisfies(request)) {\n\t\t\treturn Promise.resolve(true);\n\t\t}\n\n\t\tconst updateOngoing = !!this._updateOperation.value;\n\t\tthis._updateOperation.clear();\n\n\t\tconst source = new CancellationTokenSource();\n\n\t\tconst promise = (async () => {\n\t\t\tconst store = new DisposableStore();\n\n\t\t\tthis._loadingCount.set(this._loadingCount.get() + 1, undefined);\n\t\t\tlet didDecrease = false;\n\t\t\tconst decreaseLoadingCount = () => {\n\t\t\t\tif (!didDecrease) {\n\t\t\t\t\tdidDecrease = true;\n\t\t\t\t\tthis._loadingCount.set(this._loadingCount.get() - 1, undefined);\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst loadingReset = store.add(new RunOnceScheduler(() => decreaseLoadingCount(), 10 * 1000));\n\t\t\tloadingReset.schedule();\n\n\t\t\tconst inlineSuggestionsProviders = providers.filter(p => p.providerId);\n\t\t\tconst requestResponseInfo = new RequestResponseData(context, requestInfo, inlineSuggestionsProviders);\n\n\n\t\t\ttry {\n\t\t\t\tconst recommendedDebounceValue = this._debounceValue.get(this._textModel);\n\t\t\t\tconst debounceValue = findLastMax(\n\t\t\t\t\tproviders.map(p => p.debounceDelayMs),\n\t\t\t\t\tcompareUndefinedSmallest(numberComparator)\n\t\t\t\t) ?? recommendedDebounceValue;\n\n\t\t\t\t// Debounce in any case if update is ongoing\n\t\t\t\tconst shouldDebounce = updateOngoing || (withDebounce && context.triggerKind === InlineCompletionTriggerKind.Automatic);\n\t\t\t\tif (shouldDebounce) {\n\t\t\t\t\t// This debounces the operation\n\t\t\t\t\tawait wait(debounceValue, source.token);\n\t\t\t\t}\n\n\t\t\t\tif (source.token.isCancellationRequested || this._store.isDisposed || this._textModel.getVersionId() !== request.versionId) {\n\t\t\t\t\trequestResponseInfo.setNoSuggestionReasonIfNotSet('canceled:beforeFetch');\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tconst requestId = InlineCompletionsSource._requestId++;\n\t\t\t\tif (this._loggingEnabled.get() || this._structuredFetchLogger.isEnabled.get()) {\n\t\t\t\t\tthis._log({\n\t\t\t\t\t\tsourceId: 'InlineCompletions.fetch',\n\t\t\t\t\t\tkind: 'start',\n\t\t\t\t\t\trequestId,\n\t\t\t\t\t\tmodelUri: this._textModel.uri,\n\t\t\t\t\t\tmodelVersion: this._textModel.getVersionId(),\n\t\t\t\t\t\tcontext: { triggerKind: context.triggerKind, suggestInfo: context.selectedSuggestionInfo ? true : undefined },\n\t\t\t\t\t\ttime: Date.now(),\n\t\t\t\t\t\tprovider: providersLabel,\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tconst startTime = new Date();\n\t\t\t\tconst providerResult = provideInlineCompletions(providers, this._cursorPosition.get(), this._textModel, context, requestInfo, this._languageConfigurationService);\n\n\t\t\t\trunWhenCancelled(source.token, () => providerResult.cancelAndDispose({ kind: 'tokenCancellation' }));\n\n\t\t\t\tlet shouldStopEarly = false;\n\t\t\t\tlet producedSuggestion = false;\n\n\t\t\t\tconst suggestions: InlineSuggestionItem[] = [];\n\t\t\t\tfor await (const list of providerResult.lists) {\n\t\t\t\t\tif (!list) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tlist.addRef();\n\t\t\t\t\tstore.add(toDisposable(() => list.removeRef(list.inlineSuggestionsData.length === 0 ? { kind: 'empty' } : { kind: 'notTaken' })));\n\n\t\t\t\t\tfor (const item of list.inlineSuggestionsData) {\n\t\t\t\t\t\tproducedSuggestion = true;\n\t\t\t\t\t\tif (!context.includeInlineEdits && (item.isInlineEdit || item.showInlineEditMenu)) {\n\t\t\t\t\t\t\titem.setNotShownReason('notInlineEditRequested');\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!context.includeInlineCompletions && !(item.isInlineEdit || item.showInlineEditMenu)) {\n\t\t\t\t\t\t\titem.setNotShownReason('notInlineCompletionRequested');\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst i = InlineSuggestionItem.create(item, this._textModel);\n\t\t\t\t\t\tsuggestions.push(i);\n\t\t\t\t\t\t// Stop after first visible inline completion\n\t\t\t\t\t\tif (!i.isInlineEdit && !i.showInlineEditMenu && context.triggerKind === InlineCompletionTriggerKind.Automatic) {\n\t\t\t\t\t\t\tif (i.isVisible(this._textModel, this._cursorPosition.get())) {\n\t\t\t\t\t\t\t\tshouldStopEarly = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (shouldStopEarly) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tproviderResult.cancelAndDispose({ kind: 'lostRace' });\n\n\t\t\t\tif (this._loggingEnabled.get() || this._structuredFetchLogger.isEnabled.get()) {\n\t\t\t\t\tconst didAllProvidersReturn = providerResult.didAllProvidersReturn;\n\t\t\t\t\tlet error: string | undefined = undefined;\n\t\t\t\t\tif (source.token.isCancellationRequested || this._store.isDisposed || this._textModel.getVersionId() !== request.versionId) {\n\t\t\t\t\t\terror = 'canceled';\n\t\t\t\t\t}\n\t\t\t\t\tconst result = suggestions.map(c => ({\n\t\t\t\t\t\trange: c.editRange.toString(),\n\t\t\t\t\t\ttext: c.insertText,\n\t\t\t\t\t\tisInlineEdit: !!c.isInlineEdit,\n\t\t\t\t\t\tsource: c.source.provider.groupId,\n\t\t\t\t\t}));\n\t\t\t\t\tthis._log({ sourceId: 'InlineCompletions.fetch', kind: 'end', requestId, durationMs: (Date.now() - startTime.getTime()), error, result, time: Date.now(), didAllProvidersReturn });\n\t\t\t\t}\n\n\t\t\t\trequestResponseInfo.setRequestUuid(providerResult.contextWithUuid.requestUuid);\n\t\t\t\tif (producedSuggestion) {\n\t\t\t\t\trequestResponseInfo.setHasProducedSuggestion();\n\t\t\t\t\tif (suggestions.length > 0 && source.token.isCancellationRequested) {\n\t\t\t\t\t\tsuggestions.forEach(s => s.setNotShownReasonIfNotSet('canceled:whileAwaitingOtherProviders'));\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (source.token.isCancellationRequested) {\n\t\t\t\t\t\trequestResponseInfo.setNoSuggestionReasonIfNotSet('canceled:whileFetching');\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst completionsQuotaExceeded = this._contextKeyService.getContextKeyValue<boolean>('completionsQuotaExceeded');\n\t\t\t\t\t\trequestResponseInfo.setNoSuggestionReasonIfNotSet(completionsQuotaExceeded ? 'completionsQuotaExceeded' : 'noSuggestion');\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst remainingTimeToWait = context.earliestShownDateTime - Date.now();\n\t\t\t\tif (remainingTimeToWait > 0) {\n\t\t\t\t\tawait wait(remainingTimeToWait, source.token);\n\t\t\t\t}\n\n\t\t\t\tif (source.token.isCancellationRequested || this._store.isDisposed || this._textModel.getVersionId() !== request.versionId\n\t\t\t\t\t|| userJumpedToActiveCompletion.get() /* In the meantime the user showed interest for the active completion so dont hide it */) {\n\t\t\t\t\tconst notShownReason =\n\t\t\t\t\t\tsource.token.isCancellationRequested ? 'canceled:afterMinShowDelay' :\n\t\t\t\t\t\t\tthis._store.isDisposed ? 'canceled:disposed' :\n\t\t\t\t\t\t\t\tthis._textModel.getVersionId() !== request.versionId ? 'canceled:documentChanged' :\n\t\t\t\t\t\t\t\t\tuserJumpedToActiveCompletion.get() ? 'canceled:userJumped' :\n\t\t\t\t\t\t\t\t\t\t'unknown';\n\t\t\t\t\tsuggestions.forEach(s => s.setNotShownReasonIfNotSet(notShownReason));\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tconst endTime = new Date();\n\t\t\t\tthis._debounceValue.update(this._textModel, endTime.getTime() - startTime.getTime());\n\n\t\t\t\tconst cursorPosition = this._cursorPosition.get();\n\t\t\t\tthis._updateOperation.clear();\n\t\t\t\ttransaction(tx => {\n\t\t\t\t\t/** @description Update completions with provider result */\n\t\t\t\t\tconst v = this._state.get();\n\n\t\t\t\t\tif (context.selectedSuggestionInfo) {\n\t\t\t\t\t\tthis._state.set({\n\t\t\t\t\t\t\tinlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t\t\t\t\t\tsuggestWidgetInlineCompletions: v.suggestWidgetInlineCompletions.createStateWithAppliedResults(suggestions, request, this._textModel, cursorPosition, activeInlineCompletion),\n\t\t\t\t\t\t}, tx);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis._state.set({\n\t\t\t\t\t\t\tinlineCompletions: v.inlineCompletions.createStateWithAppliedResults(suggestions, request, this._textModel, cursorPosition, activeInlineCompletion),\n\t\t\t\t\t\t\tsuggestWidgetInlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t\t\t\t\t}, tx);\n\t\t\t\t\t}\n\n\t\t\t\t\tv.inlineCompletions.dispose();\n\t\t\t\t\tv.suggestWidgetInlineCompletions.dispose();\n\t\t\t\t});\n\t\t\t} finally {\n\t\t\t\tstore.dispose();\n\t\t\t\tdecreaseLoadingCount();\n\t\t\t\tthis.sendInlineCompletionsRequestTelemetry(requestResponseInfo);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t})();\n\n\t\tconst updateOperation = new UpdateOperation(request, source, promise);\n\t\tthis._updateOperation.value = updateOperation;\n\n\t\treturn promise;\n\t}\n\n\tpublic clear(tx: ITransaction): void {\n\t\tthis._updateOperation.clear();\n\t\tconst v = this._state.get();\n\t\tthis._state.set({\n\t\t\tinlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t\tsuggestWidgetInlineCompletions: InlineCompletionsState.createEmpty()\n\t\t}, tx);\n\t\tv.inlineCompletions.dispose();\n\t\tv.suggestWidgetInlineCompletions.dispose();\n\t}\n\n\tpublic seedInlineCompletionsWithSuggestWidget(): void {\n\t\tconst inlineCompletions = this.inlineCompletions.get();\n\t\tconst suggestWidgetInlineCompletions = this.suggestWidgetInlineCompletions.get();\n\t\tif (!suggestWidgetInlineCompletions) {\n\t\t\treturn;\n\t\t}\n\t\ttransaction(tx => {\n\t\t\t/** @description Seed inline completions with (newer) suggest widget inline completions */\n\t\t\tif (!inlineCompletions || (suggestWidgetInlineCompletions.request?.versionId ?? -1) > (inlineCompletions.request?.versionId ?? -1)) {\n\t\t\t\tinlineCompletions?.dispose();\n\t\t\t\tconst s = this._state.get();\n\t\t\t\tthis._state.set({\n\t\t\t\t\tinlineCompletions: suggestWidgetInlineCompletions.clone(),\n\t\t\t\t\tsuggestWidgetInlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t\t\t}, tx);\n\t\t\t\ts.inlineCompletions.dispose();\n\t\t\t\ts.suggestWidgetInlineCompletions.dispose();\n\t\t\t}\n\t\t\tthis.clearSuggestWidgetInlineCompletions(tx);\n\t\t});\n\t}\n\n\tprivate sendInlineCompletionsRequestTelemetry(\n\t\trequestResponseInfo: RequestResponseData\n\t): void {\n\t\tif (!this._sendRequestData.get() && !this._contextKeyService.getContextKeyValue<boolean>('isRunningUnificationExperiment')) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (requestResponseInfo.requestUuid === undefined || requestResponseInfo.hasProducedSuggestion) {\n\t\t\treturn;\n\t\t}\n\n\n\t\tif (!isCompletionsEnabled(this._completionsEnabled, this._textModel.getLanguageId())) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!requestResponseInfo.providers.some(p => isCopilotLikeExtension(p.providerId?.extensionId))) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst emptyEndOfLifeEvent: InlineCompletionEndOfLifeEvent = {\n\t\t\topportunityId: requestResponseInfo.requestUuid,\n\t\t\tnoSuggestionReason: requestResponseInfo.noSuggestionReason ?? 'unknown',\n\t\t\textensionId: 'vscode-core',\n\t\t\textensionVersion: '0.0.0',\n\t\t\tgroupId: 'empty',\n\t\t\tshown: false,\n\t\t\teditorType: requestResponseInfo.requestInfo.editorType,\n\t\t\trequestReason: requestResponseInfo.requestInfo.reason,\n\t\t\ttypingInterval: requestResponseInfo.requestInfo.typingInterval,\n\t\t\ttypingIntervalCharacterCount: requestResponseInfo.requestInfo.typingIntervalCharacterCount,\n\t\t\tlanguageId: requestResponseInfo.requestInfo.languageId,\n\t\t\tselectedSuggestionInfo: !!requestResponseInfo.context.selectedSuggestionInfo,\n\t\t\tavailableProviders: requestResponseInfo.providers.map(p => p.providerId?.toString()).filter(isDefined).join(','),\n\t\t\t...forwardToChannelIf(requestResponseInfo.providers.some(p => isCopilotLikeExtension(p.providerId?.extensionId))),\n\t\t\ttimeUntilProviderRequest: undefined,\n\t\t\ttimeUntilProviderResponse: undefined,\n\t\t\tviewKind: undefined,\n\t\t\tpreceeded: undefined,\n\t\t\terror: undefined,\n\t\t\tsuperseded: undefined,\n\t\t\treason: undefined,\n\t\t\tcorrelationId: undefined,\n\t\t\tshownDuration: undefined,\n\t\t\tshownDurationUncollapsed: undefined,\n\t\t\ttimeUntilShown: undefined,\n\t\t\tpartiallyAccepted: undefined,\n\t\t\tpartiallyAcceptedCountSinceOriginal: undefined,\n\t\t\tpartiallyAcceptedRatioSinceOriginal: undefined,\n\t\t\tpartiallyAcceptedCharactersSinceOriginal: undefined,\n\t\t\tcursorColumnDistance: undefined,\n\t\t\tcursorLineDistance: undefined,\n\t\t\tlineCountOriginal: undefined,\n\t\t\tlineCountModified: undefined,\n\t\t\tcharacterCountOriginal: undefined,\n\t\t\tcharacterCountModified: undefined,\n\t\t\tdisjointReplacements: undefined,\n\t\t\tsameShapeReplacements: undefined,\n\t\t\tnotShownReason: undefined,\n\t\t};\n\n\t\tconst dataChannel = this._instantiationService.createInstance(DataChannelForwardingTelemetryService);\n\t\tsendInlineCompletionsEndOfLifeTelemetry(dataChannel, emptyEndOfLifeEvent);\n\t}\n\n\tpublic clearSuggestWidgetInlineCompletions(tx: ITransaction): void {\n\t\tif (this._updateOperation.value?.request.context.selectedSuggestionInfo) {\n\t\t\tthis._updateOperation.clear();\n\t\t}\n\t}\n\n\tpublic cancelUpdate(): void {\n\t\tthis._updateOperation.clear();\n\t}\n}\n\nclass UpdateRequest {\n\tconstructor(\n\t\tpublic readonly position: Position,\n\t\tpublic readonly context: InlineCompletionContextWithoutUuid,\n\t\tpublic readonly versionId: number,\n\t\tpublic readonly providers: Set<InlineCompletionsProvider>,\n\t) {\n\t}\n\n\tpublic satisfies(other: UpdateRequest): boolean {\n\t\treturn this.position.equals(other.position)\n\t\t\t&& equalsIfDefined(this.context.selectedSuggestionInfo, other.context.selectedSuggestionInfo, itemEquals())\n\t\t\t&& (other.context.triggerKind === InlineCompletionTriggerKind.Automatic\n\t\t\t\t|| this.context.triggerKind === InlineCompletionTriggerKind.Explicit)\n\t\t\t&& this.versionId === other.versionId\n\t\t\t&& isSubset(other.providers, this.providers);\n\t}\n}\n\nclass RequestResponseData {\n\tpublic requestUuid: string | undefined;\n\tpublic noSuggestionReason: string | undefined;\n\tpublic hasProducedSuggestion = false;\n\n\tconstructor(\n\t\tpublic readonly context: InlineCompletionContextWithoutUuid,\n\t\tpublic readonly requestInfo: InlineSuggestRequestInfo,\n\t\tpublic readonly providers: InlineCompletionsProvider[],\n\t) { }\n\n\tsetRequestUuid(uuid: string) {\n\t\tthis.requestUuid = uuid;\n\t}\n\n\tsetNoSuggestionReasonIfNotSet(type: string) {\n\t\tthis.noSuggestionReason ??= type;\n\t}\n\n\tsetHasProducedSuggestion() {\n\t\tthis.hasProducedSuggestion = true;\n\t}\n}\n\nfunction isSubset<T>(set1: Set<T>, set2: Set<T>): boolean {\n\treturn [...set1].every(item => set2.has(item));\n}\n\nfunction isCompletionsEnabled(completionsEnablementObject: Record<string, boolean> | undefined, modeId: string = '*'): boolean {\n\tif (completionsEnablementObject === undefined) {\n\t\treturn false; // default to disabled if setting is not available\n\t}\n\n\tif (typeof completionsEnablementObject[modeId] !== 'undefined') {\n\t\treturn Boolean(completionsEnablementObject[modeId]); // go with setting if explicitly defined\n\t}\n\n\treturn Boolean(completionsEnablementObject['*']); // fallback to global setting otherwise\n}\n\nclass UpdateOperation implements IDisposable {\n\tconstructor(\n\t\tpublic readonly request: UpdateRequest,\n\t\tpublic readonly cancellationTokenSource: CancellationTokenSource,\n\t\tpublic readonly promise: Promise<boolean>,\n\t) {\n\t}\n\n\tdispose() {\n\t\tthis.cancellationTokenSource.cancel();\n\t}\n}\n\nclass InlineCompletionsState extends Disposable {\n\tpublic static createEmpty(): InlineCompletionsState {\n\t\treturn new InlineCompletionsState([], undefined);\n\t}\n\n\tconstructor(\n\t\tpublic readonly inlineCompletions: readonly InlineSuggestionItem[],\n\t\tpublic readonly request: UpdateRequest | undefined,\n\t) {\n\t\tfor (const inlineCompletion of inlineCompletions) {\n\t\t\tinlineCompletion.addRef();\n\t\t}\n\n\t\tsuper();\n\n\t\tthis._register({\n\t\t\tdispose: () => {\n\t\t\t\tfor (const inlineCompletion of this.inlineCompletions) {\n\t\t\t\t\tinlineCompletion.removeRef();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate _findById(id: InlineSuggestionIdentity): InlineSuggestionItem | undefined {\n\t\treturn this.inlineCompletions.find(i => i.identity === id);\n\t}\n\n\tprivate _findByHash(hash: string): InlineSuggestionItem | undefined {\n\t\treturn this.inlineCompletions.find(i => i.hash === hash);\n\t}\n\n\t/**\n\t * Applies the edit on the state.\n\t*/\n\tpublic createStateWithAppliedEdit(edit: StringEdit, textModel: ITextModel): InlineCompletionsState {\n\t\tconst newInlineCompletions = this.inlineCompletions.map(i => i.withEdit(edit, textModel)).filter(isDefined);\n\t\treturn new InlineCompletionsState(newInlineCompletions, this.request);\n\t}\n\n\tpublic createStateWithAppliedResults(updatedSuggestions: InlineSuggestionItem[], request: UpdateRequest, textModel: ITextModel, cursorPosition: Position, itemIdToPreserveAtTop: InlineSuggestionIdentity | undefined): InlineCompletionsState {\n\t\tlet itemToPreserve: InlineSuggestionItem | undefined = undefined;\n\t\tif (itemIdToPreserveAtTop) {\n\t\t\tconst itemToPreserveCandidate = this._findById(itemIdToPreserveAtTop);\n\t\t\tif (itemToPreserveCandidate && itemToPreserveCandidate.canBeReused(textModel, request.position)) {\n\t\t\t\titemToPreserve = itemToPreserveCandidate;\n\n\t\t\t\tconst updatedItemToPreserve = updatedSuggestions.find(i => i.hash === itemToPreserveCandidate.hash);\n\t\t\t\tif (updatedItemToPreserve) {\n\t\t\t\t\tupdatedSuggestions = moveToFront(updatedItemToPreserve, updatedSuggestions);\n\t\t\t\t} else {\n\t\t\t\t\tupdatedSuggestions = [itemToPreserveCandidate, ...updatedSuggestions];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst preferInlineCompletions = itemToPreserve\n\t\t\t// itemToPreserve has precedence\n\t\t\t? !itemToPreserve.isInlineEdit\n\t\t\t// Otherwise: prefer inline completion if there is a visible one\n\t\t\t: updatedSuggestions.some(i => !i.isInlineEdit && i.isVisible(textModel, cursorPosition));\n\n\t\tlet updatedItems: InlineSuggestionItem[] = [];\n\t\tfor (const i of updatedSuggestions) {\n\t\t\tconst oldItem = this._findByHash(i.hash);\n\t\t\tlet item;\n\t\t\tif (oldItem && oldItem !== i) {\n\t\t\t\titem = i.withIdentity(oldItem.identity);\n\t\t\t\ti.setIsPreceeded(oldItem);\n\t\t\t\toldItem.setEndOfLifeReason({ kind: InlineCompletionEndOfLifeReasonKind.Ignored, userTypingDisagreed: false, supersededBy: i.getSourceCompletion() });\n\t\t\t} else {\n\t\t\t\titem = i;\n\t\t\t}\n\t\t\tif (preferInlineCompletions !== item.isInlineEdit) {\n\t\t\t\tupdatedItems.push(item);\n\t\t\t}\n\t\t}\n\n\t\tupdatedItems.sort(compareBy(i => i.showInlineEditMenu, booleanComparator));\n\t\tupdatedItems = distinctByKey(updatedItems, i => i.semanticId);\n\n\t\treturn new InlineCompletionsState(updatedItems, request);\n\t}\n\n\tpublic clone(): InlineCompletionsState {\n\t\treturn new InlineCompletionsState(this.inlineCompletions, this.request);\n\t}\n}\n\n/** Keeps the first item in case of duplicates. */\nfunction distinctByKey<T>(items: T[], key: (item: T) => unknown): T[] {\n\tconst seen = new Set();\n\treturn items.filter(item => {\n\t\tconst k = key(item);\n\t\tif (seen.has(k)) {\n\t\t\treturn false;\n\t\t}\n\t\tseen.add(k);\n\t\treturn true;\n\t});\n}\n\nfunction moveToFront<T>(item: T, items: T[]): T[] {\n\tconst index = items.indexOf(item);\n\tif (index > -1) {\n\t\treturn [item, ...items.slice(0, index), ...items.slice(index + 1)];\n\t}\n\treturn items;\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 { booleanComparator, compareBy, compareUndefinedSmallest, numberComparator } from '../../../../../base/common/arrays.js';\nimport { findLastMax } from '../../../../../base/common/arraysFind.js';\nimport { RunOnceScheduler } from '../../../../../base/common/async.js';\nimport { CancellationTokenSource } from '../../../../../base/common/cancellation.js';\nimport { equalsIfDefined, itemEquals } from '../../../../../base/common/equals.js';\nimport { Disposable, DisposableStore, IDisposable, MutableDisposable, toDisposable } from '../../../../../base/common/lifecycle.js';\nimport { derived, IObservable, IObservableWithChange, ITransaction, observableValue, recordChangesLazy, transaction } from '../../../../../base/common/observable.js';\n// eslint-disable-next-line local/code-no-deep-import-of-internal\nimport { observableReducerSettable } from '../../../../../base/common/observableInternal/experimental/reducer.js';\nimport { isDefined, isObject } from '../../../../../base/common/types.js';\nimport { IConfigurationService } from '../../../../../platform/configuration/common/configuration.js';\nimport { IContextKeyService } from '../../../../../platform/contextkey/common/contextkey.js';\nimport { DataChannelForwardingTelemetryService, forwardToChannelIf, isCopilotLikeExtension } from '../../../../../platform/dataChannel/browser/forwardingTelemetryService.js';\nimport { IInstantiationService } from '../../../../../platform/instantiation/common/instantiation.js';\nimport { ILogService } from '../../../../../platform/log/common/log.js';\nimport { observableConfigValue } from '../../../../../platform/observable/common/platformObservableUtils.js';\nimport product from '../../../../../platform/product/common/product.js';\nimport { StringEdit } from '../../../../common/core/edits/stringEdit.js';\nimport { Position } from '../../../../common/core/position.js';\nimport { InlineCompletionEndOfLifeReasonKind, InlineCompletionTriggerKind, InlineCompletionsProvider } from '../../../../common/languages.js';\nimport { ILanguageConfigurationService } from '../../../../common/languages/languageConfigurationRegistry.js';\nimport { ITextModel } from '../../../../common/model.js';\nimport { offsetEditFromContentChanges } from '../../../../common/model/textModelStringEdit.js';\nimport { IFeatureDebounceInformation } from '../../../../common/services/languageFeatureDebounce.js';\nimport { IModelContentChangedEvent } from '../../../../common/textModelEvents.js';\nimport { formatRecordableLogEntry, IRecordableEditorLogEntry, IRecordableLogEntry, StructuredLogger } from '../structuredLogger.js';\nimport { InlineCompletionEndOfLifeEvent, sendInlineCompletionsEndOfLifeTelemetry } from '../telemetry.js';\nimport { wait } from '../utils.js';\nimport { InlineSuggestionIdentity, InlineSuggestionItem } from './inlineSuggestionItem.js';\nimport { InlineCompletionContextWithoutUuid, InlineSuggestRequestInfo, provideInlineCompletions, runWhenCancelled } from './provideInlineCompletions.js';\n\nexport class InlineCompletionsSource extends Disposable {\n\tprivate static _requestId = 0;\n\n\tprivate readonly _updateOperation = this._register(new MutableDisposable<UpdateOperation>());\n\n\tprivate readonly _loggingEnabled;\n\tprivate readonly _sendRequestData;\n\n\tprivate readonly _structuredFetchLogger;\n\n\tprivate readonly _state = observableReducerSettable(this, {\n\t\tinitial: () => ({\n\t\t\tinlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t\tsuggestWidgetInlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t}),\n\t\tdisposeFinal: (values) => {\n\t\t\tvalues.inlineCompletions.dispose();\n\t\t\tvalues.suggestWidgetInlineCompletions.dispose();\n\t\t},\n\t\tchangeTracker: recordChangesLazy(() => ({ versionId: this._versionId })),\n\t\tupdate: (reader, previousValue, changes) => {\n\t\t\tconst edit = StringEdit.compose(changes.changes.map(c => c.change ? offsetEditFromContentChanges(c.change.changes) : StringEdit.empty).filter(isDefined));\n\n\t\t\tif (edit.isEmpty()) {\n\t\t\t\treturn previousValue;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\treturn {\n\t\t\t\t\tinlineCompletions: previousValue.inlineCompletions.createStateWithAppliedEdit(edit, this._textModel),\n\t\t\t\t\tsuggestWidgetInlineCompletions: previousValue.suggestWidgetInlineCompletions.createStateWithAppliedEdit(edit, this._textModel),\n\t\t\t\t};\n\t\t\t} finally {\n\t\t\t\tpreviousValue.inlineCompletions.dispose();\n\t\t\t\tpreviousValue.suggestWidgetInlineCompletions.dispose();\n\t\t\t}\n\t\t}\n\t});\n\n\tpublic readonly inlineCompletions = this._state.map(this, v => v.inlineCompletions);\n\tpublic readonly suggestWidgetInlineCompletions = this._state.map(this, v => v.suggestWidgetInlineCompletions);\n\n\tprivate _completionsEnabled: Record<string, boolean> | undefined = undefined;\n\n\tconstructor(\n\t\tprivate readonly _textModel: ITextModel,\n\t\tprivate readonly _versionId: IObservableWithChange<number | null, IModelContentChangedEvent | undefined>,\n\t\tprivate readonly _debounceValue: IFeatureDebounceInformation,\n\t\tprivate readonly _cursorPosition: IObservable<Position>,\n\t\t@ILanguageConfigurationService private readonly _languageConfigurationService: ILanguageConfigurationService,\n\t\t@ILogService private readonly _logService: ILogService,\n\t\t@IConfigurationService private readonly _configurationService: IConfigurationService,\n\t\t@IInstantiationService private readonly _instantiationService: IInstantiationService,\n\t\t@IContextKeyService private readonly _contextKeyService: IContextKeyService,\n\t) {\n\t\tsuper();\n\t\tthis._loggingEnabled = observableConfigValue('editor.inlineSuggest.logFetch', false, this._configurationService).recomputeInitiallyAndOnChange(this._store);\n\t\tthis._sendRequestData = observableConfigValue('editor.inlineSuggest.emptyResponseInformation', true, this._configurationService).recomputeInitiallyAndOnChange(this._store);\n\t\tthis._structuredFetchLogger = this._register(this._instantiationService.createInstance(StructuredLogger.cast<\n\t\t\t{ kind: 'start'; requestId: number; context: unknown } & IRecordableEditorLogEntry\n\t\t\t| { kind: 'end'; error: unknown; durationMs: number; result: unknown; requestId: number } & IRecordableLogEntry\n\t\t>(),\n\t\t\t'editor.inlineSuggest.logFetch.commandId'\n\t\t));\n\n\t\tthis.clearOperationOnTextModelChange.recomputeInitiallyAndOnChange(this._store);\n\n\t\tconst enablementSetting = product.defaultChatAgent?.completionsEnablementSetting ?? undefined;\n\t\tif (enablementSetting) {\n\t\t\tthis._updateCompletionsEnablement(enablementSetting);\n\t\t\tthis._register(this._configurationService.onDidChangeConfiguration(e => {\n\t\t\t\tif (e.affectsConfiguration(enablementSetting)) {\n\t\t\t\t\tthis._updateCompletionsEnablement(enablementSetting);\n\t\t\t\t}\n\t\t\t}));\n\t\t}\n\t}\n\n\tprivate _updateCompletionsEnablement(enalementSetting: string) {\n\t\tconst result = this._configurationService.getValue<Record<string, boolean>>(enalementSetting);\n\t\tif (!isObject(result)) {\n\t\t\tthis._completionsEnabled = undefined;\n\t\t} else {\n\t\t\tthis._completionsEnabled = result;\n\t\t}\n\t}\n\n\tpublic readonly clearOperationOnTextModelChange = derived(this, reader => {\n\t\tthis._versionId.read(reader);\n\t\tthis._updateOperation.clear();\n\t\treturn undefined; // always constant\n\t});\n\n\tprivate _log(entry:\n\t\t{ sourceId: string; kind: 'start'; requestId: number; context: unknown; provider: string | undefined } & IRecordableEditorLogEntry\n\t\t| { sourceId: string; kind: 'end'; error: unknown; durationMs: number; result: unknown; requestId: number; didAllProvidersReturn: boolean } & IRecordableLogEntry\n\t) {\n\t\tif (this._loggingEnabled.get()) {\n\t\t\tthis._logService.info(formatRecordableLogEntry(entry));\n\t\t}\n\t\tthis._structuredFetchLogger.log(entry);\n\t}\n\n\tprivate readonly _loadingCount = observableValue(this, 0);\n\n\tpublic fetch(\n\t\tproviders: InlineCompletionsProvider[],\n\t\tprovidersLabel: string | undefined,\n\t\tcontext: InlineCompletionContextWithoutUuid,\n\t\tactiveInlineCompletion: InlineSuggestionIdentity | undefined,\n\t\twithDebounce: boolean,\n\t\tuserJumpedToActiveCompletion: IObservable<boolean>,\n\t\trequestInfo: InlineSuggestRequestInfo\n\t): Promise<boolean> {\n\t\tconst position = this._cursorPosition.get();\n\t\tconst request = new UpdateRequest(position, context, this._textModel.getVersionId(), new Set(providers));\n\n\t\tconst target = context.selectedSuggestionInfo ? this.suggestWidgetInlineCompletions.get() : this.inlineCompletions.get();\n\n\t\tif (this._updateOperation.value?.request.satisfies(request)) {\n\t\t\treturn this._updateOperation.value.promise;\n\t\t} else if (target?.request?.satisfies(request)) {\n\t\t\treturn Promise.resolve(true);\n\t\t}\n\n\t\tconst updateOngoing = !!this._updateOperation.value;\n\t\tthis._updateOperation.clear();\n\n\t\tconst source = new CancellationTokenSource();\n\n\t\tconst promise = (async () => {\n\t\t\tconst store = new DisposableStore();\n\n\t\t\tthis._loadingCount.set(this._loadingCount.get() + 1, undefined);\n\t\t\tlet didDecrease = false;\n\t\t\tconst decreaseLoadingCount = () => {\n\t\t\t\tif (!didDecrease) {\n\t\t\t\t\tdidDecrease = true;\n\t\t\t\t\tthis._loadingCount.set(this._loadingCount.get() - 1, undefined);\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst loadingReset = store.add(new RunOnceScheduler(() => decreaseLoadingCount(), 10 * 1000));\n\t\t\tloadingReset.schedule();\n\n\t\t\tconst inlineSuggestionsProviders = providers.filter(p => p.providerId);\n\t\t\tconst requestResponseInfo = new RequestResponseData(context, requestInfo, inlineSuggestionsProviders);\n\n\n\t\t\ttry {\n\t\t\t\tconst recommendedDebounceValue = this._debounceValue.get(this._textModel);\n\t\t\t\tconst debounceValue = findLastMax(\n\t\t\t\t\tproviders.map(p => p.debounceDelayMs),\n\t\t\t\t\tcompareUndefinedSmallest(numberComparator)\n\t\t\t\t) ?? recommendedDebounceValue;\n\n\t\t\t\t// Debounce in any case if update is ongoing\n\t\t\t\tconst shouldDebounce = updateOngoing || (withDebounce && context.triggerKind === InlineCompletionTriggerKind.Automatic);\n\t\t\t\tif (shouldDebounce) {\n\t\t\t\t\t// This debounces the operation\n\t\t\t\t\tawait wait(debounceValue, source.token);\n\t\t\t\t}\n\n\t\t\t\tif (source.token.isCancellationRequested || this._store.isDisposed || this._textModel.getVersionId() !== request.versionId) {\n\t\t\t\t\trequestResponseInfo.setNoSuggestionReasonIfNotSet('canceled:beforeFetch');\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tconst requestId = InlineCompletionsSource._requestId++;\n\t\t\t\tif (this._loggingEnabled.get() || this._structuredFetchLogger.isEnabled.get()) {\n\t\t\t\t\tthis._log({\n\t\t\t\t\t\tsourceId: 'InlineCompletions.fetch',\n\t\t\t\t\t\tkind: 'start',\n\t\t\t\t\t\trequestId,\n\t\t\t\t\t\tmodelUri: this._textModel.uri,\n\t\t\t\t\t\tmodelVersion: this._textModel.getVersionId(),\n\t\t\t\t\t\tcontext: { triggerKind: context.triggerKind, suggestInfo: context.selectedSuggestionInfo ? true : undefined },\n\t\t\t\t\t\ttime: Date.now(),\n\t\t\t\t\t\tprovider: providersLabel,\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tconst startTime = new Date();\n\t\t\t\tconst providerResult = provideInlineCompletions(providers, this._cursorPosition.get(), this._textModel, context, requestInfo, this._languageConfigurationService);\n\n\t\t\t\trunWhenCancelled(source.token, () => providerResult.cancelAndDispose({ kind: 'tokenCancellation' }));\n\n\t\t\t\tlet shouldStopEarly = false;\n\t\t\t\tlet producedSuggestion = false;\n\n\t\t\t\tconst suggestions: InlineSuggestionItem[] = [];\n\t\t\t\tfor await (const list of providerResult.lists) {\n\t\t\t\t\tif (!list) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tlist.addRef();\n\t\t\t\t\tstore.add(toDisposable(() => list.removeRef(list.inlineSuggestionsData.length === 0 ? { kind: 'empty' } : { kind: 'notTaken' })));\n\n\t\t\t\t\tfor (const item of list.inlineSuggestionsData) {\n\t\t\t\t\t\tproducedSuggestion = true;\n\t\t\t\t\t\tif (!context.includeInlineEdits && (item.isInlineEdit || item.showInlineEditMenu)) {\n\t\t\t\t\t\t\titem.setNotShownReason('notInlineEditRequested');\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!context.includeInlineCompletions && !(item.isInlineEdit || item.showInlineEditMenu)) {\n\t\t\t\t\t\t\titem.setNotShownReason('notInlineCompletionRequested');\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst i = InlineSuggestionItem.create(item, this._textModel);\n\t\t\t\t\t\tsuggestions.push(i);\n\t\t\t\t\t\t// Stop after first visible inline completion\n\t\t\t\t\t\tif (!i.isInlineEdit && !i.showInlineEditMenu && context.triggerKind === InlineCompletionTriggerKind.Automatic) {\n\t\t\t\t\t\t\tif (i.isVisible(this._textModel, this._cursorPosition.get())) {\n\t\t\t\t\t\t\t\tshouldStopEarly = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (shouldStopEarly) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tproviderResult.cancelAndDispose({ kind: 'lostRace' });\n\n\t\t\t\tif (this._loggingEnabled.get() || this._structuredFetchLogger.isEnabled.get()) {\n\t\t\t\t\tconst didAllProvidersReturn = providerResult.didAllProvidersReturn;\n\t\t\t\t\tlet error: string | undefined = undefined;\n\t\t\t\t\tif (source.token.isCancellationRequested || this._store.isDisposed || this._textModel.getVersionId() !== request.versionId) {\n\t\t\t\t\t\terror = 'canceled';\n\t\t\t\t\t}\n\t\t\t\t\tconst result = suggestions.map(c => ({\n\t\t\t\t\t\trange: c.editRange.toString(),\n\t\t\t\t\t\ttext: c.insertText,\n\t\t\t\t\t\tisInlineEdit: !!c.isInlineEdit,\n\t\t\t\t\t\tsource: c.source.provider.groupId,\n\t\t\t\t\t}));\n\t\t\t\t\tthis._log({ sourceId: 'InlineCompletions.fetch', kind: 'end', requestId, durationMs: (Date.now() - startTime.getTime()), error, result, time: Date.now(), didAllProvidersReturn });\n\t\t\t\t}\n\n\t\t\t\trequestResponseInfo.setRequestUuid(providerResult.contextWithUuid.requestUuid);\n\t\t\t\tif (producedSuggestion) {\n\t\t\t\t\trequestResponseInfo.setHasProducedSuggestion();\n\t\t\t\t\tif (suggestions.length > 0 && source.token.isCancellationRequested) {\n\t\t\t\t\t\tsuggestions.forEach(s => s.setNotShownReasonIfNotSet('canceled:whileAwaitingOtherProviders'));\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (source.token.isCancellationRequested) {\n\t\t\t\t\t\trequestResponseInfo.setNoSuggestionReasonIfNotSet('canceled:whileFetching');\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst completionsQuotaExceeded = this._contextKeyService.getContextKeyValue<boolean>('completionsQuotaExceeded');\n\t\t\t\t\t\trequestResponseInfo.setNoSuggestionReasonIfNotSet(completionsQuotaExceeded ? 'completionsQuotaExceeded' : 'noSuggestion');\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst remainingTimeToWait = context.earliestShownDateTime - Date.now();\n\t\t\t\tif (remainingTimeToWait > 0) {\n\t\t\t\t\tawait wait(remainingTimeToWait, source.token);\n\t\t\t\t}\n\n\t\t\t\tif (source.token.isCancellationRequested || this._store.isDisposed || this._textModel.getVersionId() !== request.versionId\n\t\t\t\t\t|| userJumpedToActiveCompletion.get() /* In the meantime the user showed interest for the active completion so dont hide it */) {\n\t\t\t\t\tconst notShownReason =\n\t\t\t\t\t\tsource.token.isCancellationRequested ? 'canceled:afterMinShowDelay' :\n\t\t\t\t\t\t\tthis._store.isDisposed ? 'canceled:disposed' :\n\t\t\t\t\t\t\t\tthis._textModel.getVersionId() !== request.versionId ? 'canceled:documentChanged' :\n\t\t\t\t\t\t\t\t\tuserJumpedToActiveCompletion.get() ? 'canceled:userJumped' :\n\t\t\t\t\t\t\t\t\t\t'unknown';\n\t\t\t\t\tsuggestions.forEach(s => s.setNotShownReasonIfNotSet(notShownReason));\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tconst endTime = new Date();\n\t\t\t\tthis._debounceValue.update(this._textModel, endTime.getTime() - startTime.getTime());\n\n\t\t\t\tconst cursorPosition = this._cursorPosition.get();\n\t\t\t\tthis._updateOperation.clear();\n\t\t\t\ttransaction(tx => {\n\t\t\t\t\t/** @description Update completions with provider result */\n\t\t\t\t\tconst v = this._state.get();\n\n\t\t\t\t\tif (context.selectedSuggestionInfo) {\n\t\t\t\t\t\tthis._state.set({\n\t\t\t\t\t\t\tinlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t\t\t\t\t\tsuggestWidgetInlineCompletions: v.suggestWidgetInlineCompletions.createStateWithAppliedResults(suggestions, request, this._textModel, cursorPosition, activeInlineCompletion),\n\t\t\t\t\t\t}, tx);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis._state.set({\n\t\t\t\t\t\t\tinlineCompletions: v.inlineCompletions.createStateWithAppliedResults(suggestions, request, this._textModel, cursorPosition, activeInlineCompletion),\n\t\t\t\t\t\t\tsuggestWidgetInlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t\t\t\t\t}, tx);\n\t\t\t\t\t}\n\n\t\t\t\t\tv.inlineCompletions.dispose();\n\t\t\t\t\tv.suggestWidgetInlineCompletions.dispose();\n\t\t\t\t});\n\t\t\t} finally {\n\t\t\t\tstore.dispose();\n\t\t\t\tdecreaseLoadingCount();\n\t\t\t\tthis.sendInlineCompletionsRequestTelemetry(requestResponseInfo);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t})();\n\n\t\tconst updateOperation = new UpdateOperation(request, source, promise);\n\t\tthis._updateOperation.value = updateOperation;\n\n\t\treturn promise;\n\t}\n\n\tpublic clear(tx: ITransaction): void {\n\t\tthis._updateOperation.clear();\n\t\tconst v = this._state.get();\n\t\tthis._state.set({\n\t\t\tinlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t\tsuggestWidgetInlineCompletions: InlineCompletionsState.createEmpty()\n\t\t}, tx);\n\t\tv.inlineCompletions.dispose();\n\t\tv.suggestWidgetInlineCompletions.dispose();\n\t}\n\n\tpublic seedInlineCompletionsWithSuggestWidget(): void {\n\t\tconst inlineCompletions = this.inlineCompletions.get();\n\t\tconst suggestWidgetInlineCompletions = this.suggestWidgetInlineCompletions.get();\n\t\tif (!suggestWidgetInlineCompletions) {\n\t\t\treturn;\n\t\t}\n\t\ttransaction(tx => {\n\t\t\t/** @description Seed inline completions with (newer) suggest widget inline completions */\n\t\t\tif (!inlineCompletions || (suggestWidgetInlineCompletions.request?.versionId ?? -1) > (inlineCompletions.request?.versionId ?? -1)) {\n\t\t\t\tinlineCompletions?.dispose();\n\t\t\t\tconst s = this._state.get();\n\t\t\t\tthis._state.set({\n\t\t\t\t\tinlineCompletions: suggestWidgetInlineCompletions.clone(),\n\t\t\t\t\tsuggestWidgetInlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t\t\t}, tx);\n\t\t\t\ts.inlineCompletions.dispose();\n\t\t\t\ts.suggestWidgetInlineCompletions.dispose();\n\t\t\t}\n\t\t\tthis.clearSuggestWidgetInlineCompletions(tx);\n\t\t});\n\t}\n\n\tprivate sendInlineCompletionsRequestTelemetry(\n\t\trequestResponseInfo: RequestResponseData\n\t): void {\n\t\tif (!this._sendRequestData.get() && !this._contextKeyService.getContextKeyValue<boolean>('isRunningUnificationExperiment')) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (requestResponseInfo.requestUuid === undefined || requestResponseInfo.hasProducedSuggestion) {\n\t\t\treturn;\n\t\t}\n\n\n\t\tif (!isCompletionsEnabled(this._completionsEnabled, this._textModel.getLanguageId())) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!requestResponseInfo.providers.some(p => isCopilotLikeExtension(p.providerId?.extensionId))) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst emptyEndOfLifeEvent: InlineCompletionEndOfLifeEvent = {\n\t\t\topportunityId: requestResponseInfo.requestUuid,\n\t\t\tnoSuggestionReason: requestResponseInfo.noSuggestionReason ?? 'unknown',\n\t\t\textensionId: 'vscode-core',\n\t\t\textensionVersion: '0.0.0',\n\t\t\tgroupId: 'empty',\n\t\t\tshown: false,\n\t\t\teditorType: requestResponseInfo.requestInfo.editorType,\n\t\t\trequestReason: requestResponseInfo.requestInfo.reason,\n\t\t\ttypingInterval: requestResponseInfo.requestInfo.typingInterval,\n\t\t\ttypingIntervalCharacterCount: requestResponseInfo.requestInfo.typingIntervalCharacterCount,\n\t\t\tlanguageId: requestResponseInfo.requestInfo.languageId,\n\t\t\tselectedSuggestionInfo: !!requestResponseInfo.context.selectedSuggestionInfo,\n\t\t\tavailableProviders: requestResponseInfo.providers.map(p => p.providerId?.toString()).filter(isDefined).join(','),\n\t\t\t...forwardToChannelIf(requestResponseInfo.providers.some(p => isCopilotLikeExtension(p.providerId?.extensionId))),\n\t\t\ttimeUntilProviderRequest: undefined,\n\t\t\ttimeUntilProviderResponse: undefined,\n\t\t\tviewKind: undefined,\n\t\t\tpreceeded: undefined,\n\t\t\terror: undefined,\n\t\t\tsuperseded: undefined,\n\t\t\treason: undefined,\n\t\t\tcorrelationId: undefined,\n\t\t\tshownDuration: undefined,\n\t\t\tshownDurationUncollapsed: undefined,\n\t\t\ttimeUntilShown: undefined,\n\t\t\tpartiallyAccepted: undefined,\n\t\t\tpartiallyAcceptedCountSinceOriginal: undefined,\n\t\t\tpartiallyAcceptedRatioSinceOriginal: undefined,\n\t\t\tpartiallyAcceptedCharactersSinceOriginal: undefined,\n\t\t\tcursorColumnDistance: undefined,\n\t\t\tcursorLineDistance: undefined,\n\t\t\tlineCountOriginal: undefined,\n\t\t\tlineCountModified: undefined,\n\t\t\tcharacterCountOriginal: undefined,\n\t\t\tcharacterCountModified: undefined,\n\t\t\tdisjointReplacements: undefined,\n\t\t\tsameShapeReplacements: undefined,\n\t\t\tnotShownReason: undefined,\n\t\t};\n\n\t\tconst dataChannel = this._instantiationService.createInstance(DataChannelForwardingTelemetryService);\n\t\tsendInlineCompletionsEndOfLifeTelemetry(dataChannel, emptyEndOfLifeEvent);\n\t}\n\n\tpublic clearSuggestWidgetInlineCompletions(tx: ITransaction): void {\n\t\tif (this._updateOperation.value?.request.context.selectedSuggestionInfo) {\n\t\t\tthis._updateOperation.clear();\n\t\t}\n\t}\n\n\tpublic cancelUpdate(): void {\n\t\tthis._updateOperation.clear();\n\t}\n}\n\nclass UpdateRequest {\n\tconstructor(\n\t\tpublic readonly position: Position,\n\t\tpublic readonly context: InlineCompletionContextWithoutUuid,\n\t\tpublic readonly versionId: number,\n\t\tpublic readonly providers: Set<InlineCompletionsProvider>,\n\t) {\n\t}\n\n\tpublic satisfies(other: UpdateRequest): boolean {\n\t\treturn this.position.equals(other.position)\n\t\t\t&& equalsIfDefined(this.context.selectedSuggestionInfo, other.context.selectedSuggestionInfo, itemEquals())\n\t\t\t&& (other.context.triggerKind === InlineCompletionTriggerKind.Automatic\n\t\t\t\t|| this.context.triggerKind === InlineCompletionTriggerKind.Explicit)\n\t\t\t&& this.versionId === other.versionId\n\t\t\t&& isSubset(other.providers, this.providers);\n\t}\n}\n\nclass RequestResponseData {\n\tpublic requestUuid: string | undefined;\n\tpublic noSuggestionReason: string | undefined;\n\tpublic hasProducedSuggestion = false;\n\n\tconstructor(\n\t\tpublic readonly context: InlineCompletionContextWithoutUuid,\n\t\tpublic readonly requestInfo: InlineSuggestRequestInfo,\n\t\tpublic readonly providers: InlineCompletionsProvider[],\n\t) { }\n\n\tsetRequestUuid(uuid: string) {\n\t\tthis.requestUuid = uuid;\n\t}\n\n\tsetNoSuggestionReasonIfNotSet(type: string) {\n\t\tthis.noSuggestionReason ??= type;\n\t}\n\n\tsetHasProducedSuggestion() {\n\t\tthis.hasProducedSuggestion = true;\n\t}\n}\n\nfunction isSubset<T>(set1: Set<T>, set2: Set<T>): boolean {\n\treturn [...set1].every(item => set2.has(item));\n}\n\nfunction isCompletionsEnabled(completionsEnablementObject: Record<string, boolean> | undefined, modeId: string = '*'): boolean {\n\tif (completionsEnablementObject === undefined) {\n\t\treturn false; // default to disabled if setting is not available\n\t}\n\n\tif (typeof completionsEnablementObject[modeId] !== 'undefined') {\n\t\treturn Boolean(completionsEnablementObject[modeId]); // go with setting if explicitly defined\n\t}\n\n\treturn Boolean(completionsEnablementObject['*']); // fallback to global setting otherwise\n}\n\nclass UpdateOperation implements IDisposable {\n\tconstructor(\n\t\tpublic readonly request: UpdateRequest,\n\t\tpublic readonly cancellationTokenSource: CancellationTokenSource,\n\t\tpublic readonly promise: Promise<boolean>,\n\t) {\n\t}\n\n\tdispose() {\n\t\tthis.cancellationTokenSource.cancel();\n\t}\n}\n\nclass InlineCompletionsState extends Disposable {\n\tpublic static createEmpty(): InlineCompletionsState {\n\t\treturn new InlineCompletionsState([], undefined);\n\t}\n\n\tconstructor(\n\t\tpublic readonly inlineCompletions: readonly InlineSuggestionItem[],\n\t\tpublic readonly request: UpdateRequest | undefined,\n\t) {\n\t\tfor (const inlineCompletion of inlineCompletions) {\n\t\t\tinlineCompletion.addRef();\n\t\t}\n\n\t\tsuper();\n\n\t\tthis._register({\n\t\t\tdispose: () => {\n\t\t\t\tfor (const inlineCompletion of this.inlineCompletions) {\n\t\t\t\t\tinlineCompletion.removeRef();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate _findById(id: InlineSuggestionIdentity): InlineSuggestionItem | undefined {\n\t\treturn this.inlineCompletions.find(i => i.identity === id);\n\t}\n\n\tprivate _findByHash(hash: string): InlineSuggestionItem | undefined {\n\t\treturn this.inlineCompletions.find(i => i.hash === hash);\n\t}\n\n\t/**\n\t * Applies the edit on the state.\n\t*/\n\tpublic createStateWithAppliedEdit(edit: StringEdit, textModel: ITextModel): InlineCompletionsState {\n\t\tconst newInlineCompletions = this.inlineCompletions.map(i => i.withEdit(edit, textModel)).filter(isDefined);\n\t\treturn new InlineCompletionsState(newInlineCompletions, this.request);\n\t}\n\n\tpublic createStateWithAppliedResults(updatedSuggestions: InlineSuggestionItem[], request: UpdateRequest, textModel: ITextModel, cursorPosition: Position, itemIdToPreserveAtTop: InlineSuggestionIdentity | undefined): InlineCompletionsState {\n\t\tlet itemToPreserve: InlineSuggestionItem | undefined = undefined;\n\t\tif (itemIdToPreserveAtTop) {\n\t\t\tconst itemToPreserveCandidate = this._findById(itemIdToPreserveAtTop);\n\t\t\tif (itemToPreserveCandidate && itemToPreserveCandidate.canBeReused(textModel, request.position)) {\n\t\t\t\titemToPreserve = itemToPreserveCandidate;\n\n\t\t\t\tconst updatedItemToPreserve = updatedSuggestions.find(i => i.hash === itemToPreserveCandidate.hash);\n\t\t\t\tif (updatedItemToPreserve) {\n\t\t\t\t\tupdatedSuggestions = moveToFront(updatedItemToPreserve, updatedSuggestions);\n\t\t\t\t} else {\n\t\t\t\t\tupdatedSuggestions = [itemToPreserveCandidate, ...updatedSuggestions];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst preferInlineCompletions = itemToPreserve\n\t\t\t// itemToPreserve has precedence\n\t\t\t? !itemToPreserve.isInlineEdit\n\t\t\t// Otherwise: prefer inline completion if there is a visible one\n\t\t\t: updatedSuggestions.some(i => !i.isInlineEdit && i.isVisible(textModel, cursorPosition));\n\n\t\tlet updatedItems: InlineSuggestionItem[] = [];\n\t\tfor (const i of updatedSuggestions) {\n\t\t\tconst oldItem = this._findByHash(i.hash);\n\t\t\tlet item;\n\t\t\tif (oldItem && oldItem !== i) {\n\t\t\t\titem = i.withIdentity(oldItem.identity);\n\t\t\t\ti.setIsPreceeded(oldItem);\n\t\t\t\toldItem.setEndOfLifeReason({ kind: InlineCompletionEndOfLifeReasonKind.Ignored, userTypingDisagreed: false, supersededBy: i.getSourceCompletion() });\n\t\t\t} else {\n\t\t\t\titem = i;\n\t\t\t}\n\t\t\tif (preferInlineCompletions !== item.isInlineEdit) {\n\t\t\t\tupdatedItems.push(item);\n\t\t\t}\n\t\t}\n\n\t\tupdatedItems.sort(compareBy(i => i.showInlineEditMenu, booleanComparator));\n\t\tupdatedItems = distinctByKey(updatedItems, i => i.semanticId);\n\n\t\treturn new InlineCompletionsState(updatedItems, request);\n\t}\n\n\tpublic clone(): InlineCompletionsState {\n\t\treturn new InlineCompletionsState(this.inlineCompletions, this.request);\n\t}\n}\n\n/** Keeps the first item in case of duplicates. */\nfunction distinctByKey<T>(items: T[], key: (item: T) => unknown): T[] {\n\tconst seen = new Set();\n\treturn items.filter(item => {\n\t\tconst k = key(item);\n\t\tif (seen.has(k)) {\n\t\t\treturn false;\n\t\t}\n\t\tseen.add(k);\n\t\treturn true;\n\t});\n}\n\nfunction moveToFront<T>(item: T, items: T[]): T[] {\n\tconst index = items.indexOf(item);\n\tif (index > -1) {\n\t\treturn [item, ...items.slice(0, index), ...items.slice(index + 1)];\n\t}\n\treturn items;\n}\n"]}
|