monaco-editor-core 0.54.0-dev-20251006 → 0.54.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/nls.messages.de.js +1 -1
- package/esm/nls.messages.es.js +1 -1
- package/esm/nls.messages.fr.js +1 -1
- package/esm/nls.messages.it.js +1 -1
- package/esm/nls.messages.ja.js +1 -1
- package/esm/nls.messages.ko.js +1 -1
- package/esm/nls.messages.ru.js +1 -1
- package/esm/nls.messages.zh-cn.js +1 -1
- package/esm/nls.messages.zh-tw.js +1 -1
- package/esm/vs/base/browser/canIUse.js +0 -1
- package/esm/vs/base/browser/canIUse.js.map +1 -1
- package/esm/vs/base/browser/dom.js +0 -9
- package/esm/vs/base/browser/dom.js.map +1 -1
- package/esm/vs/base/browser/fastDomNode.js.map +1 -1
- package/esm/vs/base/browser/mouseEvent.js +0 -3
- package/esm/vs/base/browser/mouseEvent.js.map +1 -1
- package/esm/vs/base/browser/trustedTypes.js +0 -2
- package/esm/vs/base/browser/trustedTypes.js.map +1 -1
- package/esm/vs/base/browser/ui/list/listWidget.js +5 -5
- package/esm/vs/base/browser/ui/list/listWidget.js.map +1 -1
- package/esm/vs/base/browser/ui/sash/sash.css +1 -1
- package/esm/vs/base/browser/ui/sash/sash.js +0 -4
- package/esm/vs/base/browser/ui/sash/sash.js.map +1 -1
- package/esm/vs/base/browser/ui/scrollbar/scrollableElement.js +1 -1
- package/esm/vs/base/browser/ui/scrollbar/scrollableElement.js.map +1 -1
- package/esm/vs/base/browser/ui/table/table.css +2 -2
- package/esm/vs/base/browser/ui/tree/abstractTree.js +3 -7
- package/esm/vs/base/browser/ui/tree/abstractTree.js.map +1 -1
- package/esm/vs/base/browser/ui/tree/asyncDataTree.js +0 -4
- package/esm/vs/base/browser/ui/tree/asyncDataTree.js.map +1 -1
- package/esm/vs/base/browser/ui/tree/indexTreeModel.js +0 -1
- package/esm/vs/base/browser/ui/tree/indexTreeModel.js.map +1 -1
- package/esm/vs/base/browser/ui/tree/media/tree.css +2 -2
- package/esm/vs/base/browser/webWorkerFactory.js +0 -3
- package/esm/vs/base/browser/webWorkerFactory.js.map +1 -1
- package/esm/vs/base/common/buffer.js.map +1 -1
- package/esm/vs/base/common/decorators.js +0 -1
- package/esm/vs/base/common/decorators.js.map +1 -1
- package/esm/vs/base/common/errors.js +0 -1
- package/esm/vs/base/common/errors.js.map +1 -1
- package/esm/vs/base/common/hash.js.map +1 -1
- package/esm/vs/base/common/hotReload.js +0 -2
- package/esm/vs/base/common/hotReload.js.map +1 -1
- package/esm/vs/base/common/hotReloadHelpers.js +0 -1
- package/esm/vs/base/common/hotReloadHelpers.js.map +1 -1
- package/esm/vs/base/common/lifecycle.js +0 -4
- package/esm/vs/base/common/lifecycle.js.map +1 -1
- package/esm/vs/base/common/map.js +0 -1
- package/esm/vs/base/common/map.js.map +1 -1
- package/esm/vs/base/common/marshalling.js +0 -4
- package/esm/vs/base/common/marshalling.js.map +1 -1
- package/esm/vs/base/common/network.js +0 -1
- package/esm/vs/base/common/network.js.map +1 -1
- package/esm/vs/base/common/objects.js +0 -1
- package/esm/vs/base/common/objects.js.map +1 -1
- package/esm/vs/base/common/observableInternal/changeTracker.js +0 -4
- package/esm/vs/base/common/observableInternal/changeTracker.js.map +1 -1
- package/esm/vs/base/common/observableInternal/debugLocation.js +0 -1
- package/esm/vs/base/common/observableInternal/debugLocation.js.map +1 -1
- package/esm/vs/base/common/observableInternal/debugName.js +0 -1
- package/esm/vs/base/common/observableInternal/debugName.js.map +1 -1
- package/esm/vs/base/common/observableInternal/logging/consoleObservableLogger.js +0 -1
- package/esm/vs/base/common/observableInternal/logging/consoleObservableLogger.js.map +1 -1
- package/esm/vs/base/common/observableInternal/logging/debugger/debuggerRpc.js +0 -1
- package/esm/vs/base/common/observableInternal/logging/debugger/debuggerRpc.js.map +1 -1
- package/esm/vs/base/common/observableInternal/logging/debugger/rpc.js +0 -1
- package/esm/vs/base/common/observableInternal/logging/debugger/rpc.js.map +1 -1
- package/esm/vs/base/common/observableInternal/observables/derived.js +1 -7
- package/esm/vs/base/common/observableInternal/observables/derived.js.map +1 -1
- package/esm/vs/base/common/observableInternal/observables/derivedImpl.js +0 -2
- package/esm/vs/base/common/observableInternal/observables/derivedImpl.js.map +1 -1
- package/esm/vs/base/common/observableInternal/observables/observableFromEvent.js +0 -1
- package/esm/vs/base/common/observableInternal/observables/observableFromEvent.js.map +1 -1
- package/esm/vs/base/common/observableInternal/reactions/autorunImpl.js +0 -1
- package/esm/vs/base/common/observableInternal/reactions/autorunImpl.js.map +1 -1
- package/esm/vs/base/common/process.js +0 -1
- package/esm/vs/base/common/process.js.map +1 -1
- package/esm/vs/base/common/product.js.map +1 -1
- package/esm/vs/base/common/types.js +0 -2
- package/esm/vs/base/common/types.js.map +1 -1
- package/esm/vs/base/common/worker/webWorker.js +14 -26
- package/esm/vs/base/common/worker/webWorker.js.map +1 -1
- package/esm/vs/editor/browser/config/editorConfiguration.js +2 -3
- package/esm/vs/editor/browser/config/editorConfiguration.js.map +1 -1
- package/esm/vs/editor/browser/config/migrateOptions.js +1 -1
- package/esm/vs/editor/browser/config/migrateOptions.js.map +1 -1
- package/esm/vs/editor/browser/controller/editContext/native/editContextFactory.js.map +1 -1
- package/esm/vs/editor/browser/controller/editContext/native/nativeEditContextUtils.js +0 -2
- package/esm/vs/editor/browser/controller/editContext/native/nativeEditContextUtils.js.map +1 -1
- package/esm/vs/editor/browser/controller/mouseHandler.js +1 -2
- package/esm/vs/editor/browser/controller/mouseHandler.js.map +1 -1
- package/esm/vs/editor/browser/controller/mouseTarget.js +0 -7
- package/esm/vs/editor/browser/controller/mouseTarget.js.map +1 -1
- package/esm/vs/editor/browser/controller/pointerHandler.js.map +1 -1
- package/esm/vs/editor/browser/coreCommands.js.map +1 -1
- package/esm/vs/editor/browser/editorBrowser.js.map +1 -1
- package/esm/vs/editor/browser/editorDom.js.map +1 -1
- package/esm/vs/editor/browser/editorExtensions.js.map +1 -1
- package/esm/vs/editor/browser/gpu/gpuUtils.js +0 -1
- package/esm/vs/editor/browser/gpu/gpuUtils.js.map +1 -1
- package/esm/vs/editor/browser/gpu/viewGpuContext.js +0 -1
- package/esm/vs/editor/browser/gpu/viewGpuContext.js.map +1 -1
- package/esm/vs/editor/browser/services/abstractCodeEditorService.js.map +1 -1
- package/esm/vs/editor/browser/services/bulkEditService.js.map +1 -1
- package/esm/vs/editor/browser/services/codeEditorService.js.map +1 -1
- package/esm/vs/editor/browser/services/editorWorkerService.js.map +1 -1
- package/esm/vs/editor/browser/services/hoverService/hover.css +0 -2
- package/esm/vs/editor/browser/services/hoverService/hoverService.js.map +1 -1
- package/esm/vs/editor/browser/services/hoverService/hoverWidget.js +1 -1
- package/esm/vs/editor/browser/services/hoverService/hoverWidget.js.map +1 -1
- package/esm/vs/editor/browser/services/inlineCompletionsService.js +8 -8
- package/esm/vs/editor/browser/services/inlineCompletionsService.js.map +1 -1
- package/esm/vs/editor/browser/services/openerService.js.map +1 -1
- package/esm/vs/editor/browser/view.js.map +1 -1
- package/esm/vs/editor/browser/viewParts/contentWidgets/contentWidgets.js +0 -1
- package/esm/vs/editor/browser/viewParts/contentWidgets/contentWidgets.js.map +1 -1
- package/esm/vs/editor/browser/viewParts/viewZones/viewZones.js +0 -1
- package/esm/vs/editor/browser/viewParts/viewZones/viewZones.js.map +1 -1
- package/esm/vs/editor/browser/widget/codeEditor/codeEditorContributions.js.map +1 -1
- package/esm/vs/editor/browser/widget/codeEditor/codeEditorWidget.js +1 -4
- package/esm/vs/editor/browser/widget/codeEditor/codeEditorWidget.js.map +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/components/diffEditorEditors.js +0 -1
- package/esm/vs/editor/browser/widget/diffEditor/components/diffEditorEditors.js.map +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/delegatingEditorImpl.js.map +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/diffEditorOptions.js +0 -1
- package/esm/vs/editor/browser/widget/diffEditor/diffEditorOptions.js.map +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/diffEditorWidget.js +0 -1
- package/esm/vs/editor/browser/widget/diffEditor/diffEditorWidget.js.map +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/utils.js +0 -2
- package/esm/vs/editor/browser/widget/diffEditor/utils.js.map +1 -1
- package/esm/vs/editor/browser/widget/multiDiffEditor/diffEditorItemTemplate.js +0 -2
- package/esm/vs/editor/browser/widget/multiDiffEditor/diffEditorItemTemplate.js.map +1 -1
- package/esm/vs/editor/common/config/editorOptions.js +68 -122
- package/esm/vs/editor/common/config/editorOptions.js.map +1 -1
- package/esm/vs/editor/common/config/fontInfo.js +16 -32
- package/esm/vs/editor/common/config/fontInfo.js.map +1 -1
- package/esm/vs/editor/common/core/edits/edit.js +0 -1
- package/esm/vs/editor/common/core/edits/edit.js.map +1 -1
- package/esm/vs/editor/common/core/edits/stringEdit.js +0 -2
- package/esm/vs/editor/common/core/edits/stringEdit.js.map +1 -1
- package/esm/vs/editor/common/core/position.js +1 -1
- package/esm/vs/editor/common/core/position.js.map +1 -1
- package/esm/vs/editor/common/core/range.js +1 -1
- package/esm/vs/editor/common/core/range.js.map +1 -1
- package/esm/vs/editor/common/core/selection.js +1 -1
- package/esm/vs/editor/common/core/selection.js.map +1 -1
- package/esm/vs/editor/common/cursor/cursorMoveCommands.js.map +1 -1
- package/esm/vs/editor/common/editorCommon.js.map +1 -1
- package/esm/vs/editor/common/languages.js +1 -1
- package/esm/vs/editor/common/languages.js.map +1 -1
- package/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/length.js +0 -14
- package/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/length.js.map +1 -1
- package/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/smallImmutableSet.js +0 -2
- package/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/smallImmutableSet.js.map +1 -1
- package/esm/vs/editor/common/model/textModel.js +1 -1
- package/esm/vs/editor/common/model/textModel.js.map +1 -1
- package/esm/vs/editor/common/model.js +1 -1
- package/esm/vs/editor/common/model.js.map +1 -1
- package/esm/vs/editor/common/services/editorBaseApi.js.map +1 -1
- package/esm/vs/editor/common/services/editorWebWorker.js +0 -1
- package/esm/vs/editor/common/services/editorWebWorker.js.map +1 -1
- package/esm/vs/editor/common/services/editorWorkerHost.js.map +1 -1
- package/esm/vs/editor/common/services/modelService.js +21 -14
- package/esm/vs/editor/common/services/modelService.js.map +1 -1
- package/esm/vs/editor/common/textModelEditSource.js +0 -2
- package/esm/vs/editor/common/textModelEditSource.js.map +1 -1
- package/esm/vs/editor/common/viewLayout/viewLineRenderer.js +1 -40
- package/esm/vs/editor/common/viewLayout/viewLineRenderer.js.map +1 -1
- package/esm/vs/editor/common/viewModel/viewModelImpl.js +1 -2
- package/esm/vs/editor/common/viewModel/viewModelImpl.js.map +1 -1
- package/esm/vs/editor/contrib/codeAction/browser/codeActionController.js +0 -1
- package/esm/vs/editor/contrib/codeAction/browser/codeActionController.js.map +1 -1
- package/esm/vs/editor/contrib/codelens/browser/codelensController.js +1 -1
- package/esm/vs/editor/contrib/codelens/browser/codelensController.js.map +1 -1
- package/esm/vs/editor/contrib/colorPicker/browser/colorDetector.js +0 -1
- package/esm/vs/editor/contrib/colorPicker/browser/colorDetector.js.map +1 -1
- package/esm/vs/editor/contrib/contextmenu/browser/contextmenu.js +0 -1
- package/esm/vs/editor/contrib/contextmenu/browser/contextmenu.js.map +1 -1
- package/esm/vs/editor/contrib/find/browser/findModel.js +0 -1
- package/esm/vs/editor/contrib/find/browser/findModel.js.map +1 -1
- package/esm/vs/editor/contrib/find/browser/findWidget.css +5 -5
- package/esm/vs/editor/contrib/folding/browser/folding.css +4 -4
- package/esm/vs/editor/contrib/folding/browser/foldingDecorations.js.map +1 -1
- package/esm/vs/editor/contrib/gotoSymbol/browser/link/goToDefinitionAtPosition.js +1 -1
- package/esm/vs/editor/contrib/gotoSymbol/browser/link/goToDefinitionAtPosition.js.map +1 -1
- package/esm/vs/editor/contrib/inlayHints/browser/inlayHintsController.js +1 -1
- package/esm/vs/editor/contrib/inlayHints/browser/inlayHintsController.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.js +3 -4
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsSource.js +7 -56
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsSource.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/structuredLogger.js +0 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/structuredLogger.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.js +0 -2
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorView.js +0 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorView.js.map +1 -1
- package/esm/vs/editor/contrib/parameterHints/browser/parameterHintsWidget.js +1 -1
- package/esm/vs/editor/contrib/parameterHints/browser/parameterHintsWidget.js.map +1 -1
- package/esm/vs/editor/contrib/symbolIcons/browser/symbolIcons.css +0 -2
- package/esm/vs/editor/contrib/unicodeHighlighter/browser/unicodeHighlighter.js +0 -2
- package/esm/vs/editor/contrib/unicodeHighlighter/browser/unicodeHighlighter.js.map +1 -1
- package/esm/vs/editor/contrib/unusualLineTerminators/browser/unusualLineTerminators.js.map +1 -1
- package/esm/vs/editor/editor.api.d.ts +8 -8
- package/esm/vs/editor/editor.api.js +0 -4
- package/esm/vs/editor/editor.api.js.map +1 -1
- package/esm/vs/editor/standalone/browser/standaloneEditor.js +0 -37
- package/esm/vs/editor/standalone/browser/standaloneEditor.js.map +1 -1
- package/esm/vs/editor/standalone/browser/standaloneLanguages.js +0 -37
- package/esm/vs/editor/standalone/browser/standaloneLanguages.js.map +1 -1
- package/esm/vs/editor/standalone/browser/standaloneWebWorker.js.map +1 -1
- package/esm/vs/editor/standalone/common/monarch/monarchCompile.js +0 -3
- package/esm/vs/editor/standalone/common/monarch/monarchCompile.js.map +1 -1
- package/esm/vs/platform/accessibility/browser/accessibilityService.js +2 -2
- package/esm/vs/platform/accessibility/browser/accessibilityService.js.map +1 -1
- package/esm/vs/platform/contextkey/common/contextkey.js +0 -5
- package/esm/vs/platform/contextkey/common/contextkey.js.map +1 -1
- package/esm/vs/platform/dataChannel/browser/forwardingTelemetryService.js +0 -1
- package/esm/vs/platform/dataChannel/browser/forwardingTelemetryService.js.map +1 -1
- package/esm/vs/platform/dnd/browser/dnd.js +0 -2
- package/esm/vs/platform/dnd/browser/dnd.js.map +1 -1
- package/esm/vs/platform/instantiation/common/instantiation.js +0 -5
- package/esm/vs/platform/instantiation/common/instantiation.js.map +1 -1
- package/esm/vs/platform/instantiation/common/instantiationService.js +0 -1
- package/esm/vs/platform/instantiation/common/instantiationService.js.map +1 -1
- package/esm/vs/platform/list/browser/listService.js +0 -5
- package/esm/vs/platform/list/browser/listService.js.map +1 -1
- package/esm/vs/platform/observable/common/wrapInHotClass.js +0 -2
- package/esm/vs/platform/observable/common/wrapInHotClass.js.map +1 -1
- package/esm/vs/platform/observable/common/wrapInReloadableClass.js +0 -3
- package/esm/vs/platform/observable/common/wrapInReloadableClass.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/quickInput.js +1 -1
- package/esm/vs/platform/quickinput/browser/quickInput.js.map +1 -1
- package/monaco.d.ts +8 -8
- package/package.json +2 -2
- package/version.txt +1 -1
- package/esm/vs/base/parts/sandbox/common/sandboxTypes.js +0 -2
- package/esm/vs/base/parts/sandbox/common/sandboxTypes.js.map +0 -1
- package/esm/vs/editor/common/config/fontInfoFromSettings.js +0 -16
- package/esm/vs/editor/common/config/fontInfoFromSettings.js.map +0 -1
- package/esm/vs/platform/product/common/product.js +0 -69
- package/esm/vs/platform/product/common/product.js.map +0 -1
|
@@ -14,21 +14,18 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
14
14
|
var InlineCompletionsSource_1;
|
|
15
15
|
import { booleanComparator, compareBy, compareUndefinedSmallest, numberComparator } from '../../../../../base/common/arrays.js';
|
|
16
16
|
import { findLastMax } from '../../../../../base/common/arraysFind.js';
|
|
17
|
-
import { RunOnceScheduler } from '../../../../../base/common/async.js';
|
|
18
17
|
import { CancellationTokenSource } from '../../../../../base/common/cancellation.js';
|
|
19
18
|
import { equalsIfDefined, itemEquals } from '../../../../../base/common/equals.js';
|
|
20
19
|
import { Disposable, DisposableStore, MutableDisposable, toDisposable } from '../../../../../base/common/lifecycle.js';
|
|
21
20
|
import { derived, observableValue, recordChangesLazy, transaction } from '../../../../../base/common/observable.js';
|
|
22
21
|
// eslint-disable-next-line local/code-no-deep-import-of-internal
|
|
23
22
|
import { observableReducerSettable } from '../../../../../base/common/observableInternal/experimental/reducer.js';
|
|
24
|
-
import { isDefined
|
|
23
|
+
import { isDefined } from '../../../../../base/common/types.js';
|
|
25
24
|
import { IConfigurationService } from '../../../../../platform/configuration/common/configuration.js';
|
|
26
|
-
import { IContextKeyService } from '../../../../../platform/contextkey/common/contextkey.js';
|
|
27
25
|
import { DataChannelForwardingTelemetryService, forwardToChannelIf, isCopilotLikeExtension } from '../../../../../platform/dataChannel/browser/forwardingTelemetryService.js';
|
|
28
26
|
import { IInstantiationService } from '../../../../../platform/instantiation/common/instantiation.js';
|
|
29
27
|
import { ILogService } from '../../../../../platform/log/common/log.js';
|
|
30
28
|
import { observableConfigValue } from '../../../../../platform/observable/common/platformObservableUtils.js';
|
|
31
|
-
import product from '../../../../../platform/product/common/product.js';
|
|
32
29
|
import { StringEdit } from '../../../../common/core/edits/stringEdit.js';
|
|
33
30
|
import { InlineCompletionEndOfLifeReasonKind, InlineCompletionTriggerKind } from '../../../../common/languages.js';
|
|
34
31
|
import { ILanguageConfigurationService } from '../../../../common/languages/languageConfigurationRegistry.js';
|
|
@@ -41,7 +38,7 @@ import { provideInlineCompletions, runWhenCancelled } from './provideInlineCompl
|
|
|
41
38
|
let InlineCompletionsSource = class InlineCompletionsSource extends Disposable {
|
|
42
39
|
static { InlineCompletionsSource_1 = this; }
|
|
43
40
|
static { this._requestId = 0; }
|
|
44
|
-
constructor(_textModel, _versionId, _debounceValue, _cursorPosition, _languageConfigurationService, _logService, _configurationService, _instantiationService
|
|
41
|
+
constructor(_textModel, _versionId, _debounceValue, _cursorPosition, _languageConfigurationService, _logService, _configurationService, _instantiationService) {
|
|
45
42
|
super();
|
|
46
43
|
this._textModel = _textModel;
|
|
47
44
|
this._versionId = _versionId;
|
|
@@ -51,7 +48,6 @@ let InlineCompletionsSource = class InlineCompletionsSource extends Disposable {
|
|
|
51
48
|
this._logService = _logService;
|
|
52
49
|
this._configurationService = _configurationService;
|
|
53
50
|
this._instantiationService = _instantiationService;
|
|
54
|
-
this._contextKeyService = _contextKeyService;
|
|
55
51
|
this._updateOperation = this._register(new MutableDisposable());
|
|
56
52
|
this._state = observableReducerSettable(this, {
|
|
57
53
|
initial: () => ({
|
|
@@ -82,7 +78,6 @@ let InlineCompletionsSource = class InlineCompletionsSource extends Disposable {
|
|
|
82
78
|
});
|
|
83
79
|
this.inlineCompletions = this._state.map(this, v => v.inlineCompletions);
|
|
84
80
|
this.suggestWidgetInlineCompletions = this._state.map(this, v => v.suggestWidgetInlineCompletions);
|
|
85
|
-
this._completionsEnabled = undefined;
|
|
86
81
|
this.clearOperationOnTextModelChange = derived(this, reader => {
|
|
87
82
|
this._versionId.read(reader);
|
|
88
83
|
this._updateOperation.clear();
|
|
@@ -93,24 +88,6 @@ let InlineCompletionsSource = class InlineCompletionsSource extends Disposable {
|
|
|
93
88
|
this._sendRequestData = observableConfigValue('editor.inlineSuggest.emptyResponseInformation', true, this._configurationService).recomputeInitiallyAndOnChange(this._store);
|
|
94
89
|
this._structuredFetchLogger = this._register(this._instantiationService.createInstance(StructuredLogger.cast(), 'editor.inlineSuggest.logFetch.commandId'));
|
|
95
90
|
this.clearOperationOnTextModelChange.recomputeInitiallyAndOnChange(this._store);
|
|
96
|
-
const enablementSetting = product.defaultChatAgent?.completionsEnablementSetting ?? undefined;
|
|
97
|
-
if (enablementSetting) {
|
|
98
|
-
this._updateCompletionsEnablement(enablementSetting);
|
|
99
|
-
this._register(this._configurationService.onDidChangeConfiguration(e => {
|
|
100
|
-
if (e.affectsConfiguration(enablementSetting)) {
|
|
101
|
-
this._updateCompletionsEnablement(enablementSetting);
|
|
102
|
-
}
|
|
103
|
-
}));
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
_updateCompletionsEnablement(enalementSetting) {
|
|
107
|
-
const result = this._configurationService.getValue(enalementSetting);
|
|
108
|
-
if (!isObject(result)) {
|
|
109
|
-
this._completionsEnabled = undefined;
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
this._completionsEnabled = result;
|
|
113
|
-
}
|
|
114
91
|
}
|
|
115
92
|
_log(entry) {
|
|
116
93
|
if (this._loggingEnabled.get()) {
|
|
@@ -132,17 +109,8 @@ let InlineCompletionsSource = class InlineCompletionsSource extends Disposable {
|
|
|
132
109
|
this._updateOperation.clear();
|
|
133
110
|
const source = new CancellationTokenSource();
|
|
134
111
|
const promise = (async () => {
|
|
135
|
-
const store = new DisposableStore();
|
|
136
112
|
this._loadingCount.set(this._loadingCount.get() + 1, undefined);
|
|
137
|
-
|
|
138
|
-
const decreaseLoadingCount = () => {
|
|
139
|
-
if (!didDecrease) {
|
|
140
|
-
didDecrease = true;
|
|
141
|
-
this._loadingCount.set(this._loadingCount.get() - 1, undefined);
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
const loadingReset = store.add(new RunOnceScheduler(() => decreaseLoadingCount(), 10 * 1000));
|
|
145
|
-
loadingReset.schedule();
|
|
113
|
+
const store = new DisposableStore();
|
|
146
114
|
const inlineSuggestionsProviders = providers.filter(p => p.providerId);
|
|
147
115
|
const requestResponseInfo = new RequestResponseData(context, requestInfo, inlineSuggestionsProviders);
|
|
148
116
|
try {
|
|
@@ -233,8 +201,7 @@ let InlineCompletionsSource = class InlineCompletionsSource extends Disposable {
|
|
|
233
201
|
requestResponseInfo.setNoSuggestionReasonIfNotSet('canceled:whileFetching');
|
|
234
202
|
}
|
|
235
203
|
else {
|
|
236
|
-
|
|
237
|
-
requestResponseInfo.setNoSuggestionReasonIfNotSet(completionsQuotaExceeded ? 'completionsQuotaExceeded' : 'noSuggestion');
|
|
204
|
+
requestResponseInfo.setNoSuggestionReasonIfNotSet('noSuggestion');
|
|
238
205
|
}
|
|
239
206
|
}
|
|
240
207
|
const remainingTimeToWait = context.earliestShownDateTime - Date.now();
|
|
@@ -275,8 +242,8 @@ let InlineCompletionsSource = class InlineCompletionsSource extends Disposable {
|
|
|
275
242
|
});
|
|
276
243
|
}
|
|
277
244
|
finally {
|
|
245
|
+
this._loadingCount.set(this._loadingCount.get() - 1, undefined);
|
|
278
246
|
store.dispose();
|
|
279
|
-
decreaseLoadingCount();
|
|
280
247
|
this.sendInlineCompletionsRequestTelemetry(requestResponseInfo);
|
|
281
248
|
}
|
|
282
249
|
return true;
|
|
@@ -317,18 +284,12 @@ let InlineCompletionsSource = class InlineCompletionsSource extends Disposable {
|
|
|
317
284
|
});
|
|
318
285
|
}
|
|
319
286
|
sendInlineCompletionsRequestTelemetry(requestResponseInfo) {
|
|
320
|
-
if (!this._sendRequestData.get()
|
|
287
|
+
if (!this._sendRequestData.get()) {
|
|
321
288
|
return;
|
|
322
289
|
}
|
|
323
290
|
if (requestResponseInfo.requestUuid === undefined || requestResponseInfo.hasProducedSuggestion) {
|
|
324
291
|
return;
|
|
325
292
|
}
|
|
326
|
-
if (!isCompletionsEnabled(this._completionsEnabled, this._textModel.getLanguageId())) {
|
|
327
|
-
return;
|
|
328
|
-
}
|
|
329
|
-
if (!requestResponseInfo.providers.some(p => isCopilotLikeExtension(p.providerId?.extensionId))) {
|
|
330
|
-
return;
|
|
331
|
-
}
|
|
332
293
|
const emptyEndOfLifeEvent = {
|
|
333
294
|
id: requestResponseInfo.requestUuid,
|
|
334
295
|
opportunityId: requestResponseInfo.requestUuid,
|
|
@@ -386,8 +347,7 @@ InlineCompletionsSource = InlineCompletionsSource_1 = __decorate([
|
|
|
386
347
|
__param(4, ILanguageConfigurationService),
|
|
387
348
|
__param(5, ILogService),
|
|
388
349
|
__param(6, IConfigurationService),
|
|
389
|
-
__param(7, IInstantiationService)
|
|
390
|
-
__param(8, IContextKeyService)
|
|
350
|
+
__param(7, IInstantiationService)
|
|
391
351
|
], InlineCompletionsSource);
|
|
392
352
|
export { InlineCompletionsSource };
|
|
393
353
|
class UpdateRequest {
|
|
@@ -426,15 +386,6 @@ class RequestResponseData {
|
|
|
426
386
|
function isSubset(set1, set2) {
|
|
427
387
|
return [...set1].every(item => set2.has(item));
|
|
428
388
|
}
|
|
429
|
-
function isCompletionsEnabled(completionsEnablementObject, modeId = '*') {
|
|
430
|
-
if (completionsEnablementObject === undefined) {
|
|
431
|
-
return false; // default to disabled if setting is not available
|
|
432
|
-
}
|
|
433
|
-
if (typeof completionsEnablementObject[modeId] !== 'undefined') {
|
|
434
|
-
return Boolean(completionsEnablementObject[modeId]); // go with setting if explicitly defined
|
|
435
|
-
}
|
|
436
|
-
return Boolean(completionsEnablementObject['*']); // fallback to global setting otherwise
|
|
437
|
-
}
|
|
438
389
|
class UpdateOperation {
|
|
439
390
|
constructor(request, cancellationTokenSource, promise) {
|
|
440
391
|
this.request = request;
|
package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsSource.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsSource.ts","vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsSource.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;;A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kDAAkD;AAClD,SAAS,aAAa,CAAI,KAAU,EAAE,GAAyB;IAC9D,MAAM,IAAI,GAAG,IAAI,GAAG,EAAE,CAAC;IACvB,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;QAC1B,MAAM,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC;QACpB,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YACjB,OAAO,KAAK,CAAC;QACd,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACZ,OAAO,IAAI,CAAC;IACb,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,WAAW,CAAI,IAAO,EAAE,KAAU;IAC1C,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAClC,IAAI,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC;QAChB,OAAO,CAAC,IAAI,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;IACpE,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC","file":"inlineCompletionsSource.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { booleanComparator, compareBy, compareUndefinedSmallest, numberComparator } from '../../../../../base/common/arrays.js';\nimport { findLastMax } from '../../../../../base/common/arraysFind.js';\nimport { RunOnceScheduler } from '../../../../../base/common/async.js';\nimport { CancellationTokenSource } from '../../../../../base/common/cancellation.js';\nimport { equalsIfDefined, itemEquals } from '../../../../../base/common/equals.js';\nimport { Disposable, DisposableStore, IDisposable, MutableDisposable, toDisposable } from '../../../../../base/common/lifecycle.js';\nimport { derived, IObservable, IObservableWithChange, ITransaction, observableValue, recordChangesLazy, transaction } from '../../../../../base/common/observable.js';\n// eslint-disable-next-line local/code-no-deep-import-of-internal\nimport { observableReducerSettable } from '../../../../../base/common/observableInternal/experimental/reducer.js';\nimport { isDefined, isObject } from '../../../../../base/common/types.js';\nimport { IConfigurationService } from '../../../../../platform/configuration/common/configuration.js';\nimport { IContextKeyService } from '../../../../../platform/contextkey/common/contextkey.js';\nimport { DataChannelForwardingTelemetryService, forwardToChannelIf, isCopilotLikeExtension } from '../../../../../platform/dataChannel/browser/forwardingTelemetryService.js';\nimport { IInstantiationService } from '../../../../../platform/instantiation/common/instantiation.js';\nimport { ILogService } from '../../../../../platform/log/common/log.js';\nimport { observableConfigValue } from '../../../../../platform/observable/common/platformObservableUtils.js';\nimport product from '../../../../../platform/product/common/product.js';\nimport { StringEdit } from '../../../../common/core/edits/stringEdit.js';\nimport { Position } from '../../../../common/core/position.js';\nimport { InlineCompletionEndOfLifeReasonKind, InlineCompletionTriggerKind, InlineCompletionsProvider } from '../../../../common/languages.js';\nimport { ILanguageConfigurationService } from '../../../../common/languages/languageConfigurationRegistry.js';\nimport { ITextModel } from '../../../../common/model.js';\nimport { offsetEditFromContentChanges } from '../../../../common/model/textModelStringEdit.js';\nimport { IFeatureDebounceInformation } from '../../../../common/services/languageFeatureDebounce.js';\nimport { IModelContentChangedEvent } from '../../../../common/textModelEvents.js';\nimport { formatRecordableLogEntry, IRecordableEditorLogEntry, IRecordableLogEntry, StructuredLogger } from '../structuredLogger.js';\nimport { InlineCompletionEndOfLifeEvent, sendInlineCompletionsEndOfLifeTelemetry } from '../telemetry.js';\nimport { wait } from '../utils.js';\nimport { InlineSuggestionIdentity, InlineSuggestionItem } from './inlineSuggestionItem.js';\nimport { InlineCompletionContextWithoutUuid, InlineSuggestRequestInfo, provideInlineCompletions, runWhenCancelled } from './provideInlineCompletions.js';\n\nexport class InlineCompletionsSource extends Disposable {\n\tprivate static _requestId = 0;\n\n\tprivate readonly _updateOperation = this._register(new MutableDisposable<UpdateOperation>());\n\n\tprivate readonly _loggingEnabled;\n\tprivate readonly _sendRequestData;\n\n\tprivate readonly _structuredFetchLogger;\n\n\tprivate readonly _state = observableReducerSettable(this, {\n\t\tinitial: () => ({\n\t\t\tinlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t\tsuggestWidgetInlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t}),\n\t\tdisposeFinal: (values) => {\n\t\t\tvalues.inlineCompletions.dispose();\n\t\t\tvalues.suggestWidgetInlineCompletions.dispose();\n\t\t},\n\t\tchangeTracker: recordChangesLazy(() => ({ versionId: this._versionId })),\n\t\tupdate: (reader, previousValue, changes) => {\n\t\t\tconst edit = StringEdit.compose(changes.changes.map(c => c.change ? offsetEditFromContentChanges(c.change.changes) : StringEdit.empty).filter(isDefined));\n\n\t\t\tif (edit.isEmpty()) {\n\t\t\t\treturn previousValue;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\treturn {\n\t\t\t\t\tinlineCompletions: previousValue.inlineCompletions.createStateWithAppliedEdit(edit, this._textModel),\n\t\t\t\t\tsuggestWidgetInlineCompletions: previousValue.suggestWidgetInlineCompletions.createStateWithAppliedEdit(edit, this._textModel),\n\t\t\t\t};\n\t\t\t} finally {\n\t\t\t\tpreviousValue.inlineCompletions.dispose();\n\t\t\t\tpreviousValue.suggestWidgetInlineCompletions.dispose();\n\t\t\t}\n\t\t}\n\t});\n\n\tpublic readonly inlineCompletions = this._state.map(this, v => v.inlineCompletions);\n\tpublic readonly suggestWidgetInlineCompletions = this._state.map(this, v => v.suggestWidgetInlineCompletions);\n\n\tprivate _completionsEnabled: Record<string, boolean> | undefined = undefined;\n\n\tconstructor(\n\t\tprivate readonly _textModel: ITextModel,\n\t\tprivate readonly _versionId: IObservableWithChange<number | null, IModelContentChangedEvent | undefined>,\n\t\tprivate readonly _debounceValue: IFeatureDebounceInformation,\n\t\tprivate readonly _cursorPosition: IObservable<Position>,\n\t\t@ILanguageConfigurationService private readonly _languageConfigurationService: ILanguageConfigurationService,\n\t\t@ILogService private readonly _logService: ILogService,\n\t\t@IConfigurationService private readonly _configurationService: IConfigurationService,\n\t\t@IInstantiationService private readonly _instantiationService: IInstantiationService,\n\t\t@IContextKeyService private readonly _contextKeyService: IContextKeyService,\n\t) {\n\t\tsuper();\n\t\tthis._loggingEnabled = observableConfigValue('editor.inlineSuggest.logFetch', false, this._configurationService).recomputeInitiallyAndOnChange(this._store);\n\t\tthis._sendRequestData = observableConfigValue('editor.inlineSuggest.emptyResponseInformation', true, this._configurationService).recomputeInitiallyAndOnChange(this._store);\n\t\tthis._structuredFetchLogger = this._register(this._instantiationService.createInstance(StructuredLogger.cast<\n\t\t\t{ kind: 'start'; requestId: number; context: unknown } & IRecordableEditorLogEntry\n\t\t\t| { kind: 'end'; error: unknown; durationMs: number; result: unknown; requestId: number } & IRecordableLogEntry\n\t\t>(),\n\t\t\t'editor.inlineSuggest.logFetch.commandId'\n\t\t));\n\n\t\tthis.clearOperationOnTextModelChange.recomputeInitiallyAndOnChange(this._store);\n\n\t\tconst enablementSetting = product.defaultChatAgent?.completionsEnablementSetting ?? undefined;\n\t\tif (enablementSetting) {\n\t\t\tthis._updateCompletionsEnablement(enablementSetting);\n\t\t\tthis._register(this._configurationService.onDidChangeConfiguration(e => {\n\t\t\t\tif (e.affectsConfiguration(enablementSetting)) {\n\t\t\t\t\tthis._updateCompletionsEnablement(enablementSetting);\n\t\t\t\t}\n\t\t\t}));\n\t\t}\n\t}\n\n\tprivate _updateCompletionsEnablement(enalementSetting: string) {\n\t\tconst result = this._configurationService.getValue<Record<string, boolean>>(enalementSetting);\n\t\tif (!isObject(result)) {\n\t\t\tthis._completionsEnabled = undefined;\n\t\t} else {\n\t\t\tthis._completionsEnabled = result;\n\t\t}\n\t}\n\n\tpublic readonly clearOperationOnTextModelChange = derived(this, reader => {\n\t\tthis._versionId.read(reader);\n\t\tthis._updateOperation.clear();\n\t\treturn undefined; // always constant\n\t});\n\n\tprivate _log(entry:\n\t\t{ sourceId: string; kind: 'start'; requestId: number; context: unknown; provider: string | undefined } & IRecordableEditorLogEntry\n\t\t| { sourceId: string; kind: 'end'; error: unknown; durationMs: number; result: unknown; requestId: number; didAllProvidersReturn: boolean } & IRecordableLogEntry\n\t) {\n\t\tif (this._loggingEnabled.get()) {\n\t\t\tthis._logService.info(formatRecordableLogEntry(entry));\n\t\t}\n\t\tthis._structuredFetchLogger.log(entry);\n\t}\n\n\tprivate readonly _loadingCount = observableValue(this, 0);\n\n\tpublic fetch(\n\t\tproviders: InlineCompletionsProvider[],\n\t\tprovidersLabel: string | undefined,\n\t\tcontext: InlineCompletionContextWithoutUuid,\n\t\tactiveInlineCompletion: InlineSuggestionIdentity | undefined,\n\t\twithDebounce: boolean,\n\t\tuserJumpedToActiveCompletion: IObservable<boolean>,\n\t\trequestInfo: InlineSuggestRequestInfo\n\t): Promise<boolean> {\n\t\tconst position = this._cursorPosition.get();\n\t\tconst request = new UpdateRequest(position, context, this._textModel.getVersionId(), new Set(providers));\n\n\t\tconst target = context.selectedSuggestionInfo ? this.suggestWidgetInlineCompletions.get() : this.inlineCompletions.get();\n\n\t\tif (this._updateOperation.value?.request.satisfies(request)) {\n\t\t\treturn this._updateOperation.value.promise;\n\t\t} else if (target?.request?.satisfies(request)) {\n\t\t\treturn Promise.resolve(true);\n\t\t}\n\n\t\tconst updateOngoing = !!this._updateOperation.value;\n\t\tthis._updateOperation.clear();\n\n\t\tconst source = new CancellationTokenSource();\n\n\t\tconst promise = (async () => {\n\t\t\tconst store = new DisposableStore();\n\n\t\t\tthis._loadingCount.set(this._loadingCount.get() + 1, undefined);\n\t\t\tlet didDecrease = false;\n\t\t\tconst decreaseLoadingCount = () => {\n\t\t\t\tif (!didDecrease) {\n\t\t\t\t\tdidDecrease = true;\n\t\t\t\t\tthis._loadingCount.set(this._loadingCount.get() - 1, undefined);\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst loadingReset = store.add(new RunOnceScheduler(() => decreaseLoadingCount(), 10 * 1000));\n\t\t\tloadingReset.schedule();\n\n\t\t\tconst inlineSuggestionsProviders = providers.filter(p => p.providerId);\n\t\t\tconst requestResponseInfo = new RequestResponseData(context, requestInfo, inlineSuggestionsProviders);\n\n\n\t\t\ttry {\n\t\t\t\tconst recommendedDebounceValue = this._debounceValue.get(this._textModel);\n\t\t\t\tconst debounceValue = findLastMax(\n\t\t\t\t\tproviders.map(p => p.debounceDelayMs),\n\t\t\t\t\tcompareUndefinedSmallest(numberComparator)\n\t\t\t\t) ?? recommendedDebounceValue;\n\n\t\t\t\t// Debounce in any case if update is ongoing\n\t\t\t\tconst shouldDebounce = updateOngoing || (withDebounce && context.triggerKind === InlineCompletionTriggerKind.Automatic);\n\t\t\t\tif (shouldDebounce) {\n\t\t\t\t\t// This debounces the operation\n\t\t\t\t\tawait wait(debounceValue, source.token);\n\t\t\t\t}\n\n\t\t\t\tif (source.token.isCancellationRequested || this._store.isDisposed || this._textModel.getVersionId() !== request.versionId) {\n\t\t\t\t\trequestResponseInfo.setNoSuggestionReasonIfNotSet('canceled:beforeFetch');\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tconst requestId = InlineCompletionsSource._requestId++;\n\t\t\t\tif (this._loggingEnabled.get() || this._structuredFetchLogger.isEnabled.get()) {\n\t\t\t\t\tthis._log({\n\t\t\t\t\t\tsourceId: 'InlineCompletions.fetch',\n\t\t\t\t\t\tkind: 'start',\n\t\t\t\t\t\trequestId,\n\t\t\t\t\t\tmodelUri: this._textModel.uri,\n\t\t\t\t\t\tmodelVersion: this._textModel.getVersionId(),\n\t\t\t\t\t\tcontext: { triggerKind: context.triggerKind, suggestInfo: context.selectedSuggestionInfo ? true : undefined },\n\t\t\t\t\t\ttime: Date.now(),\n\t\t\t\t\t\tprovider: providersLabel,\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tconst startTime = new Date();\n\t\t\t\tconst providerResult = provideInlineCompletions(providers, this._cursorPosition.get(), this._textModel, context, requestInfo, this._languageConfigurationService);\n\n\t\t\t\trunWhenCancelled(source.token, () => providerResult.cancelAndDispose({ kind: 'tokenCancellation' }));\n\n\t\t\t\tlet shouldStopEarly = false;\n\t\t\t\tlet producedSuggestion = false;\n\n\t\t\t\tconst suggestions: InlineSuggestionItem[] = [];\n\t\t\t\tfor await (const list of providerResult.lists) {\n\t\t\t\t\tif (!list) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tlist.addRef();\n\t\t\t\t\tstore.add(toDisposable(() => list.removeRef(list.inlineSuggestionsData.length === 0 ? { kind: 'empty' } : { kind: 'notTaken' })));\n\n\t\t\t\t\tfor (const item of list.inlineSuggestionsData) {\n\t\t\t\t\t\tproducedSuggestion = true;\n\t\t\t\t\t\tif (!context.includeInlineEdits && (item.isInlineEdit || item.showInlineEditMenu)) {\n\t\t\t\t\t\t\titem.setNotShownReason('notInlineEditRequested');\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!context.includeInlineCompletions && !(item.isInlineEdit || item.showInlineEditMenu)) {\n\t\t\t\t\t\t\titem.setNotShownReason('notInlineCompletionRequested');\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst i = InlineSuggestionItem.create(item, this._textModel);\n\t\t\t\t\t\tsuggestions.push(i);\n\t\t\t\t\t\t// Stop after first visible inline completion\n\t\t\t\t\t\tif (!i.isInlineEdit && !i.showInlineEditMenu && context.triggerKind === InlineCompletionTriggerKind.Automatic) {\n\t\t\t\t\t\t\tif (i.isVisible(this._textModel, this._cursorPosition.get())) {\n\t\t\t\t\t\t\t\tshouldStopEarly = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (shouldStopEarly) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tproviderResult.cancelAndDispose({ kind: 'lostRace' });\n\n\t\t\t\tif (this._loggingEnabled.get() || this._structuredFetchLogger.isEnabled.get()) {\n\t\t\t\t\tconst didAllProvidersReturn = providerResult.didAllProvidersReturn;\n\t\t\t\t\tlet error: string | undefined = undefined;\n\t\t\t\t\tif (source.token.isCancellationRequested || this._store.isDisposed || this._textModel.getVersionId() !== request.versionId) {\n\t\t\t\t\t\terror = 'canceled';\n\t\t\t\t\t}\n\t\t\t\t\tconst result = suggestions.map(c => ({\n\t\t\t\t\t\trange: c.editRange.toString(),\n\t\t\t\t\t\ttext: c.insertText,\n\t\t\t\t\t\tisInlineEdit: !!c.isInlineEdit,\n\t\t\t\t\t\tsource: c.source.provider.groupId,\n\t\t\t\t\t}));\n\t\t\t\t\tthis._log({ sourceId: 'InlineCompletions.fetch', kind: 'end', requestId, durationMs: (Date.now() - startTime.getTime()), error, result, time: Date.now(), didAllProvidersReturn });\n\t\t\t\t}\n\n\t\t\t\trequestResponseInfo.setRequestUuid(providerResult.contextWithUuid.requestUuid);\n\t\t\t\tif (producedSuggestion) {\n\t\t\t\t\trequestResponseInfo.setHasProducedSuggestion();\n\t\t\t\t\tif (suggestions.length > 0 && source.token.isCancellationRequested) {\n\t\t\t\t\t\tsuggestions.forEach(s => s.setNotShownReasonIfNotSet('canceled:whileAwaitingOtherProviders'));\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (source.token.isCancellationRequested) {\n\t\t\t\t\t\trequestResponseInfo.setNoSuggestionReasonIfNotSet('canceled:whileFetching');\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst completionsQuotaExceeded = this._contextKeyService.getContextKeyValue<boolean>('completionsQuotaExceeded');\n\t\t\t\t\t\trequestResponseInfo.setNoSuggestionReasonIfNotSet(completionsQuotaExceeded ? 'completionsQuotaExceeded' : 'noSuggestion');\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst remainingTimeToWait = context.earliestShownDateTime - Date.now();\n\t\t\t\tif (remainingTimeToWait > 0) {\n\t\t\t\t\tawait wait(remainingTimeToWait, source.token);\n\t\t\t\t}\n\n\t\t\t\tif (source.token.isCancellationRequested || this._store.isDisposed || this._textModel.getVersionId() !== request.versionId\n\t\t\t\t\t|| userJumpedToActiveCompletion.get() /* In the meantime the user showed interest for the active completion so dont hide it */) {\n\t\t\t\t\tconst notShownReason =\n\t\t\t\t\t\tsource.token.isCancellationRequested ? 'canceled:afterMinShowDelay' :\n\t\t\t\t\t\t\tthis._store.isDisposed ? 'canceled:disposed' :\n\t\t\t\t\t\t\t\tthis._textModel.getVersionId() !== request.versionId ? 'canceled:documentChanged' :\n\t\t\t\t\t\t\t\t\tuserJumpedToActiveCompletion.get() ? 'canceled:userJumped' :\n\t\t\t\t\t\t\t\t\t\t'unknown';\n\t\t\t\t\tsuggestions.forEach(s => s.setNotShownReasonIfNotSet(notShownReason));\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tconst endTime = new Date();\n\t\t\t\tthis._debounceValue.update(this._textModel, endTime.getTime() - startTime.getTime());\n\n\t\t\t\tconst cursorPosition = this._cursorPosition.get();\n\t\t\t\tthis._updateOperation.clear();\n\t\t\t\ttransaction(tx => {\n\t\t\t\t\t/** @description Update completions with provider result */\n\t\t\t\t\tconst v = this._state.get();\n\n\t\t\t\t\tif (context.selectedSuggestionInfo) {\n\t\t\t\t\t\tthis._state.set({\n\t\t\t\t\t\t\tinlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t\t\t\t\t\tsuggestWidgetInlineCompletions: v.suggestWidgetInlineCompletions.createStateWithAppliedResults(suggestions, request, this._textModel, cursorPosition, activeInlineCompletion),\n\t\t\t\t\t\t}, tx);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis._state.set({\n\t\t\t\t\t\t\tinlineCompletions: v.inlineCompletions.createStateWithAppliedResults(suggestions, request, this._textModel, cursorPosition, activeInlineCompletion),\n\t\t\t\t\t\t\tsuggestWidgetInlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t\t\t\t\t}, tx);\n\t\t\t\t\t}\n\n\t\t\t\t\tv.inlineCompletions.dispose();\n\t\t\t\t\tv.suggestWidgetInlineCompletions.dispose();\n\t\t\t\t});\n\t\t\t} finally {\n\t\t\t\tstore.dispose();\n\t\t\t\tdecreaseLoadingCount();\n\t\t\t\tthis.sendInlineCompletionsRequestTelemetry(requestResponseInfo);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t})();\n\n\t\tconst updateOperation = new UpdateOperation(request, source, promise);\n\t\tthis._updateOperation.value = updateOperation;\n\n\t\treturn promise;\n\t}\n\n\tpublic clear(tx: ITransaction): void {\n\t\tthis._updateOperation.clear();\n\t\tconst v = this._state.get();\n\t\tthis._state.set({\n\t\t\tinlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t\tsuggestWidgetInlineCompletions: InlineCompletionsState.createEmpty()\n\t\t}, tx);\n\t\tv.inlineCompletions.dispose();\n\t\tv.suggestWidgetInlineCompletions.dispose();\n\t}\n\n\tpublic seedInlineCompletionsWithSuggestWidget(): void {\n\t\tconst inlineCompletions = this.inlineCompletions.get();\n\t\tconst suggestWidgetInlineCompletions = this.suggestWidgetInlineCompletions.get();\n\t\tif (!suggestWidgetInlineCompletions) {\n\t\t\treturn;\n\t\t}\n\t\ttransaction(tx => {\n\t\t\t/** @description Seed inline completions with (newer) suggest widget inline completions */\n\t\t\tif (!inlineCompletions || (suggestWidgetInlineCompletions.request?.versionId ?? -1) > (inlineCompletions.request?.versionId ?? -1)) {\n\t\t\t\tinlineCompletions?.dispose();\n\t\t\t\tconst s = this._state.get();\n\t\t\t\tthis._state.set({\n\t\t\t\t\tinlineCompletions: suggestWidgetInlineCompletions.clone(),\n\t\t\t\t\tsuggestWidgetInlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t\t\t}, tx);\n\t\t\t\ts.inlineCompletions.dispose();\n\t\t\t\ts.suggestWidgetInlineCompletions.dispose();\n\t\t\t}\n\t\t\tthis.clearSuggestWidgetInlineCompletions(tx);\n\t\t});\n\t}\n\n\tprivate sendInlineCompletionsRequestTelemetry(\n\t\trequestResponseInfo: RequestResponseData\n\t): void {\n\t\tif (!this._sendRequestData.get() && !this._contextKeyService.getContextKeyValue<boolean>('isRunningUnificationExperiment')) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (requestResponseInfo.requestUuid === undefined || requestResponseInfo.hasProducedSuggestion) {\n\t\t\treturn;\n\t\t}\n\n\n\t\tif (!isCompletionsEnabled(this._completionsEnabled, this._textModel.getLanguageId())) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!requestResponseInfo.providers.some(p => isCopilotLikeExtension(p.providerId?.extensionId))) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst emptyEndOfLifeEvent: InlineCompletionEndOfLifeEvent = {\n\t\t\tid: requestResponseInfo.requestUuid,\n\t\t\topportunityId: requestResponseInfo.requestUuid,\n\t\t\tnoSuggestionReason: requestResponseInfo.noSuggestionReason ?? 'unknown',\n\t\t\textensionId: 'vscode-core',\n\t\t\textensionVersion: '0.0.0',\n\t\t\tgroupId: 'empty',\n\t\t\tshown: false,\n\t\t\teditorType: requestResponseInfo.requestInfo.editorType,\n\t\t\trequestReason: requestResponseInfo.requestInfo.reason,\n\t\t\ttypingInterval: requestResponseInfo.requestInfo.typingInterval,\n\t\t\ttypingIntervalCharacterCount: requestResponseInfo.requestInfo.typingIntervalCharacterCount,\n\t\t\tlanguageId: requestResponseInfo.requestInfo.languageId,\n\t\t\tselectedSuggestionInfo: !!requestResponseInfo.context.selectedSuggestionInfo,\n\t\t\tavailableProviders: requestResponseInfo.providers.map(p => p.providerId?.toString()).filter(isDefined).join(','),\n\t\t\t...forwardToChannelIf(requestResponseInfo.providers.some(p => isCopilotLikeExtension(p.providerId?.extensionId))),\n\t\t\ttimeUntilProviderRequest: undefined,\n\t\t\ttimeUntilProviderResponse: undefined,\n\t\t\tviewKind: undefined,\n\t\t\tpreceeded: undefined,\n\t\t\terror: undefined,\n\t\t\tsuperseded: undefined,\n\t\t\treason: undefined,\n\t\t\tcorrelationId: undefined,\n\t\t\tshownDuration: undefined,\n\t\t\tshownDurationUncollapsed: undefined,\n\t\t\ttimeUntilShown: undefined,\n\t\t\tpartiallyAccepted: undefined,\n\t\t\tpartiallyAcceptedCountSinceOriginal: undefined,\n\t\t\tpartiallyAcceptedRatioSinceOriginal: undefined,\n\t\t\tpartiallyAcceptedCharactersSinceOriginal: undefined,\n\t\t\tcursorColumnDistance: undefined,\n\t\t\tcursorLineDistance: undefined,\n\t\t\tlineCountOriginal: undefined,\n\t\t\tlineCountModified: undefined,\n\t\t\tcharacterCountOriginal: undefined,\n\t\t\tcharacterCountModified: undefined,\n\t\t\tdisjointReplacements: undefined,\n\t\t\tsameShapeReplacements: undefined,\n\t\t\tnotShownReason: undefined,\n\t\t};\n\n\t\tconst dataChannel = this._instantiationService.createInstance(DataChannelForwardingTelemetryService);\n\t\tsendInlineCompletionsEndOfLifeTelemetry(dataChannel, emptyEndOfLifeEvent);\n\t}\n\n\tpublic clearSuggestWidgetInlineCompletions(tx: ITransaction): void {\n\t\tif (this._updateOperation.value?.request.context.selectedSuggestionInfo) {\n\t\t\tthis._updateOperation.clear();\n\t\t}\n\t}\n\n\tpublic cancelUpdate(): void {\n\t\tthis._updateOperation.clear();\n\t}\n}\n\nclass UpdateRequest {\n\tconstructor(\n\t\tpublic readonly position: Position,\n\t\tpublic readonly context: InlineCompletionContextWithoutUuid,\n\t\tpublic readonly versionId: number,\n\t\tpublic readonly providers: Set<InlineCompletionsProvider>,\n\t) {\n\t}\n\n\tpublic satisfies(other: UpdateRequest): boolean {\n\t\treturn this.position.equals(other.position)\n\t\t\t&& equalsIfDefined(this.context.selectedSuggestionInfo, other.context.selectedSuggestionInfo, itemEquals())\n\t\t\t&& (other.context.triggerKind === InlineCompletionTriggerKind.Automatic\n\t\t\t\t|| this.context.triggerKind === InlineCompletionTriggerKind.Explicit)\n\t\t\t&& this.versionId === other.versionId\n\t\t\t&& isSubset(other.providers, this.providers);\n\t}\n}\n\nclass RequestResponseData {\n\tpublic requestUuid: string | undefined;\n\tpublic noSuggestionReason: string | undefined;\n\tpublic hasProducedSuggestion = false;\n\n\tconstructor(\n\t\tpublic readonly context: InlineCompletionContextWithoutUuid,\n\t\tpublic readonly requestInfo: InlineSuggestRequestInfo,\n\t\tpublic readonly providers: InlineCompletionsProvider[],\n\t) { }\n\n\tsetRequestUuid(uuid: string) {\n\t\tthis.requestUuid = uuid;\n\t}\n\n\tsetNoSuggestionReasonIfNotSet(type: string) {\n\t\tthis.noSuggestionReason ??= type;\n\t}\n\n\tsetHasProducedSuggestion() {\n\t\tthis.hasProducedSuggestion = true;\n\t}\n}\n\nfunction isSubset<T>(set1: Set<T>, set2: Set<T>): boolean {\n\treturn [...set1].every(item => set2.has(item));\n}\n\nfunction isCompletionsEnabled(completionsEnablementObject: Record<string, boolean> | undefined, modeId: string = '*'): boolean {\n\tif (completionsEnablementObject === undefined) {\n\t\treturn false; // default to disabled if setting is not available\n\t}\n\n\tif (typeof completionsEnablementObject[modeId] !== 'undefined') {\n\t\treturn Boolean(completionsEnablementObject[modeId]); // go with setting if explicitly defined\n\t}\n\n\treturn Boolean(completionsEnablementObject['*']); // fallback to global setting otherwise\n}\n\nclass UpdateOperation implements IDisposable {\n\tconstructor(\n\t\tpublic readonly request: UpdateRequest,\n\t\tpublic readonly cancellationTokenSource: CancellationTokenSource,\n\t\tpublic readonly promise: Promise<boolean>,\n\t) {\n\t}\n\n\tdispose() {\n\t\tthis.cancellationTokenSource.cancel();\n\t}\n}\n\nclass InlineCompletionsState extends Disposable {\n\tpublic static createEmpty(): InlineCompletionsState {\n\t\treturn new InlineCompletionsState([], undefined);\n\t}\n\n\tconstructor(\n\t\tpublic readonly inlineCompletions: readonly InlineSuggestionItem[],\n\t\tpublic readonly request: UpdateRequest | undefined,\n\t) {\n\t\tfor (const inlineCompletion of inlineCompletions) {\n\t\t\tinlineCompletion.addRef();\n\t\t}\n\n\t\tsuper();\n\n\t\tthis._register({\n\t\t\tdispose: () => {\n\t\t\t\tfor (const inlineCompletion of this.inlineCompletions) {\n\t\t\t\t\tinlineCompletion.removeRef();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate _findById(id: InlineSuggestionIdentity): InlineSuggestionItem | undefined {\n\t\treturn this.inlineCompletions.find(i => i.identity === id);\n\t}\n\n\tprivate _findByHash(hash: string): InlineSuggestionItem | undefined {\n\t\treturn this.inlineCompletions.find(i => i.hash === hash);\n\t}\n\n\t/**\n\t * Applies the edit on the state.\n\t*/\n\tpublic createStateWithAppliedEdit(edit: StringEdit, textModel: ITextModel): InlineCompletionsState {\n\t\tconst newInlineCompletions = this.inlineCompletions.map(i => i.withEdit(edit, textModel)).filter(isDefined);\n\t\treturn new InlineCompletionsState(newInlineCompletions, this.request);\n\t}\n\n\tpublic createStateWithAppliedResults(updatedSuggestions: InlineSuggestionItem[], request: UpdateRequest, textModel: ITextModel, cursorPosition: Position, itemIdToPreserveAtTop: InlineSuggestionIdentity | undefined): InlineCompletionsState {\n\t\tlet itemToPreserve: InlineSuggestionItem | undefined = undefined;\n\t\tif (itemIdToPreserveAtTop) {\n\t\t\tconst itemToPreserveCandidate = this._findById(itemIdToPreserveAtTop);\n\t\t\tif (itemToPreserveCandidate && itemToPreserveCandidate.canBeReused(textModel, request.position)) {\n\t\t\t\titemToPreserve = itemToPreserveCandidate;\n\n\t\t\t\tconst updatedItemToPreserve = updatedSuggestions.find(i => i.hash === itemToPreserveCandidate.hash);\n\t\t\t\tif (updatedItemToPreserve) {\n\t\t\t\t\tupdatedSuggestions = moveToFront(updatedItemToPreserve, updatedSuggestions);\n\t\t\t\t} else {\n\t\t\t\t\tupdatedSuggestions = [itemToPreserveCandidate, ...updatedSuggestions];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst preferInlineCompletions = itemToPreserve\n\t\t\t// itemToPreserve has precedence\n\t\t\t? !itemToPreserve.isInlineEdit\n\t\t\t// Otherwise: prefer inline completion if there is a visible one\n\t\t\t: updatedSuggestions.some(i => !i.isInlineEdit && i.isVisible(textModel, cursorPosition));\n\n\t\tlet updatedItems: InlineSuggestionItem[] = [];\n\t\tfor (const i of updatedSuggestions) {\n\t\t\tconst oldItem = this._findByHash(i.hash);\n\t\t\tlet item;\n\t\t\tif (oldItem && oldItem !== i) {\n\t\t\t\titem = i.withIdentity(oldItem.identity);\n\t\t\t\ti.setIsPreceeded(oldItem);\n\t\t\t\toldItem.setEndOfLifeReason({ kind: InlineCompletionEndOfLifeReasonKind.Ignored, userTypingDisagreed: false, supersededBy: i.getSourceCompletion() });\n\t\t\t} else {\n\t\t\t\titem = i;\n\t\t\t}\n\t\t\tif (preferInlineCompletions !== item.isInlineEdit) {\n\t\t\t\tupdatedItems.push(item);\n\t\t\t}\n\t\t}\n\n\t\tupdatedItems.sort(compareBy(i => i.showInlineEditMenu, booleanComparator));\n\t\tupdatedItems = distinctByKey(updatedItems, i => i.semanticId);\n\n\t\treturn new InlineCompletionsState(updatedItems, request);\n\t}\n\n\tpublic clone(): InlineCompletionsState {\n\t\treturn new InlineCompletionsState(this.inlineCompletions, this.request);\n\t}\n}\n\n/** Keeps the first item in case of duplicates. */\nfunction distinctByKey<T>(items: T[], key: (item: T) => unknown): T[] {\n\tconst seen = new Set();\n\treturn items.filter(item => {\n\t\tconst k = key(item);\n\t\tif (seen.has(k)) {\n\t\t\treturn false;\n\t\t}\n\t\tseen.add(k);\n\t\treturn true;\n\t});\n}\n\nfunction moveToFront<T>(item: T, items: T[]): T[] {\n\tconst index = items.indexOf(item);\n\tif (index > -1) {\n\t\treturn [item, ...items.slice(0, index), ...items.slice(index + 1)];\n\t}\n\treturn items;\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { booleanComparator, compareBy, compareUndefinedSmallest, numberComparator } from '../../../../../base/common/arrays.js';\nimport { findLastMax } from '../../../../../base/common/arraysFind.js';\nimport { RunOnceScheduler } from '../../../../../base/common/async.js';\nimport { CancellationTokenSource } from '../../../../../base/common/cancellation.js';\nimport { equalsIfDefined, itemEquals } from '../../../../../base/common/equals.js';\nimport { Disposable, DisposableStore, IDisposable, MutableDisposable, toDisposable } from '../../../../../base/common/lifecycle.js';\nimport { derived, IObservable, IObservableWithChange, ITransaction, observableValue, recordChangesLazy, transaction } from '../../../../../base/common/observable.js';\n// eslint-disable-next-line local/code-no-deep-import-of-internal\nimport { observableReducerSettable } from '../../../../../base/common/observableInternal/experimental/reducer.js';\nimport { isDefined, isObject } from '../../../../../base/common/types.js';\nimport { IConfigurationService } from '../../../../../platform/configuration/common/configuration.js';\nimport { IContextKeyService } from '../../../../../platform/contextkey/common/contextkey.js';\nimport { DataChannelForwardingTelemetryService, forwardToChannelIf, isCopilotLikeExtension } from '../../../../../platform/dataChannel/browser/forwardingTelemetryService.js';\nimport { IInstantiationService } from '../../../../../platform/instantiation/common/instantiation.js';\nimport { ILogService } from '../../../../../platform/log/common/log.js';\nimport { observableConfigValue } from '../../../../../platform/observable/common/platformObservableUtils.js';\nimport product from '../../../../../platform/product/common/product.js';\nimport { StringEdit } from '../../../../common/core/edits/stringEdit.js';\nimport { Position } from '../../../../common/core/position.js';\nimport { InlineCompletionEndOfLifeReasonKind, InlineCompletionTriggerKind, InlineCompletionsProvider } from '../../../../common/languages.js';\nimport { ILanguageConfigurationService } from '../../../../common/languages/languageConfigurationRegistry.js';\nimport { ITextModel } from '../../../../common/model.js';\nimport { offsetEditFromContentChanges } from '../../../../common/model/textModelStringEdit.js';\nimport { IFeatureDebounceInformation } from '../../../../common/services/languageFeatureDebounce.js';\nimport { IModelContentChangedEvent } from '../../../../common/textModelEvents.js';\nimport { formatRecordableLogEntry, IRecordableEditorLogEntry, IRecordableLogEntry, StructuredLogger } from '../structuredLogger.js';\nimport { InlineCompletionEndOfLifeEvent, sendInlineCompletionsEndOfLifeTelemetry } from '../telemetry.js';\nimport { wait } from '../utils.js';\nimport { InlineSuggestionIdentity, InlineSuggestionItem } from './inlineSuggestionItem.js';\nimport { InlineCompletionContextWithoutUuid, InlineSuggestRequestInfo, provideInlineCompletions, runWhenCancelled } from './provideInlineCompletions.js';\n\nexport class InlineCompletionsSource extends Disposable {\n\tprivate static _requestId = 0;\n\n\tprivate readonly _updateOperation = this._register(new MutableDisposable<UpdateOperation>());\n\n\tprivate readonly _loggingEnabled;\n\tprivate readonly _sendRequestData;\n\n\tprivate readonly _structuredFetchLogger;\n\n\tprivate readonly _state = observableReducerSettable(this, {\n\t\tinitial: () => ({\n\t\t\tinlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t\tsuggestWidgetInlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t}),\n\t\tdisposeFinal: (values) => {\n\t\t\tvalues.inlineCompletions.dispose();\n\t\t\tvalues.suggestWidgetInlineCompletions.dispose();\n\t\t},\n\t\tchangeTracker: recordChangesLazy(() => ({ versionId: this._versionId })),\n\t\tupdate: (reader, previousValue, changes) => {\n\t\t\tconst edit = StringEdit.compose(changes.changes.map(c => c.change ? offsetEditFromContentChanges(c.change.changes) : StringEdit.empty).filter(isDefined));\n\n\t\t\tif (edit.isEmpty()) {\n\t\t\t\treturn previousValue;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\treturn {\n\t\t\t\t\tinlineCompletions: previousValue.inlineCompletions.createStateWithAppliedEdit(edit, this._textModel),\n\t\t\t\t\tsuggestWidgetInlineCompletions: previousValue.suggestWidgetInlineCompletions.createStateWithAppliedEdit(edit, this._textModel),\n\t\t\t\t};\n\t\t\t} finally {\n\t\t\t\tpreviousValue.inlineCompletions.dispose();\n\t\t\t\tpreviousValue.suggestWidgetInlineCompletions.dispose();\n\t\t\t}\n\t\t}\n\t});\n\n\tpublic readonly inlineCompletions = this._state.map(this, v => v.inlineCompletions);\n\tpublic readonly suggestWidgetInlineCompletions = this._state.map(this, v => v.suggestWidgetInlineCompletions);\n\n\tprivate _completionsEnabled: Record<string, boolean> | undefined = undefined;\n\n\tconstructor(\n\t\tprivate readonly _textModel: ITextModel,\n\t\tprivate readonly _versionId: IObservableWithChange<number | null, IModelContentChangedEvent | undefined>,\n\t\tprivate readonly _debounceValue: IFeatureDebounceInformation,\n\t\tprivate readonly _cursorPosition: IObservable<Position>,\n\t\t@ILanguageConfigurationService private readonly _languageConfigurationService: ILanguageConfigurationService,\n\t\t@ILogService private readonly _logService: ILogService,\n\t\t@IConfigurationService private readonly _configurationService: IConfigurationService,\n\t\t@IInstantiationService private readonly _instantiationService: IInstantiationService,\n\t\t@IContextKeyService private readonly _contextKeyService: IContextKeyService,\n\t) {\n\t\tsuper();\n\t\tthis._loggingEnabled = observableConfigValue('editor.inlineSuggest.logFetch', false, this._configurationService).recomputeInitiallyAndOnChange(this._store);\n\t\tthis._sendRequestData = observableConfigValue('editor.inlineSuggest.emptyResponseInformation', true, this._configurationService).recomputeInitiallyAndOnChange(this._store);\n\t\tthis._structuredFetchLogger = this._register(this._instantiationService.createInstance(StructuredLogger.cast<\n\t\t\t{ kind: 'start'; requestId: number; context: unknown } & IRecordableEditorLogEntry\n\t\t\t| { kind: 'end'; error: unknown; durationMs: number; result: unknown; requestId: number } & IRecordableLogEntry\n\t\t>(),\n\t\t\t'editor.inlineSuggest.logFetch.commandId'\n\t\t));\n\n\t\tthis.clearOperationOnTextModelChange.recomputeInitiallyAndOnChange(this._store);\n\n\t\tconst enablementSetting = product.defaultChatAgent?.completionsEnablementSetting ?? undefined;\n\t\tif (enablementSetting) {\n\t\t\tthis._updateCompletionsEnablement(enablementSetting);\n\t\t\tthis._register(this._configurationService.onDidChangeConfiguration(e => {\n\t\t\t\tif (e.affectsConfiguration(enablementSetting)) {\n\t\t\t\t\tthis._updateCompletionsEnablement(enablementSetting);\n\t\t\t\t}\n\t\t\t}));\n\t\t}\n\t}\n\n\tprivate _updateCompletionsEnablement(enalementSetting: string) {\n\t\tconst result = this._configurationService.getValue<Record<string, boolean>>(enalementSetting);\n\t\tif (!isObject(result)) {\n\t\t\tthis._completionsEnabled = undefined;\n\t\t} else {\n\t\t\tthis._completionsEnabled = result;\n\t\t}\n\t}\n\n\tpublic readonly clearOperationOnTextModelChange = derived(this, reader => {\n\t\tthis._versionId.read(reader);\n\t\tthis._updateOperation.clear();\n\t\treturn undefined; // always constant\n\t});\n\n\tprivate _log(entry:\n\t\t{ sourceId: string; kind: 'start'; requestId: number; context: unknown; provider: string | undefined } & IRecordableEditorLogEntry\n\t\t| { sourceId: string; kind: 'end'; error: unknown; durationMs: number; result: unknown; requestId: number; didAllProvidersReturn: boolean } & IRecordableLogEntry\n\t) {\n\t\tif (this._loggingEnabled.get()) {\n\t\t\tthis._logService.info(formatRecordableLogEntry(entry));\n\t\t}\n\t\tthis._structuredFetchLogger.log(entry);\n\t}\n\n\tprivate readonly _loadingCount = observableValue(this, 0);\n\n\tpublic fetch(\n\t\tproviders: InlineCompletionsProvider[],\n\t\tprovidersLabel: string | undefined,\n\t\tcontext: InlineCompletionContextWithoutUuid,\n\t\tactiveInlineCompletion: InlineSuggestionIdentity | undefined,\n\t\twithDebounce: boolean,\n\t\tuserJumpedToActiveCompletion: IObservable<boolean>,\n\t\trequestInfo: InlineSuggestRequestInfo\n\t): Promise<boolean> {\n\t\tconst position = this._cursorPosition.get();\n\t\tconst request = new UpdateRequest(position, context, this._textModel.getVersionId(), new Set(providers));\n\n\t\tconst target = context.selectedSuggestionInfo ? this.suggestWidgetInlineCompletions.get() : this.inlineCompletions.get();\n\n\t\tif (this._updateOperation.value?.request.satisfies(request)) {\n\t\t\treturn this._updateOperation.value.promise;\n\t\t} else if (target?.request?.satisfies(request)) {\n\t\t\treturn Promise.resolve(true);\n\t\t}\n\n\t\tconst updateOngoing = !!this._updateOperation.value;\n\t\tthis._updateOperation.clear();\n\n\t\tconst source = new CancellationTokenSource();\n\n\t\tconst promise = (async () => {\n\t\t\tconst store = new DisposableStore();\n\n\t\t\tthis._loadingCount.set(this._loadingCount.get() + 1, undefined);\n\t\t\tlet didDecrease = false;\n\t\t\tconst decreaseLoadingCount = () => {\n\t\t\t\tif (!didDecrease) {\n\t\t\t\t\tdidDecrease = true;\n\t\t\t\t\tthis._loadingCount.set(this._loadingCount.get() - 1, undefined);\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst loadingReset = store.add(new RunOnceScheduler(() => decreaseLoadingCount(), 10 * 1000));\n\t\t\tloadingReset.schedule();\n\n\t\t\tconst inlineSuggestionsProviders = providers.filter(p => p.providerId);\n\t\t\tconst requestResponseInfo = new RequestResponseData(context, requestInfo, inlineSuggestionsProviders);\n\n\n\t\t\ttry {\n\t\t\t\tconst recommendedDebounceValue = this._debounceValue.get(this._textModel);\n\t\t\t\tconst debounceValue = findLastMax(\n\t\t\t\t\tproviders.map(p => p.debounceDelayMs),\n\t\t\t\t\tcompareUndefinedSmallest(numberComparator)\n\t\t\t\t) ?? recommendedDebounceValue;\n\n\t\t\t\t// Debounce in any case if update is ongoing\n\t\t\t\tconst shouldDebounce = updateOngoing || (withDebounce && context.triggerKind === InlineCompletionTriggerKind.Automatic);\n\t\t\t\tif (shouldDebounce) {\n\t\t\t\t\t// This debounces the operation\n\t\t\t\t\tawait wait(debounceValue, source.token);\n\t\t\t\t}\n\n\t\t\t\tif (source.token.isCancellationRequested || this._store.isDisposed || this._textModel.getVersionId() !== request.versionId) {\n\t\t\t\t\trequestResponseInfo.setNoSuggestionReasonIfNotSet('canceled:beforeFetch');\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tconst requestId = InlineCompletionsSource._requestId++;\n\t\t\t\tif (this._loggingEnabled.get() || this._structuredFetchLogger.isEnabled.get()) {\n\t\t\t\t\tthis._log({\n\t\t\t\t\t\tsourceId: 'InlineCompletions.fetch',\n\t\t\t\t\t\tkind: 'start',\n\t\t\t\t\t\trequestId,\n\t\t\t\t\t\tmodelUri: this._textModel.uri,\n\t\t\t\t\t\tmodelVersion: this._textModel.getVersionId(),\n\t\t\t\t\t\tcontext: { triggerKind: context.triggerKind, suggestInfo: context.selectedSuggestionInfo ? true : undefined },\n\t\t\t\t\t\ttime: Date.now(),\n\t\t\t\t\t\tprovider: providersLabel,\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tconst startTime = new Date();\n\t\t\t\tconst providerResult = provideInlineCompletions(providers, this._cursorPosition.get(), this._textModel, context, requestInfo, this._languageConfigurationService);\n\n\t\t\t\trunWhenCancelled(source.token, () => providerResult.cancelAndDispose({ kind: 'tokenCancellation' }));\n\n\t\t\t\tlet shouldStopEarly = false;\n\t\t\t\tlet producedSuggestion = false;\n\n\t\t\t\tconst suggestions: InlineSuggestionItem[] = [];\n\t\t\t\tfor await (const list of providerResult.lists) {\n\t\t\t\t\tif (!list) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tlist.addRef();\n\t\t\t\t\tstore.add(toDisposable(() => list.removeRef(list.inlineSuggestionsData.length === 0 ? { kind: 'empty' } : { kind: 'notTaken' })));\n\n\t\t\t\t\tfor (const item of list.inlineSuggestionsData) {\n\t\t\t\t\t\tproducedSuggestion = true;\n\t\t\t\t\t\tif (!context.includeInlineEdits && (item.isInlineEdit || item.showInlineEditMenu)) {\n\t\t\t\t\t\t\titem.setNotShownReason('notInlineEditRequested');\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!context.includeInlineCompletions && !(item.isInlineEdit || item.showInlineEditMenu)) {\n\t\t\t\t\t\t\titem.setNotShownReason('notInlineCompletionRequested');\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst i = InlineSuggestionItem.create(item, this._textModel);\n\t\t\t\t\t\tsuggestions.push(i);\n\t\t\t\t\t\t// Stop after first visible inline completion\n\t\t\t\t\t\tif (!i.isInlineEdit && !i.showInlineEditMenu && context.triggerKind === InlineCompletionTriggerKind.Automatic) {\n\t\t\t\t\t\t\tif (i.isVisible(this._textModel, this._cursorPosition.get())) {\n\t\t\t\t\t\t\t\tshouldStopEarly = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (shouldStopEarly) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tproviderResult.cancelAndDispose({ kind: 'lostRace' });\n\n\t\t\t\tif (this._loggingEnabled.get() || this._structuredFetchLogger.isEnabled.get()) {\n\t\t\t\t\tconst didAllProvidersReturn = providerResult.didAllProvidersReturn;\n\t\t\t\t\tlet error: string | undefined = undefined;\n\t\t\t\t\tif (source.token.isCancellationRequested || this._store.isDisposed || this._textModel.getVersionId() !== request.versionId) {\n\t\t\t\t\t\terror = 'canceled';\n\t\t\t\t\t}\n\t\t\t\t\tconst result = suggestions.map(c => ({\n\t\t\t\t\t\trange: c.editRange.toString(),\n\t\t\t\t\t\ttext: c.insertText,\n\t\t\t\t\t\tisInlineEdit: !!c.isInlineEdit,\n\t\t\t\t\t\tsource: c.source.provider.groupId,\n\t\t\t\t\t}));\n\t\t\t\t\tthis._log({ sourceId: 'InlineCompletions.fetch', kind: 'end', requestId, durationMs: (Date.now() - startTime.getTime()), error, result, time: Date.now(), didAllProvidersReturn });\n\t\t\t\t}\n\n\t\t\t\trequestResponseInfo.setRequestUuid(providerResult.contextWithUuid.requestUuid);\n\t\t\t\tif (producedSuggestion) {\n\t\t\t\t\trequestResponseInfo.setHasProducedSuggestion();\n\t\t\t\t\tif (suggestions.length > 0 && source.token.isCancellationRequested) {\n\t\t\t\t\t\tsuggestions.forEach(s => s.setNotShownReasonIfNotSet('canceled:whileAwaitingOtherProviders'));\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (source.token.isCancellationRequested) {\n\t\t\t\t\t\trequestResponseInfo.setNoSuggestionReasonIfNotSet('canceled:whileFetching');\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst completionsQuotaExceeded = this._contextKeyService.getContextKeyValue<boolean>('completionsQuotaExceeded');\n\t\t\t\t\t\trequestResponseInfo.setNoSuggestionReasonIfNotSet(completionsQuotaExceeded ? 'completionsQuotaExceeded' : 'noSuggestion');\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst remainingTimeToWait = context.earliestShownDateTime - Date.now();\n\t\t\t\tif (remainingTimeToWait > 0) {\n\t\t\t\t\tawait wait(remainingTimeToWait, source.token);\n\t\t\t\t}\n\n\t\t\t\tif (source.token.isCancellationRequested || this._store.isDisposed || this._textModel.getVersionId() !== request.versionId\n\t\t\t\t\t|| userJumpedToActiveCompletion.get() /* In the meantime the user showed interest for the active completion so dont hide it */) {\n\t\t\t\t\tconst notShownReason =\n\t\t\t\t\t\tsource.token.isCancellationRequested ? 'canceled:afterMinShowDelay' :\n\t\t\t\t\t\t\tthis._store.isDisposed ? 'canceled:disposed' :\n\t\t\t\t\t\t\t\tthis._textModel.getVersionId() !== request.versionId ? 'canceled:documentChanged' :\n\t\t\t\t\t\t\t\t\tuserJumpedToActiveCompletion.get() ? 'canceled:userJumped' :\n\t\t\t\t\t\t\t\t\t\t'unknown';\n\t\t\t\t\tsuggestions.forEach(s => s.setNotShownReasonIfNotSet(notShownReason));\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tconst endTime = new Date();\n\t\t\t\tthis._debounceValue.update(this._textModel, endTime.getTime() - startTime.getTime());\n\n\t\t\t\tconst cursorPosition = this._cursorPosition.get();\n\t\t\t\tthis._updateOperation.clear();\n\t\t\t\ttransaction(tx => {\n\t\t\t\t\t/** @description Update completions with provider result */\n\t\t\t\t\tconst v = this._state.get();\n\n\t\t\t\t\tif (context.selectedSuggestionInfo) {\n\t\t\t\t\t\tthis._state.set({\n\t\t\t\t\t\t\tinlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t\t\t\t\t\tsuggestWidgetInlineCompletions: v.suggestWidgetInlineCompletions.createStateWithAppliedResults(suggestions, request, this._textModel, cursorPosition, activeInlineCompletion),\n\t\t\t\t\t\t}, tx);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis._state.set({\n\t\t\t\t\t\t\tinlineCompletions: v.inlineCompletions.createStateWithAppliedResults(suggestions, request, this._textModel, cursorPosition, activeInlineCompletion),\n\t\t\t\t\t\t\tsuggestWidgetInlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t\t\t\t\t}, tx);\n\t\t\t\t\t}\n\n\t\t\t\t\tv.inlineCompletions.dispose();\n\t\t\t\t\tv.suggestWidgetInlineCompletions.dispose();\n\t\t\t\t});\n\t\t\t} finally {\n\t\t\t\tstore.dispose();\n\t\t\t\tdecreaseLoadingCount();\n\t\t\t\tthis.sendInlineCompletionsRequestTelemetry(requestResponseInfo);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t})();\n\n\t\tconst updateOperation = new UpdateOperation(request, source, promise);\n\t\tthis._updateOperation.value = updateOperation;\n\n\t\treturn promise;\n\t}\n\n\tpublic clear(tx: ITransaction): void {\n\t\tthis._updateOperation.clear();\n\t\tconst v = this._state.get();\n\t\tthis._state.set({\n\t\t\tinlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t\tsuggestWidgetInlineCompletions: InlineCompletionsState.createEmpty()\n\t\t}, tx);\n\t\tv.inlineCompletions.dispose();\n\t\tv.suggestWidgetInlineCompletions.dispose();\n\t}\n\n\tpublic seedInlineCompletionsWithSuggestWidget(): void {\n\t\tconst inlineCompletions = this.inlineCompletions.get();\n\t\tconst suggestWidgetInlineCompletions = this.suggestWidgetInlineCompletions.get();\n\t\tif (!suggestWidgetInlineCompletions) {\n\t\t\treturn;\n\t\t}\n\t\ttransaction(tx => {\n\t\t\t/** @description Seed inline completions with (newer) suggest widget inline completions */\n\t\t\tif (!inlineCompletions || (suggestWidgetInlineCompletions.request?.versionId ?? -1) > (inlineCompletions.request?.versionId ?? -1)) {\n\t\t\t\tinlineCompletions?.dispose();\n\t\t\t\tconst s = this._state.get();\n\t\t\t\tthis._state.set({\n\t\t\t\t\tinlineCompletions: suggestWidgetInlineCompletions.clone(),\n\t\t\t\t\tsuggestWidgetInlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t\t\t}, tx);\n\t\t\t\ts.inlineCompletions.dispose();\n\t\t\t\ts.suggestWidgetInlineCompletions.dispose();\n\t\t\t}\n\t\t\tthis.clearSuggestWidgetInlineCompletions(tx);\n\t\t});\n\t}\n\n\tprivate sendInlineCompletionsRequestTelemetry(\n\t\trequestResponseInfo: RequestResponseData\n\t): void {\n\t\tif (!this._sendRequestData.get() && !this._contextKeyService.getContextKeyValue<boolean>('isRunningUnificationExperiment')) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (requestResponseInfo.requestUuid === undefined || requestResponseInfo.hasProducedSuggestion) {\n\t\t\treturn;\n\t\t}\n\n\n\t\tif (!isCompletionsEnabled(this._completionsEnabled, this._textModel.getLanguageId())) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!requestResponseInfo.providers.some(p => isCopilotLikeExtension(p.providerId?.extensionId))) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst emptyEndOfLifeEvent: InlineCompletionEndOfLifeEvent = {\n\t\t\tid: requestResponseInfo.requestUuid,\n\t\t\topportunityId: requestResponseInfo.requestUuid,\n\t\t\tnoSuggestionReason: requestResponseInfo.noSuggestionReason ?? 'unknown',\n\t\t\textensionId: 'vscode-core',\n\t\t\textensionVersion: '0.0.0',\n\t\t\tgroupId: 'empty',\n\t\t\tshown: false,\n\t\t\teditorType: requestResponseInfo.requestInfo.editorType,\n\t\t\trequestReason: requestResponseInfo.requestInfo.reason,\n\t\t\ttypingInterval: requestResponseInfo.requestInfo.typingInterval,\n\t\t\ttypingIntervalCharacterCount: requestResponseInfo.requestInfo.typingIntervalCharacterCount,\n\t\t\tlanguageId: requestResponseInfo.requestInfo.languageId,\n\t\t\tselectedSuggestionInfo: !!requestResponseInfo.context.selectedSuggestionInfo,\n\t\t\tavailableProviders: requestResponseInfo.providers.map(p => p.providerId?.toString()).filter(isDefined).join(','),\n\t\t\t...forwardToChannelIf(requestResponseInfo.providers.some(p => isCopilotLikeExtension(p.providerId?.extensionId))),\n\t\t\ttimeUntilProviderRequest: undefined,\n\t\t\ttimeUntilProviderResponse: undefined,\n\t\t\tviewKind: undefined,\n\t\t\tpreceeded: undefined,\n\t\t\terror: undefined,\n\t\t\tsuperseded: undefined,\n\t\t\treason: undefined,\n\t\t\tcorrelationId: undefined,\n\t\t\tshownDuration: undefined,\n\t\t\tshownDurationUncollapsed: undefined,\n\t\t\ttimeUntilShown: undefined,\n\t\t\tpartiallyAccepted: undefined,\n\t\t\tpartiallyAcceptedCountSinceOriginal: undefined,\n\t\t\tpartiallyAcceptedRatioSinceOriginal: undefined,\n\t\t\tpartiallyAcceptedCharactersSinceOriginal: undefined,\n\t\t\tcursorColumnDistance: undefined,\n\t\t\tcursorLineDistance: undefined,\n\t\t\tlineCountOriginal: undefined,\n\t\t\tlineCountModified: undefined,\n\t\t\tcharacterCountOriginal: undefined,\n\t\t\tcharacterCountModified: undefined,\n\t\t\tdisjointReplacements: undefined,\n\t\t\tsameShapeReplacements: undefined,\n\t\t\tnotShownReason: undefined,\n\t\t};\n\n\t\tconst dataChannel = this._instantiationService.createInstance(DataChannelForwardingTelemetryService);\n\t\tsendInlineCompletionsEndOfLifeTelemetry(dataChannel, emptyEndOfLifeEvent);\n\t}\n\n\tpublic clearSuggestWidgetInlineCompletions(tx: ITransaction): void {\n\t\tif (this._updateOperation.value?.request.context.selectedSuggestionInfo) {\n\t\t\tthis._updateOperation.clear();\n\t\t}\n\t}\n\n\tpublic cancelUpdate(): void {\n\t\tthis._updateOperation.clear();\n\t}\n}\n\nclass UpdateRequest {\n\tconstructor(\n\t\tpublic readonly position: Position,\n\t\tpublic readonly context: InlineCompletionContextWithoutUuid,\n\t\tpublic readonly versionId: number,\n\t\tpublic readonly providers: Set<InlineCompletionsProvider>,\n\t) {\n\t}\n\n\tpublic satisfies(other: UpdateRequest): boolean {\n\t\treturn this.position.equals(other.position)\n\t\t\t&& equalsIfDefined(this.context.selectedSuggestionInfo, other.context.selectedSuggestionInfo, itemEquals())\n\t\t\t&& (other.context.triggerKind === InlineCompletionTriggerKind.Automatic\n\t\t\t\t|| this.context.triggerKind === InlineCompletionTriggerKind.Explicit)\n\t\t\t&& this.versionId === other.versionId\n\t\t\t&& isSubset(other.providers, this.providers);\n\t}\n}\n\nclass RequestResponseData {\n\tpublic requestUuid: string | undefined;\n\tpublic noSuggestionReason: string | undefined;\n\tpublic hasProducedSuggestion = false;\n\n\tconstructor(\n\t\tpublic readonly context: InlineCompletionContextWithoutUuid,\n\t\tpublic readonly requestInfo: InlineSuggestRequestInfo,\n\t\tpublic readonly providers: InlineCompletionsProvider[],\n\t) { }\n\n\tsetRequestUuid(uuid: string) {\n\t\tthis.requestUuid = uuid;\n\t}\n\n\tsetNoSuggestionReasonIfNotSet(type: string) {\n\t\tthis.noSuggestionReason ??= type;\n\t}\n\n\tsetHasProducedSuggestion() {\n\t\tthis.hasProducedSuggestion = true;\n\t}\n}\n\nfunction isSubset<T>(set1: Set<T>, set2: Set<T>): boolean {\n\treturn [...set1].every(item => set2.has(item));\n}\n\nfunction isCompletionsEnabled(completionsEnablementObject: Record<string, boolean> | undefined, modeId: string = '*'): boolean {\n\tif (completionsEnablementObject === undefined) {\n\t\treturn false; // default to disabled if setting is not available\n\t}\n\n\tif (typeof completionsEnablementObject[modeId] !== 'undefined') {\n\t\treturn Boolean(completionsEnablementObject[modeId]); // go with setting if explicitly defined\n\t}\n\n\treturn Boolean(completionsEnablementObject['*']); // fallback to global setting otherwise\n}\n\nclass UpdateOperation implements IDisposable {\n\tconstructor(\n\t\tpublic readonly request: UpdateRequest,\n\t\tpublic readonly cancellationTokenSource: CancellationTokenSource,\n\t\tpublic readonly promise: Promise<boolean>,\n\t) {\n\t}\n\n\tdispose() {\n\t\tthis.cancellationTokenSource.cancel();\n\t}\n}\n\nclass InlineCompletionsState extends Disposable {\n\tpublic static createEmpty(): InlineCompletionsState {\n\t\treturn new InlineCompletionsState([], undefined);\n\t}\n\n\tconstructor(\n\t\tpublic readonly inlineCompletions: readonly InlineSuggestionItem[],\n\t\tpublic readonly request: UpdateRequest | undefined,\n\t) {\n\t\tfor (const inlineCompletion of inlineCompletions) {\n\t\t\tinlineCompletion.addRef();\n\t\t}\n\n\t\tsuper();\n\n\t\tthis._register({\n\t\t\tdispose: () => {\n\t\t\t\tfor (const inlineCompletion of this.inlineCompletions) {\n\t\t\t\t\tinlineCompletion.removeRef();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate _findById(id: InlineSuggestionIdentity): InlineSuggestionItem | undefined {\n\t\treturn this.inlineCompletions.find(i => i.identity === id);\n\t}\n\n\tprivate _findByHash(hash: string): InlineSuggestionItem | undefined {\n\t\treturn this.inlineCompletions.find(i => i.hash === hash);\n\t}\n\n\t/**\n\t * Applies the edit on the state.\n\t*/\n\tpublic createStateWithAppliedEdit(edit: StringEdit, textModel: ITextModel): InlineCompletionsState {\n\t\tconst newInlineCompletions = this.inlineCompletions.map(i => i.withEdit(edit, textModel)).filter(isDefined);\n\t\treturn new InlineCompletionsState(newInlineCompletions, this.request);\n\t}\n\n\tpublic createStateWithAppliedResults(updatedSuggestions: InlineSuggestionItem[], request: UpdateRequest, textModel: ITextModel, cursorPosition: Position, itemIdToPreserveAtTop: InlineSuggestionIdentity | undefined): InlineCompletionsState {\n\t\tlet itemToPreserve: InlineSuggestionItem | undefined = undefined;\n\t\tif (itemIdToPreserveAtTop) {\n\t\t\tconst itemToPreserveCandidate = this._findById(itemIdToPreserveAtTop);\n\t\t\tif (itemToPreserveCandidate && itemToPreserveCandidate.canBeReused(textModel, request.position)) {\n\t\t\t\titemToPreserve = itemToPreserveCandidate;\n\n\t\t\t\tconst updatedItemToPreserve = updatedSuggestions.find(i => i.hash === itemToPreserveCandidate.hash);\n\t\t\t\tif (updatedItemToPreserve) {\n\t\t\t\t\tupdatedSuggestions = moveToFront(updatedItemToPreserve, updatedSuggestions);\n\t\t\t\t} else {\n\t\t\t\t\tupdatedSuggestions = [itemToPreserveCandidate, ...updatedSuggestions];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst preferInlineCompletions = itemToPreserve\n\t\t\t// itemToPreserve has precedence\n\t\t\t? !itemToPreserve.isInlineEdit\n\t\t\t// Otherwise: prefer inline completion if there is a visible one\n\t\t\t: updatedSuggestions.some(i => !i.isInlineEdit && i.isVisible(textModel, cursorPosition));\n\n\t\tlet updatedItems: InlineSuggestionItem[] = [];\n\t\tfor (const i of updatedSuggestions) {\n\t\t\tconst oldItem = this._findByHash(i.hash);\n\t\t\tlet item;\n\t\t\tif (oldItem && oldItem !== i) {\n\t\t\t\titem = i.withIdentity(oldItem.identity);\n\t\t\t\ti.setIsPreceeded(oldItem);\n\t\t\t\toldItem.setEndOfLifeReason({ kind: InlineCompletionEndOfLifeReasonKind.Ignored, userTypingDisagreed: false, supersededBy: i.getSourceCompletion() });\n\t\t\t} else {\n\t\t\t\titem = i;\n\t\t\t}\n\t\t\tif (preferInlineCompletions !== item.isInlineEdit) {\n\t\t\t\tupdatedItems.push(item);\n\t\t\t}\n\t\t}\n\n\t\tupdatedItems.sort(compareBy(i => i.showInlineEditMenu, booleanComparator));\n\t\tupdatedItems = distinctByKey(updatedItems, i => i.semanticId);\n\n\t\treturn new InlineCompletionsState(updatedItems, request);\n\t}\n\n\tpublic clone(): InlineCompletionsState {\n\t\treturn new InlineCompletionsState(this.inlineCompletions, this.request);\n\t}\n}\n\n/** Keeps the first item in case of duplicates. */\nfunction distinctByKey<T>(items: T[], key: (item: T) => unknown): T[] {\n\tconst seen = new Set();\n\treturn items.filter(item => {\n\t\tconst k = key(item);\n\t\tif (seen.has(k)) {\n\t\t\treturn false;\n\t\t}\n\t\tseen.add(k);\n\t\treturn true;\n\t});\n}\n\nfunction moveToFront<T>(item: T, items: T[]): T[] {\n\tconst index = items.indexOf(item);\n\tif (index > -1) {\n\t\treturn [item, ...items.slice(0, index), ...items.slice(index + 1)];\n\t}\n\treturn items;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsSource.ts","vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsSource.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;;AAEhG,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAChI,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,4CAA4C,CAAC;AACrF,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,eAAe,EAAe,iBAAiB,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACpI,OAAO,EAAE,OAAO,EAAoD,eAAe,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AACtK,iEAAiE;AACjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,uEAAuE,CAAC;AAClH,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+DAA+D,CAAC;AACtG,OAAO,EAAE,qCAAqC,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,2EAA2E,CAAC;AAC9K,OAAO,EAAE,qBAAqB,EAAE,MAAM,+DAA+D,CAAC;AACtG,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sEAAsE,CAAC;AAC7G,OAAO,EAAE,UAAU,EAAE,MAAM,6CAA6C,CAAC;AAEzE,OAAO,EAAE,mCAAmC,EAAE,2BAA2B,EAA6B,MAAM,iCAAiC,CAAC;AAC9I,OAAO,EAAE,6BAA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sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { booleanComparator, compareBy, compareUndefinedSmallest, numberComparator } from '../../../../../base/common/arrays.js';\nimport { findLastMax } from '../../../../../base/common/arraysFind.js';\nimport { CancellationTokenSource } from '../../../../../base/common/cancellation.js';\nimport { equalsIfDefined, itemEquals } from '../../../../../base/common/equals.js';\nimport { Disposable, DisposableStore, IDisposable, MutableDisposable, toDisposable } from '../../../../../base/common/lifecycle.js';\nimport { derived, IObservable, IObservableWithChange, ITransaction, observableValue, recordChangesLazy, transaction } from '../../../../../base/common/observable.js';\n// eslint-disable-next-line local/code-no-deep-import-of-internal\nimport { observableReducerSettable } from '../../../../../base/common/observableInternal/experimental/reducer.js';\nimport { isDefined } from '../../../../../base/common/types.js';\nimport { IConfigurationService } from '../../../../../platform/configuration/common/configuration.js';\nimport { DataChannelForwardingTelemetryService, forwardToChannelIf, isCopilotLikeExtension } from '../../../../../platform/dataChannel/browser/forwardingTelemetryService.js';\nimport { IInstantiationService } from '../../../../../platform/instantiation/common/instantiation.js';\nimport { ILogService } from '../../../../../platform/log/common/log.js';\nimport { observableConfigValue } from '../../../../../platform/observable/common/platformObservableUtils.js';\nimport { StringEdit } from '../../../../common/core/edits/stringEdit.js';\nimport { Position } from '../../../../common/core/position.js';\nimport { InlineCompletionEndOfLifeReasonKind, InlineCompletionTriggerKind, InlineCompletionsProvider } from '../../../../common/languages.js';\nimport { ILanguageConfigurationService } from '../../../../common/languages/languageConfigurationRegistry.js';\nimport { ITextModel } from '../../../../common/model.js';\nimport { offsetEditFromContentChanges } from '../../../../common/model/textModelStringEdit.js';\nimport { IFeatureDebounceInformation } from '../../../../common/services/languageFeatureDebounce.js';\nimport { IModelContentChangedEvent } from '../../../../common/textModelEvents.js';\nimport { formatRecordableLogEntry, IRecordableEditorLogEntry, IRecordableLogEntry, StructuredLogger } from '../structuredLogger.js';\nimport { InlineCompletionEndOfLifeEvent, sendInlineCompletionsEndOfLifeTelemetry } from '../telemetry.js';\nimport { wait } from '../utils.js';\nimport { InlineSuggestionIdentity, InlineSuggestionItem } from './inlineSuggestionItem.js';\nimport { InlineCompletionContextWithoutUuid, InlineSuggestRequestInfo, provideInlineCompletions, runWhenCancelled } from './provideInlineCompletions.js';\n\nexport class InlineCompletionsSource extends Disposable {\n\tprivate static _requestId = 0;\n\n\tprivate readonly _updateOperation = this._register(new MutableDisposable<UpdateOperation>());\n\n\tprivate readonly _loggingEnabled;\n\tprivate readonly _sendRequestData;\n\n\tprivate readonly _structuredFetchLogger;\n\n\tprivate readonly _state = observableReducerSettable(this, {\n\t\tinitial: () => ({\n\t\t\tinlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t\tsuggestWidgetInlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t}),\n\t\tdisposeFinal: (values) => {\n\t\t\tvalues.inlineCompletions.dispose();\n\t\t\tvalues.suggestWidgetInlineCompletions.dispose();\n\t\t},\n\t\tchangeTracker: recordChangesLazy(() => ({ versionId: this._versionId })),\n\t\tupdate: (reader, previousValue, changes) => {\n\t\t\tconst edit = StringEdit.compose(changes.changes.map(c => c.change ? offsetEditFromContentChanges(c.change.changes) : StringEdit.empty).filter(isDefined));\n\n\t\t\tif (edit.isEmpty()) {\n\t\t\t\treturn previousValue;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\treturn {\n\t\t\t\t\tinlineCompletions: previousValue.inlineCompletions.createStateWithAppliedEdit(edit, this._textModel),\n\t\t\t\t\tsuggestWidgetInlineCompletions: previousValue.suggestWidgetInlineCompletions.createStateWithAppliedEdit(edit, this._textModel),\n\t\t\t\t};\n\t\t\t} finally {\n\t\t\t\tpreviousValue.inlineCompletions.dispose();\n\t\t\t\tpreviousValue.suggestWidgetInlineCompletions.dispose();\n\t\t\t}\n\t\t}\n\t});\n\n\tpublic readonly inlineCompletions = this._state.map(this, v => v.inlineCompletions);\n\tpublic readonly suggestWidgetInlineCompletions = this._state.map(this, v => v.suggestWidgetInlineCompletions);\n\n\tconstructor(\n\t\tprivate readonly _textModel: ITextModel,\n\t\tprivate readonly _versionId: IObservableWithChange<number | null, IModelContentChangedEvent | undefined>,\n\t\tprivate readonly _debounceValue: IFeatureDebounceInformation,\n\t\tprivate readonly _cursorPosition: IObservable<Position>,\n\t\t@ILanguageConfigurationService private readonly _languageConfigurationService: ILanguageConfigurationService,\n\t\t@ILogService private readonly _logService: ILogService,\n\t\t@IConfigurationService private readonly _configurationService: IConfigurationService,\n\t\t@IInstantiationService private readonly _instantiationService: IInstantiationService,\n\t) {\n\t\tsuper();\n\t\tthis._loggingEnabled = observableConfigValue('editor.inlineSuggest.logFetch', false, this._configurationService).recomputeInitiallyAndOnChange(this._store);\n\t\tthis._sendRequestData = observableConfigValue('editor.inlineSuggest.emptyResponseInformation', true, this._configurationService).recomputeInitiallyAndOnChange(this._store);\n\t\tthis._structuredFetchLogger = this._register(this._instantiationService.createInstance(StructuredLogger.cast<\n\t\t\t{ kind: 'start'; requestId: number; context: unknown } & IRecordableEditorLogEntry\n\t\t\t| { kind: 'end'; error: unknown; durationMs: number; result: unknown; requestId: number } & IRecordableLogEntry\n\t\t>(),\n\t\t\t'editor.inlineSuggest.logFetch.commandId'\n\t\t));\n\n\t\tthis.clearOperationOnTextModelChange.recomputeInitiallyAndOnChange(this._store);\n\t}\n\n\tpublic readonly clearOperationOnTextModelChange = derived(this, reader => {\n\t\tthis._versionId.read(reader);\n\t\tthis._updateOperation.clear();\n\t\treturn undefined; // always constant\n\t});\n\n\tprivate _log(entry:\n\t\t{ sourceId: string; kind: 'start'; requestId: number; context: unknown; provider: string | undefined } & IRecordableEditorLogEntry\n\t\t| { sourceId: string; kind: 'end'; error: unknown; durationMs: number; result: unknown; requestId: number; didAllProvidersReturn: boolean } & IRecordableLogEntry\n\t) {\n\t\tif (this._loggingEnabled.get()) {\n\t\t\tthis._logService.info(formatRecordableLogEntry(entry));\n\t\t}\n\t\tthis._structuredFetchLogger.log(entry);\n\t}\n\n\tprivate readonly _loadingCount = observableValue(this, 0);\n\n\tpublic fetch(\n\t\tproviders: InlineCompletionsProvider[],\n\t\tprovidersLabel: string | undefined,\n\t\tcontext: InlineCompletionContextWithoutUuid,\n\t\tactiveInlineCompletion: InlineSuggestionIdentity | undefined,\n\t\twithDebounce: boolean,\n\t\tuserJumpedToActiveCompletion: IObservable<boolean>,\n\t\trequestInfo: InlineSuggestRequestInfo\n\t): Promise<boolean> {\n\t\tconst position = this._cursorPosition.get();\n\t\tconst request = new UpdateRequest(position, context, this._textModel.getVersionId(), new Set(providers));\n\n\t\tconst target = context.selectedSuggestionInfo ? this.suggestWidgetInlineCompletions.get() : this.inlineCompletions.get();\n\n\t\tif (this._updateOperation.value?.request.satisfies(request)) {\n\t\t\treturn this._updateOperation.value.promise;\n\t\t} else if (target?.request?.satisfies(request)) {\n\t\t\treturn Promise.resolve(true);\n\t\t}\n\n\t\tconst updateOngoing = !!this._updateOperation.value;\n\t\tthis._updateOperation.clear();\n\n\t\tconst source = new CancellationTokenSource();\n\n\t\tconst promise = (async () => {\n\t\t\tthis._loadingCount.set(this._loadingCount.get() + 1, undefined);\n\t\t\tconst store = new DisposableStore();\n\t\t\tconst inlineSuggestionsProviders = providers.filter(p => p.providerId);\n\t\t\tconst requestResponseInfo = new RequestResponseData(context, requestInfo, inlineSuggestionsProviders);\n\n\t\t\ttry {\n\t\t\t\tconst recommendedDebounceValue = this._debounceValue.get(this._textModel);\n\t\t\t\tconst debounceValue = findLastMax(\n\t\t\t\t\tproviders.map(p => p.debounceDelayMs),\n\t\t\t\t\tcompareUndefinedSmallest(numberComparator)\n\t\t\t\t) ?? recommendedDebounceValue;\n\n\t\t\t\t// Debounce in any case if update is ongoing\n\t\t\t\tconst shouldDebounce = updateOngoing || (withDebounce && context.triggerKind === InlineCompletionTriggerKind.Automatic);\n\t\t\t\tif (shouldDebounce) {\n\t\t\t\t\t// This debounces the operation\n\t\t\t\t\tawait wait(debounceValue, source.token);\n\t\t\t\t}\n\n\t\t\t\tif (source.token.isCancellationRequested || this._store.isDisposed || this._textModel.getVersionId() !== request.versionId) {\n\t\t\t\t\trequestResponseInfo.setNoSuggestionReasonIfNotSet('canceled:beforeFetch');\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tconst requestId = InlineCompletionsSource._requestId++;\n\t\t\t\tif (this._loggingEnabled.get() || this._structuredFetchLogger.isEnabled.get()) {\n\t\t\t\t\tthis._log({\n\t\t\t\t\t\tsourceId: 'InlineCompletions.fetch',\n\t\t\t\t\t\tkind: 'start',\n\t\t\t\t\t\trequestId,\n\t\t\t\t\t\tmodelUri: this._textModel.uri,\n\t\t\t\t\t\tmodelVersion: this._textModel.getVersionId(),\n\t\t\t\t\t\tcontext: { triggerKind: context.triggerKind, suggestInfo: context.selectedSuggestionInfo ? true : undefined },\n\t\t\t\t\t\ttime: Date.now(),\n\t\t\t\t\t\tprovider: providersLabel,\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tconst startTime = new Date();\n\t\t\t\tconst providerResult = provideInlineCompletions(providers, this._cursorPosition.get(), this._textModel, context, requestInfo, this._languageConfigurationService);\n\n\t\t\t\trunWhenCancelled(source.token, () => providerResult.cancelAndDispose({ kind: 'tokenCancellation' }));\n\n\t\t\t\tlet shouldStopEarly = false;\n\t\t\t\tlet producedSuggestion = false;\n\n\t\t\t\tconst suggestions: InlineSuggestionItem[] = [];\n\t\t\t\tfor await (const list of providerResult.lists) {\n\t\t\t\t\tif (!list) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tlist.addRef();\n\t\t\t\t\tstore.add(toDisposable(() => list.removeRef(list.inlineSuggestionsData.length === 0 ? { kind: 'empty' } : { kind: 'notTaken' })));\n\n\t\t\t\t\tfor (const item of list.inlineSuggestionsData) {\n\t\t\t\t\t\tproducedSuggestion = true;\n\t\t\t\t\t\tif (!context.includeInlineEdits && (item.isInlineEdit || item.showInlineEditMenu)) {\n\t\t\t\t\t\t\titem.setNotShownReason('notInlineEditRequested');\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!context.includeInlineCompletions && !(item.isInlineEdit || item.showInlineEditMenu)) {\n\t\t\t\t\t\t\titem.setNotShownReason('notInlineCompletionRequested');\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst i = InlineSuggestionItem.create(item, this._textModel);\n\t\t\t\t\t\tsuggestions.push(i);\n\t\t\t\t\t\t// Stop after first visible inline completion\n\t\t\t\t\t\tif (!i.isInlineEdit && !i.showInlineEditMenu && context.triggerKind === InlineCompletionTriggerKind.Automatic) {\n\t\t\t\t\t\t\tif (i.isVisible(this._textModel, this._cursorPosition.get())) {\n\t\t\t\t\t\t\t\tshouldStopEarly = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (shouldStopEarly) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tproviderResult.cancelAndDispose({ kind: 'lostRace' });\n\n\t\t\t\tif (this._loggingEnabled.get() || this._structuredFetchLogger.isEnabled.get()) {\n\t\t\t\t\tconst didAllProvidersReturn = providerResult.didAllProvidersReturn;\n\t\t\t\t\tlet error: string | undefined = undefined;\n\t\t\t\t\tif (source.token.isCancellationRequested || this._store.isDisposed || this._textModel.getVersionId() !== request.versionId) {\n\t\t\t\t\t\terror = 'canceled';\n\t\t\t\t\t}\n\t\t\t\t\tconst result = suggestions.map(c => ({\n\t\t\t\t\t\trange: c.editRange.toString(),\n\t\t\t\t\t\ttext: c.insertText,\n\t\t\t\t\t\tisInlineEdit: !!c.isInlineEdit,\n\t\t\t\t\t\tsource: c.source.provider.groupId,\n\t\t\t\t\t}));\n\t\t\t\t\tthis._log({ sourceId: 'InlineCompletions.fetch', kind: 'end', requestId, durationMs: (Date.now() - startTime.getTime()), error, result, time: Date.now(), didAllProvidersReturn });\n\t\t\t\t}\n\n\t\t\t\trequestResponseInfo.setRequestUuid(providerResult.contextWithUuid.requestUuid);\n\t\t\t\tif (producedSuggestion) {\n\t\t\t\t\trequestResponseInfo.setHasProducedSuggestion();\n\t\t\t\t\tif (suggestions.length > 0 && source.token.isCancellationRequested) {\n\t\t\t\t\t\tsuggestions.forEach(s => s.setNotShownReasonIfNotSet('canceled:whileAwaitingOtherProviders'));\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (source.token.isCancellationRequested) {\n\t\t\t\t\t\trequestResponseInfo.setNoSuggestionReasonIfNotSet('canceled:whileFetching');\n\t\t\t\t\t} else {\n\t\t\t\t\t\trequestResponseInfo.setNoSuggestionReasonIfNotSet('noSuggestion');\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst remainingTimeToWait = context.earliestShownDateTime - Date.now();\n\t\t\t\tif (remainingTimeToWait > 0) {\n\t\t\t\t\tawait wait(remainingTimeToWait, source.token);\n\t\t\t\t}\n\n\t\t\t\tif (source.token.isCancellationRequested || this._store.isDisposed || this._textModel.getVersionId() !== request.versionId\n\t\t\t\t\t|| userJumpedToActiveCompletion.get() /* In the meantime the user showed interest for the active completion so dont hide it */) {\n\t\t\t\t\tconst notShownReason =\n\t\t\t\t\t\tsource.token.isCancellationRequested ? 'canceled:afterMinShowDelay' :\n\t\t\t\t\t\t\tthis._store.isDisposed ? 'canceled:disposed' :\n\t\t\t\t\t\t\t\tthis._textModel.getVersionId() !== request.versionId ? 'canceled:documentChanged' :\n\t\t\t\t\t\t\t\t\tuserJumpedToActiveCompletion.get() ? 'canceled:userJumped' :\n\t\t\t\t\t\t\t\t\t\t'unknown';\n\t\t\t\t\tsuggestions.forEach(s => s.setNotShownReasonIfNotSet(notShownReason));\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tconst endTime = new Date();\n\t\t\t\tthis._debounceValue.update(this._textModel, endTime.getTime() - startTime.getTime());\n\n\t\t\t\tconst cursorPosition = this._cursorPosition.get();\n\t\t\t\tthis._updateOperation.clear();\n\t\t\t\ttransaction(tx => {\n\t\t\t\t\t/** @description Update completions with provider result */\n\t\t\t\t\tconst v = this._state.get();\n\n\t\t\t\t\tif (context.selectedSuggestionInfo) {\n\t\t\t\t\t\tthis._state.set({\n\t\t\t\t\t\t\tinlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t\t\t\t\t\tsuggestWidgetInlineCompletions: v.suggestWidgetInlineCompletions.createStateWithAppliedResults(suggestions, request, this._textModel, cursorPosition, activeInlineCompletion),\n\t\t\t\t\t\t}, tx);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis._state.set({\n\t\t\t\t\t\t\tinlineCompletions: v.inlineCompletions.createStateWithAppliedResults(suggestions, request, this._textModel, cursorPosition, activeInlineCompletion),\n\t\t\t\t\t\t\tsuggestWidgetInlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t\t\t\t\t}, tx);\n\t\t\t\t\t}\n\n\t\t\t\t\tv.inlineCompletions.dispose();\n\t\t\t\t\tv.suggestWidgetInlineCompletions.dispose();\n\t\t\t\t});\n\t\t\t} finally {\n\t\t\t\tthis._loadingCount.set(this._loadingCount.get() - 1, undefined);\n\t\t\t\tstore.dispose();\n\t\t\t\tthis.sendInlineCompletionsRequestTelemetry(requestResponseInfo);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t})();\n\n\t\tconst updateOperation = new UpdateOperation(request, source, promise);\n\t\tthis._updateOperation.value = updateOperation;\n\n\t\treturn promise;\n\t}\n\n\tpublic clear(tx: ITransaction): void {\n\t\tthis._updateOperation.clear();\n\t\tconst v = this._state.get();\n\t\tthis._state.set({\n\t\t\tinlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t\tsuggestWidgetInlineCompletions: InlineCompletionsState.createEmpty()\n\t\t}, tx);\n\t\tv.inlineCompletions.dispose();\n\t\tv.suggestWidgetInlineCompletions.dispose();\n\t}\n\n\tpublic seedInlineCompletionsWithSuggestWidget(): void {\n\t\tconst inlineCompletions = this.inlineCompletions.get();\n\t\tconst suggestWidgetInlineCompletions = this.suggestWidgetInlineCompletions.get();\n\t\tif (!suggestWidgetInlineCompletions) {\n\t\t\treturn;\n\t\t}\n\t\ttransaction(tx => {\n\t\t\t/** @description Seed inline completions with (newer) suggest widget inline completions */\n\t\t\tif (!inlineCompletions || (suggestWidgetInlineCompletions.request?.versionId ?? -1) > (inlineCompletions.request?.versionId ?? -1)) {\n\t\t\t\tinlineCompletions?.dispose();\n\t\t\t\tconst s = this._state.get();\n\t\t\t\tthis._state.set({\n\t\t\t\t\tinlineCompletions: suggestWidgetInlineCompletions.clone(),\n\t\t\t\t\tsuggestWidgetInlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t\t\t}, tx);\n\t\t\t\ts.inlineCompletions.dispose();\n\t\t\t\ts.suggestWidgetInlineCompletions.dispose();\n\t\t\t}\n\t\t\tthis.clearSuggestWidgetInlineCompletions(tx);\n\t\t});\n\t}\n\n\tprivate sendInlineCompletionsRequestTelemetry(\n\t\trequestResponseInfo: RequestResponseData\n\t): void {\n\t\tif (!this._sendRequestData.get()) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (requestResponseInfo.requestUuid === undefined || requestResponseInfo.hasProducedSuggestion) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst emptyEndOfLifeEvent: InlineCompletionEndOfLifeEvent = {\n\t\t\tid: requestResponseInfo.requestUuid,\n\t\t\topportunityId: requestResponseInfo.requestUuid,\n\t\t\tnoSuggestionReason: requestResponseInfo.noSuggestionReason ?? 'unknown',\n\t\t\textensionId: 'vscode-core',\n\t\t\textensionVersion: '0.0.0',\n\t\t\tgroupId: 'empty',\n\t\t\tshown: false,\n\t\t\teditorType: requestResponseInfo.requestInfo.editorType,\n\t\t\trequestReason: requestResponseInfo.requestInfo.reason,\n\t\t\ttypingInterval: requestResponseInfo.requestInfo.typingInterval,\n\t\t\ttypingIntervalCharacterCount: requestResponseInfo.requestInfo.typingIntervalCharacterCount,\n\t\t\tlanguageId: requestResponseInfo.requestInfo.languageId,\n\t\t\tselectedSuggestionInfo: !!requestResponseInfo.context.selectedSuggestionInfo,\n\t\t\tavailableProviders: requestResponseInfo.providers.map(p => p.providerId?.toString()).filter(isDefined).join(','),\n\t\t\t...forwardToChannelIf(requestResponseInfo.providers.some(p => isCopilotLikeExtension(p.providerId?.extensionId))),\n\t\t\ttimeUntilProviderRequest: undefined,\n\t\t\ttimeUntilProviderResponse: undefined,\n\t\t\tviewKind: undefined,\n\t\t\tpreceeded: undefined,\n\t\t\terror: undefined,\n\t\t\tsuperseded: undefined,\n\t\t\treason: undefined,\n\t\t\tcorrelationId: undefined,\n\t\t\tshownDuration: undefined,\n\t\t\tshownDurationUncollapsed: undefined,\n\t\t\ttimeUntilShown: undefined,\n\t\t\tpartiallyAccepted: undefined,\n\t\t\tpartiallyAcceptedCountSinceOriginal: undefined,\n\t\t\tpartiallyAcceptedRatioSinceOriginal: undefined,\n\t\t\tpartiallyAcceptedCharactersSinceOriginal: undefined,\n\t\t\tcursorColumnDistance: undefined,\n\t\t\tcursorLineDistance: undefined,\n\t\t\tlineCountOriginal: undefined,\n\t\t\tlineCountModified: undefined,\n\t\t\tcharacterCountOriginal: undefined,\n\t\t\tcharacterCountModified: undefined,\n\t\t\tdisjointReplacements: undefined,\n\t\t\tsameShapeReplacements: undefined,\n\t\t\tnotShownReason: undefined,\n\t\t};\n\n\t\tconst dataChannel = this._instantiationService.createInstance(DataChannelForwardingTelemetryService);\n\t\tsendInlineCompletionsEndOfLifeTelemetry(dataChannel, emptyEndOfLifeEvent);\n\t}\n\n\tpublic clearSuggestWidgetInlineCompletions(tx: ITransaction): void {\n\t\tif (this._updateOperation.value?.request.context.selectedSuggestionInfo) {\n\t\t\tthis._updateOperation.clear();\n\t\t}\n\t}\n\n\tpublic cancelUpdate(): void {\n\t\tthis._updateOperation.clear();\n\t}\n}\n\nclass UpdateRequest {\n\tconstructor(\n\t\tpublic readonly position: Position,\n\t\tpublic readonly context: InlineCompletionContextWithoutUuid,\n\t\tpublic readonly versionId: number,\n\t\tpublic readonly providers: Set<InlineCompletionsProvider>,\n\t) {\n\t}\n\n\tpublic satisfies(other: UpdateRequest): boolean {\n\t\treturn this.position.equals(other.position)\n\t\t\t&& equalsIfDefined(this.context.selectedSuggestionInfo, other.context.selectedSuggestionInfo, itemEquals())\n\t\t\t&& (other.context.triggerKind === InlineCompletionTriggerKind.Automatic\n\t\t\t\t|| this.context.triggerKind === InlineCompletionTriggerKind.Explicit)\n\t\t\t&& this.versionId === other.versionId\n\t\t\t&& isSubset(other.providers, this.providers);\n\t}\n}\n\nclass RequestResponseData {\n\tpublic requestUuid: string | undefined;\n\tpublic noSuggestionReason: string | undefined;\n\tpublic hasProducedSuggestion = false;\n\n\tconstructor(\n\t\tpublic readonly context: InlineCompletionContextWithoutUuid,\n\t\tpublic readonly requestInfo: InlineSuggestRequestInfo,\n\t\tpublic readonly providers: InlineCompletionsProvider[],\n\t) { }\n\n\tsetRequestUuid(uuid: string) {\n\t\tthis.requestUuid = uuid;\n\t}\n\n\tsetNoSuggestionReasonIfNotSet(type: string) {\n\t\tthis.noSuggestionReason ??= type;\n\t}\n\n\tsetHasProducedSuggestion() {\n\t\tthis.hasProducedSuggestion = true;\n\t}\n}\n\nfunction isSubset<T>(set1: Set<T>, set2: Set<T>): boolean {\n\treturn [...set1].every(item => set2.has(item));\n}\n\nclass UpdateOperation implements IDisposable {\n\tconstructor(\n\t\tpublic readonly request: UpdateRequest,\n\t\tpublic readonly cancellationTokenSource: CancellationTokenSource,\n\t\tpublic readonly promise: Promise<boolean>,\n\t) {\n\t}\n\n\tdispose() {\n\t\tthis.cancellationTokenSource.cancel();\n\t}\n}\n\nclass InlineCompletionsState extends Disposable {\n\tpublic static createEmpty(): InlineCompletionsState {\n\t\treturn new InlineCompletionsState([], undefined);\n\t}\n\n\tconstructor(\n\t\tpublic readonly inlineCompletions: readonly InlineSuggestionItem[],\n\t\tpublic readonly request: UpdateRequest | undefined,\n\t) {\n\t\tfor (const inlineCompletion of inlineCompletions) {\n\t\t\tinlineCompletion.addRef();\n\t\t}\n\n\t\tsuper();\n\n\t\tthis._register({\n\t\t\tdispose: () => {\n\t\t\t\tfor (const inlineCompletion of this.inlineCompletions) {\n\t\t\t\t\tinlineCompletion.removeRef();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate _findById(id: InlineSuggestionIdentity): InlineSuggestionItem | undefined {\n\t\treturn this.inlineCompletions.find(i => i.identity === id);\n\t}\n\n\tprivate _findByHash(hash: string): InlineSuggestionItem | undefined {\n\t\treturn this.inlineCompletions.find(i => i.hash === hash);\n\t}\n\n\t/**\n\t * Applies the edit on the state.\n\t*/\n\tpublic createStateWithAppliedEdit(edit: StringEdit, textModel: ITextModel): InlineCompletionsState {\n\t\tconst newInlineCompletions = this.inlineCompletions.map(i => i.withEdit(edit, textModel)).filter(isDefined);\n\t\treturn new InlineCompletionsState(newInlineCompletions, this.request);\n\t}\n\n\tpublic createStateWithAppliedResults(updatedSuggestions: InlineSuggestionItem[], request: UpdateRequest, textModel: ITextModel, cursorPosition: Position, itemIdToPreserveAtTop: InlineSuggestionIdentity | undefined): InlineCompletionsState {\n\t\tlet itemToPreserve: InlineSuggestionItem | undefined = undefined;\n\t\tif (itemIdToPreserveAtTop) {\n\t\t\tconst itemToPreserveCandidate = this._findById(itemIdToPreserveAtTop);\n\t\t\tif (itemToPreserveCandidate && itemToPreserveCandidate.canBeReused(textModel, request.position)) {\n\t\t\t\titemToPreserve = itemToPreserveCandidate;\n\n\t\t\t\tconst updatedItemToPreserve = updatedSuggestions.find(i => i.hash === itemToPreserveCandidate.hash);\n\t\t\t\tif (updatedItemToPreserve) {\n\t\t\t\t\tupdatedSuggestions = moveToFront(updatedItemToPreserve, updatedSuggestions);\n\t\t\t\t} else {\n\t\t\t\t\tupdatedSuggestions = [itemToPreserveCandidate, ...updatedSuggestions];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst preferInlineCompletions = itemToPreserve\n\t\t\t// itemToPreserve has precedence\n\t\t\t? !itemToPreserve.isInlineEdit\n\t\t\t// Otherwise: prefer inline completion if there is a visible one\n\t\t\t: updatedSuggestions.some(i => !i.isInlineEdit && i.isVisible(textModel, cursorPosition));\n\n\t\tlet updatedItems: InlineSuggestionItem[] = [];\n\t\tfor (const i of updatedSuggestions) {\n\t\t\tconst oldItem = this._findByHash(i.hash);\n\t\t\tlet item;\n\t\t\tif (oldItem && oldItem !== i) {\n\t\t\t\titem = i.withIdentity(oldItem.identity);\n\t\t\t\ti.setIsPreceeded(oldItem);\n\t\t\t\toldItem.setEndOfLifeReason({ kind: InlineCompletionEndOfLifeReasonKind.Ignored, userTypingDisagreed: false, supersededBy: i.getSourceCompletion() });\n\t\t\t} else {\n\t\t\t\titem = i;\n\t\t\t}\n\t\t\tif (preferInlineCompletions !== item.isInlineEdit) {\n\t\t\t\tupdatedItems.push(item);\n\t\t\t}\n\t\t}\n\n\t\tupdatedItems.sort(compareBy(i => i.showInlineEditMenu, booleanComparator));\n\t\tupdatedItems = distinctByKey(updatedItems, i => i.semanticId);\n\n\t\treturn new InlineCompletionsState(updatedItems, request);\n\t}\n\n\tpublic clone(): InlineCompletionsState {\n\t\treturn new InlineCompletionsState(this.inlineCompletions, this.request);\n\t}\n}\n\n/** Keeps the first item in case of duplicates. */\nfunction distinctByKey<T>(items: T[], key: (item: T) => unknown): T[] {\n\tconst seen = new Set();\n\treturn items.filter(item => {\n\t\tconst k = key(item);\n\t\tif (seen.has(k)) {\n\t\t\treturn false;\n\t\t}\n\t\tseen.add(k);\n\t\treturn true;\n\t});\n}\n\nfunction moveToFront<T>(item: T, items: T[]): T[] {\n\tconst index = items.indexOf(item);\n\tif (index > -1) {\n\t\treturn [item, ...items.slice(0, index), ...items.slice(index + 1)];\n\t}\n\treturn items;\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { booleanComparator, compareBy, compareUndefinedSmallest, numberComparator } from '../../../../../base/common/arrays.js';\nimport { findLastMax } from '../../../../../base/common/arraysFind.js';\nimport { CancellationTokenSource } from '../../../../../base/common/cancellation.js';\nimport { equalsIfDefined, itemEquals } from '../../../../../base/common/equals.js';\nimport { Disposable, DisposableStore, IDisposable, MutableDisposable, toDisposable } from '../../../../../base/common/lifecycle.js';\nimport { derived, IObservable, IObservableWithChange, ITransaction, observableValue, recordChangesLazy, transaction } from '../../../../../base/common/observable.js';\n// eslint-disable-next-line local/code-no-deep-import-of-internal\nimport { observableReducerSettable } from '../../../../../base/common/observableInternal/experimental/reducer.js';\nimport { isDefined } from '../../../../../base/common/types.js';\nimport { IConfigurationService } from '../../../../../platform/configuration/common/configuration.js';\nimport { DataChannelForwardingTelemetryService, forwardToChannelIf, isCopilotLikeExtension } from '../../../../../platform/dataChannel/browser/forwardingTelemetryService.js';\nimport { IInstantiationService } from '../../../../../platform/instantiation/common/instantiation.js';\nimport { ILogService } from '../../../../../platform/log/common/log.js';\nimport { observableConfigValue } from '../../../../../platform/observable/common/platformObservableUtils.js';\nimport { StringEdit } from '../../../../common/core/edits/stringEdit.js';\nimport { Position } from '../../../../common/core/position.js';\nimport { InlineCompletionEndOfLifeReasonKind, InlineCompletionTriggerKind, InlineCompletionsProvider } from '../../../../common/languages.js';\nimport { ILanguageConfigurationService } from '../../../../common/languages/languageConfigurationRegistry.js';\nimport { ITextModel } from '../../../../common/model.js';\nimport { offsetEditFromContentChanges } from '../../../../common/model/textModelStringEdit.js';\nimport { IFeatureDebounceInformation } from '../../../../common/services/languageFeatureDebounce.js';\nimport { IModelContentChangedEvent } from '../../../../common/textModelEvents.js';\nimport { formatRecordableLogEntry, IRecordableEditorLogEntry, IRecordableLogEntry, StructuredLogger } from '../structuredLogger.js';\nimport { InlineCompletionEndOfLifeEvent, sendInlineCompletionsEndOfLifeTelemetry } from '../telemetry.js';\nimport { wait } from '../utils.js';\nimport { InlineSuggestionIdentity, InlineSuggestionItem } from './inlineSuggestionItem.js';\nimport { InlineCompletionContextWithoutUuid, InlineSuggestRequestInfo, provideInlineCompletions, runWhenCancelled } from './provideInlineCompletions.js';\n\nexport class InlineCompletionsSource extends Disposable {\n\tprivate static _requestId = 0;\n\n\tprivate readonly _updateOperation = this._register(new MutableDisposable<UpdateOperation>());\n\n\tprivate readonly _loggingEnabled;\n\tprivate readonly _sendRequestData;\n\n\tprivate readonly _structuredFetchLogger;\n\n\tprivate readonly _state = observableReducerSettable(this, {\n\t\tinitial: () => ({\n\t\t\tinlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t\tsuggestWidgetInlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t}),\n\t\tdisposeFinal: (values) => {\n\t\t\tvalues.inlineCompletions.dispose();\n\t\t\tvalues.suggestWidgetInlineCompletions.dispose();\n\t\t},\n\t\tchangeTracker: recordChangesLazy(() => ({ versionId: this._versionId })),\n\t\tupdate: (reader, previousValue, changes) => {\n\t\t\tconst edit = StringEdit.compose(changes.changes.map(c => c.change ? offsetEditFromContentChanges(c.change.changes) : StringEdit.empty).filter(isDefined));\n\n\t\t\tif (edit.isEmpty()) {\n\t\t\t\treturn previousValue;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\treturn {\n\t\t\t\t\tinlineCompletions: previousValue.inlineCompletions.createStateWithAppliedEdit(edit, this._textModel),\n\t\t\t\t\tsuggestWidgetInlineCompletions: previousValue.suggestWidgetInlineCompletions.createStateWithAppliedEdit(edit, this._textModel),\n\t\t\t\t};\n\t\t\t} finally {\n\t\t\t\tpreviousValue.inlineCompletions.dispose();\n\t\t\t\tpreviousValue.suggestWidgetInlineCompletions.dispose();\n\t\t\t}\n\t\t}\n\t});\n\n\tpublic readonly inlineCompletions = this._state.map(this, v => v.inlineCompletions);\n\tpublic readonly suggestWidgetInlineCompletions = this._state.map(this, v => v.suggestWidgetInlineCompletions);\n\n\tconstructor(\n\t\tprivate readonly _textModel: ITextModel,\n\t\tprivate readonly _versionId: IObservableWithChange<number | null, IModelContentChangedEvent | undefined>,\n\t\tprivate readonly _debounceValue: IFeatureDebounceInformation,\n\t\tprivate readonly _cursorPosition: IObservable<Position>,\n\t\t@ILanguageConfigurationService private readonly _languageConfigurationService: ILanguageConfigurationService,\n\t\t@ILogService private readonly _logService: ILogService,\n\t\t@IConfigurationService private readonly _configurationService: IConfigurationService,\n\t\t@IInstantiationService private readonly _instantiationService: IInstantiationService,\n\t) {\n\t\tsuper();\n\t\tthis._loggingEnabled = observableConfigValue('editor.inlineSuggest.logFetch', false, this._configurationService).recomputeInitiallyAndOnChange(this._store);\n\t\tthis._sendRequestData = observableConfigValue('editor.inlineSuggest.emptyResponseInformation', true, this._configurationService).recomputeInitiallyAndOnChange(this._store);\n\t\tthis._structuredFetchLogger = this._register(this._instantiationService.createInstance(StructuredLogger.cast<\n\t\t\t{ kind: 'start'; requestId: number; context: unknown } & IRecordableEditorLogEntry\n\t\t\t| { kind: 'end'; error: unknown; durationMs: number; result: unknown; requestId: number } & IRecordableLogEntry\n\t\t>(),\n\t\t\t'editor.inlineSuggest.logFetch.commandId'\n\t\t));\n\n\t\tthis.clearOperationOnTextModelChange.recomputeInitiallyAndOnChange(this._store);\n\t}\n\n\tpublic readonly clearOperationOnTextModelChange = derived(this, reader => {\n\t\tthis._versionId.read(reader);\n\t\tthis._updateOperation.clear();\n\t\treturn undefined; // always constant\n\t});\n\n\tprivate _log(entry:\n\t\t{ sourceId: string; kind: 'start'; requestId: number; context: unknown; provider: string | undefined } & IRecordableEditorLogEntry\n\t\t| { sourceId: string; kind: 'end'; error: unknown; durationMs: number; result: unknown; requestId: number; didAllProvidersReturn: boolean } & IRecordableLogEntry\n\t) {\n\t\tif (this._loggingEnabled.get()) {\n\t\t\tthis._logService.info(formatRecordableLogEntry(entry));\n\t\t}\n\t\tthis._structuredFetchLogger.log(entry);\n\t}\n\n\tprivate readonly _loadingCount = observableValue(this, 0);\n\n\tpublic fetch(\n\t\tproviders: InlineCompletionsProvider[],\n\t\tprovidersLabel: string | undefined,\n\t\tcontext: InlineCompletionContextWithoutUuid,\n\t\tactiveInlineCompletion: InlineSuggestionIdentity | undefined,\n\t\twithDebounce: boolean,\n\t\tuserJumpedToActiveCompletion: IObservable<boolean>,\n\t\trequestInfo: InlineSuggestRequestInfo\n\t): Promise<boolean> {\n\t\tconst position = this._cursorPosition.get();\n\t\tconst request = new UpdateRequest(position, context, this._textModel.getVersionId(), new Set(providers));\n\n\t\tconst target = context.selectedSuggestionInfo ? this.suggestWidgetInlineCompletions.get() : this.inlineCompletions.get();\n\n\t\tif (this._updateOperation.value?.request.satisfies(request)) {\n\t\t\treturn this._updateOperation.value.promise;\n\t\t} else if (target?.request?.satisfies(request)) {\n\t\t\treturn Promise.resolve(true);\n\t\t}\n\n\t\tconst updateOngoing = !!this._updateOperation.value;\n\t\tthis._updateOperation.clear();\n\n\t\tconst source = new CancellationTokenSource();\n\n\t\tconst promise = (async () => {\n\t\t\tthis._loadingCount.set(this._loadingCount.get() + 1, undefined);\n\t\t\tconst store = new DisposableStore();\n\t\t\tconst inlineSuggestionsProviders = providers.filter(p => p.providerId);\n\t\t\tconst requestResponseInfo = new RequestResponseData(context, requestInfo, inlineSuggestionsProviders);\n\n\t\t\ttry {\n\t\t\t\tconst recommendedDebounceValue = this._debounceValue.get(this._textModel);\n\t\t\t\tconst debounceValue = findLastMax(\n\t\t\t\t\tproviders.map(p => p.debounceDelayMs),\n\t\t\t\t\tcompareUndefinedSmallest(numberComparator)\n\t\t\t\t) ?? recommendedDebounceValue;\n\n\t\t\t\t// Debounce in any case if update is ongoing\n\t\t\t\tconst shouldDebounce = updateOngoing || (withDebounce && context.triggerKind === InlineCompletionTriggerKind.Automatic);\n\t\t\t\tif (shouldDebounce) {\n\t\t\t\t\t// This debounces the operation\n\t\t\t\t\tawait wait(debounceValue, source.token);\n\t\t\t\t}\n\n\t\t\t\tif (source.token.isCancellationRequested || this._store.isDisposed || this._textModel.getVersionId() !== request.versionId) {\n\t\t\t\t\trequestResponseInfo.setNoSuggestionReasonIfNotSet('canceled:beforeFetch');\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tconst requestId = InlineCompletionsSource._requestId++;\n\t\t\t\tif (this._loggingEnabled.get() || this._structuredFetchLogger.isEnabled.get()) {\n\t\t\t\t\tthis._log({\n\t\t\t\t\t\tsourceId: 'InlineCompletions.fetch',\n\t\t\t\t\t\tkind: 'start',\n\t\t\t\t\t\trequestId,\n\t\t\t\t\t\tmodelUri: this._textModel.uri,\n\t\t\t\t\t\tmodelVersion: this._textModel.getVersionId(),\n\t\t\t\t\t\tcontext: { triggerKind: context.triggerKind, suggestInfo: context.selectedSuggestionInfo ? true : undefined },\n\t\t\t\t\t\ttime: Date.now(),\n\t\t\t\t\t\tprovider: providersLabel,\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tconst startTime = new Date();\n\t\t\t\tconst providerResult = provideInlineCompletions(providers, this._cursorPosition.get(), this._textModel, context, requestInfo, this._languageConfigurationService);\n\n\t\t\t\trunWhenCancelled(source.token, () => providerResult.cancelAndDispose({ kind: 'tokenCancellation' }));\n\n\t\t\t\tlet shouldStopEarly = false;\n\t\t\t\tlet producedSuggestion = false;\n\n\t\t\t\tconst suggestions: InlineSuggestionItem[] = [];\n\t\t\t\tfor await (const list of providerResult.lists) {\n\t\t\t\t\tif (!list) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tlist.addRef();\n\t\t\t\t\tstore.add(toDisposable(() => list.removeRef(list.inlineSuggestionsData.length === 0 ? { kind: 'empty' } : { kind: 'notTaken' })));\n\n\t\t\t\t\tfor (const item of list.inlineSuggestionsData) {\n\t\t\t\t\t\tproducedSuggestion = true;\n\t\t\t\t\t\tif (!context.includeInlineEdits && (item.isInlineEdit || item.showInlineEditMenu)) {\n\t\t\t\t\t\t\titem.setNotShownReason('notInlineEditRequested');\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!context.includeInlineCompletions && !(item.isInlineEdit || item.showInlineEditMenu)) {\n\t\t\t\t\t\t\titem.setNotShownReason('notInlineCompletionRequested');\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst i = InlineSuggestionItem.create(item, this._textModel);\n\t\t\t\t\t\tsuggestions.push(i);\n\t\t\t\t\t\t// Stop after first visible inline completion\n\t\t\t\t\t\tif (!i.isInlineEdit && !i.showInlineEditMenu && context.triggerKind === InlineCompletionTriggerKind.Automatic) {\n\t\t\t\t\t\t\tif (i.isVisible(this._textModel, this._cursorPosition.get())) {\n\t\t\t\t\t\t\t\tshouldStopEarly = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (shouldStopEarly) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tproviderResult.cancelAndDispose({ kind: 'lostRace' });\n\n\t\t\t\tif (this._loggingEnabled.get() || this._structuredFetchLogger.isEnabled.get()) {\n\t\t\t\t\tconst didAllProvidersReturn = providerResult.didAllProvidersReturn;\n\t\t\t\t\tlet error: string | undefined = undefined;\n\t\t\t\t\tif (source.token.isCancellationRequested || this._store.isDisposed || this._textModel.getVersionId() !== request.versionId) {\n\t\t\t\t\t\terror = 'canceled';\n\t\t\t\t\t}\n\t\t\t\t\tconst result = suggestions.map(c => ({\n\t\t\t\t\t\trange: c.editRange.toString(),\n\t\t\t\t\t\ttext: c.insertText,\n\t\t\t\t\t\tisInlineEdit: !!c.isInlineEdit,\n\t\t\t\t\t\tsource: c.source.provider.groupId,\n\t\t\t\t\t}));\n\t\t\t\t\tthis._log({ sourceId: 'InlineCompletions.fetch', kind: 'end', requestId, durationMs: (Date.now() - startTime.getTime()), error, result, time: Date.now(), didAllProvidersReturn });\n\t\t\t\t}\n\n\t\t\t\trequestResponseInfo.setRequestUuid(providerResult.contextWithUuid.requestUuid);\n\t\t\t\tif (producedSuggestion) {\n\t\t\t\t\trequestResponseInfo.setHasProducedSuggestion();\n\t\t\t\t\tif (suggestions.length > 0 && source.token.isCancellationRequested) {\n\t\t\t\t\t\tsuggestions.forEach(s => s.setNotShownReasonIfNotSet('canceled:whileAwaitingOtherProviders'));\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (source.token.isCancellationRequested) {\n\t\t\t\t\t\trequestResponseInfo.setNoSuggestionReasonIfNotSet('canceled:whileFetching');\n\t\t\t\t\t} else {\n\t\t\t\t\t\trequestResponseInfo.setNoSuggestionReasonIfNotSet('noSuggestion');\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst remainingTimeToWait = context.earliestShownDateTime - Date.now();\n\t\t\t\tif (remainingTimeToWait > 0) {\n\t\t\t\t\tawait wait(remainingTimeToWait, source.token);\n\t\t\t\t}\n\n\t\t\t\tif (source.token.isCancellationRequested || this._store.isDisposed || this._textModel.getVersionId() !== request.versionId\n\t\t\t\t\t|| userJumpedToActiveCompletion.get() /* In the meantime the user showed interest for the active completion so dont hide it */) {\n\t\t\t\t\tconst notShownReason =\n\t\t\t\t\t\tsource.token.isCancellationRequested ? 'canceled:afterMinShowDelay' :\n\t\t\t\t\t\t\tthis._store.isDisposed ? 'canceled:disposed' :\n\t\t\t\t\t\t\t\tthis._textModel.getVersionId() !== request.versionId ? 'canceled:documentChanged' :\n\t\t\t\t\t\t\t\t\tuserJumpedToActiveCompletion.get() ? 'canceled:userJumped' :\n\t\t\t\t\t\t\t\t\t\t'unknown';\n\t\t\t\t\tsuggestions.forEach(s => s.setNotShownReasonIfNotSet(notShownReason));\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tconst endTime = new Date();\n\t\t\t\tthis._debounceValue.update(this._textModel, endTime.getTime() - startTime.getTime());\n\n\t\t\t\tconst cursorPosition = this._cursorPosition.get();\n\t\t\t\tthis._updateOperation.clear();\n\t\t\t\ttransaction(tx => {\n\t\t\t\t\t/** @description Update completions with provider result */\n\t\t\t\t\tconst v = this._state.get();\n\n\t\t\t\t\tif (context.selectedSuggestionInfo) {\n\t\t\t\t\t\tthis._state.set({\n\t\t\t\t\t\t\tinlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t\t\t\t\t\tsuggestWidgetInlineCompletions: v.suggestWidgetInlineCompletions.createStateWithAppliedResults(suggestions, request, this._textModel, cursorPosition, activeInlineCompletion),\n\t\t\t\t\t\t}, tx);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis._state.set({\n\t\t\t\t\t\t\tinlineCompletions: v.inlineCompletions.createStateWithAppliedResults(suggestions, request, this._textModel, cursorPosition, activeInlineCompletion),\n\t\t\t\t\t\t\tsuggestWidgetInlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t\t\t\t\t}, tx);\n\t\t\t\t\t}\n\n\t\t\t\t\tv.inlineCompletions.dispose();\n\t\t\t\t\tv.suggestWidgetInlineCompletions.dispose();\n\t\t\t\t});\n\t\t\t} finally {\n\t\t\t\tthis._loadingCount.set(this._loadingCount.get() - 1, undefined);\n\t\t\t\tstore.dispose();\n\t\t\t\tthis.sendInlineCompletionsRequestTelemetry(requestResponseInfo);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t})();\n\n\t\tconst updateOperation = new UpdateOperation(request, source, promise);\n\t\tthis._updateOperation.value = updateOperation;\n\n\t\treturn promise;\n\t}\n\n\tpublic clear(tx: ITransaction): void {\n\t\tthis._updateOperation.clear();\n\t\tconst v = this._state.get();\n\t\tthis._state.set({\n\t\t\tinlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t\tsuggestWidgetInlineCompletions: InlineCompletionsState.createEmpty()\n\t\t}, tx);\n\t\tv.inlineCompletions.dispose();\n\t\tv.suggestWidgetInlineCompletions.dispose();\n\t}\n\n\tpublic seedInlineCompletionsWithSuggestWidget(): void {\n\t\tconst inlineCompletions = this.inlineCompletions.get();\n\t\tconst suggestWidgetInlineCompletions = this.suggestWidgetInlineCompletions.get();\n\t\tif (!suggestWidgetInlineCompletions) {\n\t\t\treturn;\n\t\t}\n\t\ttransaction(tx => {\n\t\t\t/** @description Seed inline completions with (newer) suggest widget inline completions */\n\t\t\tif (!inlineCompletions || (suggestWidgetInlineCompletions.request?.versionId ?? -1) > (inlineCompletions.request?.versionId ?? -1)) {\n\t\t\t\tinlineCompletions?.dispose();\n\t\t\t\tconst s = this._state.get();\n\t\t\t\tthis._state.set({\n\t\t\t\t\tinlineCompletions: suggestWidgetInlineCompletions.clone(),\n\t\t\t\t\tsuggestWidgetInlineCompletions: InlineCompletionsState.createEmpty(),\n\t\t\t\t}, tx);\n\t\t\t\ts.inlineCompletions.dispose();\n\t\t\t\ts.suggestWidgetInlineCompletions.dispose();\n\t\t\t}\n\t\t\tthis.clearSuggestWidgetInlineCompletions(tx);\n\t\t});\n\t}\n\n\tprivate sendInlineCompletionsRequestTelemetry(\n\t\trequestResponseInfo: RequestResponseData\n\t): void {\n\t\tif (!this._sendRequestData.get()) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (requestResponseInfo.requestUuid === undefined || requestResponseInfo.hasProducedSuggestion) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst emptyEndOfLifeEvent: InlineCompletionEndOfLifeEvent = {\n\t\t\tid: requestResponseInfo.requestUuid,\n\t\t\topportunityId: requestResponseInfo.requestUuid,\n\t\t\tnoSuggestionReason: requestResponseInfo.noSuggestionReason ?? 'unknown',\n\t\t\textensionId: 'vscode-core',\n\t\t\textensionVersion: '0.0.0',\n\t\t\tgroupId: 'empty',\n\t\t\tshown: false,\n\t\t\teditorType: requestResponseInfo.requestInfo.editorType,\n\t\t\trequestReason: requestResponseInfo.requestInfo.reason,\n\t\t\ttypingInterval: requestResponseInfo.requestInfo.typingInterval,\n\t\t\ttypingIntervalCharacterCount: requestResponseInfo.requestInfo.typingIntervalCharacterCount,\n\t\t\tlanguageId: requestResponseInfo.requestInfo.languageId,\n\t\t\tselectedSuggestionInfo: !!requestResponseInfo.context.selectedSuggestionInfo,\n\t\t\tavailableProviders: requestResponseInfo.providers.map(p => p.providerId?.toString()).filter(isDefined).join(','),\n\t\t\t...forwardToChannelIf(requestResponseInfo.providers.some(p => isCopilotLikeExtension(p.providerId?.extensionId))),\n\t\t\ttimeUntilProviderRequest: undefined,\n\t\t\ttimeUntilProviderResponse: undefined,\n\t\t\tviewKind: undefined,\n\t\t\tpreceeded: undefined,\n\t\t\terror: undefined,\n\t\t\tsuperseded: undefined,\n\t\t\treason: undefined,\n\t\t\tcorrelationId: undefined,\n\t\t\tshownDuration: undefined,\n\t\t\tshownDurationUncollapsed: undefined,\n\t\t\ttimeUntilShown: undefined,\n\t\t\tpartiallyAccepted: undefined,\n\t\t\tpartiallyAcceptedCountSinceOriginal: undefined,\n\t\t\tpartiallyAcceptedRatioSinceOriginal: undefined,\n\t\t\tpartiallyAcceptedCharactersSinceOriginal: undefined,\n\t\t\tcursorColumnDistance: undefined,\n\t\t\tcursorLineDistance: undefined,\n\t\t\tlineCountOriginal: undefined,\n\t\t\tlineCountModified: undefined,\n\t\t\tcharacterCountOriginal: undefined,\n\t\t\tcharacterCountModified: undefined,\n\t\t\tdisjointReplacements: undefined,\n\t\t\tsameShapeReplacements: undefined,\n\t\t\tnotShownReason: undefined,\n\t\t};\n\n\t\tconst dataChannel = this._instantiationService.createInstance(DataChannelForwardingTelemetryService);\n\t\tsendInlineCompletionsEndOfLifeTelemetry(dataChannel, emptyEndOfLifeEvent);\n\t}\n\n\tpublic clearSuggestWidgetInlineCompletions(tx: ITransaction): void {\n\t\tif (this._updateOperation.value?.request.context.selectedSuggestionInfo) {\n\t\t\tthis._updateOperation.clear();\n\t\t}\n\t}\n\n\tpublic cancelUpdate(): void {\n\t\tthis._updateOperation.clear();\n\t}\n}\n\nclass UpdateRequest {\n\tconstructor(\n\t\tpublic readonly position: Position,\n\t\tpublic readonly context: InlineCompletionContextWithoutUuid,\n\t\tpublic readonly versionId: number,\n\t\tpublic readonly providers: Set<InlineCompletionsProvider>,\n\t) {\n\t}\n\n\tpublic satisfies(other: UpdateRequest): boolean {\n\t\treturn this.position.equals(other.position)\n\t\t\t&& equalsIfDefined(this.context.selectedSuggestionInfo, other.context.selectedSuggestionInfo, itemEquals())\n\t\t\t&& (other.context.triggerKind === InlineCompletionTriggerKind.Automatic\n\t\t\t\t|| this.context.triggerKind === InlineCompletionTriggerKind.Explicit)\n\t\t\t&& this.versionId === other.versionId\n\t\t\t&& isSubset(other.providers, this.providers);\n\t}\n}\n\nclass RequestResponseData {\n\tpublic requestUuid: string | undefined;\n\tpublic noSuggestionReason: string | undefined;\n\tpublic hasProducedSuggestion = false;\n\n\tconstructor(\n\t\tpublic readonly context: InlineCompletionContextWithoutUuid,\n\t\tpublic readonly requestInfo: InlineSuggestRequestInfo,\n\t\tpublic readonly providers: InlineCompletionsProvider[],\n\t) { }\n\n\tsetRequestUuid(uuid: string) {\n\t\tthis.requestUuid = uuid;\n\t}\n\n\tsetNoSuggestionReasonIfNotSet(type: string) {\n\t\tthis.noSuggestionReason ??= type;\n\t}\n\n\tsetHasProducedSuggestion() {\n\t\tthis.hasProducedSuggestion = true;\n\t}\n}\n\nfunction isSubset<T>(set1: Set<T>, set2: Set<T>): boolean {\n\treturn [...set1].every(item => set2.has(item));\n}\n\nclass UpdateOperation implements IDisposable {\n\tconstructor(\n\t\tpublic readonly request: UpdateRequest,\n\t\tpublic readonly cancellationTokenSource: CancellationTokenSource,\n\t\tpublic readonly promise: Promise<boolean>,\n\t) {\n\t}\n\n\tdispose() {\n\t\tthis.cancellationTokenSource.cancel();\n\t}\n}\n\nclass InlineCompletionsState extends Disposable {\n\tpublic static createEmpty(): InlineCompletionsState {\n\t\treturn new InlineCompletionsState([], undefined);\n\t}\n\n\tconstructor(\n\t\tpublic readonly inlineCompletions: readonly InlineSuggestionItem[],\n\t\tpublic readonly request: UpdateRequest | undefined,\n\t) {\n\t\tfor (const inlineCompletion of inlineCompletions) {\n\t\t\tinlineCompletion.addRef();\n\t\t}\n\n\t\tsuper();\n\n\t\tthis._register({\n\t\t\tdispose: () => {\n\t\t\t\tfor (const inlineCompletion of this.inlineCompletions) {\n\t\t\t\t\tinlineCompletion.removeRef();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate _findById(id: InlineSuggestionIdentity): InlineSuggestionItem | undefined {\n\t\treturn this.inlineCompletions.find(i => i.identity === id);\n\t}\n\n\tprivate _findByHash(hash: string): InlineSuggestionItem | undefined {\n\t\treturn this.inlineCompletions.find(i => i.hash === hash);\n\t}\n\n\t/**\n\t * Applies the edit on the state.\n\t*/\n\tpublic createStateWithAppliedEdit(edit: StringEdit, textModel: ITextModel): InlineCompletionsState {\n\t\tconst newInlineCompletions = this.inlineCompletions.map(i => i.withEdit(edit, textModel)).filter(isDefined);\n\t\treturn new InlineCompletionsState(newInlineCompletions, this.request);\n\t}\n\n\tpublic createStateWithAppliedResults(updatedSuggestions: InlineSuggestionItem[], request: UpdateRequest, textModel: ITextModel, cursorPosition: Position, itemIdToPreserveAtTop: InlineSuggestionIdentity | undefined): InlineCompletionsState {\n\t\tlet itemToPreserve: InlineSuggestionItem | undefined = undefined;\n\t\tif (itemIdToPreserveAtTop) {\n\t\t\tconst itemToPreserveCandidate = this._findById(itemIdToPreserveAtTop);\n\t\t\tif (itemToPreserveCandidate && itemToPreserveCandidate.canBeReused(textModel, request.position)) {\n\t\t\t\titemToPreserve = itemToPreserveCandidate;\n\n\t\t\t\tconst updatedItemToPreserve = updatedSuggestions.find(i => i.hash === itemToPreserveCandidate.hash);\n\t\t\t\tif (updatedItemToPreserve) {\n\t\t\t\t\tupdatedSuggestions = moveToFront(updatedItemToPreserve, updatedSuggestions);\n\t\t\t\t} else {\n\t\t\t\t\tupdatedSuggestions = [itemToPreserveCandidate, ...updatedSuggestions];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst preferInlineCompletions = itemToPreserve\n\t\t\t// itemToPreserve has precedence\n\t\t\t? !itemToPreserve.isInlineEdit\n\t\t\t// Otherwise: prefer inline completion if there is a visible one\n\t\t\t: updatedSuggestions.some(i => !i.isInlineEdit && i.isVisible(textModel, cursorPosition));\n\n\t\tlet updatedItems: InlineSuggestionItem[] = [];\n\t\tfor (const i of updatedSuggestions) {\n\t\t\tconst oldItem = this._findByHash(i.hash);\n\t\t\tlet item;\n\t\t\tif (oldItem && oldItem !== i) {\n\t\t\t\titem = i.withIdentity(oldItem.identity);\n\t\t\t\ti.setIsPreceeded(oldItem);\n\t\t\t\toldItem.setEndOfLifeReason({ kind: InlineCompletionEndOfLifeReasonKind.Ignored, userTypingDisagreed: false, supersededBy: i.getSourceCompletion() });\n\t\t\t} else {\n\t\t\t\titem = i;\n\t\t\t}\n\t\t\tif (preferInlineCompletions !== item.isInlineEdit) {\n\t\t\t\tupdatedItems.push(item);\n\t\t\t}\n\t\t}\n\n\t\tupdatedItems.sort(compareBy(i => i.showInlineEditMenu, booleanComparator));\n\t\tupdatedItems = distinctByKey(updatedItems, i => i.semanticId);\n\n\t\treturn new InlineCompletionsState(updatedItems, request);\n\t}\n\n\tpublic clone(): InlineCompletionsState {\n\t\treturn new InlineCompletionsState(this.inlineCompletions, this.request);\n\t}\n}\n\n/** Keeps the first item in case of duplicates. */\nfunction distinctByKey<T>(items: T[], key: (item: T) => unknown): T[] {\n\tconst seen = new Set();\n\treturn items.filter(item => {\n\t\tconst k = key(item);\n\t\tif (seen.has(k)) {\n\t\t\treturn false;\n\t\t}\n\t\tseen.add(k);\n\t\treturn true;\n\t});\n}\n\nfunction moveToFront<T>(item: T, items: T[]): T[] {\n\tconst index = items.indexOf(item);\n\tif (index > -1) {\n\t\treturn [item, ...items.slice(0, index), ...items.slice(index + 1)];\n\t}\n\treturn items;\n}\n"]}
|
|
@@ -20,7 +20,6 @@ import { IDataChannelService } from '../../../../platform/dataChannel/common/dat
|
|
|
20
20
|
* The sourceLabel must not contain '@'!
|
|
21
21
|
*/
|
|
22
22
|
export function formatRecordableLogEntry(entry) {
|
|
23
|
-
// eslint-disable-next-line local/code-no-any-casts
|
|
24
23
|
return entry.sourceId + ' @@ ' + JSON.stringify({ ...entry, modelUri: entry.modelUri?.toString(), sourceId: undefined });
|
|
25
24
|
}
|
|
26
25
|
let StructuredLogger = StructuredLogger_1 = class StructuredLogger extends Disposable {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/inlineCompletions/browser/structuredLogger.ts","vs/editor/contrib/inlineCompletions/browser/structuredLogger.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;;AAEhG,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAClE,OAAO,EAAe,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAEzF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sDAAsD,CAAC;AAC1F,OAAO,EAAE,mBAAmB,EAAE,MAAM,wDAAwD,CAAC;AAkB7F;;EAEE;AACF,MAAM,UAAU,wBAAwB,CAAgC,KAAQ;IAC/E,
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/inlineCompletions/browser/structuredLogger.ts","vs/editor/contrib/inlineCompletions/browser/structuredLogger.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;;AAEhG,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAClE,OAAO,EAAe,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAEzF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sDAAsD,CAAC;AAC1F,OAAO,EAAE,mBAAmB,EAAE,MAAM,wDAAwD,CAAC;AAkB7F;;EAEE;AACF,MAAM,UAAU,wBAAwB,CAAgC,KAAQ;IAC/E,OAAO,KAAK,CAAC,QAAQ,GAAG,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C;IAClF,OAAO,mBAAmB,CAAC,iBAAiB,CAAC,kBAAkB,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,kBAAkB,CAAI,GAAG,CAAC,CAAC,CAAC;AACtH,CAAC","file":"structuredLogger.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Disposable } from '../../../../base/common/lifecycle.js';\nimport { IObservable, observableFromEvent } from '../../../../base/common/observable.js';\nimport { URI } from '../../../../base/common/uri.js';\nimport { IContextKeyService } from '../../../../platform/contextkey/common/contextkey.js';\nimport { IDataChannelService } from '../../../../platform/dataChannel/common/dataChannel.js';\n\nexport interface IRecordableLogEntry {\n\tsourceId: string;\n\ttime: number;\n}\n\nexport interface IRecordableEditorLogEntry extends IRecordableLogEntry {\n\tmodelUri: URI; // This has to be a URI, so that it gets translated automatically in remote scenarios\n\tmodelVersion: number;\n}\n\nexport interface IDocumentEventDataSetChangeReason {\n\tsourceId: 'TextModel.setChangeReason';\n\tsource: 'inlineSuggestion.accept' | 'snippet' | string;\n}\n\n\n/**\n * The sourceLabel must not contain '@'!\n*/\nexport function formatRecordableLogEntry<T extends IRecordableLogEntry>(entry: T): string {\n\treturn entry.sourceId + ' @@ ' + JSON.stringify({ ...entry, modelUri: (entry as any).modelUri?.toString(), sourceId: undefined });\n}\n\nexport class StructuredLogger<T extends IRecordableLogEntry> extends Disposable {\n\tpublic static cast<T extends IRecordableLogEntry>(): typeof StructuredLogger<T> {\n\t\treturn this as typeof StructuredLogger<T>;\n\t}\n\n\tpublic readonly isEnabled;\n\tprivate readonly _isEnabledContextKeyValue;\n\n\tconstructor(\n\t\tprivate readonly _key: string,\n\t\t@IContextKeyService private readonly _contextKeyService: IContextKeyService,\n\t\t@IDataChannelService private readonly _dataChannelService: IDataChannelService,\n\t) {\n\t\tsuper();\n\t\tthis._isEnabledContextKeyValue = observableContextKey<boolean>('structuredLogger.enabled:' + this._key, this._contextKeyService).recomputeInitiallyAndOnChange(this._store);\n\t\tthis.isEnabled = this._isEnabledContextKeyValue.map(v => v !== undefined);\n\t}\n\n\tpublic log(data: T): boolean {\n\t\tconst enabled = this._isEnabledContextKeyValue.get();\n\t\tif (!enabled) {\n\t\t\treturn false;\n\t\t}\n\t\tthis._dataChannelService.getDataChannel<T>('structuredLogger:' + this._key).sendData(data);\n\t\treturn true;\n\t}\n}\n\nfunction observableContextKey<T>(key: string, contextKeyService: IContextKeyService): IObservable<T | undefined> {\n\treturn observableFromEvent(contextKeyService.onDidChangeContext, () => contextKeyService.getContextKeyValue<T>(key));\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Disposable } from '../../../../base/common/lifecycle.js';\nimport { IObservable, observableFromEvent } from '../../../../base/common/observable.js';\nimport { URI } from '../../../../base/common/uri.js';\nimport { IContextKeyService } from '../../../../platform/contextkey/common/contextkey.js';\nimport { IDataChannelService } from '../../../../platform/dataChannel/common/dataChannel.js';\n\nexport interface IRecordableLogEntry {\n\tsourceId: string;\n\ttime: number;\n}\n\nexport interface IRecordableEditorLogEntry extends IRecordableLogEntry {\n\tmodelUri: URI; // This has to be a URI, so that it gets translated automatically in remote scenarios\n\tmodelVersion: number;\n}\n\nexport interface IDocumentEventDataSetChangeReason {\n\tsourceId: 'TextModel.setChangeReason';\n\tsource: 'inlineSuggestion.accept' | 'snippet' | string;\n}\n\n\n/**\n * The sourceLabel must not contain '@'!\n*/\nexport function formatRecordableLogEntry<T extends IRecordableLogEntry>(entry: T): string {\n\treturn entry.sourceId + ' @@ ' + JSON.stringify({ ...entry, modelUri: (entry as any).modelUri?.toString(), sourceId: undefined });\n}\n\nexport class StructuredLogger<T extends IRecordableLogEntry> extends Disposable {\n\tpublic static cast<T extends IRecordableLogEntry>(): typeof StructuredLogger<T> {\n\t\treturn this as typeof StructuredLogger<T>;\n\t}\n\n\tpublic readonly isEnabled;\n\tprivate readonly _isEnabledContextKeyValue;\n\n\tconstructor(\n\t\tprivate readonly _key: string,\n\t\t@IContextKeyService private readonly _contextKeyService: IContextKeyService,\n\t\t@IDataChannelService private readonly _dataChannelService: IDataChannelService,\n\t) {\n\t\tsuper();\n\t\tthis._isEnabledContextKeyValue = observableContextKey<boolean>('structuredLogger.enabled:' + this._key, this._contextKeyService).recomputeInitiallyAndOnChange(this._store);\n\t\tthis.isEnabled = this._isEnabledContextKeyValue.map(v => v !== undefined);\n\t}\n\n\tpublic log(data: T): boolean {\n\t\tconst enabled = this._isEnabledContextKeyValue.get();\n\t\tif (!enabled) {\n\t\t\treturn false;\n\t\t}\n\t\tthis._dataChannelService.getDataChannel<T>('structuredLogger:' + this._key).sendData(data);\n\t\treturn true;\n\t}\n}\n\nfunction observableContextKey<T>(key: string, contextKeyService: IContextKeyService): IObservable<T | undefined> {\n\treturn observableFromEvent(contextKeyService.onDidChangeContext, () => contextKeyService.getContextKeyValue<T>(key));\n}\n"]}
|
|
@@ -241,7 +241,6 @@ let GhostTextView = class GhostTextView extends Disposable {
|
|
|
241
241
|
color: 'orange',
|
|
242
242
|
},
|
|
243
243
|
ref: (dom) => {
|
|
244
|
-
// eslint-disable-next-line local/code-no-any-casts
|
|
245
244
|
dom.ghostTextViewWarningWidgetData = { range: Range.fromPositions(state.position) };
|
|
246
245
|
}
|
|
247
246
|
}, [
|
|
@@ -262,7 +261,6 @@ let GhostTextView = class GhostTextView extends Disposable {
|
|
|
262
261
|
}));
|
|
263
262
|
}
|
|
264
263
|
static getWarningWidgetContext(domNode) {
|
|
265
|
-
// eslint-disable-next-line local/code-no-any-casts
|
|
266
264
|
const data = domNode.ghostTextViewWarningWidgetData;
|
|
267
265
|
if (data) {
|
|
268
266
|
return data;
|