monaco-editor-core 0.55.0-dev-20251026 → 0.55.0-dev-20251028
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/nls.keys.json +1 -1
- package/esm/nls.messages.cs.js +2 -2
- package/esm/nls.messages.de.js +2 -2
- package/esm/nls.messages.es.js +2 -2
- package/esm/nls.messages.fr.js +2 -2
- package/esm/nls.messages.it.js +2 -2
- package/esm/nls.messages.ja.js +2 -2
- package/esm/nls.messages.js +1 -1
- package/esm/nls.messages.json +1 -1
- package/esm/nls.messages.ko.js +2 -2
- package/esm/nls.messages.pl.js +2 -2
- package/esm/nls.messages.pt-br.js +2 -2
- package/esm/nls.messages.ru.js +2 -2
- package/esm/nls.messages.tr.js +2 -2
- package/esm/nls.messages.zh-cn.js +2 -2
- package/esm/nls.messages.zh-tw.js +2 -2
- package/esm/nls.metadata.json +2 -0
- package/esm/vs/base/browser/ui/actionbar/actionbar.js +17 -0
- package/esm/vs/base/browser/ui/actionbar/actionbar.js.map +1 -1
- package/esm/vs/base/browser/ui/iconLabel/iconLabel.js +2 -1
- package/esm/vs/base/browser/ui/iconLabel/iconLabel.js.map +1 -1
- package/esm/vs/base/browser/ui/scrollbar/media/scrollbars.css +4 -0
- package/esm/vs/base/browser/ui/toolbar/toolbar.css +11 -0
- package/esm/vs/base/browser/ui/toolbar/toolbar.js +115 -2
- package/esm/vs/base/browser/ui/toolbar/toolbar.js.map +1 -1
- package/esm/vs/base/common/jsonSchema.js.map +1 -1
- package/esm/vs/editor/common/cursor/cursorWordOperations.js +14 -4
- package/esm/vs/editor/common/cursor/cursorWordOperations.js.map +1 -1
- package/esm/vs/editor/common/languages/textToHtmlTokenizer.js +21 -10
- package/esm/vs/editor/common/languages/textToHtmlTokenizer.js.map +1 -1
- package/esm/vs/editor/common/languages.js +5 -5
- package/esm/vs/editor/common/languages.js.map +1 -1
- package/esm/vs/editor/common/standalone/standaloneEnums.js +5 -5
- package/esm/vs/editor/common/standalone/standaloneEnums.js.map +1 -1
- package/esm/vs/editor/contrib/codeAction/browser/codeActionCommands.js.map +1 -1
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteContribution.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.js +5 -5
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsSource.js +2 -2
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsSource.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineSuggestionItem.js +22 -24
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineSuggestionItem.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/provideInlineCompletions.js +16 -22
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/provideInlineCompletions.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/telemetry.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditWithChanges.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsModel.js +1 -6
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsModel.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsView.js +6 -2
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViewInterface.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsCustomView.js +6 -6
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsCustomView.js.map +1 -1
- package/esm/vs/editor/contrib/semanticTokens/browser/viewportSemanticTokens.js +6 -0
- package/esm/vs/editor/contrib/semanticTokens/browser/viewportSemanticTokens.js.map +1 -1
- package/esm/vs/editor/contrib/suggest/browser/suggestInlineCompletions.js +2 -2
- package/esm/vs/editor/contrib/suggest/browser/suggestInlineCompletions.js.map +1 -1
- package/esm/vs/editor/editor.api.d.ts +20 -18
- package/esm/vs/editor/standalone/browser/standaloneLanguages.js +1 -1
- package/esm/vs/editor/standalone/browser/standaloneLanguages.js.map +1 -1
- package/esm/vs/platform/theme/common/colorUtils.js +2 -2
- package/esm/vs/platform/theme/common/colors/miscColors.js +5 -4
- package/esm/vs/platform/theme/common/colors/miscColors.js.map +1 -1
- package/esm/vs/platform/theme/common/colors/quickpickColors.js +9 -9
- package/esm/vs/platform/theme/common/colors/searchColors.js +3 -3
- package/esm/vs/platform/theme/common/iconRegistry.js +6 -6
- package/esm/vs/platform/undoRedo/common/undoRedoService.js +20 -20
- package/esm/vs/platform/workspace/common/workspace.js +1 -1
- package/monaco.d.ts +20 -18
- package/package.json +2 -2
package/esm/vs/editor/contrib/inlineCompletions/browser/model/provideInlineCompletions.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/provideInlineCompletions.ts","vs/editor/contrib/inlineCompletions/browser/model/provideInlineCompletions.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAqB,uBAAuB,EAAE,MAAM,4CAA4C,CAAC;AACxG,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,UAAU,EAAe,MAAM,yCAAyC,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAGlE,OAAO,EAAE,iBAAiB,E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","file":"provideInlineCompletions.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 { assertNever } from '../../../../../base/common/assert.js';\nimport { AsyncIterableProducer } from '../../../../../base/common/async.js';\nimport { CancellationToken, CancellationTokenSource } from '../../../../../base/common/cancellation.js';\nimport { onUnexpectedExternalError } from '../../../../../base/common/errors.js';\nimport { Disposable, IDisposable } from '../../../../../base/common/lifecycle.js';\nimport { prefixedUuid } from '../../../../../base/common/uuid.js';\nimport { ICommandService } from '../../../../../platform/commands/common/commands.js';\nimport { ISingleEditOperation } from '../../../../common/core/editOperation.js';\nimport { StringReplacement } from '../../../../common/core/edits/stringEdit.js';\nimport { OffsetRange } from '../../../../common/core/ranges/offsetRange.js';\nimport { Position } from '../../../../common/core/position.js';\nimport { Range } from '../../../../common/core/range.js';\nimport { TextReplacement } from '../../../../common/core/edits/textEdit.js';\nimport { InlineCompletionEndOfLifeReason, InlineCompletionEndOfLifeReasonKind, InlineCompletionDisplayLocationKind, InlineCompletion, InlineCompletionContext, InlineCompletions, InlineCompletionsProvider, PartialAcceptInfo, InlineCompletionsDisposeReason, LifetimeSummary, ProviderId } from '../../../../common/languages.js';\nimport { ILanguageConfigurationService } from '../../../../common/languages/languageConfigurationRegistry.js';\nimport { ITextModel } from '../../../../common/model.js';\nimport { fixBracketsInLine } from '../../../../common/model/bracketPairsTextModelPart/fixBrackets.js';\nimport { SnippetParser, Text } from '../../../snippet/browser/snippetParser.js';\nimport { getReadonlyEmptyArray } from '../utils.js';\nimport { groupByMap } from '../../../../../base/common/collections.js';\nimport { DirectedGraph } from './graph.js';\nimport { CachedFunction } from '../../../../../base/common/cache.js';\nimport { InlineCompletionViewData, InlineCompletionViewKind } from '../view/inlineEdits/inlineEditsViewInterface.js';\nimport { isDefined } from '../../../../../base/common/types.js';\nimport { inlineCompletionIsVisible } from './inlineSuggestionItem.js';\nimport { EditDeltaInfo } from '../../../../common/textModelEditSource.js';\n\nexport type InlineCompletionContextWithoutUuid = Omit<InlineCompletionContext, 'requestUuid'>;\n\nexport function provideInlineCompletions(\n\tproviders: InlineCompletionsProvider[],\n\tposition: Position,\n\tmodel: ITextModel,\n\tcontext: InlineCompletionContextWithoutUuid,\n\trequestInfo: InlineSuggestRequestInfo,\n\tlanguageConfigurationService?: ILanguageConfigurationService,\n): IInlineCompletionProviderResult {\n\tconst requestUuid = prefixedUuid('icr');\n\n\tconst cancellationTokenSource = new CancellationTokenSource();\n\tlet cancelReason: InlineCompletionsDisposeReason | undefined = undefined;\n\n\tconst contextWithUuid: InlineCompletionContext = { ...context, requestUuid: requestUuid };\n\n\tconst defaultReplaceRange = getDefaultRange(position, model);\n\n\tconst providersByGroupId = groupByMap(providers, p => p.groupId);\n\tconst yieldsToGraph = DirectedGraph.from(providers, p => {\n\t\treturn p.yieldsToGroupIds?.flatMap(groupId => providersByGroupId.get(groupId) ?? []) ?? [];\n\t});\n\tconst { foundCycles } = yieldsToGraph.removeCycles();\n\tif (foundCycles.length > 0) {\n\t\tonUnexpectedExternalError(new Error(`Inline completions: cyclic yield-to dependency detected.`\n\t\t\t+ ` Path: ${foundCycles.map(s => s.toString ? s.toString() : ('' + s)).join(' -> ')}`));\n\t}\n\n\tlet runningCount = 0;\n\n\tconst queryProvider = new CachedFunction(async (provider: InlineCompletionsProvider<InlineCompletions>): Promise<InlineSuggestionList | undefined> => {\n\t\ttry {\n\t\t\trunningCount++;\n\t\t\tif (cancellationTokenSource.token.isCancellationRequested) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst yieldsTo = yieldsToGraph.getOutgoing(provider);\n\t\t\tfor (const p of yieldsTo) {\n\t\t\t\t// We know there is no cycle, so no recursion here\n\t\t\t\tconst result = await queryProvider.get(p);\n\t\t\t\tif (result) {\n\t\t\t\t\tfor (const item of result.inlineSuggestions.items) {\n\t\t\t\t\t\tif (item.isInlineEdit || typeof item.insertText !== 'string') {\n\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst t = new TextReplacement(Range.lift(item.range) ?? defaultReplaceRange, item.insertText);\n\t\t\t\t\t\tif (inlineCompletionIsVisible(t, undefined, model, position)) {\n\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// else: inline completion is not visible, so lets not block\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet result: InlineCompletions | null | undefined;\n\t\t\tconst providerStartTime = Date.now();\n\t\t\ttry {\n\t\t\t\tresult = await provider.provideInlineCompletions(model, position, contextWithUuid, cancellationTokenSource.token);\n\t\t\t} catch (e) {\n\t\t\t\tonUnexpectedExternalError(e);\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tconst providerEndTime = Date.now();\n\n\t\t\tif (!result) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst data: InlineSuggestData[] = [];\n\t\t\tconst list = new InlineSuggestionList(result, data, provider);\n\t\t\tlist.addRef();\n\t\t\trunWhenCancelled(cancellationTokenSource.token, () => {\n\t\t\t\treturn list.removeRef(cancelReason);\n\t\t\t});\n\t\t\tif (cancellationTokenSource.token.isCancellationRequested) {\n\t\t\t\treturn undefined; // The list is disposed now, so we cannot return the items!\n\t\t\t}\n\n\t\t\tfor (const item of result.items) {\n\t\t\t\tdata.push(toInlineSuggestData(item, list, defaultReplaceRange, model, languageConfigurationService, contextWithUuid, requestInfo, { startTime: providerStartTime, endTime: providerEndTime }));\n\t\t\t}\n\n\t\t\treturn list;\n\t\t} finally {\n\t\t\trunningCount--;\n\t\t}\n\t});\n\n\tconst inlineCompletionLists = AsyncIterableProducer.fromPromisesResolveOrder(providers.map(p => queryProvider.get(p))).filter(isDefined);\n\n\treturn {\n\t\tcontextWithUuid,\n\t\tget didAllProvidersReturn() { return runningCount === 0; },\n\t\tlists: inlineCompletionLists,\n\t\tcancelAndDispose: reason => {\n\t\t\tif (cancelReason !== undefined) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcancelReason = reason;\n\t\t\tcancellationTokenSource.dispose(true);\n\t\t}\n\t};\n}\n\n/** If the token is eventually cancelled, this will not leak either. */\nexport function runWhenCancelled(token: CancellationToken, callback: () => void): IDisposable {\n\tif (token.isCancellationRequested) {\n\t\tcallback();\n\t\treturn Disposable.None;\n\t} else {\n\t\tconst listener = token.onCancellationRequested(() => {\n\t\t\tlistener.dispose();\n\t\t\tcallback();\n\t\t});\n\t\treturn { dispose: () => listener.dispose() };\n\t}\n}\n\nexport interface IInlineCompletionProviderResult {\n\tget didAllProvidersReturn(): boolean;\n\n\tcontextWithUuid: InlineCompletionContext;\n\n\tcancelAndDispose(reason: InlineCompletionsDisposeReason): void;\n\n\tlists: AsyncIterableProducer<InlineSuggestionList>;\n}\n\nfunction toInlineSuggestData(\n\tinlineCompletion: InlineCompletion,\n\tsource: InlineSuggestionList,\n\tdefaultReplaceRange: Range,\n\ttextModel: ITextModel,\n\tlanguageConfigurationService: ILanguageConfigurationService | undefined,\n\tcontext: InlineCompletionContext,\n\trequestInfo: InlineSuggestRequestInfo,\n\tproviderRequestInfo: InlineSuggestProviderRequestInfo,\n): InlineSuggestData {\n\tlet insertText: string;\n\tlet snippetInfo: SnippetInfo | undefined;\n\tlet range = inlineCompletion.range ? Range.lift(inlineCompletion.range) : defaultReplaceRange;\n\n\tif (typeof inlineCompletion.insertText === 'string') {\n\t\tinsertText = inlineCompletion.insertText;\n\n\t\tif (languageConfigurationService && inlineCompletion.completeBracketPairs) {\n\t\t\tinsertText = closeBrackets(\n\t\t\t\tinsertText,\n\t\t\t\trange.getStartPosition(),\n\t\t\t\ttextModel,\n\t\t\t\tlanguageConfigurationService\n\t\t\t);\n\n\t\t\t// Modify range depending on if brackets are added or removed\n\t\t\tconst diff = insertText.length - inlineCompletion.insertText.length;\n\t\t\tif (diff !== 0) {\n\t\t\t\trange = new Range(range.startLineNumber, range.startColumn, range.endLineNumber, range.endColumn + diff);\n\t\t\t}\n\t\t}\n\n\t\tsnippetInfo = undefined;\n\t} else if ('snippet' in inlineCompletion.insertText) {\n\t\tconst preBracketCompletionLength = inlineCompletion.insertText.snippet.length;\n\n\t\tif (languageConfigurationService && inlineCompletion.completeBracketPairs) {\n\t\t\tinlineCompletion.insertText.snippet = closeBrackets(\n\t\t\t\tinlineCompletion.insertText.snippet,\n\t\t\t\trange.getStartPosition(),\n\t\t\t\ttextModel,\n\t\t\t\tlanguageConfigurationService\n\t\t\t);\n\n\t\t\t// Modify range depending on if brackets are added or removed\n\t\t\tconst diff = inlineCompletion.insertText.snippet.length - preBracketCompletionLength;\n\t\t\tif (diff !== 0) {\n\t\t\t\trange = new Range(range.startLineNumber, range.startColumn, range.endLineNumber, range.endColumn + diff);\n\t\t\t}\n\t\t}\n\n\t\tconst snippet = new SnippetParser().parse(inlineCompletion.insertText.snippet);\n\n\t\tif (snippet.children.length === 1 && snippet.children[0] instanceof Text) {\n\t\t\tinsertText = snippet.children[0].value;\n\t\t\tsnippetInfo = undefined;\n\t\t} else {\n\t\t\tinsertText = snippet.toString();\n\t\t\tsnippetInfo = {\n\t\t\t\tsnippet: inlineCompletion.insertText.snippet,\n\t\t\t\trange: range\n\t\t\t};\n\t\t}\n\t} else {\n\t\tassertNever(inlineCompletion.insertText);\n\t}\n\n\tconst displayLocation = inlineCompletion.displayLocation ? {\n\t\trange: Range.lift(inlineCompletion.displayLocation.range),\n\t\tlabel: inlineCompletion.displayLocation.label,\n\t\tkind: inlineCompletion.displayLocation.kind,\n\t\tjumpToEdit: inlineCompletion.displayLocation.jumpToEdit,\n\t} : undefined;\n\n\treturn new InlineSuggestData(\n\t\trange,\n\t\tinsertText,\n\t\tsnippetInfo,\n\t\tdisplayLocation,\n\t\tinlineCompletion.additionalTextEdits || getReadonlyEmptyArray(),\n\t\tinlineCompletion,\n\t\tsource,\n\t\tcontext,\n\t\tinlineCompletion.isInlineEdit ?? false,\n\t\trequestInfo,\n\t\tproviderRequestInfo,\n\t\tinlineCompletion.correlationId,\n\t);\n}\n\nexport type InlineSuggestRequestInfo = {\n\tstartTime: number;\n\teditorType: InlineCompletionEditorType;\n\tlanguageId: string;\n\treason: string;\n\ttypingInterval: number;\n\ttypingIntervalCharacterCount: number;\n\tavailableProviders: ProviderId[];\n};\n\nexport type InlineSuggestProviderRequestInfo = {\n\tstartTime: number;\n\tendTime: number;\n};\n\nexport type PartialAcceptance = {\n\tcharacters: number;\n\tcount: number;\n\tratio: number;\n};\n\nexport type InlineSuggestViewData = {\n\teditorType: InlineCompletionEditorType;\n\trenderData?: InlineCompletionViewData;\n\tviewKind?: InlineCompletionViewKind;\n\terror?: string;\n};\n\nexport class InlineSuggestData {\n\tprivate _didShow = false;\n\tprivate _timeUntilShown: number | undefined = undefined;\n\tprivate _showStartTime: number | undefined = undefined;\n\tprivate _shownDuration: number = 0;\n\tprivate _showUncollapsedStartTime: number | undefined = undefined;\n\tprivate _showUncollapsedDuration: number = 0;\n\tprivate _notShownReason: string | undefined = undefined;\n\n\tprivate _viewData: InlineSuggestViewData;\n\tprivate _didReportEndOfLife = false;\n\tprivate _lastSetEndOfLifeReason: InlineCompletionEndOfLifeReason | undefined = undefined;\n\tprivate _isPreceeded = false;\n\tprivate _partiallyAcceptedCount = 0;\n\tprivate _partiallyAcceptedSinceOriginal: PartialAcceptance = { characters: 0, ratio: 0, count: 0 };\n\n\tconstructor(\n\t\tpublic readonly range: Range,\n\t\tpublic readonly insertText: string,\n\t\tpublic readonly snippetInfo: SnippetInfo | undefined,\n\t\tpublic readonly displayLocation: IDisplayLocation | undefined,\n\t\tpublic readonly additionalTextEdits: readonly ISingleEditOperation[],\n\n\t\tpublic readonly sourceInlineCompletion: InlineCompletion,\n\t\tpublic readonly source: InlineSuggestionList,\n\t\tpublic readonly context: InlineCompletionContext,\n\t\tpublic readonly isInlineEdit: boolean,\n\n\t\tprivate readonly _requestInfo: InlineSuggestRequestInfo,\n\t\tprivate readonly _providerRequestInfo: InlineSuggestProviderRequestInfo,\n\t\tprivate readonly _correlationId: string | undefined,\n\t) {\n\t\tthis._viewData = { editorType: _requestInfo.editorType };\n\t}\n\n\tpublic get showInlineEditMenu() { return this.sourceInlineCompletion.showInlineEditMenu ?? false; }\n\n\tpublic get partialAccepts(): PartialAcceptance { return this._partiallyAcceptedSinceOriginal; }\n\n\tpublic async reportInlineEditShown(commandService: ICommandService, updatedInsertText: string, viewKind: InlineCompletionViewKind, viewData: InlineCompletionViewData): Promise<void> {\n\t\tthis.updateShownDuration(viewKind);\n\n\t\tif (this._didShow) {\n\t\t\treturn;\n\t\t}\n\t\tthis._didShow = true;\n\t\tthis._viewData.viewKind = viewKind;\n\t\tthis._viewData.renderData = viewData;\n\t\tthis._timeUntilShown = Date.now() - this._requestInfo.startTime;\n\n\t\tconst editDeltaInfo = new EditDeltaInfo(viewData.lineCountModified, viewData.lineCountOriginal, viewData.characterCountModified, viewData.characterCountOriginal);\n\t\tthis.source.provider.handleItemDidShow?.(this.source.inlineSuggestions, this.sourceInlineCompletion, updatedInsertText, editDeltaInfo);\n\n\t\tif (this.sourceInlineCompletion.shownCommand) {\n\t\t\tawait commandService.executeCommand(this.sourceInlineCompletion.shownCommand.id, ...(this.sourceInlineCompletion.shownCommand.arguments || []));\n\t\t}\n\t}\n\n\tpublic reportPartialAccept(acceptedCharacters: number, info: PartialAcceptInfo, partialAcceptance: PartialAcceptance) {\n\t\tthis._partiallyAcceptedCount++;\n\t\tthis._partiallyAcceptedSinceOriginal.characters += partialAcceptance.characters;\n\t\tthis._partiallyAcceptedSinceOriginal.ratio = Math.min(this._partiallyAcceptedSinceOriginal.ratio + (1 - this._partiallyAcceptedSinceOriginal.ratio) * partialAcceptance.ratio, 1);\n\t\tthis._partiallyAcceptedSinceOriginal.count += partialAcceptance.count;\n\n\t\tthis.source.provider.handlePartialAccept?.(\n\t\t\tthis.source.inlineSuggestions,\n\t\t\tthis.sourceInlineCompletion,\n\t\t\tacceptedCharacters,\n\t\t\tinfo\n\t\t);\n\t}\n\n\t/**\n\t * Sends the end of life event to the provider.\n\t * If no reason is provided, the last set reason is used.\n\t * If no reason was set, the default reason is used.\n\t*/\n\tpublic reportEndOfLife(reason?: InlineCompletionEndOfLifeReason): void {\n\t\tif (this._didReportEndOfLife) {\n\t\t\treturn;\n\t\t}\n\t\tthis._didReportEndOfLife = true;\n\t\tthis.reportInlineEditHidden();\n\n\t\tif (!reason) {\n\t\t\treason = this._lastSetEndOfLifeReason ?? { kind: InlineCompletionEndOfLifeReasonKind.Ignored, userTypingDisagreed: false, supersededBy: undefined };\n\t\t}\n\n\t\tif (reason.kind === InlineCompletionEndOfLifeReasonKind.Rejected && this.source.provider.handleRejection) {\n\t\t\tthis.source.provider.handleRejection(this.source.inlineSuggestions, this.sourceInlineCompletion);\n\t\t}\n\n\t\tif (this.source.provider.handleEndOfLifetime) {\n\t\t\tconst summary: LifetimeSummary = {\n\t\t\t\trequestUuid: this.context.requestUuid,\n\t\t\t\tcorrelationId: this._correlationId,\n\t\t\t\tselectedSuggestionInfo: !!this.context.selectedSuggestionInfo,\n\t\t\t\tpartiallyAccepted: this._partiallyAcceptedCount,\n\t\t\t\tpartiallyAcceptedCountSinceOriginal: this._partiallyAcceptedSinceOriginal.count,\n\t\t\t\tpartiallyAcceptedRatioSinceOriginal: this._partiallyAcceptedSinceOriginal.ratio,\n\t\t\t\tpartiallyAcceptedCharactersSinceOriginal: this._partiallyAcceptedSinceOriginal.characters,\n\t\t\t\tshown: this._didShow,\n\t\t\t\tshownDuration: this._shownDuration,\n\t\t\t\tshownDurationUncollapsed: this._showUncollapsedDuration,\n\t\t\t\tpreceeded: this._isPreceeded,\n\t\t\t\ttimeUntilShown: this._timeUntilShown,\n\t\t\t\ttimeUntilProviderRequest: this._providerRequestInfo.startTime - this._requestInfo.startTime,\n\t\t\t\ttimeUntilProviderResponse: this._providerRequestInfo.endTime - this._requestInfo.startTime,\n\t\t\t\teditorType: this._viewData.editorType,\n\t\t\t\tlanguageId: this._requestInfo.languageId,\n\t\t\t\trequestReason: this._requestInfo.reason,\n\t\t\t\tviewKind: this._viewData.viewKind,\n\t\t\t\tnotShownReason: this._notShownReason,\n\t\t\t\terror: this._viewData.error,\n\t\t\t\ttypingInterval: this._requestInfo.typingInterval,\n\t\t\t\ttypingIntervalCharacterCount: this._requestInfo.typingIntervalCharacterCount,\n\t\t\t\tavailableProviders: this._requestInfo.availableProviders.map(p => p.toString()).join(','),\n\t\t\t\t...this._viewData.renderData,\n\t\t\t};\n\t\t\tthis.source.provider.handleEndOfLifetime(this.source.inlineSuggestions, this.sourceInlineCompletion, reason, summary);\n\t\t}\n\t}\n\n\tpublic reportInlineEditError(message: string): void {\n\t\tif (this._viewData.error) {\n\t\t\tthis._viewData.error += `; ${message}`;\n\t\t} else {\n\t\t\tthis._viewData.error = message;\n\t\t}\n\t}\n\n\tpublic setIsPreceeded(partialAccepts: PartialAcceptance): void {\n\t\tthis._isPreceeded = true;\n\n\t\tif (this._partiallyAcceptedSinceOriginal.characters !== 0 || this._partiallyAcceptedSinceOriginal.ratio !== 0 || this._partiallyAcceptedSinceOriginal.count !== 0) {\n\t\t\tconsole.warn('Expected partiallyAcceptedCountSinceOriginal to be { characters: 0, rate: 0, partialAcceptances: 0 } before setIsPreceeded.');\n\t\t}\n\t\tthis._partiallyAcceptedSinceOriginal = partialAccepts;\n\t}\n\n\tpublic setNotShownReason(reason: string): void {\n\t\tthis._notShownReason ??= reason;\n\t}\n\n\t/**\n\t * Sets the end of life reason, but does not send the event to the provider yet.\n\t*/\n\tpublic setEndOfLifeReason(reason: InlineCompletionEndOfLifeReason): void {\n\t\tthis.reportInlineEditHidden();\n\t\tthis._lastSetEndOfLifeReason = reason;\n\t}\n\n\tprivate updateShownDuration(viewKind: InlineCompletionViewKind) {\n\t\tconst timeNow = Date.now();\n\t\tif (!this._showStartTime) {\n\t\t\tthis._showStartTime = timeNow;\n\t\t}\n\n\t\tconst isCollapsed = viewKind === InlineCompletionViewKind.Collapsed;\n\t\tif (!isCollapsed && this._showUncollapsedStartTime === undefined) {\n\t\t\tthis._showUncollapsedStartTime = timeNow;\n\t\t}\n\n\t\tif (isCollapsed && this._showUncollapsedStartTime !== undefined) {\n\t\t\tthis._showUncollapsedDuration += timeNow - this._showUncollapsedStartTime;\n\t\t}\n\t}\n\n\tprivate reportInlineEditHidden() {\n\t\tif (this._showStartTime === undefined) {\n\t\t\treturn;\n\t\t}\n\t\tconst timeNow = Date.now();\n\t\tthis._shownDuration += timeNow - this._showStartTime;\n\t\tthis._showStartTime = undefined;\n\n\t\tif (this._showUncollapsedStartTime === undefined) {\n\t\t\treturn;\n\t\t}\n\t\tthis._showUncollapsedDuration += timeNow - this._showUncollapsedStartTime;\n\t\tthis._showUncollapsedStartTime = undefined;\n\t}\n}\n\nexport interface SnippetInfo {\n\tsnippet: string;\n\t/* Could be different than the main range */\n\trange: Range;\n}\n\nexport interface IDisplayLocation {\n\trange: Range;\n\tlabel: string;\n\tkind: InlineCompletionDisplayLocationKind;\n\tjumpToEdit: boolean;\n}\n\nexport enum InlineCompletionEditorType {\n\tTextEditor = 'textEditor',\n\tDiffEditor = 'diffEditor',\n\tNotebook = 'notebook',\n}\n\n/**\n * A ref counted pointer to the computed `InlineCompletions` and the `InlineCompletionsProvider` that\n * computed them.\n */\nexport class InlineSuggestionList {\n\tprivate refCount = 0;\n\tconstructor(\n\t\tpublic readonly inlineSuggestions: InlineCompletions,\n\t\tpublic readonly inlineSuggestionsData: readonly InlineSuggestData[],\n\t\tpublic readonly provider: InlineCompletionsProvider,\n\t) { }\n\n\taddRef(): void {\n\t\tthis.refCount++;\n\t}\n\n\tremoveRef(reason: InlineCompletionsDisposeReason = { kind: 'other' }): void {\n\t\tthis.refCount--;\n\t\tif (this.refCount === 0) {\n\t\t\tfor (const item of this.inlineSuggestionsData) {\n\t\t\t\t// Fallback if it has not been called before\n\t\t\t\titem.reportEndOfLife();\n\t\t\t}\n\t\t\tthis.provider.disposeInlineCompletions(this.inlineSuggestions, reason);\n\t\t}\n\t}\n}\n\nfunction getDefaultRange(position: Position, model: ITextModel): Range {\n\tconst word = model.getWordAtPosition(position);\n\tconst maxColumn = model.getLineMaxColumn(position.lineNumber);\n\t// By default, always replace up until the end of the current line.\n\t// This default might be subject to change!\n\treturn word\n\t\t? new Range(position.lineNumber, word.startColumn, position.lineNumber, maxColumn)\n\t\t: Range.fromPositions(position, position.with(undefined, maxColumn));\n}\n\nfunction closeBrackets(text: string, position: Position, model: ITextModel, languageConfigurationService: ILanguageConfigurationService): string {\n\tconst currentLine = model.getLineContent(position.lineNumber);\n\tconst edit = StringReplacement.replace(new OffsetRange(position.column - 1, currentLine.length), text);\n\n\tconst proposedLineTokens = model.tokenization.tokenizeLinesAt(position.lineNumber, [edit.replace(currentLine)]);\n\tconst textTokens = proposedLineTokens?.[0].sliceZeroCopy(edit.getRangeAfterReplace());\n\tif (!textTokens) {\n\t\treturn text;\n\t}\n\n\tconst fixedText = fixBracketsInLine(textTokens, languageConfigurationService);\n\treturn fixedText;\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 { assertNever } from '../../../../../base/common/assert.js';\nimport { AsyncIterableProducer } from '../../../../../base/common/async.js';\nimport { CancellationToken, CancellationTokenSource } from '../../../../../base/common/cancellation.js';\nimport { onUnexpectedExternalError } from '../../../../../base/common/errors.js';\nimport { Disposable, IDisposable } from '../../../../../base/common/lifecycle.js';\nimport { prefixedUuid } from '../../../../../base/common/uuid.js';\nimport { ICommandService } from '../../../../../platform/commands/common/commands.js';\nimport { ISingleEditOperation } from '../../../../common/core/editOperation.js';\nimport { StringReplacement } from '../../../../common/core/edits/stringEdit.js';\nimport { OffsetRange } from '../../../../common/core/ranges/offsetRange.js';\nimport { Position } from '../../../../common/core/position.js';\nimport { Range } from '../../../../common/core/range.js';\nimport { TextReplacement } from '../../../../common/core/edits/textEdit.js';\nimport { InlineCompletionEndOfLifeReason, InlineCompletionEndOfLifeReasonKind, InlineCompletionDisplayLocationKind, InlineCompletion, InlineCompletionContext, InlineCompletions, InlineCompletionsProvider, PartialAcceptInfo, InlineCompletionsDisposeReason, LifetimeSummary, ProviderId } from '../../../../common/languages.js';\nimport { ILanguageConfigurationService } from '../../../../common/languages/languageConfigurationRegistry.js';\nimport { ITextModel } from '../../../../common/model.js';\nimport { fixBracketsInLine } from '../../../../common/model/bracketPairsTextModelPart/fixBrackets.js';\nimport { SnippetParser, Text } from '../../../snippet/browser/snippetParser.js';\nimport { getReadonlyEmptyArray } from '../utils.js';\nimport { groupByMap } from '../../../../../base/common/collections.js';\nimport { DirectedGraph } from './graph.js';\nimport { CachedFunction } from '../../../../../base/common/cache.js';\nimport { InlineCompletionViewData, InlineCompletionViewKind } from '../view/inlineEdits/inlineEditsViewInterface.js';\nimport { isDefined } from '../../../../../base/common/types.js';\nimport { inlineCompletionIsVisible } from './inlineSuggestionItem.js';\nimport { EditDeltaInfo } from '../../../../common/textModelEditSource.js';\n\nexport type InlineCompletionContextWithoutUuid = Omit<InlineCompletionContext, 'requestUuid'>;\n\nexport function provideInlineCompletions(\n\tproviders: InlineCompletionsProvider[],\n\tposition: Position,\n\tmodel: ITextModel,\n\tcontext: InlineCompletionContextWithoutUuid,\n\trequestInfo: InlineSuggestRequestInfo,\n\tlanguageConfigurationService?: ILanguageConfigurationService,\n): IInlineCompletionProviderResult {\n\tconst requestUuid = prefixedUuid('icr');\n\n\tconst cancellationTokenSource = new CancellationTokenSource();\n\tlet cancelReason: InlineCompletionsDisposeReason | undefined = undefined;\n\n\tconst contextWithUuid: InlineCompletionContext = { ...context, requestUuid: requestUuid };\n\n\tconst defaultReplaceRange = getDefaultRange(position, model);\n\n\tconst providersByGroupId = groupByMap(providers, p => p.groupId);\n\tconst yieldsToGraph = DirectedGraph.from(providers, p => {\n\t\treturn p.yieldsToGroupIds?.flatMap(groupId => providersByGroupId.get(groupId) ?? []) ?? [];\n\t});\n\tconst { foundCycles } = yieldsToGraph.removeCycles();\n\tif (foundCycles.length > 0) {\n\t\tonUnexpectedExternalError(new Error(`Inline completions: cyclic yield-to dependency detected.`\n\t\t\t+ ` Path: ${foundCycles.map(s => s.toString ? s.toString() : ('' + s)).join(' -> ')}`));\n\t}\n\n\tlet runningCount = 0;\n\n\tconst queryProvider = new CachedFunction(async (provider: InlineCompletionsProvider<InlineCompletions>): Promise<InlineSuggestionList | undefined> => {\n\t\ttry {\n\t\t\trunningCount++;\n\t\t\tif (cancellationTokenSource.token.isCancellationRequested) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst yieldsTo = yieldsToGraph.getOutgoing(provider);\n\t\t\tfor (const p of yieldsTo) {\n\t\t\t\t// We know there is no cycle, so no recursion here\n\t\t\t\tconst result = await queryProvider.get(p);\n\t\t\t\tif (result) {\n\t\t\t\t\tfor (const item of result.inlineSuggestions.items) {\n\t\t\t\t\t\tif (item.isInlineEdit || typeof item.insertText !== 'string') {\n\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst t = new TextReplacement(Range.lift(item.range) ?? defaultReplaceRange, item.insertText);\n\t\t\t\t\t\tif (inlineCompletionIsVisible(t, undefined, model, position)) {\n\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// else: inline completion is not visible, so lets not block\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet result: InlineCompletions | null | undefined;\n\t\t\tconst providerStartTime = Date.now();\n\t\t\ttry {\n\t\t\t\tresult = await provider.provideInlineCompletions(model, position, contextWithUuid, cancellationTokenSource.token);\n\t\t\t} catch (e) {\n\t\t\t\tonUnexpectedExternalError(e);\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tconst providerEndTime = Date.now();\n\n\t\t\tif (!result) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst data: InlineSuggestData[] = [];\n\t\t\tconst list = new InlineSuggestionList(result, data, provider);\n\t\t\tlist.addRef();\n\t\t\trunWhenCancelled(cancellationTokenSource.token, () => {\n\t\t\t\treturn list.removeRef(cancelReason);\n\t\t\t});\n\t\t\tif (cancellationTokenSource.token.isCancellationRequested) {\n\t\t\t\treturn undefined; // The list is disposed now, so we cannot return the items!\n\t\t\t}\n\n\t\t\tfor (const item of result.items) {\n\t\t\t\tdata.push(toInlineSuggestData(item, list, defaultReplaceRange, model, languageConfigurationService, contextWithUuid, requestInfo, { startTime: providerStartTime, endTime: providerEndTime }));\n\t\t\t}\n\n\t\t\treturn list;\n\t\t} finally {\n\t\t\trunningCount--;\n\t\t}\n\t});\n\n\tconst inlineCompletionLists = AsyncIterableProducer.fromPromisesResolveOrder(providers.map(p => queryProvider.get(p))).filter(isDefined);\n\n\treturn {\n\t\tcontextWithUuid,\n\t\tget didAllProvidersReturn() { return runningCount === 0; },\n\t\tlists: inlineCompletionLists,\n\t\tcancelAndDispose: reason => {\n\t\t\tif (cancelReason !== undefined) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcancelReason = reason;\n\t\t\tcancellationTokenSource.dispose(true);\n\t\t}\n\t};\n}\n\n/** If the token is eventually cancelled, this will not leak either. */\nexport function runWhenCancelled(token: CancellationToken, callback: () => void): IDisposable {\n\tif (token.isCancellationRequested) {\n\t\tcallback();\n\t\treturn Disposable.None;\n\t} else {\n\t\tconst listener = token.onCancellationRequested(() => {\n\t\t\tlistener.dispose();\n\t\t\tcallback();\n\t\t});\n\t\treturn { dispose: () => listener.dispose() };\n\t}\n}\n\nexport interface IInlineCompletionProviderResult {\n\tget didAllProvidersReturn(): boolean;\n\n\tcontextWithUuid: InlineCompletionContext;\n\n\tcancelAndDispose(reason: InlineCompletionsDisposeReason): void;\n\n\tlists: AsyncIterableProducer<InlineSuggestionList>;\n}\n\nfunction toInlineSuggestData(\n\tinlineCompletion: InlineCompletion,\n\tsource: InlineSuggestionList,\n\tdefaultReplaceRange: Range,\n\ttextModel: ITextModel,\n\tlanguageConfigurationService: ILanguageConfigurationService | undefined,\n\tcontext: InlineCompletionContext,\n\trequestInfo: InlineSuggestRequestInfo,\n\tproviderRequestInfo: InlineSuggestProviderRequestInfo,\n): InlineSuggestData {\n\tlet insertText: string;\n\tlet snippetInfo: SnippetInfo | undefined;\n\tlet range = inlineCompletion.range ? Range.lift(inlineCompletion.range) : defaultReplaceRange;\n\n\tif (typeof inlineCompletion.insertText === 'string') {\n\t\tinsertText = inlineCompletion.insertText;\n\n\t\tif (languageConfigurationService && inlineCompletion.completeBracketPairs) {\n\t\t\tinsertText = closeBrackets(\n\t\t\t\tinsertText,\n\t\t\t\trange.getStartPosition(),\n\t\t\t\ttextModel,\n\t\t\t\tlanguageConfigurationService\n\t\t\t);\n\n\t\t\t// Modify range depending on if brackets are added or removed\n\t\t\tconst diff = insertText.length - inlineCompletion.insertText.length;\n\t\t\tif (diff !== 0) {\n\t\t\t\trange = new Range(range.startLineNumber, range.startColumn, range.endLineNumber, range.endColumn + diff);\n\t\t\t}\n\t\t}\n\n\t\tsnippetInfo = undefined;\n\t} else if ('snippet' in inlineCompletion.insertText) {\n\t\tconst preBracketCompletionLength = inlineCompletion.insertText.snippet.length;\n\n\t\tif (languageConfigurationService && inlineCompletion.completeBracketPairs) {\n\t\t\tinlineCompletion.insertText.snippet = closeBrackets(\n\t\t\t\tinlineCompletion.insertText.snippet,\n\t\t\t\trange.getStartPosition(),\n\t\t\t\ttextModel,\n\t\t\t\tlanguageConfigurationService\n\t\t\t);\n\n\t\t\t// Modify range depending on if brackets are added or removed\n\t\t\tconst diff = inlineCompletion.insertText.snippet.length - preBracketCompletionLength;\n\t\t\tif (diff !== 0) {\n\t\t\t\trange = new Range(range.startLineNumber, range.startColumn, range.endLineNumber, range.endColumn + diff);\n\t\t\t}\n\t\t}\n\n\t\tconst snippet = new SnippetParser().parse(inlineCompletion.insertText.snippet);\n\n\t\tif (snippet.children.length === 1 && snippet.children[0] instanceof Text) {\n\t\t\tinsertText = snippet.children[0].value;\n\t\t\tsnippetInfo = undefined;\n\t\t} else {\n\t\t\tinsertText = snippet.toString();\n\t\t\tsnippetInfo = {\n\t\t\t\tsnippet: inlineCompletion.insertText.snippet,\n\t\t\t\trange: range\n\t\t\t};\n\t\t}\n\t} else {\n\t\tassertNever(inlineCompletion.insertText);\n\t}\n\n\tconst displayLocation = inlineCompletion.displayLocation ? {\n\t\trange: Range.lift(inlineCompletion.displayLocation.range),\n\t\tlabel: inlineCompletion.displayLocation.label,\n\t\tkind: inlineCompletion.displayLocation.kind,\n\t\tjumpToEdit: inlineCompletion.displayLocation.jumpToEdit,\n\t} : undefined;\n\n\treturn new InlineSuggestData(\n\t\trange,\n\t\tinsertText,\n\t\tsnippetInfo,\n\t\tdisplayLocation,\n\t\tinlineCompletion.additionalTextEdits || getReadonlyEmptyArray(),\n\t\tinlineCompletion,\n\t\tsource,\n\t\tcontext,\n\t\tinlineCompletion.isInlineEdit ?? false,\n\t\trequestInfo,\n\t\tproviderRequestInfo,\n\t\tinlineCompletion.correlationId,\n\t);\n}\n\nexport type InlineSuggestRequestInfo = {\n\tstartTime: number;\n\teditorType: InlineCompletionEditorType;\n\tlanguageId: string;\n\treason: string;\n\ttypingInterval: number;\n\ttypingIntervalCharacterCount: number;\n\tavailableProviders: ProviderId[];\n};\n\nexport type InlineSuggestProviderRequestInfo = {\n\tstartTime: number;\n\tendTime: number;\n};\n\nexport type PartialAcceptance = {\n\tcharacters: number;\n\tcount: number;\n\tratio: number;\n};\n\nexport type InlineSuggestViewData = {\n\teditorType: InlineCompletionEditorType;\n\trenderData?: InlineCompletionViewData;\n\tviewKind?: InlineCompletionViewKind;\n\terror?: string;\n};\n\nexport class InlineSuggestData {\n\tprivate _didShow = false;\n\tprivate _timeUntilShown: number | undefined = undefined;\n\tprivate _showStartTime: number | undefined = undefined;\n\tprivate _shownDuration: number = 0;\n\tprivate _showUncollapsedStartTime: number | undefined = undefined;\n\tprivate _showUncollapsedDuration: number = 0;\n\tprivate _notShownReason: string | undefined = undefined;\n\n\tprivate _viewData: InlineSuggestViewData;\n\tprivate _didReportEndOfLife = false;\n\tprivate _lastSetEndOfLifeReason: InlineCompletionEndOfLifeReason | undefined = undefined;\n\tprivate _isPreceeded = false;\n\tprivate _partiallyAcceptedCount = 0;\n\tprivate _partiallyAcceptedSinceOriginal: PartialAcceptance = { characters: 0, ratio: 0, count: 0 };\n\n\tconstructor(\n\t\tpublic readonly range: Range,\n\t\tpublic readonly insertText: string,\n\t\tpublic readonly snippetInfo: SnippetInfo | undefined,\n\t\tpublic readonly displayLocation: IDisplayLocation | undefined,\n\t\tpublic readonly additionalTextEdits: readonly ISingleEditOperation[],\n\n\t\tpublic readonly sourceInlineCompletion: InlineCompletion,\n\t\tpublic readonly source: InlineSuggestionList,\n\t\tpublic readonly context: InlineCompletionContext,\n\t\tpublic readonly isInlineEdit: boolean,\n\n\t\tprivate readonly _requestInfo: InlineSuggestRequestInfo,\n\t\tprivate readonly _providerRequestInfo: InlineSuggestProviderRequestInfo,\n\t\tprivate readonly _correlationId: string | undefined,\n\t) {\n\t\tthis._viewData = { editorType: _requestInfo.editorType };\n\t}\n\n\tpublic get showInlineEditMenu() { return this.sourceInlineCompletion.showInlineEditMenu ?? false; }\n\n\tpublic get partialAccepts(): PartialAcceptance { return this._partiallyAcceptedSinceOriginal; }\n\n\tpublic async reportInlineEditShown(commandService: ICommandService, updatedInsertText: string, viewKind: InlineCompletionViewKind, viewData: InlineCompletionViewData): Promise<void> {\n\t\tthis.updateShownDuration(viewKind);\n\n\t\tif (this._didShow) {\n\t\t\treturn;\n\t\t}\n\t\tthis._didShow = true;\n\t\tthis._viewData.viewKind = viewKind;\n\t\tthis._viewData.renderData = viewData;\n\t\tthis._timeUntilShown = Date.now() - this._requestInfo.startTime;\n\n\t\tconst editDeltaInfo = new EditDeltaInfo(viewData.lineCountModified, viewData.lineCountOriginal, viewData.characterCountModified, viewData.characterCountOriginal);\n\t\tthis.source.provider.handleItemDidShow?.(this.source.inlineSuggestions, this.sourceInlineCompletion, updatedInsertText, editDeltaInfo);\n\n\t\tif (this.sourceInlineCompletion.shownCommand) {\n\t\t\tawait commandService.executeCommand(this.sourceInlineCompletion.shownCommand.id, ...(this.sourceInlineCompletion.shownCommand.arguments || []));\n\t\t}\n\t}\n\n\tpublic reportPartialAccept(acceptedCharacters: number, info: PartialAcceptInfo, partialAcceptance: PartialAcceptance) {\n\t\tthis._partiallyAcceptedCount++;\n\t\tthis._partiallyAcceptedSinceOriginal.characters += partialAcceptance.characters;\n\t\tthis._partiallyAcceptedSinceOriginal.ratio = Math.min(this._partiallyAcceptedSinceOriginal.ratio + (1 - this._partiallyAcceptedSinceOriginal.ratio) * partialAcceptance.ratio, 1);\n\t\tthis._partiallyAcceptedSinceOriginal.count += partialAcceptance.count;\n\n\t\tthis.source.provider.handlePartialAccept?.(\n\t\t\tthis.source.inlineSuggestions,\n\t\t\tthis.sourceInlineCompletion,\n\t\t\tacceptedCharacters,\n\t\t\tinfo\n\t\t);\n\t}\n\n\t/**\n\t * Sends the end of life event to the provider.\n\t * If no reason is provided, the last set reason is used.\n\t * If no reason was set, the default reason is used.\n\t*/\n\tpublic reportEndOfLife(reason?: InlineCompletionEndOfLifeReason): void {\n\t\tif (this._didReportEndOfLife) {\n\t\t\treturn;\n\t\t}\n\t\tthis._didReportEndOfLife = true;\n\t\tthis.reportInlineEditHidden();\n\n\t\tif (!reason) {\n\t\t\treason = this._lastSetEndOfLifeReason ?? { kind: InlineCompletionEndOfLifeReasonKind.Ignored, userTypingDisagreed: false, supersededBy: undefined };\n\t\t}\n\n\t\tif (reason.kind === InlineCompletionEndOfLifeReasonKind.Rejected && this.source.provider.handleRejection) {\n\t\t\tthis.source.provider.handleRejection(this.source.inlineSuggestions, this.sourceInlineCompletion);\n\t\t}\n\n\t\tif (this.source.provider.handleEndOfLifetime) {\n\t\t\tconst summary: LifetimeSummary = {\n\t\t\t\trequestUuid: this.context.requestUuid,\n\t\t\t\tcorrelationId: this._correlationId,\n\t\t\t\tselectedSuggestionInfo: !!this.context.selectedSuggestionInfo,\n\t\t\t\tpartiallyAccepted: this._partiallyAcceptedCount,\n\t\t\t\tpartiallyAcceptedCountSinceOriginal: this._partiallyAcceptedSinceOriginal.count,\n\t\t\t\tpartiallyAcceptedRatioSinceOriginal: this._partiallyAcceptedSinceOriginal.ratio,\n\t\t\t\tpartiallyAcceptedCharactersSinceOriginal: this._partiallyAcceptedSinceOriginal.characters,\n\t\t\t\tshown: this._didShow,\n\t\t\t\tshownDuration: this._shownDuration,\n\t\t\t\tshownDurationUncollapsed: this._showUncollapsedDuration,\n\t\t\t\tpreceeded: this._isPreceeded,\n\t\t\t\ttimeUntilShown: this._timeUntilShown,\n\t\t\t\ttimeUntilProviderRequest: this._providerRequestInfo.startTime - this._requestInfo.startTime,\n\t\t\t\ttimeUntilProviderResponse: this._providerRequestInfo.endTime - this._requestInfo.startTime,\n\t\t\t\teditorType: this._viewData.editorType,\n\t\t\t\tlanguageId: this._requestInfo.languageId,\n\t\t\t\trequestReason: this._requestInfo.reason,\n\t\t\t\tviewKind: this._viewData.viewKind,\n\t\t\t\tnotShownReason: this._notShownReason,\n\t\t\t\terror: this._viewData.error,\n\t\t\t\ttypingInterval: this._requestInfo.typingInterval,\n\t\t\t\ttypingIntervalCharacterCount: this._requestInfo.typingIntervalCharacterCount,\n\t\t\t\tavailableProviders: this._requestInfo.availableProviders.map(p => p.toString()).join(','),\n\t\t\t\t...this._viewData.renderData,\n\t\t\t};\n\t\t\tthis.source.provider.handleEndOfLifetime(this.source.inlineSuggestions, this.sourceInlineCompletion, reason, summary);\n\t\t}\n\t}\n\n\tpublic reportInlineEditError(message: string): void {\n\t\tif (this._viewData.error) {\n\t\t\tthis._viewData.error += `; ${message}`;\n\t\t} else {\n\t\t\tthis._viewData.error = message;\n\t\t}\n\t}\n\n\tpublic setIsPreceeded(partialAccepts: PartialAcceptance): void {\n\t\tthis._isPreceeded = true;\n\n\t\tif (this._partiallyAcceptedSinceOriginal.characters !== 0 || this._partiallyAcceptedSinceOriginal.ratio !== 0 || this._partiallyAcceptedSinceOriginal.count !== 0) {\n\t\t\tconsole.warn('Expected partiallyAcceptedCountSinceOriginal to be { characters: 0, rate: 0, partialAcceptances: 0 } before setIsPreceeded.');\n\t\t}\n\t\tthis._partiallyAcceptedSinceOriginal = partialAccepts;\n\t}\n\n\tpublic setNotShownReason(reason: string): void {\n\t\tthis._notShownReason ??= reason;\n\t}\n\n\t/**\n\t * Sets the end of life reason, but does not send the event to the provider yet.\n\t*/\n\tpublic setEndOfLifeReason(reason: InlineCompletionEndOfLifeReason): void {\n\t\tthis.reportInlineEditHidden();\n\t\tthis._lastSetEndOfLifeReason = reason;\n\t}\n\n\tprivate updateShownDuration(viewKind: InlineCompletionViewKind) {\n\t\tconst timeNow = Date.now();\n\t\tif (!this._showStartTime) {\n\t\t\tthis._showStartTime = timeNow;\n\t\t}\n\n\t\tconst isCollapsed = viewKind === InlineCompletionViewKind.Collapsed;\n\t\tif (!isCollapsed && this._showUncollapsedStartTime === undefined) {\n\t\t\tthis._showUncollapsedStartTime = timeNow;\n\t\t}\n\n\t\tif (isCollapsed && this._showUncollapsedStartTime !== undefined) {\n\t\t\tthis._showUncollapsedDuration += timeNow - this._showUncollapsedStartTime;\n\t\t}\n\t}\n\n\tprivate reportInlineEditHidden() {\n\t\tif (this._showStartTime === undefined) {\n\t\t\treturn;\n\t\t}\n\t\tconst timeNow = Date.now();\n\t\tthis._shownDuration += timeNow - this._showStartTime;\n\t\tthis._showStartTime = undefined;\n\n\t\tif (this._showUncollapsedStartTime === undefined) {\n\t\t\treturn;\n\t\t}\n\t\tthis._showUncollapsedDuration += timeNow - this._showUncollapsedStartTime;\n\t\tthis._showUncollapsedStartTime = undefined;\n\t}\n}\n\nexport interface SnippetInfo {\n\tsnippet: string;\n\t/* Could be different than the main range */\n\trange: Range;\n}\n\nexport interface IDisplayLocation {\n\trange: Range;\n\tlabel: string;\n\tkind: InlineCompletionDisplayLocationKind;\n\tjumpToEdit: boolean;\n}\n\nexport enum InlineCompletionEditorType {\n\tTextEditor = 'textEditor',\n\tDiffEditor = 'diffEditor',\n\tNotebook = 'notebook',\n}\n\n/**\n * A ref counted pointer to the computed `InlineCompletions` and the `InlineCompletionsProvider` that\n * computed them.\n */\nexport class InlineSuggestionList {\n\tprivate refCount = 0;\n\tconstructor(\n\t\tpublic readonly inlineSuggestions: InlineCompletions,\n\t\tpublic readonly inlineSuggestionsData: readonly InlineSuggestData[],\n\t\tpublic readonly provider: InlineCompletionsProvider,\n\t) { }\n\n\taddRef(): void {\n\t\tthis.refCount++;\n\t}\n\n\tremoveRef(reason: InlineCompletionsDisposeReason = { kind: 'other' }): void {\n\t\tthis.refCount--;\n\t\tif (this.refCount === 0) {\n\t\t\tfor (const item of this.inlineSuggestionsData) {\n\t\t\t\t// Fallback if it has not been called before\n\t\t\t\titem.reportEndOfLife();\n\t\t\t}\n\t\t\tthis.provider.disposeInlineCompletions(this.inlineSuggestions, reason);\n\t\t}\n\t}\n}\n\nfunction getDefaultRange(position: Position, model: ITextModel): Range {\n\tconst word = model.getWordAtPosition(position);\n\tconst maxColumn = model.getLineMaxColumn(position.lineNumber);\n\t// By default, always replace up until the end of the current line.\n\t// This default might be subject to change!\n\treturn word\n\t\t? new Range(position.lineNumber, word.startColumn, position.lineNumber, maxColumn)\n\t\t: Range.fromPositions(position, position.with(undefined, maxColumn));\n}\n\nfunction closeBrackets(text: string, position: Position, model: ITextModel, languageConfigurationService: ILanguageConfigurationService): string {\n\tconst currentLine = model.getLineContent(position.lineNumber);\n\tconst edit = StringReplacement.replace(new OffsetRange(position.column - 1, currentLine.length), text);\n\n\tconst proposedLineTokens = model.tokenization.tokenizeLinesAt(position.lineNumber, [edit.replace(currentLine)]);\n\tconst textTokens = proposedLineTokens?.[0].sliceZeroCopy(edit.getRangeAfterReplace());\n\tif (!textTokens) {\n\t\treturn text;\n\t}\n\n\tconst fixedText = fixBracketsInLine(textTokens, languageConfigurationService);\n\treturn fixedText;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/inlineCompletions/browser/model/provideInlineCompletions.ts","vs/editor/contrib/inlineCompletions/browser/model/provideInlineCompletions.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAqB,uBAAuB,EAAE,MAAM,4CAA4C,CAAC;AACxG,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,UAAU,EAAe,MAAM,yCAAyC,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAGlE,OAAO,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAE5E,OAAO,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AAC5E,OAAO,EAAmC,mCAAmC,EAAiM,MAAM,iCAAiC,CAAC;AAGtT,OAAO,EAAE,iBAAiB,EAAE,MAAM,mEAAmE,CAAC;AACtG,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,2CAA2C,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAA4B,wBAAwB,EAAE,MAAM,iDAAiD,CAAC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AC,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC;IAEvG,MAAM,kBAAkB,GAAG,KAAK,CAAC,YAAY,CAAC,eAAe,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAChH,MAAM,UAAU,GAAG,kBAAkB,EAAE,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC;IACtF,IAAI,CAAC,UAAU,EAAE,CAAC;QACjB,OAAO,IAAI,CAAC;IACb,CAAC;IAED,MAAM,SAAS,GAAG,iBAAiB,CAAC,UAAU,EAAE,4BAA4B,CAAC,CAAC;IAC9E,OAAO,SAAS,CAAC;AAClB,CAAC","file":"provideInlineCompletions.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 { assertNever } from '../../../../../base/common/assert.js';\nimport { AsyncIterableProducer } from '../../../../../base/common/async.js';\nimport { CancellationToken, CancellationTokenSource } from '../../../../../base/common/cancellation.js';\nimport { onUnexpectedExternalError } from '../../../../../base/common/errors.js';\nimport { Disposable, IDisposable } from '../../../../../base/common/lifecycle.js';\nimport { prefixedUuid } from '../../../../../base/common/uuid.js';\nimport { ICommandService } from '../../../../../platform/commands/common/commands.js';\nimport { ISingleEditOperation } from '../../../../common/core/editOperation.js';\nimport { StringReplacement } from '../../../../common/core/edits/stringEdit.js';\nimport { OffsetRange } from '../../../../common/core/ranges/offsetRange.js';\nimport { Position } from '../../../../common/core/position.js';\nimport { Range } from '../../../../common/core/range.js';\nimport { TextReplacement } from '../../../../common/core/edits/textEdit.js';\nimport { InlineCompletionEndOfLifeReason, InlineCompletionEndOfLifeReasonKind, InlineCompletion, InlineCompletionContext, InlineCompletions, InlineCompletionsProvider, PartialAcceptInfo, InlineCompletionsDisposeReason, LifetimeSummary, ProviderId, InlineCompletionHint } from '../../../../common/languages.js';\nimport { ILanguageConfigurationService } from '../../../../common/languages/languageConfigurationRegistry.js';\nimport { ITextModel } from '../../../../common/model.js';\nimport { fixBracketsInLine } from '../../../../common/model/bracketPairsTextModelPart/fixBrackets.js';\nimport { SnippetParser, Text } from '../../../snippet/browser/snippetParser.js';\nimport { getReadonlyEmptyArray } from '../utils.js';\nimport { groupByMap } from '../../../../../base/common/collections.js';\nimport { DirectedGraph } from './graph.js';\nimport { CachedFunction } from '../../../../../base/common/cache.js';\nimport { InlineCompletionViewData, InlineCompletionViewKind } from '../view/inlineEdits/inlineEditsViewInterface.js';\nimport { isDefined } from '../../../../../base/common/types.js';\nimport { inlineCompletionIsVisible } from './inlineSuggestionItem.js';\nimport { EditDeltaInfo } from '../../../../common/textModelEditSource.js';\nimport { URI } from '../../../../../base/common/uri.js';\n\nexport type InlineCompletionContextWithoutUuid = Omit<InlineCompletionContext, 'requestUuid'>;\n\nexport function provideInlineCompletions(\n\tproviders: InlineCompletionsProvider[],\n\tposition: Position,\n\tmodel: ITextModel,\n\tcontext: InlineCompletionContextWithoutUuid,\n\trequestInfo: InlineSuggestRequestInfo,\n\tlanguageConfigurationService?: ILanguageConfigurationService,\n): IInlineCompletionProviderResult {\n\tconst requestUuid = prefixedUuid('icr');\n\n\tconst cancellationTokenSource = new CancellationTokenSource();\n\tlet cancelReason: InlineCompletionsDisposeReason | undefined = undefined;\n\n\tconst contextWithUuid: InlineCompletionContext = { ...context, requestUuid: requestUuid };\n\n\tconst defaultReplaceRange = getDefaultRange(position, model);\n\n\tconst providersByGroupId = groupByMap(providers, p => p.groupId);\n\tconst yieldsToGraph = DirectedGraph.from(providers, p => {\n\t\treturn p.yieldsToGroupIds?.flatMap(groupId => providersByGroupId.get(groupId) ?? []) ?? [];\n\t});\n\tconst { foundCycles } = yieldsToGraph.removeCycles();\n\tif (foundCycles.length > 0) {\n\t\tonUnexpectedExternalError(new Error(`Inline completions: cyclic yield-to dependency detected.`\n\t\t\t+ ` Path: ${foundCycles.map(s => s.toString ? s.toString() : ('' + s)).join(' -> ')}`));\n\t}\n\n\tlet runningCount = 0;\n\n\tconst queryProvider = new CachedFunction(async (provider: InlineCompletionsProvider<InlineCompletions>): Promise<InlineSuggestionList | undefined> => {\n\t\ttry {\n\t\t\trunningCount++;\n\t\t\tif (cancellationTokenSource.token.isCancellationRequested) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst yieldsTo = yieldsToGraph.getOutgoing(provider);\n\t\t\tfor (const p of yieldsTo) {\n\t\t\t\t// We know there is no cycle, so no recursion here\n\t\t\t\tconst result = await queryProvider.get(p);\n\t\t\t\tif (result) {\n\t\t\t\t\tfor (const item of result.inlineSuggestions.items) {\n\t\t\t\t\t\tif (item.isInlineEdit || typeof item.insertText !== 'string' && item.insertText !== undefined) {\n\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (item.insertText !== undefined) {\n\t\t\t\t\t\t\tconst t = new TextReplacement(Range.lift(item.range) ?? defaultReplaceRange, item.insertText);\n\t\t\t\t\t\t\tif (inlineCompletionIsVisible(t, undefined, model, position)) {\n\t\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// else: inline completion is not visible, so lets not block\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet result: InlineCompletions | null | undefined;\n\t\t\tconst providerStartTime = Date.now();\n\t\t\ttry {\n\t\t\t\tresult = await provider.provideInlineCompletions(model, position, contextWithUuid, cancellationTokenSource.token);\n\t\t\t} catch (e) {\n\t\t\t\tonUnexpectedExternalError(e);\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tconst providerEndTime = Date.now();\n\n\t\t\tif (!result) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst data: InlineSuggestData[] = [];\n\t\t\tconst list = new InlineSuggestionList(result, data, provider);\n\t\t\tlist.addRef();\n\t\t\trunWhenCancelled(cancellationTokenSource.token, () => {\n\t\t\t\treturn list.removeRef(cancelReason);\n\t\t\t});\n\t\t\tif (cancellationTokenSource.token.isCancellationRequested) {\n\t\t\t\treturn undefined; // The list is disposed now, so we cannot return the items!\n\t\t\t}\n\n\t\t\tfor (const item of result.items) {\n\t\t\t\tdata.push(toInlineSuggestData(item, list, defaultReplaceRange, model, languageConfigurationService, contextWithUuid, requestInfo, { startTime: providerStartTime, endTime: providerEndTime }));\n\t\t\t}\n\n\t\t\treturn list;\n\t\t} finally {\n\t\t\trunningCount--;\n\t\t}\n\t});\n\n\tconst inlineCompletionLists = AsyncIterableProducer.fromPromisesResolveOrder(providers.map(p => queryProvider.get(p))).filter(isDefined);\n\n\treturn {\n\t\tcontextWithUuid,\n\t\tget didAllProvidersReturn() { return runningCount === 0; },\n\t\tlists: inlineCompletionLists,\n\t\tcancelAndDispose: reason => {\n\t\t\tif (cancelReason !== undefined) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcancelReason = reason;\n\t\t\tcancellationTokenSource.dispose(true);\n\t\t}\n\t};\n}\n\n/** If the token is eventually cancelled, this will not leak either. */\nexport function runWhenCancelled(token: CancellationToken, callback: () => void): IDisposable {\n\tif (token.isCancellationRequested) {\n\t\tcallback();\n\t\treturn Disposable.None;\n\t} else {\n\t\tconst listener = token.onCancellationRequested(() => {\n\t\t\tlistener.dispose();\n\t\t\tcallback();\n\t\t});\n\t\treturn { dispose: () => listener.dispose() };\n\t}\n}\n\nexport interface IInlineCompletionProviderResult {\n\tget didAllProvidersReturn(): boolean;\n\n\tcontextWithUuid: InlineCompletionContext;\n\n\tcancelAndDispose(reason: InlineCompletionsDisposeReason): void;\n\n\tlists: AsyncIterableProducer<InlineSuggestionList>;\n}\n\nfunction toInlineSuggestData(\n\tinlineCompletion: InlineCompletion,\n\tsource: InlineSuggestionList,\n\tdefaultReplaceRange: Range,\n\ttextModel: ITextModel,\n\tlanguageConfigurationService: ILanguageConfigurationService | undefined,\n\tcontext: InlineCompletionContext,\n\trequestInfo: InlineSuggestRequestInfo,\n\tproviderRequestInfo: InlineSuggestProviderRequestInfo,\n): InlineSuggestData {\n\tlet insertText: string;\n\tlet snippetInfo: SnippetInfo | undefined;\n\tlet range = inlineCompletion.range ? Range.lift(inlineCompletion.range) : defaultReplaceRange;\n\n\tif (typeof inlineCompletion.insertText === 'string') {\n\t\tinsertText = inlineCompletion.insertText;\n\n\t\tif (languageConfigurationService && inlineCompletion.completeBracketPairs) {\n\t\t\tinsertText = closeBrackets(\n\t\t\t\tinsertText,\n\t\t\t\trange.getStartPosition(),\n\t\t\t\ttextModel,\n\t\t\t\tlanguageConfigurationService\n\t\t\t);\n\n\t\t\t// Modify range depending on if brackets are added or removed\n\t\t\tconst diff = insertText.length - inlineCompletion.insertText.length;\n\t\t\tif (diff !== 0) {\n\t\t\t\trange = new Range(range.startLineNumber, range.startColumn, range.endLineNumber, range.endColumn + diff);\n\t\t\t}\n\t\t}\n\n\t\tsnippetInfo = undefined;\n\t} else if (inlineCompletion.insertText === undefined) {\n\t\tinsertText = ''; // TODO use undefined\n\t\tsnippetInfo = undefined;\n\t\trange = new Range(1, 1, 1, 1);\n\t} else if ('snippet' in inlineCompletion.insertText) {\n\t\tconst preBracketCompletionLength = inlineCompletion.insertText.snippet.length;\n\n\t\tif (languageConfigurationService && inlineCompletion.completeBracketPairs) {\n\t\t\tinlineCompletion.insertText.snippet = closeBrackets(\n\t\t\t\tinlineCompletion.insertText.snippet,\n\t\t\t\trange.getStartPosition(),\n\t\t\t\ttextModel,\n\t\t\t\tlanguageConfigurationService\n\t\t\t);\n\n\t\t\t// Modify range depending on if brackets are added or removed\n\t\t\tconst diff = inlineCompletion.insertText.snippet.length - preBracketCompletionLength;\n\t\t\tif (diff !== 0) {\n\t\t\t\trange = new Range(range.startLineNumber, range.startColumn, range.endLineNumber, range.endColumn + diff);\n\t\t\t}\n\t\t}\n\n\t\tconst snippet = new SnippetParser().parse(inlineCompletion.insertText.snippet);\n\n\t\tif (snippet.children.length === 1 && snippet.children[0] instanceof Text) {\n\t\t\tinsertText = snippet.children[0].value;\n\t\t\tsnippetInfo = undefined;\n\t\t} else {\n\t\t\tinsertText = snippet.toString();\n\t\t\tsnippetInfo = {\n\t\t\t\tsnippet: inlineCompletion.insertText.snippet,\n\t\t\t\trange: range\n\t\t\t};\n\t\t}\n\t} else {\n\t\tassertNever(inlineCompletion.insertText);\n\t}\n\n\treturn new InlineSuggestData(\n\t\trange,\n\t\tinsertText,\n\t\tsnippetInfo,\n\t\tURI.revive(inlineCompletion.uri),\n\t\tinlineCompletion.hint,\n\t\tinlineCompletion.additionalTextEdits || getReadonlyEmptyArray(),\n\t\tinlineCompletion,\n\t\tsource,\n\t\tcontext,\n\t\tinlineCompletion.isInlineEdit ?? false,\n\t\trequestInfo,\n\t\tproviderRequestInfo,\n\t\tinlineCompletion.correlationId,\n\t);\n}\n\nexport type InlineSuggestRequestInfo = {\n\tstartTime: number;\n\teditorType: InlineCompletionEditorType;\n\tlanguageId: string;\n\treason: string;\n\ttypingInterval: number;\n\ttypingIntervalCharacterCount: number;\n\tavailableProviders: ProviderId[];\n};\n\nexport type InlineSuggestProviderRequestInfo = {\n\tstartTime: number;\n\tendTime: number;\n};\n\nexport type PartialAcceptance = {\n\tcharacters: number;\n\tcount: number;\n\tratio: number;\n};\n\nexport type InlineSuggestViewData = {\n\teditorType: InlineCompletionEditorType;\n\trenderData?: InlineCompletionViewData;\n\tviewKind?: InlineCompletionViewKind;\n};\n\nexport class InlineSuggestData {\n\tprivate _didShow = false;\n\tprivate _timeUntilShown: number | undefined = undefined;\n\tprivate _showStartTime: number | undefined = undefined;\n\tprivate _shownDuration: number = 0;\n\tprivate _showUncollapsedStartTime: number | undefined = undefined;\n\tprivate _showUncollapsedDuration: number = 0;\n\tprivate _notShownReason: string | undefined = undefined;\n\n\tprivate _viewData: InlineSuggestViewData;\n\tprivate _didReportEndOfLife = false;\n\tprivate _lastSetEndOfLifeReason: InlineCompletionEndOfLifeReason | undefined = undefined;\n\tprivate _isPreceeded = false;\n\tprivate _partiallyAcceptedCount = 0;\n\tprivate _partiallyAcceptedSinceOriginal: PartialAcceptance = { characters: 0, ratio: 0, count: 0 };\n\n\tconstructor(\n\t\tpublic readonly range: Range,\n\t\tpublic readonly insertText: string,\n\t\tpublic readonly snippetInfo: SnippetInfo | undefined,\n\t\tpublic readonly uri: URI | undefined,\n\t\tpublic readonly hint: InlineCompletionHint | undefined,\n\t\tpublic readonly additionalTextEdits: readonly ISingleEditOperation[],\n\n\t\tpublic readonly sourceInlineCompletion: InlineCompletion,\n\t\tpublic readonly source: InlineSuggestionList,\n\t\tpublic readonly context: InlineCompletionContext,\n\t\tpublic readonly isInlineEdit: boolean,\n\n\t\tprivate readonly _requestInfo: InlineSuggestRequestInfo,\n\t\tprivate readonly _providerRequestInfo: InlineSuggestProviderRequestInfo,\n\t\tprivate readonly _correlationId: string | undefined,\n\t) {\n\t\tthis._viewData = { editorType: _requestInfo.editorType };\n\t}\n\n\tpublic get showInlineEditMenu() { return this.sourceInlineCompletion.showInlineEditMenu ?? false; }\n\n\tpublic get partialAccepts(): PartialAcceptance { return this._partiallyAcceptedSinceOriginal; }\n\n\tpublic async reportInlineEditShown(commandService: ICommandService, updatedInsertText: string, viewKind: InlineCompletionViewKind, viewData: InlineCompletionViewData): Promise<void> {\n\t\tthis.updateShownDuration(viewKind);\n\n\t\tif (this._didShow) {\n\t\t\treturn;\n\t\t}\n\t\tthis._didShow = true;\n\t\tthis._viewData.viewKind = viewKind;\n\t\tthis._viewData.renderData = viewData;\n\t\tthis._timeUntilShown = Date.now() - this._requestInfo.startTime;\n\n\t\tconst editDeltaInfo = new EditDeltaInfo(viewData.lineCountModified, viewData.lineCountOriginal, viewData.characterCountModified, viewData.characterCountOriginal);\n\t\tthis.source.provider.handleItemDidShow?.(this.source.inlineSuggestions, this.sourceInlineCompletion, updatedInsertText, editDeltaInfo);\n\n\t\tif (this.sourceInlineCompletion.shownCommand) {\n\t\t\tawait commandService.executeCommand(this.sourceInlineCompletion.shownCommand.id, ...(this.sourceInlineCompletion.shownCommand.arguments || []));\n\t\t}\n\t}\n\n\tpublic reportPartialAccept(acceptedCharacters: number, info: PartialAcceptInfo, partialAcceptance: PartialAcceptance) {\n\t\tthis._partiallyAcceptedCount++;\n\t\tthis._partiallyAcceptedSinceOriginal.characters += partialAcceptance.characters;\n\t\tthis._partiallyAcceptedSinceOriginal.ratio = Math.min(this._partiallyAcceptedSinceOriginal.ratio + (1 - this._partiallyAcceptedSinceOriginal.ratio) * partialAcceptance.ratio, 1);\n\t\tthis._partiallyAcceptedSinceOriginal.count += partialAcceptance.count;\n\n\t\tthis.source.provider.handlePartialAccept?.(\n\t\t\tthis.source.inlineSuggestions,\n\t\t\tthis.sourceInlineCompletion,\n\t\t\tacceptedCharacters,\n\t\t\tinfo\n\t\t);\n\t}\n\n\t/**\n\t * Sends the end of life event to the provider.\n\t * If no reason is provided, the last set reason is used.\n\t * If no reason was set, the default reason is used.\n\t*/\n\tpublic reportEndOfLife(reason?: InlineCompletionEndOfLifeReason): void {\n\t\tif (this._didReportEndOfLife) {\n\t\t\treturn;\n\t\t}\n\t\tthis._didReportEndOfLife = true;\n\t\tthis.reportInlineEditHidden();\n\n\t\tif (!reason) {\n\t\t\treason = this._lastSetEndOfLifeReason ?? { kind: InlineCompletionEndOfLifeReasonKind.Ignored, userTypingDisagreed: false, supersededBy: undefined };\n\t\t}\n\n\t\tif (reason.kind === InlineCompletionEndOfLifeReasonKind.Rejected && this.source.provider.handleRejection) {\n\t\t\tthis.source.provider.handleRejection(this.source.inlineSuggestions, this.sourceInlineCompletion);\n\t\t}\n\n\t\tif (this.source.provider.handleEndOfLifetime) {\n\t\t\tconst summary: LifetimeSummary = {\n\t\t\t\trequestUuid: this.context.requestUuid,\n\t\t\t\tcorrelationId: this._correlationId,\n\t\t\t\tselectedSuggestionInfo: !!this.context.selectedSuggestionInfo,\n\t\t\t\tpartiallyAccepted: this._partiallyAcceptedCount,\n\t\t\t\tpartiallyAcceptedCountSinceOriginal: this._partiallyAcceptedSinceOriginal.count,\n\t\t\t\tpartiallyAcceptedRatioSinceOriginal: this._partiallyAcceptedSinceOriginal.ratio,\n\t\t\t\tpartiallyAcceptedCharactersSinceOriginal: this._partiallyAcceptedSinceOriginal.characters,\n\t\t\t\tshown: this._didShow,\n\t\t\t\tshownDuration: this._shownDuration,\n\t\t\t\tshownDurationUncollapsed: this._showUncollapsedDuration,\n\t\t\t\tpreceeded: this._isPreceeded,\n\t\t\t\ttimeUntilShown: this._timeUntilShown,\n\t\t\t\ttimeUntilProviderRequest: this._providerRequestInfo.startTime - this._requestInfo.startTime,\n\t\t\t\ttimeUntilProviderResponse: this._providerRequestInfo.endTime - this._requestInfo.startTime,\n\t\t\t\teditorType: this._viewData.editorType,\n\t\t\t\tlanguageId: this._requestInfo.languageId,\n\t\t\t\trequestReason: this._requestInfo.reason,\n\t\t\t\tviewKind: this._viewData.viewKind,\n\t\t\t\tnotShownReason: this._notShownReason,\n\t\t\t\ttypingInterval: this._requestInfo.typingInterval,\n\t\t\t\ttypingIntervalCharacterCount: this._requestInfo.typingIntervalCharacterCount,\n\t\t\t\tavailableProviders: this._requestInfo.availableProviders.map(p => p.toString()).join(','),\n\t\t\t\t...this._viewData.renderData,\n\t\t\t};\n\t\t\tthis.source.provider.handleEndOfLifetime(this.source.inlineSuggestions, this.sourceInlineCompletion, reason, summary);\n\t\t}\n\t}\n\n\tpublic setIsPreceeded(partialAccepts: PartialAcceptance): void {\n\t\tthis._isPreceeded = true;\n\n\t\tif (this._partiallyAcceptedSinceOriginal.characters !== 0 || this._partiallyAcceptedSinceOriginal.ratio !== 0 || this._partiallyAcceptedSinceOriginal.count !== 0) {\n\t\t\tconsole.warn('Expected partiallyAcceptedCountSinceOriginal to be { characters: 0, rate: 0, partialAcceptances: 0 } before setIsPreceeded.');\n\t\t}\n\t\tthis._partiallyAcceptedSinceOriginal = partialAccepts;\n\t}\n\n\tpublic setNotShownReason(reason: string): void {\n\t\tthis._notShownReason ??= reason;\n\t}\n\n\t/**\n\t * Sets the end of life reason, but does not send the event to the provider yet.\n\t*/\n\tpublic setEndOfLifeReason(reason: InlineCompletionEndOfLifeReason): void {\n\t\tthis.reportInlineEditHidden();\n\t\tthis._lastSetEndOfLifeReason = reason;\n\t}\n\n\tprivate updateShownDuration(viewKind: InlineCompletionViewKind) {\n\t\tconst timeNow = Date.now();\n\t\tif (!this._showStartTime) {\n\t\t\tthis._showStartTime = timeNow;\n\t\t}\n\n\t\tconst isCollapsed = viewKind === InlineCompletionViewKind.Collapsed;\n\t\tif (!isCollapsed && this._showUncollapsedStartTime === undefined) {\n\t\t\tthis._showUncollapsedStartTime = timeNow;\n\t\t}\n\n\t\tif (isCollapsed && this._showUncollapsedStartTime !== undefined) {\n\t\t\tthis._showUncollapsedDuration += timeNow - this._showUncollapsedStartTime;\n\t\t}\n\t}\n\n\tprivate reportInlineEditHidden() {\n\t\tif (this._showStartTime === undefined) {\n\t\t\treturn;\n\t\t}\n\t\tconst timeNow = Date.now();\n\t\tthis._shownDuration += timeNow - this._showStartTime;\n\t\tthis._showStartTime = undefined;\n\n\t\tif (this._showUncollapsedStartTime === undefined) {\n\t\t\treturn;\n\t\t}\n\t\tthis._showUncollapsedDuration += timeNow - this._showUncollapsedStartTime;\n\t\tthis._showUncollapsedStartTime = undefined;\n\t}\n}\n\nexport interface SnippetInfo {\n\tsnippet: string;\n\t/* Could be different than the main range */\n\trange: Range;\n}\n\nexport enum InlineCompletionEditorType {\n\tTextEditor = 'textEditor',\n\tDiffEditor = 'diffEditor',\n\tNotebook = 'notebook',\n}\n\n/**\n * A ref counted pointer to the computed `InlineCompletions` and the `InlineCompletionsProvider` that\n * computed them.\n */\nexport class InlineSuggestionList {\n\tprivate refCount = 0;\n\tconstructor(\n\t\tpublic readonly inlineSuggestions: InlineCompletions,\n\t\tpublic readonly inlineSuggestionsData: readonly InlineSuggestData[],\n\t\tpublic readonly provider: InlineCompletionsProvider,\n\t) { }\n\n\taddRef(): void {\n\t\tthis.refCount++;\n\t}\n\n\tremoveRef(reason: InlineCompletionsDisposeReason = { kind: 'other' }): void {\n\t\tthis.refCount--;\n\t\tif (this.refCount === 0) {\n\t\t\tfor (const item of this.inlineSuggestionsData) {\n\t\t\t\t// Fallback if it has not been called before\n\t\t\t\titem.reportEndOfLife();\n\t\t\t}\n\t\t\tthis.provider.disposeInlineCompletions(this.inlineSuggestions, reason);\n\t\t}\n\t}\n}\n\nfunction getDefaultRange(position: Position, model: ITextModel): Range {\n\tconst word = model.getWordAtPosition(position);\n\tconst maxColumn = model.getLineMaxColumn(position.lineNumber);\n\t// By default, always replace up until the end of the current line.\n\t// This default might be subject to change!\n\treturn word\n\t\t? new Range(position.lineNumber, word.startColumn, position.lineNumber, maxColumn)\n\t\t: Range.fromPositions(position, position.with(undefined, maxColumn));\n}\n\nfunction closeBrackets(text: string, position: Position, model: ITextModel, languageConfigurationService: ILanguageConfigurationService): string {\n\tconst currentLine = model.getLineContent(position.lineNumber);\n\tconst edit = StringReplacement.replace(new OffsetRange(position.column - 1, currentLine.length), text);\n\n\tconst proposedLineTokens = model.tokenization.tokenizeLinesAt(position.lineNumber, [edit.replace(currentLine)]);\n\tconst textTokens = proposedLineTokens?.[0].sliceZeroCopy(edit.getRangeAfterReplace());\n\tif (!textTokens) {\n\t\treturn text;\n\t}\n\n\tconst fixedText = fixBracketsInLine(textTokens, languageConfigurationService);\n\treturn fixedText;\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 { assertNever } from '../../../../../base/common/assert.js';\nimport { AsyncIterableProducer } from '../../../../../base/common/async.js';\nimport { CancellationToken, CancellationTokenSource } from '../../../../../base/common/cancellation.js';\nimport { onUnexpectedExternalError } from '../../../../../base/common/errors.js';\nimport { Disposable, IDisposable } from '../../../../../base/common/lifecycle.js';\nimport { prefixedUuid } from '../../../../../base/common/uuid.js';\nimport { ICommandService } from '../../../../../platform/commands/common/commands.js';\nimport { ISingleEditOperation } from '../../../../common/core/editOperation.js';\nimport { StringReplacement } from '../../../../common/core/edits/stringEdit.js';\nimport { OffsetRange } from '../../../../common/core/ranges/offsetRange.js';\nimport { Position } from '../../../../common/core/position.js';\nimport { Range } from '../../../../common/core/range.js';\nimport { TextReplacement } from '../../../../common/core/edits/textEdit.js';\nimport { InlineCompletionEndOfLifeReason, InlineCompletionEndOfLifeReasonKind, InlineCompletion, InlineCompletionContext, InlineCompletions, InlineCompletionsProvider, PartialAcceptInfo, InlineCompletionsDisposeReason, LifetimeSummary, ProviderId, InlineCompletionHint } from '../../../../common/languages.js';\nimport { ILanguageConfigurationService } from '../../../../common/languages/languageConfigurationRegistry.js';\nimport { ITextModel } from '../../../../common/model.js';\nimport { fixBracketsInLine } from '../../../../common/model/bracketPairsTextModelPart/fixBrackets.js';\nimport { SnippetParser, Text } from '../../../snippet/browser/snippetParser.js';\nimport { getReadonlyEmptyArray } from '../utils.js';\nimport { groupByMap } from '../../../../../base/common/collections.js';\nimport { DirectedGraph } from './graph.js';\nimport { CachedFunction } from '../../../../../base/common/cache.js';\nimport { InlineCompletionViewData, InlineCompletionViewKind } from '../view/inlineEdits/inlineEditsViewInterface.js';\nimport { isDefined } from '../../../../../base/common/types.js';\nimport { inlineCompletionIsVisible } from './inlineSuggestionItem.js';\nimport { EditDeltaInfo } from '../../../../common/textModelEditSource.js';\nimport { URI } from '../../../../../base/common/uri.js';\n\nexport type InlineCompletionContextWithoutUuid = Omit<InlineCompletionContext, 'requestUuid'>;\n\nexport function provideInlineCompletions(\n\tproviders: InlineCompletionsProvider[],\n\tposition: Position,\n\tmodel: ITextModel,\n\tcontext: InlineCompletionContextWithoutUuid,\n\trequestInfo: InlineSuggestRequestInfo,\n\tlanguageConfigurationService?: ILanguageConfigurationService,\n): IInlineCompletionProviderResult {\n\tconst requestUuid = prefixedUuid('icr');\n\n\tconst cancellationTokenSource = new CancellationTokenSource();\n\tlet cancelReason: InlineCompletionsDisposeReason | undefined = undefined;\n\n\tconst contextWithUuid: InlineCompletionContext = { ...context, requestUuid: requestUuid };\n\n\tconst defaultReplaceRange = getDefaultRange(position, model);\n\n\tconst providersByGroupId = groupByMap(providers, p => p.groupId);\n\tconst yieldsToGraph = DirectedGraph.from(providers, p => {\n\t\treturn p.yieldsToGroupIds?.flatMap(groupId => providersByGroupId.get(groupId) ?? []) ?? [];\n\t});\n\tconst { foundCycles } = yieldsToGraph.removeCycles();\n\tif (foundCycles.length > 0) {\n\t\tonUnexpectedExternalError(new Error(`Inline completions: cyclic yield-to dependency detected.`\n\t\t\t+ ` Path: ${foundCycles.map(s => s.toString ? s.toString() : ('' + s)).join(' -> ')}`));\n\t}\n\n\tlet runningCount = 0;\n\n\tconst queryProvider = new CachedFunction(async (provider: InlineCompletionsProvider<InlineCompletions>): Promise<InlineSuggestionList | undefined> => {\n\t\ttry {\n\t\t\trunningCount++;\n\t\t\tif (cancellationTokenSource.token.isCancellationRequested) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst yieldsTo = yieldsToGraph.getOutgoing(provider);\n\t\t\tfor (const p of yieldsTo) {\n\t\t\t\t// We know there is no cycle, so no recursion here\n\t\t\t\tconst result = await queryProvider.get(p);\n\t\t\t\tif (result) {\n\t\t\t\t\tfor (const item of result.inlineSuggestions.items) {\n\t\t\t\t\t\tif (item.isInlineEdit || typeof item.insertText !== 'string' && item.insertText !== undefined) {\n\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (item.insertText !== undefined) {\n\t\t\t\t\t\t\tconst t = new TextReplacement(Range.lift(item.range) ?? defaultReplaceRange, item.insertText);\n\t\t\t\t\t\t\tif (inlineCompletionIsVisible(t, undefined, model, position)) {\n\t\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// else: inline completion is not visible, so lets not block\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet result: InlineCompletions | null | undefined;\n\t\t\tconst providerStartTime = Date.now();\n\t\t\ttry {\n\t\t\t\tresult = await provider.provideInlineCompletions(model, position, contextWithUuid, cancellationTokenSource.token);\n\t\t\t} catch (e) {\n\t\t\t\tonUnexpectedExternalError(e);\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tconst providerEndTime = Date.now();\n\n\t\t\tif (!result) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst data: InlineSuggestData[] = [];\n\t\t\tconst list = new InlineSuggestionList(result, data, provider);\n\t\t\tlist.addRef();\n\t\t\trunWhenCancelled(cancellationTokenSource.token, () => {\n\t\t\t\treturn list.removeRef(cancelReason);\n\t\t\t});\n\t\t\tif (cancellationTokenSource.token.isCancellationRequested) {\n\t\t\t\treturn undefined; // The list is disposed now, so we cannot return the items!\n\t\t\t}\n\n\t\t\tfor (const item of result.items) {\n\t\t\t\tdata.push(toInlineSuggestData(item, list, defaultReplaceRange, model, languageConfigurationService, contextWithUuid, requestInfo, { startTime: providerStartTime, endTime: providerEndTime }));\n\t\t\t}\n\n\t\t\treturn list;\n\t\t} finally {\n\t\t\trunningCount--;\n\t\t}\n\t});\n\n\tconst inlineCompletionLists = AsyncIterableProducer.fromPromisesResolveOrder(providers.map(p => queryProvider.get(p))).filter(isDefined);\n\n\treturn {\n\t\tcontextWithUuid,\n\t\tget didAllProvidersReturn() { return runningCount === 0; },\n\t\tlists: inlineCompletionLists,\n\t\tcancelAndDispose: reason => {\n\t\t\tif (cancelReason !== undefined) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcancelReason = reason;\n\t\t\tcancellationTokenSource.dispose(true);\n\t\t}\n\t};\n}\n\n/** If the token is eventually cancelled, this will not leak either. */\nexport function runWhenCancelled(token: CancellationToken, callback: () => void): IDisposable {\n\tif (token.isCancellationRequested) {\n\t\tcallback();\n\t\treturn Disposable.None;\n\t} else {\n\t\tconst listener = token.onCancellationRequested(() => {\n\t\t\tlistener.dispose();\n\t\t\tcallback();\n\t\t});\n\t\treturn { dispose: () => listener.dispose() };\n\t}\n}\n\nexport interface IInlineCompletionProviderResult {\n\tget didAllProvidersReturn(): boolean;\n\n\tcontextWithUuid: InlineCompletionContext;\n\n\tcancelAndDispose(reason: InlineCompletionsDisposeReason): void;\n\n\tlists: AsyncIterableProducer<InlineSuggestionList>;\n}\n\nfunction toInlineSuggestData(\n\tinlineCompletion: InlineCompletion,\n\tsource: InlineSuggestionList,\n\tdefaultReplaceRange: Range,\n\ttextModel: ITextModel,\n\tlanguageConfigurationService: ILanguageConfigurationService | undefined,\n\tcontext: InlineCompletionContext,\n\trequestInfo: InlineSuggestRequestInfo,\n\tproviderRequestInfo: InlineSuggestProviderRequestInfo,\n): InlineSuggestData {\n\tlet insertText: string;\n\tlet snippetInfo: SnippetInfo | undefined;\n\tlet range = inlineCompletion.range ? Range.lift(inlineCompletion.range) : defaultReplaceRange;\n\n\tif (typeof inlineCompletion.insertText === 'string') {\n\t\tinsertText = inlineCompletion.insertText;\n\n\t\tif (languageConfigurationService && inlineCompletion.completeBracketPairs) {\n\t\t\tinsertText = closeBrackets(\n\t\t\t\tinsertText,\n\t\t\t\trange.getStartPosition(),\n\t\t\t\ttextModel,\n\t\t\t\tlanguageConfigurationService\n\t\t\t);\n\n\t\t\t// Modify range depending on if brackets are added or removed\n\t\t\tconst diff = insertText.length - inlineCompletion.insertText.length;\n\t\t\tif (diff !== 0) {\n\t\t\t\trange = new Range(range.startLineNumber, range.startColumn, range.endLineNumber, range.endColumn + diff);\n\t\t\t}\n\t\t}\n\n\t\tsnippetInfo = undefined;\n\t} else if (inlineCompletion.insertText === undefined) {\n\t\tinsertText = ''; // TODO use undefined\n\t\tsnippetInfo = undefined;\n\t\trange = new Range(1, 1, 1, 1);\n\t} else if ('snippet' in inlineCompletion.insertText) {\n\t\tconst preBracketCompletionLength = inlineCompletion.insertText.snippet.length;\n\n\t\tif (languageConfigurationService && inlineCompletion.completeBracketPairs) {\n\t\t\tinlineCompletion.insertText.snippet = closeBrackets(\n\t\t\t\tinlineCompletion.insertText.snippet,\n\t\t\t\trange.getStartPosition(),\n\t\t\t\ttextModel,\n\t\t\t\tlanguageConfigurationService\n\t\t\t);\n\n\t\t\t// Modify range depending on if brackets are added or removed\n\t\t\tconst diff = inlineCompletion.insertText.snippet.length - preBracketCompletionLength;\n\t\t\tif (diff !== 0) {\n\t\t\t\trange = new Range(range.startLineNumber, range.startColumn, range.endLineNumber, range.endColumn + diff);\n\t\t\t}\n\t\t}\n\n\t\tconst snippet = new SnippetParser().parse(inlineCompletion.insertText.snippet);\n\n\t\tif (snippet.children.length === 1 && snippet.children[0] instanceof Text) {\n\t\t\tinsertText = snippet.children[0].value;\n\t\t\tsnippetInfo = undefined;\n\t\t} else {\n\t\t\tinsertText = snippet.toString();\n\t\t\tsnippetInfo = {\n\t\t\t\tsnippet: inlineCompletion.insertText.snippet,\n\t\t\t\trange: range\n\t\t\t};\n\t\t}\n\t} else {\n\t\tassertNever(inlineCompletion.insertText);\n\t}\n\n\treturn new InlineSuggestData(\n\t\trange,\n\t\tinsertText,\n\t\tsnippetInfo,\n\t\tURI.revive(inlineCompletion.uri),\n\t\tinlineCompletion.hint,\n\t\tinlineCompletion.additionalTextEdits || getReadonlyEmptyArray(),\n\t\tinlineCompletion,\n\t\tsource,\n\t\tcontext,\n\t\tinlineCompletion.isInlineEdit ?? false,\n\t\trequestInfo,\n\t\tproviderRequestInfo,\n\t\tinlineCompletion.correlationId,\n\t);\n}\n\nexport type InlineSuggestRequestInfo = {\n\tstartTime: number;\n\teditorType: InlineCompletionEditorType;\n\tlanguageId: string;\n\treason: string;\n\ttypingInterval: number;\n\ttypingIntervalCharacterCount: number;\n\tavailableProviders: ProviderId[];\n};\n\nexport type InlineSuggestProviderRequestInfo = {\n\tstartTime: number;\n\tendTime: number;\n};\n\nexport type PartialAcceptance = {\n\tcharacters: number;\n\tcount: number;\n\tratio: number;\n};\n\nexport type InlineSuggestViewData = {\n\teditorType: InlineCompletionEditorType;\n\trenderData?: InlineCompletionViewData;\n\tviewKind?: InlineCompletionViewKind;\n};\n\nexport class InlineSuggestData {\n\tprivate _didShow = false;\n\tprivate _timeUntilShown: number | undefined = undefined;\n\tprivate _showStartTime: number | undefined = undefined;\n\tprivate _shownDuration: number = 0;\n\tprivate _showUncollapsedStartTime: number | undefined = undefined;\n\tprivate _showUncollapsedDuration: number = 0;\n\tprivate _notShownReason: string | undefined = undefined;\n\n\tprivate _viewData: InlineSuggestViewData;\n\tprivate _didReportEndOfLife = false;\n\tprivate _lastSetEndOfLifeReason: InlineCompletionEndOfLifeReason | undefined = undefined;\n\tprivate _isPreceeded = false;\n\tprivate _partiallyAcceptedCount = 0;\n\tprivate _partiallyAcceptedSinceOriginal: PartialAcceptance = { characters: 0, ratio: 0, count: 0 };\n\n\tconstructor(\n\t\tpublic readonly range: Range,\n\t\tpublic readonly insertText: string,\n\t\tpublic readonly snippetInfo: SnippetInfo | undefined,\n\t\tpublic readonly uri: URI | undefined,\n\t\tpublic readonly hint: InlineCompletionHint | undefined,\n\t\tpublic readonly additionalTextEdits: readonly ISingleEditOperation[],\n\n\t\tpublic readonly sourceInlineCompletion: InlineCompletion,\n\t\tpublic readonly source: InlineSuggestionList,\n\t\tpublic readonly context: InlineCompletionContext,\n\t\tpublic readonly isInlineEdit: boolean,\n\n\t\tprivate readonly _requestInfo: InlineSuggestRequestInfo,\n\t\tprivate readonly _providerRequestInfo: InlineSuggestProviderRequestInfo,\n\t\tprivate readonly _correlationId: string | undefined,\n\t) {\n\t\tthis._viewData = { editorType: _requestInfo.editorType };\n\t}\n\n\tpublic get showInlineEditMenu() { return this.sourceInlineCompletion.showInlineEditMenu ?? false; }\n\n\tpublic get partialAccepts(): PartialAcceptance { return this._partiallyAcceptedSinceOriginal; }\n\n\tpublic async reportInlineEditShown(commandService: ICommandService, updatedInsertText: string, viewKind: InlineCompletionViewKind, viewData: InlineCompletionViewData): Promise<void> {\n\t\tthis.updateShownDuration(viewKind);\n\n\t\tif (this._didShow) {\n\t\t\treturn;\n\t\t}\n\t\tthis._didShow = true;\n\t\tthis._viewData.viewKind = viewKind;\n\t\tthis._viewData.renderData = viewData;\n\t\tthis._timeUntilShown = Date.now() - this._requestInfo.startTime;\n\n\t\tconst editDeltaInfo = new EditDeltaInfo(viewData.lineCountModified, viewData.lineCountOriginal, viewData.characterCountModified, viewData.characterCountOriginal);\n\t\tthis.source.provider.handleItemDidShow?.(this.source.inlineSuggestions, this.sourceInlineCompletion, updatedInsertText, editDeltaInfo);\n\n\t\tif (this.sourceInlineCompletion.shownCommand) {\n\t\t\tawait commandService.executeCommand(this.sourceInlineCompletion.shownCommand.id, ...(this.sourceInlineCompletion.shownCommand.arguments || []));\n\t\t}\n\t}\n\n\tpublic reportPartialAccept(acceptedCharacters: number, info: PartialAcceptInfo, partialAcceptance: PartialAcceptance) {\n\t\tthis._partiallyAcceptedCount++;\n\t\tthis._partiallyAcceptedSinceOriginal.characters += partialAcceptance.characters;\n\t\tthis._partiallyAcceptedSinceOriginal.ratio = Math.min(this._partiallyAcceptedSinceOriginal.ratio + (1 - this._partiallyAcceptedSinceOriginal.ratio) * partialAcceptance.ratio, 1);\n\t\tthis._partiallyAcceptedSinceOriginal.count += partialAcceptance.count;\n\n\t\tthis.source.provider.handlePartialAccept?.(\n\t\t\tthis.source.inlineSuggestions,\n\t\t\tthis.sourceInlineCompletion,\n\t\t\tacceptedCharacters,\n\t\t\tinfo\n\t\t);\n\t}\n\n\t/**\n\t * Sends the end of life event to the provider.\n\t * If no reason is provided, the last set reason is used.\n\t * If no reason was set, the default reason is used.\n\t*/\n\tpublic reportEndOfLife(reason?: InlineCompletionEndOfLifeReason): void {\n\t\tif (this._didReportEndOfLife) {\n\t\t\treturn;\n\t\t}\n\t\tthis._didReportEndOfLife = true;\n\t\tthis.reportInlineEditHidden();\n\n\t\tif (!reason) {\n\t\t\treason = this._lastSetEndOfLifeReason ?? { kind: InlineCompletionEndOfLifeReasonKind.Ignored, userTypingDisagreed: false, supersededBy: undefined };\n\t\t}\n\n\t\tif (reason.kind === InlineCompletionEndOfLifeReasonKind.Rejected && this.source.provider.handleRejection) {\n\t\t\tthis.source.provider.handleRejection(this.source.inlineSuggestions, this.sourceInlineCompletion);\n\t\t}\n\n\t\tif (this.source.provider.handleEndOfLifetime) {\n\t\t\tconst summary: LifetimeSummary = {\n\t\t\t\trequestUuid: this.context.requestUuid,\n\t\t\t\tcorrelationId: this._correlationId,\n\t\t\t\tselectedSuggestionInfo: !!this.context.selectedSuggestionInfo,\n\t\t\t\tpartiallyAccepted: this._partiallyAcceptedCount,\n\t\t\t\tpartiallyAcceptedCountSinceOriginal: this._partiallyAcceptedSinceOriginal.count,\n\t\t\t\tpartiallyAcceptedRatioSinceOriginal: this._partiallyAcceptedSinceOriginal.ratio,\n\t\t\t\tpartiallyAcceptedCharactersSinceOriginal: this._partiallyAcceptedSinceOriginal.characters,\n\t\t\t\tshown: this._didShow,\n\t\t\t\tshownDuration: this._shownDuration,\n\t\t\t\tshownDurationUncollapsed: this._showUncollapsedDuration,\n\t\t\t\tpreceeded: this._isPreceeded,\n\t\t\t\ttimeUntilShown: this._timeUntilShown,\n\t\t\t\ttimeUntilProviderRequest: this._providerRequestInfo.startTime - this._requestInfo.startTime,\n\t\t\t\ttimeUntilProviderResponse: this._providerRequestInfo.endTime - this._requestInfo.startTime,\n\t\t\t\teditorType: this._viewData.editorType,\n\t\t\t\tlanguageId: this._requestInfo.languageId,\n\t\t\t\trequestReason: this._requestInfo.reason,\n\t\t\t\tviewKind: this._viewData.viewKind,\n\t\t\t\tnotShownReason: this._notShownReason,\n\t\t\t\ttypingInterval: this._requestInfo.typingInterval,\n\t\t\t\ttypingIntervalCharacterCount: this._requestInfo.typingIntervalCharacterCount,\n\t\t\t\tavailableProviders: this._requestInfo.availableProviders.map(p => p.toString()).join(','),\n\t\t\t\t...this._viewData.renderData,\n\t\t\t};\n\t\t\tthis.source.provider.handleEndOfLifetime(this.source.inlineSuggestions, this.sourceInlineCompletion, reason, summary);\n\t\t}\n\t}\n\n\tpublic setIsPreceeded(partialAccepts: PartialAcceptance): void {\n\t\tthis._isPreceeded = true;\n\n\t\tif (this._partiallyAcceptedSinceOriginal.characters !== 0 || this._partiallyAcceptedSinceOriginal.ratio !== 0 || this._partiallyAcceptedSinceOriginal.count !== 0) {\n\t\t\tconsole.warn('Expected partiallyAcceptedCountSinceOriginal to be { characters: 0, rate: 0, partialAcceptances: 0 } before setIsPreceeded.');\n\t\t}\n\t\tthis._partiallyAcceptedSinceOriginal = partialAccepts;\n\t}\n\n\tpublic setNotShownReason(reason: string): void {\n\t\tthis._notShownReason ??= reason;\n\t}\n\n\t/**\n\t * Sets the end of life reason, but does not send the event to the provider yet.\n\t*/\n\tpublic setEndOfLifeReason(reason: InlineCompletionEndOfLifeReason): void {\n\t\tthis.reportInlineEditHidden();\n\t\tthis._lastSetEndOfLifeReason = reason;\n\t}\n\n\tprivate updateShownDuration(viewKind: InlineCompletionViewKind) {\n\t\tconst timeNow = Date.now();\n\t\tif (!this._showStartTime) {\n\t\t\tthis._showStartTime = timeNow;\n\t\t}\n\n\t\tconst isCollapsed = viewKind === InlineCompletionViewKind.Collapsed;\n\t\tif (!isCollapsed && this._showUncollapsedStartTime === undefined) {\n\t\t\tthis._showUncollapsedStartTime = timeNow;\n\t\t}\n\n\t\tif (isCollapsed && this._showUncollapsedStartTime !== undefined) {\n\t\t\tthis._showUncollapsedDuration += timeNow - this._showUncollapsedStartTime;\n\t\t}\n\t}\n\n\tprivate reportInlineEditHidden() {\n\t\tif (this._showStartTime === undefined) {\n\t\t\treturn;\n\t\t}\n\t\tconst timeNow = Date.now();\n\t\tthis._shownDuration += timeNow - this._showStartTime;\n\t\tthis._showStartTime = undefined;\n\n\t\tif (this._showUncollapsedStartTime === undefined) {\n\t\t\treturn;\n\t\t}\n\t\tthis._showUncollapsedDuration += timeNow - this._showUncollapsedStartTime;\n\t\tthis._showUncollapsedStartTime = undefined;\n\t}\n}\n\nexport interface SnippetInfo {\n\tsnippet: string;\n\t/* Could be different than the main range */\n\trange: Range;\n}\n\nexport enum InlineCompletionEditorType {\n\tTextEditor = 'textEditor',\n\tDiffEditor = 'diffEditor',\n\tNotebook = 'notebook',\n}\n\n/**\n * A ref counted pointer to the computed `InlineCompletions` and the `InlineCompletionsProvider` that\n * computed them.\n */\nexport class InlineSuggestionList {\n\tprivate refCount = 0;\n\tconstructor(\n\t\tpublic readonly inlineSuggestions: InlineCompletions,\n\t\tpublic readonly inlineSuggestionsData: readonly InlineSuggestData[],\n\t\tpublic readonly provider: InlineCompletionsProvider,\n\t) { }\n\n\taddRef(): void {\n\t\tthis.refCount++;\n\t}\n\n\tremoveRef(reason: InlineCompletionsDisposeReason = { kind: 'other' }): void {\n\t\tthis.refCount--;\n\t\tif (this.refCount === 0) {\n\t\t\tfor (const item of this.inlineSuggestionsData) {\n\t\t\t\t// Fallback if it has not been called before\n\t\t\t\titem.reportEndOfLife();\n\t\t\t}\n\t\t\tthis.provider.disposeInlineCompletions(this.inlineSuggestions, reason);\n\t\t}\n\t}\n}\n\nfunction getDefaultRange(position: Position, model: ITextModel): Range {\n\tconst word = model.getWordAtPosition(position);\n\tconst maxColumn = model.getLineMaxColumn(position.lineNumber);\n\t// By default, always replace up until the end of the current line.\n\t// This default might be subject to change!\n\treturn word\n\t\t? new Range(position.lineNumber, word.startColumn, position.lineNumber, maxColumn)\n\t\t: Range.fromPositions(position, position.with(undefined, maxColumn));\n}\n\nfunction closeBrackets(text: string, position: Position, model: ITextModel, languageConfigurationService: ILanguageConfigurationService): string {\n\tconst currentLine = model.getLineContent(position.lineNumber);\n\tconst edit = StringReplacement.replace(new OffsetRange(position.column - 1, currentLine.length), text);\n\n\tconst proposedLineTokens = model.tokenization.tokenizeLinesAt(position.lineNumber, [edit.replace(currentLine)]);\n\tconst textTokens = proposedLineTokens?.[0].sliceZeroCopy(edit.getRangeAfterReplace());\n\tif (!textTokens) {\n\t\treturn text;\n\t}\n\n\tconst fixedText = fixBracketsInLine(textTokens, languageConfigurationService);\n\treturn fixedText;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/inlineCompletions/browser/telemetry.ts","vs/editor/contrib/inlineCompletions/browser/telemetry.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAIhG,MAAM,UAAU,uCAAuC,CAAC,WAAkD,EAAE,gBAAgD;IAC3J,WAAW,CAAC,UAAU,CAA2E,4BAA4B,EAAE,gBAAgB,CAAC,CAAC;AAClJ,CAAC","file":"telemetry.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 { DataChannelForwardingTelemetryService } from '../../../../platform/dataChannel/browser/forwardingTelemetryService.js';\n\nexport function sendInlineCompletionsEndOfLifeTelemetry(dataChannel: DataChannelForwardingTelemetryService, endOfLifeSummary: InlineCompletionEndOfLifeEvent) {\n\tdataChannel.publicLog2<InlineCompletionEndOfLifeEvent, InlineCompletionsEndOfLifeClassification>('inlineCompletion.endOfLife', endOfLifeSummary);\n}\n\nexport type InlineCompletionEndOfLifeEvent = {\n\t// request\n\topportunityId: string;\n\trequestReason: string;\n\teditorType: string;\n\tlanguageId: string;\n\ttypingInterval: number;\n\ttypingIntervalCharacterCount: number;\n\tselectedSuggestionInfo: boolean;\n\tavailableProviders: string;\n\t// response\n\tcorrelationId: string | undefined;\n\textensionId: string;\n\textensionVersion: string;\n\tgroupId: string | undefined;\n\t// behavior\n\tshown: boolean;\n\tshownDuration: number | undefined;\n\tshownDurationUncollapsed: number | undefined;\n\ttimeUntilShown: number | undefined;\n\ttimeUntilProviderRequest: number | undefined;\n\ttimeUntilProviderResponse: number | undefined;\n\treason: 'accepted' | 'rejected' | 'ignored' | undefined;\n\tpartiallyAccepted: number | undefined;\n\tpartiallyAcceptedCountSinceOriginal: number | undefined;\n\tpartiallyAcceptedRatioSinceOriginal: number | undefined;\n\tpartiallyAcceptedCharactersSinceOriginal: number | undefined;\n\tpreceeded: boolean | undefined;\n\tsuperseded: boolean | undefined;\n\terror: string | undefined;\n\tnotShownReason: string | undefined;\n\t// rendering\n\tviewKind: string | undefined;\n\tcursorColumnDistance: number | undefined;\n\tcursorLineDistance: number | undefined;\n\tlineCountOriginal: number | undefined;\n\tlineCountModified: number | undefined;\n\tcharacterCountOriginal: number | undefined;\n\tcharacterCountModified: number | undefined;\n\tdisjointReplacements: number | undefined;\n\tsameShapeReplacements: boolean | undefined;\n\t// empty\n\tnoSuggestionReason: string | undefined;\n};\n\ntype InlineCompletionsEndOfLifeClassification = {\n\towner: 'benibenj';\n\tcomment: 'Inline completions ended. @sentToGitHub';\n\topportunityId: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Unique identifier for an opportunity to show an inline completion or NES' };\n\tcorrelationId: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The correlation identifier for the inline completion' };\n\textensionId: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The identifier for the extension that contributed the inline completion' };\n\textensionVersion: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The version of the extension that contributed the inline completion' };\n\tgroupId: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The group ID of the extension that contributed the inline completion' };\n\tavailableProviders: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The list of available inline completion providers at the time of the request' };\n\tshown: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Whether the inline completion was shown to the user' };\n\tshownDuration: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The duration for which the inline completion was shown' };\n\tshownDurationUncollapsed: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The duration for which the inline completion was shown without collapsing' };\n\ttimeUntilShown: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The time it took for the inline completion to be shown after the request' };\n\ttimeUntilProviderRequest: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The time it took for the inline completion to be requested from the provider' };\n\ttimeUntilProviderResponse: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The time it took for the inline completion to be shown after the request' };\n\treason: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The reason for the inline completion ending' };\n\tselectedSuggestionInfo: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Whether the inline completion was requested with a selected suggestion' };\n\tpartiallyAccepted: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'How often the inline completion was partially accepted by the user' };\n\tpartiallyAcceptedCountSinceOriginal: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'How often the inline completion was partially accepted since the original request' };\n\tpartiallyAcceptedRatioSinceOriginal: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The percentage of characters accepted since the original request' };\n\tpartiallyAcceptedCharactersSinceOriginal: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The character count accepted since the original request' };\n\tpreceeded: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Whether the inline completion was preceeded by another one' };\n\tlanguageId: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The language ID of the document where the inline completion was shown' };\n\trequestReason: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The reason for the inline completion request' };\n\terror: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The error message if the inline completion failed' };\n\ttypingInterval: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The average typing interval of the user at the moment the inline completion was requested' };\n\ttypingIntervalCharacterCount: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The character count involved in the typing interval calculation' };\n\tsuperseded: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Whether the inline completion was superseded by another one' };\n\teditorType: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The type of the editor where the inline completion was shown' };\n\tviewKind: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The kind of the view where the inline completion was shown' };\n\tcursorColumnDistance: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The distance in columns from the cursor to the inline suggestion' };\n\tcursorLineDistance: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The distance in lines from the cursor to the inline suggestion' };\n\tlineCountOriginal: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The number of lines in the original text' };\n\tlineCountModified: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The number of lines in the modified text' };\n\tcharacterCountOriginal: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The number of characters in the original text' };\n\tcharacterCountModified: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The number of characters in the modified text' };\n\tdisjointReplacements: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The number of inner replacements made by the inline completion' };\n\tsameShapeReplacements: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Whether all inner replacements are the same shape' };\n\tnoSuggestionReason: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The reason why no inline completion was provided' };\n\tnotShownReason: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The reason why the inline completion was not shown' };\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 { DataChannelForwardingTelemetryService } from '../../../../platform/dataChannel/browser/forwardingTelemetryService.js';\n\nexport function sendInlineCompletionsEndOfLifeTelemetry(dataChannel: DataChannelForwardingTelemetryService, endOfLifeSummary: InlineCompletionEndOfLifeEvent) {\n\tdataChannel.publicLog2<InlineCompletionEndOfLifeEvent, InlineCompletionsEndOfLifeClassification>('inlineCompletion.endOfLife', endOfLifeSummary);\n}\n\nexport type InlineCompletionEndOfLifeEvent = {\n\t// request\n\topportunityId: string;\n\trequestReason: string;\n\teditorType: string;\n\tlanguageId: string;\n\ttypingInterval: number;\n\ttypingIntervalCharacterCount: number;\n\tselectedSuggestionInfo: boolean;\n\tavailableProviders: string;\n\t// response\n\tcorrelationId: string | undefined;\n\textensionId: string;\n\textensionVersion: string;\n\tgroupId: string | undefined;\n\t// behavior\n\tshown: boolean;\n\tshownDuration: number | undefined;\n\tshownDurationUncollapsed: number | undefined;\n\ttimeUntilShown: number | undefined;\n\ttimeUntilProviderRequest: number | undefined;\n\ttimeUntilProviderResponse: number | undefined;\n\treason: 'accepted' | 'rejected' | 'ignored' | undefined;\n\tpartiallyAccepted: number | undefined;\n\tpartiallyAcceptedCountSinceOriginal: number | undefined;\n\tpartiallyAcceptedRatioSinceOriginal: number | undefined;\n\tpartiallyAcceptedCharactersSinceOriginal: number | undefined;\n\tpreceeded: boolean | undefined;\n\tsuperseded: boolean | undefined;\n\terror: string | undefined;\n\tnotShownReason: string | undefined;\n\t// rendering\n\tviewKind: string | undefined;\n\tcursorColumnDistance: number | undefined;\n\tcursorLineDistance: number | undefined;\n\tlineCountOriginal: number | undefined;\n\tlineCountModified: number | undefined;\n\tcharacterCountOriginal: number | undefined;\n\tcharacterCountModified: number | undefined;\n\tdisjointReplacements: number | undefined;\n\tsameShapeReplacements: boolean | undefined;\n\t// empty\n\tnoSuggestionReason: string | undefined;\n};\n\ntype InlineCompletionsEndOfLifeClassification = {\n\towner: 'benibenj';\n\tcomment: 'Inline completions ended. @sentToGitHub';\n\topportunityId: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Unique identifier for an opportunity to show an inline completion or NES' };\n\tcorrelationId: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The correlation identifier for the inline completion' };\n\textensionId: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The identifier for the extension that contributed the inline completion' };\n\textensionVersion: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The version of the extension that contributed the inline completion' };\n\tgroupId: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The group ID of the extension that contributed the inline completion' };\n\tavailableProviders: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The list of available inline completion providers at the time of the request' };\n\tshown: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Whether the inline completion was shown to the user' };\n\tshownDuration: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The duration for which the inline completion was shown' };\n\tshownDurationUncollapsed: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The duration for which the inline completion was shown without collapsing' };\n\ttimeUntilShown: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The time it took for the inline completion to be shown after the request' };\n\ttimeUntilProviderRequest: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The time it took for the inline completion to be requested from the provider' };\n\ttimeUntilProviderResponse: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The time it took for the inline completion to be shown after the request' };\n\treason: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The reason for the inline completion ending' };\n\tselectedSuggestionInfo: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Whether the inline completion was requested with a selected suggestion' };\n\tpartiallyAccepted: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'How often the inline completion was partially accepted by the user' };\n\tpartiallyAcceptedCountSinceOriginal: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'How often the inline completion was partially accepted since the original request' };\n\tpartiallyAcceptedRatioSinceOriginal: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The percentage of characters accepted since the original request' };\n\tpartiallyAcceptedCharactersSinceOriginal: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The character count accepted since the original request' };\n\tpreceeded: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Whether the inline completion was preceeded by another one' };\n\tlanguageId: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The language ID of the document where the inline completion was shown' };\n\trequestReason: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The reason for the inline completion request' };\n\terror: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The error message if the inline completion failed' };\n\ttypingInterval: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The average typing interval of the user at the moment the inline completion was requested' };\n\ttypingIntervalCharacterCount: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The character count involved in the typing interval calculation' };\n\tsuperseded: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Whether the inline completion was superseded by another one' };\n\teditorType: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The type of the editor where the inline completion was shown' };\n\tviewKind: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The kind of the view where the inline completion was shown' };\n\tcursorColumnDistance: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The distance in columns from the cursor to the inline suggestion' };\n\tcursorLineDistance: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The distance in lines from the cursor to the inline suggestion' };\n\tlineCountOriginal: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The number of lines in the original text' };\n\tlineCountModified: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The number of lines in the modified text' };\n\tcharacterCountOriginal: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The number of characters in the original text' };\n\tcharacterCountModified: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The number of characters in the modified text' };\n\tdisjointReplacements: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The number of inner replacements made by the inline completion' };\n\tsameShapeReplacements: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Whether all inner replacements are the same shape' };\n\tnoSuggestionReason: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The reason why no inline completion was provided' };\n\tnotShownReason: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The reason why the inline completion was not shown' };\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/inlineCompletions/browser/telemetry.ts","vs/editor/contrib/inlineCompletions/browser/telemetry.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAIhG,MAAM,UAAU,uCAAuC,CAAC,WAAkD,EAAE,gBAAgD;IAC3J,WAAW,CAAC,UAAU,CAA2E,4BAA4B,EAAE,gBAAgB,CAAC,CAAC;AAClJ,CAAC","file":"telemetry.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 { DataChannelForwardingTelemetryService } from '../../../../platform/dataChannel/browser/forwardingTelemetryService.js';\n\nexport function sendInlineCompletionsEndOfLifeTelemetry(dataChannel: DataChannelForwardingTelemetryService, endOfLifeSummary: InlineCompletionEndOfLifeEvent) {\n\tdataChannel.publicLog2<InlineCompletionEndOfLifeEvent, InlineCompletionsEndOfLifeClassification>('inlineCompletion.endOfLife', endOfLifeSummary);\n}\n\nexport type InlineCompletionEndOfLifeEvent = {\n\t// request\n\topportunityId: string;\n\trequestReason: string;\n\teditorType: string;\n\tlanguageId: string;\n\ttypingInterval: number;\n\ttypingIntervalCharacterCount: number;\n\tselectedSuggestionInfo: boolean;\n\tavailableProviders: string;\n\t// response\n\tcorrelationId: string | undefined;\n\textensionId: string;\n\textensionVersion: string;\n\tgroupId: string | undefined;\n\t// behavior\n\tshown: boolean;\n\tshownDuration: number | undefined;\n\tshownDurationUncollapsed: number | undefined;\n\ttimeUntilShown: number | undefined;\n\ttimeUntilProviderRequest: number | undefined;\n\ttimeUntilProviderResponse: number | undefined;\n\treason: 'accepted' | 'rejected' | 'ignored' | undefined;\n\tpartiallyAccepted: number | undefined;\n\tpartiallyAcceptedCountSinceOriginal: number | undefined;\n\tpartiallyAcceptedRatioSinceOriginal: number | undefined;\n\tpartiallyAcceptedCharactersSinceOriginal: number | undefined;\n\tpreceeded: boolean | undefined;\n\tsuperseded: boolean | undefined;\n\tnotShownReason: string | undefined;\n\t// rendering\n\tviewKind: string | undefined;\n\tcursorColumnDistance: number | undefined;\n\tcursorLineDistance: number | undefined;\n\tlineCountOriginal: number | undefined;\n\tlineCountModified: number | undefined;\n\tcharacterCountOriginal: number | undefined;\n\tcharacterCountModified: number | undefined;\n\tdisjointReplacements: number | undefined;\n\tsameShapeReplacements: boolean | undefined;\n\t// empty\n\tnoSuggestionReason: string | undefined;\n};\n\ntype InlineCompletionsEndOfLifeClassification = {\n\towner: 'benibenj';\n\tcomment: 'Inline completions ended. @sentToGitHub';\n\topportunityId: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Unique identifier for an opportunity to show an inline completion or NES' };\n\tcorrelationId: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The correlation identifier for the inline completion' };\n\textensionId: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The identifier for the extension that contributed the inline completion' };\n\textensionVersion: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The version of the extension that contributed the inline completion' };\n\tgroupId: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The group ID of the extension that contributed the inline completion' };\n\tavailableProviders: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The list of available inline completion providers at the time of the request' };\n\tshown: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Whether the inline completion was shown to the user' };\n\tshownDuration: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The duration for which the inline completion was shown' };\n\tshownDurationUncollapsed: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The duration for which the inline completion was shown without collapsing' };\n\ttimeUntilShown: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The time it took for the inline completion to be shown after the request' };\n\ttimeUntilProviderRequest: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The time it took for the inline completion to be requested from the provider' };\n\ttimeUntilProviderResponse: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The time it took for the inline completion to be shown after the request' };\n\treason: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The reason for the inline completion ending' };\n\tselectedSuggestionInfo: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Whether the inline completion was requested with a selected suggestion' };\n\tpartiallyAccepted: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'How often the inline completion was partially accepted by the user' };\n\tpartiallyAcceptedCountSinceOriginal: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'How often the inline completion was partially accepted since the original request' };\n\tpartiallyAcceptedRatioSinceOriginal: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The percentage of characters accepted since the original request' };\n\tpartiallyAcceptedCharactersSinceOriginal: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The character count accepted since the original request' };\n\tpreceeded: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Whether the inline completion was preceeded by another one' };\n\tlanguageId: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The language ID of the document where the inline completion was shown' };\n\trequestReason: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The reason for the inline completion request' };\n\ttypingInterval: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The average typing interval of the user at the moment the inline completion was requested' };\n\ttypingIntervalCharacterCount: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The character count involved in the typing interval calculation' };\n\tsuperseded: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Whether the inline completion was superseded by another one' };\n\teditorType: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The type of the editor where the inline completion was shown' };\n\tviewKind: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The kind of the view where the inline completion was shown' };\n\tcursorColumnDistance: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The distance in columns from the cursor to the inline suggestion' };\n\tcursorLineDistance: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The distance in lines from the cursor to the inline suggestion' };\n\tlineCountOriginal: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The number of lines in the original text' };\n\tlineCountModified: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The number of lines in the modified text' };\n\tcharacterCountOriginal: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The number of characters in the original text' };\n\tcharacterCountModified: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The number of characters in the modified text' };\n\tdisjointReplacements: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The number of inner replacements made by the inline completion' };\n\tsameShapeReplacements: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Whether all inner replacements are the same shape' };\n\tnoSuggestionReason: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The reason why no inline completion was provided' };\n\tnotShownReason: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The reason why the inline completion was not shown' };\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 { DataChannelForwardingTelemetryService } from '../../../../platform/dataChannel/browser/forwardingTelemetryService.js';\n\nexport function sendInlineCompletionsEndOfLifeTelemetry(dataChannel: DataChannelForwardingTelemetryService, endOfLifeSummary: InlineCompletionEndOfLifeEvent) {\n\tdataChannel.publicLog2<InlineCompletionEndOfLifeEvent, InlineCompletionsEndOfLifeClassification>('inlineCompletion.endOfLife', endOfLifeSummary);\n}\n\nexport type InlineCompletionEndOfLifeEvent = {\n\t// request\n\topportunityId: string;\n\trequestReason: string;\n\teditorType: string;\n\tlanguageId: string;\n\ttypingInterval: number;\n\ttypingIntervalCharacterCount: number;\n\tselectedSuggestionInfo: boolean;\n\tavailableProviders: string;\n\t// response\n\tcorrelationId: string | undefined;\n\textensionId: string;\n\textensionVersion: string;\n\tgroupId: string | undefined;\n\t// behavior\n\tshown: boolean;\n\tshownDuration: number | undefined;\n\tshownDurationUncollapsed: number | undefined;\n\ttimeUntilShown: number | undefined;\n\ttimeUntilProviderRequest: number | undefined;\n\ttimeUntilProviderResponse: number | undefined;\n\treason: 'accepted' | 'rejected' | 'ignored' | undefined;\n\tpartiallyAccepted: number | undefined;\n\tpartiallyAcceptedCountSinceOriginal: number | undefined;\n\tpartiallyAcceptedRatioSinceOriginal: number | undefined;\n\tpartiallyAcceptedCharactersSinceOriginal: number | undefined;\n\tpreceeded: boolean | undefined;\n\tsuperseded: boolean | undefined;\n\tnotShownReason: string | undefined;\n\t// rendering\n\tviewKind: string | undefined;\n\tcursorColumnDistance: number | undefined;\n\tcursorLineDistance: number | undefined;\n\tlineCountOriginal: number | undefined;\n\tlineCountModified: number | undefined;\n\tcharacterCountOriginal: number | undefined;\n\tcharacterCountModified: number | undefined;\n\tdisjointReplacements: number | undefined;\n\tsameShapeReplacements: boolean | undefined;\n\t// empty\n\tnoSuggestionReason: string | undefined;\n};\n\ntype InlineCompletionsEndOfLifeClassification = {\n\towner: 'benibenj';\n\tcomment: 'Inline completions ended. @sentToGitHub';\n\topportunityId: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Unique identifier for an opportunity to show an inline completion or NES' };\n\tcorrelationId: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The correlation identifier for the inline completion' };\n\textensionId: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The identifier for the extension that contributed the inline completion' };\n\textensionVersion: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The version of the extension that contributed the inline completion' };\n\tgroupId: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The group ID of the extension that contributed the inline completion' };\n\tavailableProviders: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The list of available inline completion providers at the time of the request' };\n\tshown: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Whether the inline completion was shown to the user' };\n\tshownDuration: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The duration for which the inline completion was shown' };\n\tshownDurationUncollapsed: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The duration for which the inline completion was shown without collapsing' };\n\ttimeUntilShown: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The time it took for the inline completion to be shown after the request' };\n\ttimeUntilProviderRequest: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The time it took for the inline completion to be requested from the provider' };\n\ttimeUntilProviderResponse: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The time it took for the inline completion to be shown after the request' };\n\treason: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The reason for the inline completion ending' };\n\tselectedSuggestionInfo: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Whether the inline completion was requested with a selected suggestion' };\n\tpartiallyAccepted: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'How often the inline completion was partially accepted by the user' };\n\tpartiallyAcceptedCountSinceOriginal: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'How often the inline completion was partially accepted since the original request' };\n\tpartiallyAcceptedRatioSinceOriginal: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The percentage of characters accepted since the original request' };\n\tpartiallyAcceptedCharactersSinceOriginal: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The character count accepted since the original request' };\n\tpreceeded: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Whether the inline completion was preceeded by another one' };\n\tlanguageId: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The language ID of the document where the inline completion was shown' };\n\trequestReason: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The reason for the inline completion request' };\n\ttypingInterval: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The average typing interval of the user at the moment the inline completion was requested' };\n\ttypingIntervalCharacterCount: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The character count involved in the typing interval calculation' };\n\tsuperseded: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Whether the inline completion was superseded by another one' };\n\teditorType: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The type of the editor where the inline completion was shown' };\n\tviewKind: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The kind of the view where the inline completion was shown' };\n\tcursorColumnDistance: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The distance in columns from the cursor to the inline suggestion' };\n\tcursorLineDistance: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The distance in lines from the cursor to the inline suggestion' };\n\tlineCountOriginal: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The number of lines in the original text' };\n\tlineCountModified: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The number of lines in the modified text' };\n\tcharacterCountOriginal: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The number of characters in the original text' };\n\tcharacterCountModified: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The number of characters in the modified text' };\n\tdisjointReplacements: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The number of inner replacements made by the inline completion' };\n\tsameShapeReplacements: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Whether all inner replacements are the same shape' };\n\tnoSuggestionReason: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The reason why no inline completion was provided' };\n\tnotShownReason: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The reason why the inline completion was not shown' };\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditWithChanges.ts","vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditWithChanges.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,eAAe,EAAE,MAAM,8CAA8C,CAAC;AAG/E,OAAO,EAAE,SAAS,EAAE,MAAM,gDAAgD,CAAC;AAK3E,MAAM,OAAO,qBAAqB;IACjC,IAAW,QAAQ;QAClB,IAAI,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzC,OAAO,IAAI,eAAe,CAAC,IAAI,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACrD,CAAC;QACD,OAAO,eAAe,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IAC1G,CAAC;IAED,IAAW,iBAAiB,KAAK,OAAO,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC;IAClE,IAAW,iBAAiB,KAAK,OAAO,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAE3F,IAAW,YAAY;QACtB,OAAO,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,SAAS,CAC3C,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAC1B,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,iBAAiB,CAAC,eAAe,EAAE,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CACzF,CACA,CAAC;IACJ,CAAC;IAED,YACiB,YAA0B,EAC1B,IAAc,EACd,cAAwB,EACxB,oBAAyC,EACzC,QAA4C,EAC5C,gBAAsC;QALtC,iBAAY,GAAZ,YAAY,CAAc;QAC1B,SAAI,GAAJ,IAAI,CAAU;QACd,mBAAc,GAAd,cAAc,CAAU;QACxB,yBAAoB,GAApB,oBAAoB,CAAqB;QACzC,aAAQ,GAAR,QAAQ,CAAoC;QAC5C,qBAAgB,GAAhB,gBAAgB,CAAsB;IAEvD,CAAC;CACD","file":"inlineEditWithChanges.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 { LineReplacement } from '../../../../../common/core/edits/lineEdit.js';\nimport { TextEdit } from '../../../../../common/core/edits/textEdit.js';\nimport { Position } from '../../../../../common/core/position.js';\nimport { LineRange } from '../../../../../common/core/ranges/lineRange.js';\nimport { AbstractText } from '../../../../../common/core/text/abstractText.js';\nimport { InlineCompletionCommand } from '../../../../../common/languages.js';\nimport { InlineSuggestionItem } from '../../model/inlineSuggestionItem.js';\n\nexport class InlineEditWithChanges {\n\tpublic get lineEdit() {\n\t\tif (this.edit.replacements.length === 0) {\n\t\t\treturn new LineReplacement(new LineRange(1, 1), []);\n\t\t}\n\t\treturn LineReplacement.fromSingleTextEdit(this.edit.toReplacement(this.originalText), this.originalText);\n\t}\n\n\tpublic get originalLineRange() { return this.lineEdit.lineRange; }\n\tpublic get modifiedLineRange() { return this.lineEdit.toLineEdit().getNewLineRanges()[0]; }\n\n\tpublic get displayRange() {\n\t\treturn this.originalText.lineRange.intersect(\n\t\t\tthis.originalLineRange.join(\n\t\t\t\tLineRange.ofLength(this.originalLineRange.startLineNumber, this.lineEdit.newLines.length)\n\t\t\t)\n\t\t)!;\n\t}\n\n\tconstructor(\n\t\tpublic readonly originalText: AbstractText,\n\t\tpublic readonly edit: TextEdit,\n\t\tpublic readonly cursorPosition: Position,\n\t\tpublic readonly multiCursorPositions: readonly Position[],\n\t\tpublic readonly commands: readonly InlineCompletionCommand[],\n\t\tpublic readonly inlineCompletion: InlineSuggestionItem
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditWithChanges.ts","vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditWithChanges.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,eAAe,EAAE,MAAM,8CAA8C,CAAC;AAG/E,OAAO,EAAE,SAAS,EAAE,MAAM,gDAAgD,CAAC;AAK3E,MAAM,OAAO,qBAAqB;IACjC,IAAW,QAAQ;QAClB,IAAI,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzC,OAAO,IAAI,eAAe,CAAC,IAAI,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACrD,CAAC;QACD,OAAO,eAAe,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IAC1G,CAAC;IAED,IAAW,iBAAiB,KAAK,OAAO,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC;IAClE,IAAW,iBAAiB,KAAK,OAAO,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAE3F,IAAW,YAAY;QACtB,OAAO,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,SAAS,CAC3C,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAC1B,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,iBAAiB,CAAC,eAAe,EAAE,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CACzF,CACA,CAAC;IACJ,CAAC;IAED,YACiB,YAA0B,EAC1B,IAAc,EACd,cAAwB,EACxB,oBAAyC,EACzC,QAA4C,EAC5C,gBAAsC;QALtC,iBAAY,GAAZ,YAAY,CAAc;QAC1B,SAAI,GAAJ,IAAI,CAAU;QACd,mBAAc,GAAd,cAAc,CAAU;QACxB,yBAAoB,GAApB,oBAAoB,CAAqB;QACzC,aAAQ,GAAR,QAAQ,CAAoC;QAC5C,qBAAgB,GAAhB,gBAAgB,CAAsB;IAEvD,CAAC;CACD","file":"inlineEditWithChanges.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 { LineReplacement } from '../../../../../common/core/edits/lineEdit.js';\nimport { TextEdit } from '../../../../../common/core/edits/textEdit.js';\nimport { Position } from '../../../../../common/core/position.js';\nimport { LineRange } from '../../../../../common/core/ranges/lineRange.js';\nimport { AbstractText } from '../../../../../common/core/text/abstractText.js';\nimport { InlineCompletionCommand } from '../../../../../common/languages.js';\nimport { InlineSuggestionItem } from '../../model/inlineSuggestionItem.js';\n\nexport class InlineEditWithChanges {\n\tpublic get lineEdit() {\n\t\tif (this.edit.replacements.length === 0) {\n\t\t\treturn new LineReplacement(new LineRange(1, 1), []);\n\t\t}\n\t\treturn LineReplacement.fromSingleTextEdit(this.edit.toReplacement(this.originalText), this.originalText);\n\t}\n\n\tpublic get originalLineRange() { return this.lineEdit.lineRange; }\n\tpublic get modifiedLineRange() { return this.lineEdit.toLineEdit().getNewLineRanges()[0]; }\n\n\tpublic get displayRange() {\n\t\treturn this.originalText.lineRange.intersect(\n\t\t\tthis.originalLineRange.join(\n\t\t\t\tLineRange.ofLength(this.originalLineRange.startLineNumber, this.lineEdit.newLines.length)\n\t\t\t)\n\t\t)!;\n\t}\n\n\tconstructor(\n\t\tpublic readonly originalText: AbstractText,\n\t\tpublic readonly edit: TextEdit,\n\t\tpublic readonly cursorPosition: Position,\n\t\tpublic readonly multiCursorPositions: readonly Position[],\n\t\tpublic readonly commands: readonly InlineCompletionCommand[],\n\t\tpublic readonly inlineCompletion: InlineSuggestionItem,\n\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 { LineReplacement } from '../../../../../common/core/edits/lineEdit.js';\nimport { TextEdit } from '../../../../../common/core/edits/textEdit.js';\nimport { Position } from '../../../../../common/core/position.js';\nimport { LineRange } from '../../../../../common/core/ranges/lineRange.js';\nimport { AbstractText } from '../../../../../common/core/text/abstractText.js';\nimport { InlineCompletionCommand } from '../../../../../common/languages.js';\nimport { InlineSuggestionItem } from '../../model/inlineSuggestionItem.js';\n\nexport class InlineEditWithChanges {\n\tpublic get lineEdit() {\n\t\tif (this.edit.replacements.length === 0) {\n\t\t\treturn new LineReplacement(new LineRange(1, 1), []);\n\t\t}\n\t\treturn LineReplacement.fromSingleTextEdit(this.edit.toReplacement(this.originalText), this.originalText);\n\t}\n\n\tpublic get originalLineRange() { return this.lineEdit.lineRange; }\n\tpublic get modifiedLineRange() { return this.lineEdit.toLineEdit().getNewLineRanges()[0]; }\n\n\tpublic get displayRange() {\n\t\treturn this.originalText.lineRange.intersect(\n\t\t\tthis.originalLineRange.join(\n\t\t\t\tLineRange.ofLength(this.originalLineRange.startLineNumber, this.lineEdit.newLines.length)\n\t\t\t)\n\t\t)!;\n\t}\n\n\tconstructor(\n\t\tpublic readonly originalText: AbstractText,\n\t\tpublic readonly edit: TextEdit,\n\t\tpublic readonly cursorPosition: Position,\n\t\tpublic readonly multiCursorPositions: readonly Position[],\n\t\tpublic readonly commands: readonly InlineCompletionCommand[],\n\t\tpublic readonly inlineCompletion: InlineSuggestionItem,\n\t) {\n\t}\n}\n"]}
|
package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsModel.js
CHANGED
|
@@ -18,7 +18,7 @@ export class InlineEditModel {
|
|
|
18
18
|
this.displayName = this.inlineEdit.inlineCompletion.source.provider.displayName ?? localize(1215, "Inline Edit");
|
|
19
19
|
this.extensionCommands = this.inlineEdit.inlineCompletion.source.inlineSuggestions.commands ?? [];
|
|
20
20
|
this.isInDiffEditor = this._model.isInDiffEditor;
|
|
21
|
-
this.displayLocation = this.inlineEdit.inlineCompletion.
|
|
21
|
+
this.displayLocation = this.inlineEdit.inlineCompletion.hint;
|
|
22
22
|
this.showCollapsed = this._model.showCollapsed;
|
|
23
23
|
}
|
|
24
24
|
accept() {
|
|
@@ -27,11 +27,6 @@ export class InlineEditModel {
|
|
|
27
27
|
jump() {
|
|
28
28
|
this._model.jump();
|
|
29
29
|
}
|
|
30
|
-
abort(reason) {
|
|
31
|
-
console.error(reason);
|
|
32
|
-
this.inlineEdit.inlineCompletion.reportInlineEditError(reason);
|
|
33
|
-
this._model.stop();
|
|
34
|
-
}
|
|
35
30
|
handleInlineEditShown(viewKind, viewData) {
|
|
36
31
|
this._model.handleInlineSuggestionShown(this.inlineEdit.inlineCompletion, viewKind, viewData);
|
|
37
32
|
}
|
package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsModel.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsModel.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAGhG,OAAO,EAAE,OAAO,EAAe,MAAM,6CAA6C,CAAC;AACnF,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gDAAgD,CAAC;AAEtF,OAAO,EAAE,QAAQ,EAAE,MAAM,8CAA8C,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,iDAAiD,CAAC;AAI7E,OAAO,EAAyF,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAC3J,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,MAAM,OAAO,eAAe;IAU3B,YACkB,MAA8B,EACtC,UAAiC,EACjC,SAA2C;QAFnC,WAAM,GAAN,MAAM,CAAwB;QACtC,eAAU,GAAV,UAAU,CAAuB;QACjC,cAAS,GAAT,SAAS,CAAkC;QAEpD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,MAAM,CAAC;QACtD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,IAAI,QAAQ,CAAC,IAAY,EAAE,aAAa,CAAC,CAAC;QACzH,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,MAAM,CAAC,iBAAiB,CAAC,QAAQ,IAAI,EAAE,CAAC;QAClG,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC;QAEjD,IAAI,CAAC,eAAe,GAAG,IAAI,CA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AAC,CAAC,EACpD,KAAK,CAAC,eAAe,CAAC,GAAG,EAAE,EAC3B,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,EACxB,gBAAgB,CAAC,MAAM,CAAC,iBAAiB,CAAC,QAAQ,IAAI,EAAE,EACxD,gBAAgB,CAChB,EACD,SAAS,CACT,CAAC;IACH,CAAC;CACD","file":"inlineEditsModel.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 { Event } from '../../../../../../base/common/event.js';\nimport { derived, IObservable } from '../../../../../../base/common/observable.js';\nimport { localize } from '../../../../../../nls.js';\nimport { ICodeEditor } from '../../../../../browser/editorBrowser.js';\nimport { observableCodeEditor } from '../../../../../browser/observableCodeEditor.js';\nimport { LineRange } from '../../../../../common/core/ranges/lineRange.js';\nimport { TextEdit } from '../../../../../common/core/edits/textEdit.js';\nimport { StringText } from '../../../../../common/core/text/abstractText.js';\nimport { Command, InlineCompletionCommand } from '../../../../../common/languages.js';\nimport { InlineCompletionsModel } from '../../model/inlineCompletionsModel.js';\nimport { InlineCompletionItem, InlineSuggestHint } from '../../model/inlineSuggestionItem.js';\nimport { IInlineEditHost, IInlineEditModel, InlineCompletionViewData, InlineCompletionViewKind, InlineEditTabAction } from './inlineEditsViewInterface.js';\nimport { InlineEditWithChanges } from './inlineEditWithChanges.js';\n\nexport class InlineEditModel implements IInlineEditModel {\n\n\treadonly action: Command | undefined;\n\treadonly displayName: string;\n\treadonly extensionCommands: InlineCompletionCommand[];\n\treadonly isInDiffEditor: boolean;\n\n\treadonly displayLocation: InlineSuggestHint | undefined;\n\treadonly showCollapsed: IObservable<boolean>;\n\n\tconstructor(\n\t\tprivate readonly _model: InlineCompletionsModel,\n\t\treadonly inlineEdit: InlineEditWithChanges,\n\t\treadonly tabAction: IObservable<InlineEditTabAction>,\n\t) {\n\t\tthis.action = this.inlineEdit.inlineCompletion.action;\n\t\tthis.displayName = this.inlineEdit.inlineCompletion.source.provider.displayName ?? localize('inlineEdit', \"Inline Edit\");\n\t\tthis.extensionCommands = this.inlineEdit.inlineCompletion.source.inlineSuggestions.commands ?? [];\n\t\tthis.isInDiffEditor = this._model.isInDiffEditor;\n\n\t\tthis.displayLocation = this.inlineEdit.inlineCompletion.hint;\n\t\tthis.showCollapsed = this._model.showCollapsed;\n\t}\n\n\taccept() {\n\t\tthis._model.accept();\n\t}\n\n\tjump() {\n\t\tthis._model.jump();\n\t}\n\n\thandleInlineEditShown(viewKind: InlineCompletionViewKind, viewData: InlineCompletionViewData) {\n\t\tthis._model.handleInlineSuggestionShown(this.inlineEdit.inlineCompletion, viewKind, viewData);\n\t}\n}\n\nexport class InlineEditHost implements IInlineEditHost {\n\treadonly onDidAccept: Event<void>;\n\treadonly inAcceptFlow: IObservable<boolean>;\n\n\tconstructor(\n\t\tprivate readonly _model: InlineCompletionsModel,\n\t) {\n\t\tthis.onDidAccept = this._model.onDidAccept;\n\t\tthis.inAcceptFlow = this._model.inAcceptFlow;\n\t}\n}\n\nexport class GhostTextIndicator {\n\n\treadonly model: InlineEditModel;\n\n\tconstructor(\n\t\teditor: ICodeEditor,\n\t\tmodel: InlineCompletionsModel,\n\t\treadonly lineRange: LineRange,\n\t\tinlineCompletion: InlineCompletionItem,\n\t) {\n\t\tconst editorObs = observableCodeEditor(editor);\n\t\tconst tabAction = derived<InlineEditTabAction>(this, reader => {\n\t\t\tif (editorObs.isFocused.read(reader)) {\n\t\t\t\tif (inlineCompletion.showInlineEditMenu) {\n\t\t\t\t\treturn InlineEditTabAction.Accept;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn InlineEditTabAction.Inactive;\n\t\t});\n\n\t\tthis.model = new InlineEditModel(\n\t\t\tmodel,\n\t\t\tnew InlineEditWithChanges(\n\t\t\t\tnew StringText(''),\n\t\t\t\tnew TextEdit([inlineCompletion.getSingleTextEdit()]),\n\t\t\t\tmodel.primaryPosition.get(),\n\t\t\t\tmodel.allPositions.get(),\n\t\t\t\tinlineCompletion.source.inlineSuggestions.commands ?? [],\n\t\t\t\tinlineCompletion\n\t\t\t),\n\t\t\ttabAction,\n\t\t);\n\t}\n}\n"]}
|
|
@@ -14,7 +14,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
14
14
|
var InlineEditsView_1;
|
|
15
15
|
import { $ } from '../../../../../../base/browser/dom.js';
|
|
16
16
|
import { equalsIfDefined, itemEquals } from '../../../../../../base/common/equals.js';
|
|
17
|
-
import { BugIndicatingError } from '../../../../../../base/common/errors.js';
|
|
17
|
+
import { BugIndicatingError, onUnexpectedError } from '../../../../../../base/common/errors.js';
|
|
18
18
|
import { Event } from '../../../../../../base/common/event.js';
|
|
19
19
|
import { Disposable } from '../../../../../../base/common/lifecycle.js';
|
|
20
20
|
import { autorun, autorunWithStore, derived, derivedOpts, mapObservableArrayCached, observableValue } from '../../../../../../base/common/observable.js';
|
|
@@ -27,6 +27,7 @@ import { StringText } from '../../../../../common/core/text/abstractText.js';
|
|
|
27
27
|
import { TextLength } from '../../../../../common/core/text/textLength.js';
|
|
28
28
|
import { lineRangeMappingFromRangeMappings, RangeMapping } from '../../../../../common/diff/rangeMapping.js';
|
|
29
29
|
import { TextModel } from '../../../../../common/model/textModel.js';
|
|
30
|
+
import { InlineEditItem } from '../../model/inlineSuggestionItem.js';
|
|
30
31
|
import { InlineEditsGutterIndicator } from './components/gutterIndicatorView.js';
|
|
31
32
|
import { InlineEditsOnboardingExperience } from './inlineEditsNewUsers.js';
|
|
32
33
|
import { InlineCompletionViewKind, InlineEditTabAction } from './inlineEditsViewInterface.js';
|
|
@@ -63,7 +64,7 @@ let InlineEditsView = InlineEditsView_1 = class InlineEditsView extends Disposab
|
|
|
63
64
|
let diff = lineRangeMappingFromRangeMappings(mappings, inlineEdit.originalText, new StringText(newText));
|
|
64
65
|
let state = this.determineRenderState(model, reader, diff, new StringText(newText));
|
|
65
66
|
if (!state) {
|
|
66
|
-
|
|
67
|
+
onUnexpectedError(new Error(`unable to determine view: tried to render ${this._previousView?.view}`));
|
|
67
68
|
return undefined;
|
|
68
69
|
}
|
|
69
70
|
if (state.kind === InlineCompletionViewKind.SideBySide) {
|
|
@@ -253,6 +254,9 @@ let InlineEditsView = InlineEditsView_1 = class InlineEditsView extends Disposab
|
|
|
253
254
|
if (canUseCache && !reconsiderViewEditorWidthChange) {
|
|
254
255
|
return this._previousView.view;
|
|
255
256
|
}
|
|
257
|
+
if (model.inlineEdit.inlineCompletion instanceof InlineEditItem && model.inlineEdit.inlineCompletion.uri) {
|
|
258
|
+
return InlineCompletionViewKind.Custom;
|
|
259
|
+
}
|
|
256
260
|
if (model.displayLocation && !model.inlineEdit.inlineCompletion.identity.jumpedTo.read(reader)) {
|
|
257
261
|
return InlineCompletionViewKind.Custom;
|
|
258
262
|
}
|