@vscode/chat-lib 0.2.1-31 → 0.2.1-33
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/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/asyncCompletions.d.ts +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/asyncCompletions.d.ts.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/cacheUtils.d.ts +19 -0
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/cacheUtils.d.ts.map +1 -0
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/cacheUtils.js +12 -0
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/cacheUtils.js.map +1 -0
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/completionsFromNetwork.d.ts +49 -0
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/completionsFromNetwork.d.ts.map +1 -0
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/completionsFromNetwork.js +331 -0
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/completionsFromNetwork.js.map +1 -0
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/copilotCompletion.d.ts +2 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/copilotCompletion.d.ts.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/copilotCompletion.js +2 -2
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/copilotCompletion.js.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/current.d.ts +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/current.d.ts.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/current.js +2 -2
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/current.js.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/ghostText.d.ts +27 -75
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/ghostText.d.ts.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/ghostText.js +366 -830
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/ghostText.js.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/ghostTextStrategy.d.ts +16 -0
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/ghostTextStrategy.d.ts.map +1 -0
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/ghostTextStrategy.js +196 -0
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/ghostTextStrategy.js.map +1 -0
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/last.d.ts +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/last.d.ts.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/last.js +3 -3
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/last.js.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/requestContext.d.ts +37 -0
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/requestContext.d.ts.map +1 -0
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/requestContext.js +7 -0
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/requestContext.js.map +1 -0
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/resultType.d.ts +8 -0
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/resultType.d.ts.map +1 -0
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/resultType.js +16 -0
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/resultType.js.map +1 -0
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/telemetry.d.ts +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/telemetry.d.ts.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/telemetry.js +6 -6
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/telemetry.js.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/inlineCompletion.d.ts.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/inlineCompletion.js +2 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/inlineCompletion.js.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/completionsPromptFactory/componentsCompletionsPromptFactory.d.ts +5 -4
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/completionsPromptFactory/componentsCompletionsPromptFactory.d.ts.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/completionsPromptFactory/componentsCompletionsPromptFactory.js +63 -6
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/completionsPromptFactory/componentsCompletionsPromptFactory.js.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/contextProviderRegistry.d.ts +9 -0
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/contextProviderRegistry.d.ts.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/contextProviderRegistry.js +50 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/contextProviderRegistry.js.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/suggestions/suggestions.d.ts +2 -2
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/suggestions/suggestions.d.ts.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/suggestions/suggestions.js +2 -4
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/suggestions/suggestions.js.map +1 -1
- package/dist/src/_internal/extension/inlineEdits/common/nesTriggerHint.d.ts +16 -0
- package/dist/src/_internal/extension/inlineEdits/common/nesTriggerHint.d.ts.map +1 -0
- package/dist/src/_internal/extension/inlineEdits/common/nesTriggerHint.js +27 -0
- package/dist/src/_internal/extension/inlineEdits/common/nesTriggerHint.js.map +1 -0
- package/dist/src/_internal/extension/inlineEdits/common/userInteractionMonitor.d.ts +8 -1
- package/dist/src/_internal/extension/inlineEdits/common/userInteractionMonitor.d.ts.map +1 -1
- package/dist/src/_internal/extension/inlineEdits/common/userInteractionMonitor.js +10 -4
- package/dist/src/_internal/extension/inlineEdits/common/userInteractionMonitor.js.map +1 -1
- package/dist/src/_internal/extension/inlineEdits/node/nextEditProvider.d.ts +2 -0
- package/dist/src/_internal/extension/inlineEdits/node/nextEditProvider.d.ts.map +1 -1
- package/dist/src/_internal/extension/inlineEdits/node/nextEditProvider.js +1 -0
- package/dist/src/_internal/extension/inlineEdits/node/nextEditProvider.js.map +1 -1
- package/dist/src/_internal/extension/inlineEdits/node/nextEditProviderTelemetry.d.ts.map +1 -1
- package/dist/src/_internal/extension/inlineEdits/node/nextEditProviderTelemetry.js +6 -2
- package/dist/src/_internal/extension/inlineEdits/node/nextEditProviderTelemetry.js.map +1 -1
- package/dist/src/_internal/extension/prompt/node/chatMLFetcher.d.ts +5 -0
- package/dist/src/_internal/extension/prompt/node/chatMLFetcher.d.ts.map +1 -1
- package/dist/src/_internal/extension/prompt/node/chatMLFetcher.js +13 -6
- package/dist/src/_internal/extension/prompt/node/chatMLFetcher.js.map +1 -1
- package/dist/src/_internal/extension/xtab/node/xtabProvider.d.ts +2 -26
- package/dist/src/_internal/extension/xtab/node/xtabProvider.d.ts.map +1 -1
- package/dist/src/_internal/extension/xtab/node/xtabProvider.js +10 -13
- package/dist/src/_internal/extension/xtab/node/xtabProvider.js.map +1 -1
- package/dist/src/_internal/platform/authentication/common/copilotToken.d.ts +0 -4
- package/dist/src/_internal/platform/authentication/common/copilotToken.d.ts.map +1 -1
- package/dist/src/_internal/platform/authentication/common/copilotToken.js +0 -5
- package/dist/src/_internal/platform/authentication/common/copilotToken.js.map +1 -1
- package/dist/src/_internal/platform/configuration/common/configurationService.d.ts +15 -2
- package/dist/src/_internal/platform/configuration/common/configurationService.d.ts.map +1 -1
- package/dist/src/_internal/platform/configuration/common/configurationService.js +10 -5
- package/dist/src/_internal/platform/configuration/common/configurationService.js.map +1 -1
- package/dist/src/_internal/platform/endpoint/node/messagesApi.d.ts.map +1 -1
- package/dist/src/_internal/platform/endpoint/node/messagesApi.js +4 -2
- package/dist/src/_internal/platform/endpoint/node/messagesApi.js.map +1 -1
- package/dist/src/_internal/platform/inlineEdits/common/inlineEditLogContext.d.ts +4 -0
- package/dist/src/_internal/platform/inlineEdits/common/inlineEditLogContext.d.ts.map +1 -1
- package/dist/src/_internal/platform/inlineEdits/common/inlineEditLogContext.js +3 -0
- package/dist/src/_internal/platform/inlineEdits/common/inlineEditLogContext.js.map +1 -1
- package/dist/src/_internal/platform/inlineEdits/common/statelessNextEditProvider.d.ts +6 -1
- package/dist/src/_internal/platform/inlineEdits/common/statelessNextEditProvider.d.ts.map +1 -1
- package/dist/src/_internal/platform/inlineEdits/common/statelessNextEditProvider.js +10 -0
- package/dist/src/_internal/platform/inlineEdits/common/statelessNextEditProvider.js.map +1 -1
- package/dist/src/_internal/platform/networking/common/anthropic.d.ts +8 -8
- package/dist/src/_internal/platform/networking/common/anthropic.d.ts.map +1 -1
- package/dist/src/_internal/platform/networking/common/anthropic.js +33 -20
- package/dist/src/_internal/platform/networking/common/anthropic.js.map +1 -1
- package/dist/src/_internal/platform/networking/common/networking.d.ts +3 -1
- package/dist/src/_internal/platform/networking/common/networking.d.ts.map +1 -1
- package/dist/src/_internal/platform/networking/common/networking.js +4 -4
- package/dist/src/_internal/platform/networking/common/networking.js.map +1 -1
- package/dist/src/_internal/platform/networking/node/stream.js +5 -6
- package/dist/src/_internal/platform/networking/node/stream.js.map +1 -1
- package/dist/src/_internal/util/common/test/shims/chatTypes.d.ts +4 -0
- package/dist/src/_internal/util/common/test/shims/chatTypes.d.ts.map +1 -1
- package/dist/src/_internal/util/common/test/shims/chatTypes.js +8 -2
- package/dist/src/_internal/util/common/test/shims/chatTypes.js.map +1 -1
- package/dist/src/_internal/util/common/test/shims/vscodeTypesShim.d.ts.map +1 -1
- package/dist/src/_internal/util/common/test/shims/vscodeTypesShim.js +1 -0
- package/dist/src/_internal/util/common/test/shims/vscodeTypesShim.js.map +1 -1
- package/dist/src/_internal/vscodeTypes.d.ts +1 -0
- package/dist/src/_internal/vscodeTypes.d.ts.map +1 -1
- package/dist/src/_internal/vscodeTypes.js +3 -2
- package/dist/src/_internal/vscodeTypes.js.map +1 -1
- package/dist/src/main.js +2 -0
- package/dist/src/main.js.map +1 -1
- package/dist/src/package.json +134 -15
- package/package.json +2 -2
package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/ghostText.js
CHANGED
|
@@ -9,26 +9,21 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
9
9
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.ForceMultiLine = exports.
|
|
12
|
+
exports.ForceMultiLine = exports.GhostTextComputer = void 0;
|
|
13
13
|
exports.getGhostText = getGhostText;
|
|
14
|
-
const
|
|
15
|
-
const nullExperimentationService_1 = require("../../../../../../platform/telemetry/common/nullExperimentationService");
|
|
14
|
+
const logService_1 = require("../../../../../../platform/log/common/logService");
|
|
16
15
|
const telemetry_1 = require("../../../../../../platform/telemetry/common/telemetry");
|
|
17
16
|
const crypto_1 = require("../../../../../../util/common/crypto");
|
|
18
17
|
const uuid_1 = require("../../../../../../util/vs/base/common/uuid");
|
|
19
18
|
const instantiation_1 = require("../../../../../../util/vs/platform/instantiation/common/instantiation");
|
|
20
|
-
const parse_1 = require("../../../prompt/src/parse");
|
|
21
19
|
const tokenization_1 = require("../../../prompt/src/tokenization");
|
|
22
20
|
const src_1 = require("../../../types/src");
|
|
23
21
|
const completionNotifier_1 = require("../completionNotifier");
|
|
24
22
|
const config_1 = require("../config");
|
|
25
|
-
const userErrorNotifier_1 = require("../error/userErrorNotifier");
|
|
26
23
|
const featuresService_1 = require("../experiments/featuresService");
|
|
27
24
|
const logger_1 = require("../logger");
|
|
28
25
|
const networking_1 = require("../networking");
|
|
29
26
|
const config_2 = require("../openai/config");
|
|
30
|
-
const fetch_1 = require("../openai/fetch");
|
|
31
|
-
const openai_1 = require("../openai/openai");
|
|
32
27
|
const progress_1 = require("../progress");
|
|
33
28
|
const contextProviderBridge_1 = require("../prompt/components/contextProviderBridge");
|
|
34
29
|
const contextProviderStatistics_1 = require("../prompt/contextProviderStatistics");
|
|
@@ -39,805 +34,421 @@ const suggestions_1 = require("../suggestions/suggestions");
|
|
|
39
34
|
const telemetry_2 = require("../telemetry");
|
|
40
35
|
const textDocument_1 = require("../textDocument");
|
|
41
36
|
const async_1 = require("../util/async");
|
|
42
|
-
const runtimeMode_1 = require("../util/runtimeMode");
|
|
43
37
|
const asyncCompletions_1 = require("./asyncCompletions");
|
|
44
38
|
const blockTrimmer_1 = require("./blockTrimmer");
|
|
45
39
|
const completionsCache_1 = require("./completionsCache");
|
|
46
|
-
const
|
|
40
|
+
const completionsFromNetwork_1 = require("./completionsFromNetwork");
|
|
47
41
|
const current_1 = require("./current");
|
|
48
|
-
const
|
|
49
|
-
const
|
|
42
|
+
const ghostTextStrategy_1 = require("./ghostTextStrategy");
|
|
43
|
+
const resultType_1 = require("./resultType");
|
|
50
44
|
const telemetry_3 = require("./telemetry");
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
45
|
+
const defaultOptions = {
|
|
46
|
+
isCycling: false,
|
|
47
|
+
promptOnly: false,
|
|
48
|
+
isSpeculative: false,
|
|
49
|
+
};
|
|
50
|
+
function getRemainingDebounceMs(accessor, opts, telemetry) {
|
|
51
|
+
const featuresService = accessor.get(featuresService_1.ICompletionsFeaturesService);
|
|
52
|
+
const debounce = (0, config_1.getConfig)(accessor, config_1.ConfigKey.CompletionsDebounce) ??
|
|
53
|
+
featuresService.completionsDebounce(telemetry) ??
|
|
54
|
+
opts.debounceMs;
|
|
55
|
+
if (debounce === undefined) {
|
|
56
|
+
return 0;
|
|
57
|
+
}
|
|
58
|
+
const elapsed = (0, telemetry_2.now)() - telemetry.issuedTime;
|
|
59
|
+
return Math.max(0, debounce - elapsed);
|
|
60
|
+
}
|
|
61
|
+
function isCompletionRequestCancelled(currentGhostText, requestId, cancellationToken) {
|
|
62
|
+
return cancellationToken?.isCancellationRequested || requestId !== currentGhostText.currentRequestId;
|
|
63
|
+
}
|
|
64
|
+
let GhostTextComputer = class GhostTextComputer {
|
|
65
|
+
constructor(instantiationService, telemetryService, notifierService, contextProviderBridge, currentGhostText, contextproviderStatistics, asyncCompletionManager, completionsFeaturesService, logTarget, statusReporter, logService) {
|
|
66
66
|
this.instantiationService = instantiationService;
|
|
67
|
-
this.
|
|
68
|
-
this.
|
|
69
|
-
this.
|
|
67
|
+
this.telemetryService = telemetryService;
|
|
68
|
+
this.notifierService = notifierService;
|
|
69
|
+
this.contextProviderBridge = contextProviderBridge;
|
|
70
|
+
this.currentGhostText = currentGhostText;
|
|
71
|
+
this.contextproviderStatistics = contextproviderStatistics;
|
|
72
|
+
this.asyncCompletionManager = asyncCompletionManager;
|
|
73
|
+
this.completionsFeaturesService = completionsFeaturesService;
|
|
70
74
|
this.logTarget = logTarget;
|
|
71
|
-
this.
|
|
72
|
-
this.
|
|
73
|
-
this.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
if (firstRes.done) {
|
|
85
|
-
ghostTextLogger.debug(this.logTarget, 'All choices redacted');
|
|
86
|
-
return {
|
|
87
|
-
type: 'empty',
|
|
88
|
-
reason: 'all choices redacted',
|
|
89
|
-
telemetryData: (0, telemetry_3.mkBasicResultTelemetry)(baseTelemetryData),
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
if (cancellationToken?.isCancellationRequested) {
|
|
93
|
-
ghostTextLogger.debug(this.logTarget, 'Cancelled after awaiting redactedChoices iterator');
|
|
94
|
-
return {
|
|
95
|
-
type: 'canceled',
|
|
96
|
-
reason: 'after awaiting redactedChoices iterator',
|
|
97
|
-
telemetryData: (0, telemetry_3.mkCanceledResultTelemetry)(baseTelemetryData),
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
const firstChoice = firstRes.value;
|
|
101
|
-
if (firstChoice === undefined) {
|
|
102
|
-
// This is probably unreachable given the firstRes.done check above
|
|
103
|
-
ghostTextLogger.debug(this.logTarget, 'Got undefined choice from redactedChoices iterator');
|
|
104
|
-
return {
|
|
105
|
-
type: 'empty',
|
|
106
|
-
reason: 'got undefined choice from redactedChoices iterator',
|
|
107
|
-
telemetryData: (0, telemetry_3.mkBasicResultTelemetry)(baseTelemetryData),
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
this.instantiationService.invokeFunction(telemetryPerformance, 'performance', firstChoice, requestStart, processingTime);
|
|
111
|
-
ghostTextLogger.debug(this.logTarget, `Awaited first result, id: ${firstChoice.choiceIndex}`);
|
|
112
|
-
// Adds first result to cache
|
|
113
|
-
const processedFirstChoice = postProcessChoices(firstChoice);
|
|
114
|
-
if (processedFirstChoice) {
|
|
115
|
-
appendToCache(this.completionsCacheService, requestContext, processedFirstChoice);
|
|
116
|
-
ghostTextLogger.debug(this.logTarget, `GhostText first completion (index ${processedFirstChoice?.choiceIndex}): ${JSON.stringify(processedFirstChoice?.completionText)}`);
|
|
117
|
-
}
|
|
118
|
-
//Create promise for each result, don't `await` it (unless in test mode) but handle asynchronously with `.then()`
|
|
119
|
-
const cacheDone = (async () => {
|
|
120
|
-
const apiChoices = processedFirstChoice !== undefined ? [processedFirstChoice] : [];
|
|
121
|
-
for await (const choice of choicesStream) {
|
|
122
|
-
if (choice === undefined) {
|
|
123
|
-
continue;
|
|
124
|
-
}
|
|
125
|
-
ghostTextLogger.debug(this.logTarget, `GhostText later completion (index ${choice?.choiceIndex}): ${JSON.stringify(choice.completionText)}`);
|
|
126
|
-
const processedChoice = postProcessChoices(choice, apiChoices);
|
|
127
|
-
if (!processedChoice) {
|
|
128
|
-
continue;
|
|
129
|
-
}
|
|
130
|
-
apiChoices.push(processedChoice);
|
|
131
|
-
appendToCache(this.completionsCacheService, requestContext, processedChoice);
|
|
132
|
-
}
|
|
133
|
-
})();
|
|
134
|
-
if (this.runtimeMode.isRunningInTest()) {
|
|
135
|
-
await cacheDone;
|
|
136
|
-
}
|
|
137
|
-
if (processedFirstChoice) {
|
|
138
|
-
// Because we ask the server to stop at \n above, we don't need to force single line here
|
|
139
|
-
return {
|
|
140
|
-
type: 'success',
|
|
141
|
-
value: [makeGhostAPIChoice(processedFirstChoice, { forceSingleLine: false }), cacheDone],
|
|
142
|
-
telemetryData: (0, telemetry_3.mkBasicResultTelemetry)(baseTelemetryData),
|
|
143
|
-
telemetryBlob: baseTelemetryData,
|
|
144
|
-
resultType: ResultType.Network,
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
else {
|
|
148
|
-
return {
|
|
149
|
-
type: 'empty',
|
|
150
|
-
reason: 'got undefined processedFirstChoice',
|
|
151
|
-
telemetryData: (0, telemetry_3.mkBasicResultTelemetry)(baseTelemetryData),
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
/** Requests new completion from OpenAI, should be called if and only if we are in the servers-side termination mode, and it's follow-up cycling request
|
|
157
|
-
* It returns all requested completions
|
|
158
|
-
* Copies from the base telemetry data are used as the basis for each choice's telemetry.
|
|
159
|
-
*/
|
|
160
|
-
async getAllCompletionsFromNetwork(requestContext, baseTelemetryData, cancellationToken, finishedCb) {
|
|
161
|
-
return this.genericGetCompletionsFromNetwork(requestContext, baseTelemetryData, cancellationToken, finishedCb, 'all completions', async (requestStart, processingTime, choicesStream) => {
|
|
162
|
-
const apiChoices = [];
|
|
163
|
-
for await (const choice of choicesStream) {
|
|
164
|
-
if (cancellationToken?.isCancellationRequested) {
|
|
165
|
-
ghostTextLogger.debug(this.logTarget, 'Cancelled after awaiting choices iterator');
|
|
166
|
-
return {
|
|
167
|
-
type: 'canceled',
|
|
168
|
-
reason: 'after awaiting choices iterator',
|
|
169
|
-
telemetryData: (0, telemetry_3.mkCanceledResultTelemetry)(baseTelemetryData),
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
const processedChoice = postProcessChoices(choice, apiChoices);
|
|
173
|
-
if (!processedChoice) {
|
|
174
|
-
continue;
|
|
175
|
-
}
|
|
176
|
-
apiChoices.push(processedChoice);
|
|
177
|
-
}
|
|
178
|
-
//Append results to current completions cache, and network cache
|
|
179
|
-
if (apiChoices.length > 0) {
|
|
180
|
-
for (const choice of apiChoices) {
|
|
181
|
-
appendToCache(this.completionsCacheService, requestContext, choice);
|
|
182
|
-
}
|
|
183
|
-
this.instantiationService.invokeFunction(telemetryPerformance, 'cyclingPerformance', apiChoices[0], requestStart, processingTime);
|
|
184
|
-
}
|
|
185
|
-
return {
|
|
186
|
-
type: 'success',
|
|
187
|
-
value: [apiChoices, Promise.resolve()],
|
|
188
|
-
telemetryData: (0, telemetry_3.mkBasicResultTelemetry)(baseTelemetryData),
|
|
189
|
-
telemetryBlob: baseTelemetryData,
|
|
190
|
-
resultType: ResultType.Cycling,
|
|
191
|
-
};
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
async genericGetCompletionsFromNetwork(requestContext, baseTelemetryData, cancellationToken, finishedCb, what, processChoices) {
|
|
195
|
-
ghostTextLogger.debug(this.logTarget, `Getting ${what} from network`);
|
|
196
|
-
// copy the base telemetry data
|
|
197
|
-
baseTelemetryData = baseTelemetryData.extendedBy();
|
|
198
|
-
// Request one choice for automatic requests, three for invoked (cycling) requests.
|
|
199
|
-
const n = requestContext.isCycling ? 3 : 1;
|
|
200
|
-
const temperature = (0, openai_1.getTemperatureForSamples)(this.runtimeMode, n);
|
|
201
|
-
const extra = {
|
|
202
|
-
language: requestContext.languageId,
|
|
203
|
-
next_indent: requestContext.indentation.next ?? 0,
|
|
204
|
-
trim_by_indentation: (0, config_1.shouldDoServerTrimming)(requestContext.blockMode),
|
|
205
|
-
prompt_tokens: requestContext.prompt.prefixTokens ?? 0,
|
|
206
|
-
suffix_tokens: requestContext.prompt.suffixTokens ?? 0,
|
|
207
|
-
};
|
|
208
|
-
const postOptions = { n, temperature, code_annotations: false };
|
|
209
|
-
const modelTerminatesSingleline = this.featuresService.modelAlwaysTerminatesSingleline(baseTelemetryData);
|
|
210
|
-
const simulateSingleline = requestContext.blockMode === config_1.BlockMode.MoreMultiline &&
|
|
211
|
-
blockTrimmer_1.BlockTrimmer.isSupported(requestContext.languageId) &&
|
|
212
|
-
!modelTerminatesSingleline;
|
|
213
|
-
if (!requestContext.multiline && !simulateSingleline) {
|
|
214
|
-
// If we are not in multiline mode, we get the server to truncate the results. This does mean that we
|
|
215
|
-
// also cache a single line result which will be reused even if we are later in multiline mode. This is
|
|
216
|
-
// an acceptable trade-off as the transition should be relatively rare and truncating on the server is
|
|
217
|
-
// more efficient.
|
|
218
|
-
// Note that this also means we don't need to truncate when creating the GhostAPIChoice object below.
|
|
219
|
-
postOptions['stop'] = ['\n'];
|
|
220
|
-
}
|
|
221
|
-
else if (requestContext.stop) {
|
|
222
|
-
postOptions['stop'] = requestContext.stop;
|
|
223
|
-
}
|
|
224
|
-
if (requestContext.maxTokens !== undefined) {
|
|
225
|
-
postOptions['max_tokens'] = requestContext.maxTokens;
|
|
226
|
-
}
|
|
227
|
-
const requestStart = Date.now();
|
|
228
|
-
// extend telemetry data
|
|
229
|
-
const newProperties = {
|
|
230
|
-
endpoint: 'completions',
|
|
231
|
-
uiKind: fetch_1.CopilotUiKind.GhostText,
|
|
232
|
-
temperature: JSON.stringify(temperature),
|
|
233
|
-
n: JSON.stringify(n),
|
|
234
|
-
stop: JSON.stringify(postOptions['stop']) ?? 'unset',
|
|
235
|
-
logit_bias: JSON.stringify(null),
|
|
236
|
-
};
|
|
237
|
-
Object.assign(baseTelemetryData.properties, newProperties);
|
|
75
|
+
this.statusReporter = statusReporter;
|
|
76
|
+
this.logService = logService;
|
|
77
|
+
this.logger = logService.createSubLogger(['ghostText', 'GhostTextComputer']);
|
|
78
|
+
}
|
|
79
|
+
async getGhostText(completionState, token, options) {
|
|
80
|
+
const id = (0, uuid_1.generateUuid)();
|
|
81
|
+
this.currentGhostText.currentRequestId = id;
|
|
82
|
+
const telemetryData = await this.instantiationService.invokeFunction(createTelemetryWithExp, completionState.textDocument, id, options);
|
|
83
|
+
// A CLS consumer has an LSP bug where it erroneously makes method requests before `initialize` has returned, which
|
|
84
|
+
// means we can't use `initialize` to actually initialize anything expensive. This the primary user of the
|
|
85
|
+
// tokenizer, so settle for initializing here instead. We don't use waitForTokenizers() because in the event of a
|
|
86
|
+
// tokenizer load failure, that would spam handleException() on every request.
|
|
87
|
+
await tokenization_1.initializeTokenizers.catch(() => { });
|
|
238
88
|
try {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
reason: res.reason,
|
|
266
|
-
telemetryData: (0, telemetry_3.mkCanceledResultTelemetry)(baseTelemetryData),
|
|
267
|
-
};
|
|
89
|
+
this.contextProviderBridge.schedule(completionState, id, options?.opportunityId ?? '', telemetryData, token, options);
|
|
90
|
+
this.notifierService.notifyRequest(completionState, id, telemetryData, token, options);
|
|
91
|
+
const result = await this.getGhostTextWithoutAbortHandling(completionState, id, telemetryData, token, options);
|
|
92
|
+
const statistics = this.contextproviderStatistics.getStatisticsForCompletion(id);
|
|
93
|
+
const opportunityId = options?.opportunityId ?? 'unknown';
|
|
94
|
+
for (const [providerId, statistic] of statistics.getAllUsageStatistics()) {
|
|
95
|
+
/* __GDPR__
|
|
96
|
+
"context-provider.completion-stats" : {
|
|
97
|
+
"owner": "dirkb",
|
|
98
|
+
"comment": "Telemetry for copilot inline completion context",
|
|
99
|
+
"requestId": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "The request correlation id" },
|
|
100
|
+
"opportunityId": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "The opportunity id" },
|
|
101
|
+
"providerId": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "The context provider id" },
|
|
102
|
+
"resolution": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "The resolution of the context" },
|
|
103
|
+
"usage": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "How the context was used" },
|
|
104
|
+
"usageDetails": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Additional details about the usage as a JSON string" }
|
|
105
|
+
}
|
|
106
|
+
*/
|
|
107
|
+
this.telemetryService.sendMSFTTelemetryEvent('context-provider.completion-stats', {
|
|
108
|
+
requestId: id,
|
|
109
|
+
opportunityId,
|
|
110
|
+
providerId,
|
|
111
|
+
resolution: statistic.resolution,
|
|
112
|
+
usage: statistic.usage,
|
|
113
|
+
usageDetails: JSON.stringify(statistic.usageDetails),
|
|
114
|
+
}, {});
|
|
268
115
|
}
|
|
269
|
-
return
|
|
116
|
+
return result;
|
|
270
117
|
}
|
|
271
|
-
catch (
|
|
272
|
-
//
|
|
273
|
-
|
|
118
|
+
catch (e) {
|
|
119
|
+
// The cancellation token may be called after the request is done but while we still process data.
|
|
120
|
+
// The underlying implementation catches abort errors for specific scenarios but we still have uncovered paths.
|
|
121
|
+
// To avoid returning an error to the editor, this acts as an fault barrier here.
|
|
122
|
+
if ((0, networking_1.isAbortError)(e)) {
|
|
274
123
|
return {
|
|
275
124
|
type: 'canceled',
|
|
276
|
-
reason: '
|
|
277
|
-
telemetryData: (0, telemetry_3.mkCanceledResultTelemetry)(
|
|
125
|
+
reason: 'aborted at unknown location',
|
|
126
|
+
telemetryData: (0, telemetry_3.mkCanceledResultTelemetry)(telemetryData, {
|
|
278
127
|
cancelledNetworkRequest: true,
|
|
279
128
|
}),
|
|
280
129
|
};
|
|
281
130
|
}
|
|
282
|
-
|
|
283
|
-
this.instantiationService.invokeFunction(acc => ghostTextLogger.exception(acc, err, `Error on ghost text request`));
|
|
284
|
-
this.userErrorNotifier.notifyUser(err);
|
|
285
|
-
if (this.runtimeMode.shouldFailForDebugPurposes()) {
|
|
286
|
-
throw err;
|
|
287
|
-
}
|
|
288
|
-
// not including err in this result because it'll end up in standard telemetry
|
|
289
|
-
return {
|
|
290
|
-
type: 'failed',
|
|
291
|
-
reason: 'non-abort error on ghost text request',
|
|
292
|
-
telemetryData: (0, telemetry_3.mkBasicResultTelemetry)(baseTelemetryData),
|
|
293
|
-
};
|
|
294
|
-
}
|
|
131
|
+
throw e;
|
|
295
132
|
}
|
|
296
133
|
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
__param(5, completionsCache_1.ICompletionsCacheService),
|
|
306
|
-
__param(6, userErrorNotifier_1.ICompletionsUserErrorNotifierService),
|
|
307
|
-
__param(7, configurationService_1.IConfigurationService),
|
|
308
|
-
__param(8, nullExperimentationService_1.IExperimentationService)
|
|
309
|
-
], CompletionsFromNetwork);
|
|
310
|
-
/**
|
|
311
|
-
* Post-proceses a completion choice based on the current request context and existing choices.
|
|
312
|
-
*/
|
|
313
|
-
function postProcessChoices(newChoice, currentChoices) {
|
|
314
|
-
if (!currentChoices) {
|
|
315
|
-
currentChoices = [];
|
|
316
|
-
}
|
|
317
|
-
newChoice.completionText = newChoice.completionText.trimEnd();
|
|
318
|
-
if (!newChoice.completionText) {
|
|
319
|
-
return undefined;
|
|
320
|
-
}
|
|
321
|
-
// Collect only unique displayTexts
|
|
322
|
-
if (currentChoices.findIndex(v => v.completionText.trim() === newChoice.completionText.trim()) !== -1) {
|
|
323
|
-
return undefined;
|
|
324
|
-
}
|
|
325
|
-
return newChoice;
|
|
326
|
-
}
|
|
327
|
-
function makeGhostAPIChoice(choice, options) {
|
|
328
|
-
const ghostChoice = { ...choice };
|
|
329
|
-
if (options.forceSingleLine) {
|
|
330
|
-
const { completionText } = ghostChoice;
|
|
331
|
-
// Special case for when completion starts with a newline, don't count that as its own line
|
|
332
|
-
const initialLineBreak = completionText.match(/^\r?\n/);
|
|
333
|
-
if (initialLineBreak) {
|
|
334
|
-
ghostChoice.completionText = initialLineBreak[0] + completionText.split('\n')[1];
|
|
134
|
+
async getGhostTextWithoutAbortHandling(completionState, ourRequestId, preIssuedTelemetryDataWithExp, cancellationToken, options) {
|
|
135
|
+
let start = preIssuedTelemetryDataWithExp.issuedTime; // Start before getting exp assignments
|
|
136
|
+
const performanceMetrics = [];
|
|
137
|
+
/** Internal helper to record performance measurements. Mutates performanceMetrics and start. */
|
|
138
|
+
function recordPerformance(name) {
|
|
139
|
+
const next = (0, telemetry_2.now)();
|
|
140
|
+
performanceMetrics.push([name, next - start]);
|
|
141
|
+
start = next;
|
|
335
142
|
}
|
|
336
|
-
|
|
337
|
-
|
|
143
|
+
recordPerformance('telemetry');
|
|
144
|
+
if (isCompletionRequestCancelled(this.currentGhostText, ourRequestId, cancellationToken)) {
|
|
145
|
+
return {
|
|
146
|
+
type: 'abortedBeforeIssued',
|
|
147
|
+
reason: 'cancelled before extractPrompt',
|
|
148
|
+
telemetryData: (0, telemetry_3.mkBasicResultTelemetry)(preIssuedTelemetryDataWithExp),
|
|
149
|
+
};
|
|
338
150
|
}
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
if (lines.length > n + 1) {
|
|
348
|
-
return lines.slice(0, n + 1).join('\n').length;
|
|
151
|
+
const inlineSuggestion = isInlineSuggestion(completionState.textDocument, completionState.position);
|
|
152
|
+
if (inlineSuggestion === undefined) {
|
|
153
|
+
this.logger.debug('Breaking, invalid middle of the line');
|
|
154
|
+
return {
|
|
155
|
+
type: 'abortedBeforeIssued',
|
|
156
|
+
reason: 'Invalid middle of the line',
|
|
157
|
+
telemetryData: (0, telemetry_3.mkBasicResultTelemetry)(preIssuedTelemetryDataWithExp),
|
|
158
|
+
};
|
|
349
159
|
}
|
|
350
|
-
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
const multilineAfterAcceptLines = featuresService.multilineAfterAcceptLines(preIssuedTelemetryData);
|
|
357
|
-
const blockMode = blockModeConfig.forLanguage(completionState.textDocument.detectedLanguageId, preIssuedTelemetryData);
|
|
358
|
-
switch (blockMode) {
|
|
359
|
-
case config_1.BlockMode.Server:
|
|
360
|
-
// Override the server-side trimming after accepting a completion
|
|
361
|
-
if (hasAcceptedCurrentCompletion) {
|
|
362
|
-
return {
|
|
363
|
-
blockMode: config_1.BlockMode.Parsing,
|
|
364
|
-
requestMultiline: true,
|
|
365
|
-
finishedCb: takeNLines(multilineAfterAcceptLines),
|
|
366
|
-
stop: ['\n\n'],
|
|
367
|
-
maxTokens: maxSinglelineTokens * multilineAfterAcceptLines,
|
|
368
|
-
};
|
|
369
|
-
}
|
|
160
|
+
const engineInfo = this.instantiationService.invokeFunction(config_2.getEngineRequestInfo, preIssuedTelemetryDataWithExp);
|
|
161
|
+
const ghostTextOptions = { ...defaultOptions, ...options, tokenizer: engineInfo.tokenizer };
|
|
162
|
+
const prompt = await this.instantiationService.invokeFunction(prompt_1.extractPrompt, ourRequestId, completionState, preIssuedTelemetryDataWithExp, undefined, ghostTextOptions);
|
|
163
|
+
recordPerformance('prompt');
|
|
164
|
+
if (prompt.type === 'copilotContentExclusion') {
|
|
165
|
+
this.logger.debug('Copilot not available, due to content exclusion');
|
|
370
166
|
return {
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
167
|
+
type: 'abortedBeforeIssued',
|
|
168
|
+
reason: 'Copilot not available due to content exclusion',
|
|
169
|
+
telemetryData: (0, telemetry_3.mkBasicResultTelemetry)(preIssuedTelemetryDataWithExp),
|
|
374
170
|
};
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
default: {
|
|
379
|
-
// we shouldn't drop through to here, but in case we do, be explicit about the behaviour
|
|
380
|
-
let requestMultiline;
|
|
381
|
-
try {
|
|
382
|
-
requestMultiline = await instantiationService.invokeFunction(shouldRequestMultiline, blockMode, completionState.textDocument, completionState.position, inlineSuggestion, hasAcceptedCurrentCompletion, prompt);
|
|
383
|
-
}
|
|
384
|
-
catch (err) {
|
|
385
|
-
// Fallback to non-multiline
|
|
386
|
-
requestMultiline = { requestMultiline: false };
|
|
387
|
-
}
|
|
388
|
-
if (!hasAcceptedCurrentCompletion &&
|
|
389
|
-
requestMultiline.requestMultiline &&
|
|
390
|
-
featuresService.singleLineUnlessAccepted(preIssuedTelemetryData)) {
|
|
391
|
-
requestMultiline.requestMultiline = false;
|
|
392
|
-
}
|
|
393
|
-
if (requestMultiline.requestMultiline) {
|
|
394
|
-
// Note that `trailingWs` contains *any* trailing whitespace from the prompt, but the prompt itself
|
|
395
|
-
// is only trimmed if the entire last line is whitespace. We have to account for that here when we
|
|
396
|
-
// check whether the block body is finished.
|
|
397
|
-
let adjustedPosition;
|
|
398
|
-
if (prompt.trailingWs.length > 0 && !prompt.prompt.prefix.endsWith(prompt.trailingWs)) {
|
|
399
|
-
// Prompt was adjusted, so adjust the position to match
|
|
400
|
-
adjustedPosition = textDocument_1.LocationFactory.position(completionState.position.line, Math.max(completionState.position.character - prompt.trailingWs.length, 0));
|
|
401
|
-
}
|
|
402
|
-
else {
|
|
403
|
-
// Otherwise, just use the original position
|
|
404
|
-
adjustedPosition = completionState.position;
|
|
405
|
-
}
|
|
406
|
-
return {
|
|
407
|
-
blockMode: blockMode,
|
|
408
|
-
requestMultiline: true,
|
|
409
|
-
...instantiationService.invokeFunction(buildFinishedCallback, blockMode, completionState.textDocument, adjustedPosition, requestMultiline.blockPosition, prefix, true, prompt.prompt, preIssuedTelemetryData),
|
|
410
|
-
};
|
|
411
|
-
}
|
|
412
|
-
// Override single-line to multiline after accepting a completion
|
|
413
|
-
if (hasAcceptedCurrentCompletion) {
|
|
414
|
-
const result = {
|
|
415
|
-
blockMode: config_1.BlockMode.Parsing,
|
|
416
|
-
requestMultiline: true,
|
|
417
|
-
finishedCb: takeNLines(multilineAfterAcceptLines),
|
|
418
|
-
stop: ['\n\n'],
|
|
419
|
-
maxTokens: maxSinglelineTokens * multilineAfterAcceptLines,
|
|
420
|
-
};
|
|
421
|
-
if (blockMode === config_1.BlockMode.MoreMultiline) {
|
|
422
|
-
result.blockMode = config_1.BlockMode.MoreMultiline;
|
|
423
|
-
}
|
|
424
|
-
return result;
|
|
425
|
-
}
|
|
426
|
-
// not multiline
|
|
171
|
+
}
|
|
172
|
+
if (prompt.type === 'contextTooShort') {
|
|
173
|
+
this.logger.debug('Breaking, not enough context');
|
|
427
174
|
return {
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
175
|
+
type: 'abortedBeforeIssued',
|
|
176
|
+
reason: 'Not enough context',
|
|
177
|
+
telemetryData: (0, telemetry_3.mkBasicResultTelemetry)(preIssuedTelemetryDataWithExp),
|
|
431
178
|
};
|
|
432
179
|
}
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
const lookAhead = positionType === blockTrimmer_1.BlockPositionType.EmptyBlock || positionType === blockTrimmer_1.BlockPositionType.BlockEnd
|
|
440
|
-
? featuresService.longLookaheadSize(telemetryData)
|
|
441
|
-
: featuresService.shortLookaheadSize(telemetryData);
|
|
442
|
-
const completionsCacheService = accessor.get(completionsCache_1.ICompletionsCacheService);
|
|
443
|
-
const finishedCb = instantiationService.createInstance(streamedCompletionSplitter_1.StreamedCompletionSplitter, prefix, document.detectedLanguageId, false, lookAhead, (extraPrefix, item) => {
|
|
444
|
-
const cacheContext = {
|
|
445
|
-
prefix: prefix + extraPrefix,
|
|
446
|
-
prompt: { ...prompt, prefix: prompt.prefix + extraPrefix },
|
|
180
|
+
if (prompt.type === 'promptError') {
|
|
181
|
+
this.logger.debug('Error while building the prompt');
|
|
182
|
+
return {
|
|
183
|
+
type: 'abortedBeforeIssued',
|
|
184
|
+
reason: 'Error while building the prompt',
|
|
185
|
+
telemetryData: (0, telemetry_3.mkBasicResultTelemetry)(preIssuedTelemetryDataWithExp),
|
|
447
186
|
};
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
}
|
|
455
|
-
return { finishedCb: multiline ? (0, parseBlock_1.parsingBlockFinished)(document, position) : _ => undefined };
|
|
456
|
-
}
|
|
457
|
-
const defaultOptions = {
|
|
458
|
-
isCycling: false,
|
|
459
|
-
promptOnly: false,
|
|
460
|
-
isSpeculative: false,
|
|
461
|
-
};
|
|
462
|
-
function getRemainingDebounceMs(accessor, opts, telemetry) {
|
|
463
|
-
const featuresService = accessor.get(featuresService_1.ICompletionsFeaturesService);
|
|
464
|
-
const debounce = (0, config_1.getConfig)(accessor, config_1.ConfigKey.CompletionsDebounce) ??
|
|
465
|
-
featuresService.completionsDebounce(telemetry) ??
|
|
466
|
-
opts.debounceMs;
|
|
467
|
-
if (debounce === undefined) {
|
|
468
|
-
return 0;
|
|
469
|
-
}
|
|
470
|
-
const elapsed = (0, telemetry_2.now)() - telemetry.issuedTime;
|
|
471
|
-
return Math.max(0, debounce - elapsed);
|
|
472
|
-
}
|
|
473
|
-
function isCompletionRequestCancelled(currentGhostText, requestId, cancellationToken) {
|
|
474
|
-
return cancellationToken?.isCancellationRequested || requestId !== currentGhostText.currentRequestId;
|
|
475
|
-
}
|
|
476
|
-
async function getGhostTextWithoutAbortHandling(accessor, completionState, ourRequestId, preIssuedTelemetryDataWithExp, cancellationToken, options) {
|
|
477
|
-
let start = preIssuedTelemetryDataWithExp.issuedTime; // Start before getting exp assignments
|
|
478
|
-
const performanceMetrics = [];
|
|
479
|
-
/** Internal helper to record performance measurements. Mutates performanceMetrics and start. */
|
|
480
|
-
function recordPerformance(name) {
|
|
481
|
-
const next = (0, telemetry_2.now)();
|
|
482
|
-
performanceMetrics.push([name, next - start]);
|
|
483
|
-
start = next;
|
|
484
|
-
}
|
|
485
|
-
recordPerformance('telemetry');
|
|
486
|
-
const instantiationService = accessor.get(instantiation_1.IInstantiationService);
|
|
487
|
-
const featuresService = accessor.get(featuresService_1.ICompletionsFeaturesService);
|
|
488
|
-
const asyncCompletionManager = accessor.get(asyncCompletions_1.ICompletionsAsyncManagerService);
|
|
489
|
-
const logTarget = accessor.get(logger_1.ICompletionsLogTargetService);
|
|
490
|
-
const currentGhostText = accessor.get(current_1.ICompletionsCurrentGhostText);
|
|
491
|
-
const statusReporter = accessor.get(progress_1.ICompletionsStatusReporter);
|
|
492
|
-
if (isCompletionRequestCancelled(currentGhostText, ourRequestId, cancellationToken)) {
|
|
493
|
-
return {
|
|
494
|
-
type: 'abortedBeforeIssued',
|
|
495
|
-
reason: 'cancelled before extractPrompt',
|
|
496
|
-
telemetryData: (0, telemetry_3.mkBasicResultTelemetry)(preIssuedTelemetryDataWithExp),
|
|
497
|
-
};
|
|
498
|
-
}
|
|
499
|
-
const inlineSuggestion = isInlineSuggestion(completionState.textDocument, completionState.position);
|
|
500
|
-
if (inlineSuggestion === undefined) {
|
|
501
|
-
ghostTextLogger.debug(logTarget, 'Breaking, invalid middle of the line');
|
|
502
|
-
return {
|
|
503
|
-
type: 'abortedBeforeIssued',
|
|
504
|
-
reason: 'Invalid middle of the line',
|
|
505
|
-
telemetryData: (0, telemetry_3.mkBasicResultTelemetry)(preIssuedTelemetryDataWithExp),
|
|
506
|
-
};
|
|
507
|
-
}
|
|
508
|
-
const engineInfo = instantiationService.invokeFunction(config_2.getEngineRequestInfo, preIssuedTelemetryDataWithExp);
|
|
509
|
-
const ghostTextOptions = { ...defaultOptions, ...options, tokenizer: engineInfo.tokenizer };
|
|
510
|
-
const prompt = await instantiationService.invokeFunction(prompt_1.extractPrompt, ourRequestId, completionState, preIssuedTelemetryDataWithExp, undefined, ghostTextOptions);
|
|
511
|
-
recordPerformance('prompt');
|
|
512
|
-
if (prompt.type === 'copilotContentExclusion') {
|
|
513
|
-
ghostTextLogger.debug(logTarget, 'Copilot not available, due to content exclusion');
|
|
514
|
-
return {
|
|
515
|
-
type: 'abortedBeforeIssued',
|
|
516
|
-
reason: 'Copilot not available due to content exclusion',
|
|
517
|
-
telemetryData: (0, telemetry_3.mkBasicResultTelemetry)(preIssuedTelemetryDataWithExp),
|
|
518
|
-
};
|
|
519
|
-
}
|
|
520
|
-
if (prompt.type === 'contextTooShort') {
|
|
521
|
-
ghostTextLogger.debug(logTarget, 'Breaking, not enough context');
|
|
522
|
-
return {
|
|
523
|
-
type: 'abortedBeforeIssued',
|
|
524
|
-
reason: 'Not enough context',
|
|
525
|
-
telemetryData: (0, telemetry_3.mkBasicResultTelemetry)(preIssuedTelemetryDataWithExp),
|
|
526
|
-
};
|
|
527
|
-
}
|
|
528
|
-
if (prompt.type === 'promptError') {
|
|
529
|
-
ghostTextLogger.debug(logTarget, 'Error while building the prompt');
|
|
530
|
-
return {
|
|
531
|
-
type: 'abortedBeforeIssued',
|
|
532
|
-
reason: 'Error while building the prompt',
|
|
533
|
-
telemetryData: (0, telemetry_3.mkBasicResultTelemetry)(preIssuedTelemetryDataWithExp),
|
|
534
|
-
};
|
|
535
|
-
}
|
|
536
|
-
if (ghostTextOptions.promptOnly) {
|
|
537
|
-
return { type: 'promptOnly', reason: 'Breaking, promptOnly set to true', prompt: prompt };
|
|
538
|
-
}
|
|
539
|
-
if (prompt.type === 'promptCancelled') {
|
|
540
|
-
ghostTextLogger.debug(logTarget, 'Cancelled during extractPrompt');
|
|
541
|
-
return {
|
|
542
|
-
type: 'abortedBeforeIssued',
|
|
543
|
-
reason: 'Cancelled during extractPrompt',
|
|
544
|
-
telemetryData: (0, telemetry_3.mkBasicResultTelemetry)(preIssuedTelemetryDataWithExp),
|
|
545
|
-
};
|
|
546
|
-
}
|
|
547
|
-
if (prompt.type === 'promptTimeout') {
|
|
548
|
-
ghostTextLogger.debug(logTarget, 'Timeout during extractPrompt');
|
|
549
|
-
return {
|
|
550
|
-
type: 'abortedBeforeIssued',
|
|
551
|
-
reason: 'Timeout',
|
|
552
|
-
telemetryData: (0, telemetry_3.mkBasicResultTelemetry)(preIssuedTelemetryDataWithExp),
|
|
553
|
-
};
|
|
554
|
-
}
|
|
555
|
-
if (prompt.prompt.prefix.length === 0 && prompt.prompt.suffix.length === 0) {
|
|
556
|
-
ghostTextLogger.debug(logTarget, 'Error empty prompt');
|
|
557
|
-
return {
|
|
558
|
-
type: 'abortedBeforeIssued',
|
|
559
|
-
reason: 'Empty prompt',
|
|
560
|
-
telemetryData: (0, telemetry_3.mkBasicResultTelemetry)(preIssuedTelemetryDataWithExp),
|
|
561
|
-
};
|
|
562
|
-
}
|
|
563
|
-
const debounce = instantiationService.invokeFunction(getRemainingDebounceMs, ghostTextOptions, preIssuedTelemetryDataWithExp);
|
|
564
|
-
if (debounce > 0) {
|
|
565
|
-
ghostTextLogger.debug(logTarget, `Debouncing ghost text request for ${debounce}ms`);
|
|
566
|
-
await (0, async_1.delay)(debounce);
|
|
567
|
-
if (isCompletionRequestCancelled(currentGhostText, ourRequestId, cancellationToken)) {
|
|
187
|
+
}
|
|
188
|
+
if (ghostTextOptions.promptOnly) {
|
|
189
|
+
return { type: 'promptOnly', reason: 'Breaking, promptOnly set to true', prompt: prompt };
|
|
190
|
+
}
|
|
191
|
+
if (prompt.type === 'promptCancelled') {
|
|
192
|
+
this.logger.debug('Cancelled during extractPrompt');
|
|
568
193
|
return {
|
|
569
194
|
type: 'abortedBeforeIssued',
|
|
570
|
-
reason: '
|
|
195
|
+
reason: 'Cancelled during extractPrompt',
|
|
571
196
|
telemetryData: (0, telemetry_3.mkBasicResultTelemetry)(preIssuedTelemetryDataWithExp),
|
|
572
197
|
};
|
|
573
198
|
}
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
headers: engineInfo.headers,
|
|
596
|
-
stop: ghostTextStrategy.stop,
|
|
597
|
-
maxTokens: ghostTextStrategy.maxTokens,
|
|
598
|
-
afterAccept: hasAcceptedCurrentCompletion,
|
|
599
|
-
};
|
|
600
|
-
// Add headers to identify async completions and speculative requests
|
|
601
|
-
requestContext.headers = {
|
|
602
|
-
...requestContext.headers,
|
|
603
|
-
'X-Copilot-Async': 'true',
|
|
604
|
-
'X-Copilot-Speculative': ghostTextOptions.isSpeculative ? 'true' : 'false',
|
|
605
|
-
};
|
|
606
|
-
// this will be used as basis for the choice telemetry data
|
|
607
|
-
const telemetryData = instantiationService.invokeFunction(telemetryIssued, completionState.textDocument, requestContext, completionState.position, prompt, preIssuedTelemetryDataWithExp, engineInfo, ghostTextOptions);
|
|
608
|
-
// Wait before requesting more completions if there is a candidate
|
|
609
|
-
// completion request in flight. Does not wait for cycling requests or
|
|
610
|
-
// if there is a cached completion.
|
|
611
|
-
if (choices === undefined &&
|
|
612
|
-
!ghostTextOptions.isCycling &&
|
|
613
|
-
asyncCompletionManager.shouldWaitForAsyncCompletions(prefix, prompt.prompt)) {
|
|
614
|
-
const choice = await asyncCompletionManager.getFirstMatchingRequestWithTimeout(ourRequestId, prefix, prompt.prompt, ghostTextOptions.isSpeculative, telemetryData);
|
|
615
|
-
recordPerformance('asyncWait');
|
|
616
|
-
if (choice) {
|
|
617
|
-
const forceSingleLine = !ghostTextStrategy.requestMultiline;
|
|
618
|
-
const trimmedChoice = makeGhostAPIChoice(choice[0], { forceSingleLine });
|
|
619
|
-
choices = [[trimmedChoice], ResultType.Async];
|
|
620
|
-
}
|
|
621
|
-
if (isCompletionRequestCancelled(currentGhostText, ourRequestId, cancellationToken)) {
|
|
622
|
-
ghostTextLogger.debug(logTarget, 'Cancelled before requesting a new completion');
|
|
199
|
+
if (prompt.type === 'promptTimeout') {
|
|
200
|
+
this.logger.debug('Timeout during extractPrompt');
|
|
201
|
+
return {
|
|
202
|
+
type: 'abortedBeforeIssued',
|
|
203
|
+
reason: 'Timeout',
|
|
204
|
+
telemetryData: (0, telemetry_3.mkBasicResultTelemetry)(preIssuedTelemetryDataWithExp),
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
if (prompt.prompt.prefix.length === 0 && prompt.prompt.suffix.length === 0) {
|
|
208
|
+
this.logger.debug('Error empty prompt');
|
|
209
|
+
return {
|
|
210
|
+
type: 'abortedBeforeIssued',
|
|
211
|
+
reason: 'Empty prompt',
|
|
212
|
+
telemetryData: (0, telemetry_3.mkBasicResultTelemetry)(preIssuedTelemetryDataWithExp),
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
const debounce = this.instantiationService.invokeFunction(getRemainingDebounceMs, ghostTextOptions, preIssuedTelemetryDataWithExp);
|
|
216
|
+
if (debounce > 0) {
|
|
217
|
+
this.logger.debug(`Debouncing ghost text request for ${debounce}ms`);
|
|
218
|
+
await (0, async_1.delay)(debounce);
|
|
219
|
+
if (isCompletionRequestCancelled(this.currentGhostText, ourRequestId, cancellationToken)) {
|
|
623
220
|
return {
|
|
624
221
|
type: 'abortedBeforeIssued',
|
|
625
|
-
reason: '
|
|
626
|
-
telemetryData: (0, telemetry_3.mkBasicResultTelemetry)(
|
|
222
|
+
reason: 'cancelled after debounce',
|
|
223
|
+
telemetryData: (0, telemetry_3.mkBasicResultTelemetry)(preIssuedTelemetryDataWithExp),
|
|
627
224
|
};
|
|
628
225
|
}
|
|
629
226
|
}
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
227
|
+
return this.statusReporter.withProgress(async () => {
|
|
228
|
+
const [prefix] = (0, prompt_1.trimLastLine)(completionState.textDocument.getText(textDocument_1.LocationFactory.range(textDocument_1.LocationFactory.position(0, 0), completionState.position)));
|
|
229
|
+
const hasAcceptedCurrentCompletion = this.currentGhostText.hasAcceptedCurrentCompletion(prefix, prompt.prompt.suffix);
|
|
230
|
+
const originalPrompt = prompt.prompt;
|
|
231
|
+
const ghostTextStrategy = await this.instantiationService.invokeFunction(ghostTextStrategy_1.getGhostTextStrategy, completionState, prefix, prompt, inlineSuggestion, hasAcceptedCurrentCompletion, preIssuedTelemetryDataWithExp);
|
|
232
|
+
recordPerformance('strategy');
|
|
233
|
+
let choices = this.instantiationService.invokeFunction(getLocalInlineSuggestion, prefix, originalPrompt, ghostTextStrategy.requestMultiline);
|
|
234
|
+
recordPerformance('cache');
|
|
235
|
+
const repoInfo = this.instantiationService.invokeFunction(repository_1.extractRepoInfoInBackground, completionState.textDocument.uri);
|
|
236
|
+
const requestContext = {
|
|
237
|
+
blockMode: ghostTextStrategy.blockMode,
|
|
238
|
+
languageId: completionState.textDocument.detectedLanguageId,
|
|
239
|
+
repoInfo: repoInfo,
|
|
240
|
+
engineModelId: engineInfo.modelId,
|
|
241
|
+
ourRequestId,
|
|
242
|
+
prefix,
|
|
243
|
+
prompt: prompt.prompt,
|
|
244
|
+
multiline: ghostTextStrategy.requestMultiline,
|
|
245
|
+
indentation: (0, parseBlock_1.contextIndentation)(completionState.textDocument, completionState.position),
|
|
246
|
+
isCycling: ghostTextOptions.isCycling,
|
|
247
|
+
headers: engineInfo.headers,
|
|
248
|
+
stop: ghostTextStrategy.stop,
|
|
249
|
+
maxTokens: ghostTextStrategy.maxTokens,
|
|
250
|
+
afterAccept: hasAcceptedCurrentCompletion,
|
|
644
251
|
};
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
//
|
|
654
|
-
|
|
655
|
-
if
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
if (
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
252
|
+
// Add headers to identify async completions and speculative requests
|
|
253
|
+
requestContext.headers = {
|
|
254
|
+
...requestContext.headers,
|
|
255
|
+
'X-Copilot-Async': 'true',
|
|
256
|
+
'X-Copilot-Speculative': ghostTextOptions.isSpeculative ? 'true' : 'false',
|
|
257
|
+
};
|
|
258
|
+
// this will be used as basis for the choice telemetry data
|
|
259
|
+
const telemetryData = this.instantiationService.invokeFunction(telemetryIssued, completionState.textDocument, requestContext, completionState.position, prompt, preIssuedTelemetryDataWithExp, engineInfo, ghostTextOptions);
|
|
260
|
+
// Wait before requesting more completions if there is a candidate
|
|
261
|
+
// completion request in flight. Does not wait for cycling requests or
|
|
262
|
+
// if there is a cached completion.
|
|
263
|
+
if (choices === undefined &&
|
|
264
|
+
!ghostTextOptions.isCycling &&
|
|
265
|
+
this.asyncCompletionManager.shouldWaitForAsyncCompletions(prefix, prompt.prompt)) {
|
|
266
|
+
const choice = await this.asyncCompletionManager.getFirstMatchingRequestWithTimeout(ourRequestId, prefix, prompt.prompt, ghostTextOptions.isSpeculative, telemetryData);
|
|
267
|
+
recordPerformance('asyncWait');
|
|
268
|
+
if (choice) {
|
|
269
|
+
const forceSingleLine = !ghostTextStrategy.requestMultiline;
|
|
270
|
+
const trimmedChoice = (0, completionsFromNetwork_1.makeGhostAPIChoice)(choice[0], { forceSingleLine });
|
|
271
|
+
choices = [[trimmedChoice], resultType_1.ResultType.Async];
|
|
272
|
+
}
|
|
273
|
+
if (isCompletionRequestCancelled(this.currentGhostText, ourRequestId, cancellationToken)) {
|
|
274
|
+
this.logger.debug('Cancelled before requesting a new completion');
|
|
275
|
+
return {
|
|
276
|
+
type: 'abortedBeforeIssued',
|
|
277
|
+
reason: 'Cancelled after waiting for async completion',
|
|
278
|
+
telemetryData: (0, telemetry_3.mkBasicResultTelemetry)(telemetryData),
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
const isMoreMultiline = ghostTextStrategy.blockMode === config_1.BlockMode.MoreMultiline &&
|
|
283
|
+
blockTrimmer_1.BlockTrimmer.isSupported(completionState.textDocument.detectedLanguageId);
|
|
284
|
+
if (choices !== undefined) {
|
|
285
|
+
// Post-process any cached choices before deciding whether to issue a network request
|
|
286
|
+
choices[0] = choices[0]
|
|
287
|
+
.map(c => this.instantiationService.invokeFunction(suggestions_1.postProcessChoiceInContext, completionState.textDocument, completionState.position, c, isMoreMultiline, this.logger))
|
|
288
|
+
.filter(c => c !== undefined);
|
|
289
|
+
}
|
|
290
|
+
if (choices !== undefined && choices[0].length === 0) {
|
|
291
|
+
this.logger.debug(`Found empty inline suggestions locally via ${(0, telemetry_3.resultTypeToString)(choices[1])}`);
|
|
292
|
+
return {
|
|
293
|
+
type: 'empty',
|
|
294
|
+
reason: 'cached results empty after post-processing',
|
|
295
|
+
telemetryData: (0, telemetry_3.mkBasicResultTelemetry)(telemetryData),
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
if (choices !== undefined &&
|
|
299
|
+
choices[0].length > 0 &&
|
|
300
|
+
// If it's a cycling request, need to show multiple choices
|
|
301
|
+
(!ghostTextOptions.isCycling || choices[0].length > 1)) {
|
|
302
|
+
this.logger.debug(`Found inline suggestions locally via ${(0, telemetry_3.resultTypeToString)(choices[1])}`);
|
|
303
|
+
}
|
|
304
|
+
else {
|
|
305
|
+
// No local choices, go to network
|
|
306
|
+
const completionsFromNetwork = this.instantiationService.createInstance(completionsFromNetwork_1.CompletionsFromNetwork);
|
|
307
|
+
if (ghostTextOptions.isCycling) {
|
|
308
|
+
const networkChoices = await completionsFromNetwork.getAllCompletionsFromNetwork(requestContext, telemetryData, cancellationToken, ghostTextStrategy.finishedCb);
|
|
309
|
+
// TODO: if we already had some choices cached from the initial non-cycling request,
|
|
310
|
+
// and then the cycling request returns no results for some reason, we need to still
|
|
311
|
+
// return the original choices to the editor to avoid the ghost text disappearing completely.
|
|
312
|
+
// However this should be telemetrised according to the result of the cycling request itself,
|
|
313
|
+
// i.e. failure/empty (or maybe canceled).
|
|
314
|
+
//
|
|
315
|
+
// Right now this is awkward to orchestrate in the code and we don't handle it, incorrectly
|
|
316
|
+
// returning `ghostText.produced` instead. Cycling is a manual action and hence uncommon,
|
|
317
|
+
// so this shouldn't cause much inaccuracy, but we still should fix this.
|
|
318
|
+
if (networkChoices.type === 'success') {
|
|
319
|
+
const resultChoices = choices?.[0] ?? [];
|
|
320
|
+
networkChoices.value[0].forEach(c => {
|
|
321
|
+
// Collect only unique displayTexts
|
|
322
|
+
if (resultChoices.findIndex(v => v.completionText.trim() === c.completionText.trim()) !== -1) {
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
resultChoices.push(c);
|
|
326
|
+
});
|
|
327
|
+
choices = [resultChoices, resultType_1.ResultType.Cycling];
|
|
328
|
+
}
|
|
329
|
+
else {
|
|
330
|
+
if (choices === undefined) {
|
|
331
|
+
return networkChoices;
|
|
672
332
|
}
|
|
673
|
-
|
|
674
|
-
});
|
|
675
|
-
choices = [resultChoices, ResultType.Cycling];
|
|
333
|
+
}
|
|
676
334
|
}
|
|
677
335
|
else {
|
|
678
|
-
|
|
679
|
-
|
|
336
|
+
// Wrap an observer around the finished callback to update the
|
|
337
|
+
// async manager as the request streams in.
|
|
338
|
+
const finishedCb = (text, delta) => {
|
|
339
|
+
this.asyncCompletionManager.updateCompletion(ourRequestId, text);
|
|
340
|
+
return ghostTextStrategy.finishedCb(text, delta);
|
|
341
|
+
};
|
|
342
|
+
const asyncCancellationTokenSource = new src_1.CancellationTokenSource();
|
|
343
|
+
const requestPromise = completionsFromNetwork.getCompletionsFromNetwork(requestContext, telemetryData, asyncCancellationTokenSource.token, finishedCb);
|
|
344
|
+
void this.asyncCompletionManager.queueCompletionRequest(ourRequestId, prefix, prompt.prompt, asyncCancellationTokenSource, requestPromise);
|
|
345
|
+
const c = await this.asyncCompletionManager.getFirstMatchingRequest(ourRequestId, prefix, prompt.prompt, ghostTextOptions.isSpeculative);
|
|
346
|
+
if (c === undefined) {
|
|
347
|
+
return {
|
|
348
|
+
type: 'empty',
|
|
349
|
+
reason: 'received no results from async completions',
|
|
350
|
+
telemetryData: (0, telemetry_3.mkBasicResultTelemetry)(telemetryData),
|
|
351
|
+
};
|
|
680
352
|
}
|
|
353
|
+
choices = [[c[0]], resultType_1.ResultType.Async];
|
|
681
354
|
}
|
|
355
|
+
recordPerformance('network');
|
|
682
356
|
}
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
return ghostTextStrategy.finishedCb(text, delta);
|
|
357
|
+
if (choices === undefined) {
|
|
358
|
+
return {
|
|
359
|
+
type: 'failed',
|
|
360
|
+
reason: 'internal error: choices should be defined after network call',
|
|
361
|
+
telemetryData: (0, telemetry_3.mkBasicResultTelemetry)(telemetryData),
|
|
689
362
|
};
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
363
|
+
}
|
|
364
|
+
const [choicesArray, resultType] = choices;
|
|
365
|
+
const postProcessedChoicesArray = choicesArray
|
|
366
|
+
.map(c => this.instantiationService.invokeFunction(suggestions_1.postProcessChoiceInContext, completionState.textDocument, completionState.position, c, isMoreMultiline, this.logger))
|
|
367
|
+
.filter(c => c !== undefined);
|
|
368
|
+
// Delay response if needed. Note, this must come before the
|
|
369
|
+
// telemetryWithAddData call since the time_to_produce_ms is computed
|
|
370
|
+
// there
|
|
371
|
+
const completionsDelay = this.instantiationService.invokeFunction((config_1.getConfig), config_1.ConfigKey.CompletionsDelay) ??
|
|
372
|
+
this.completionsFeaturesService.completionsDelay(preIssuedTelemetryDataWithExp);
|
|
373
|
+
const elapsed = (0, telemetry_2.now)() - preIssuedTelemetryDataWithExp.issuedTime;
|
|
374
|
+
const remainingDelay = Math.max(completionsDelay - elapsed, 0);
|
|
375
|
+
if (resultType !== resultType_1.ResultType.TypingAsSuggested && !ghostTextOptions.isCycling && remainingDelay > 0) {
|
|
376
|
+
this.logger.debug(`Waiting ${remainingDelay}ms before returning completion`);
|
|
377
|
+
await (0, async_1.delay)(remainingDelay);
|
|
378
|
+
if (isCompletionRequestCancelled(this.currentGhostText, ourRequestId, cancellationToken)) {
|
|
379
|
+
this.logger.debug('Cancelled after completions delay');
|
|
695
380
|
return {
|
|
696
|
-
type: '
|
|
697
|
-
reason: '
|
|
698
|
-
telemetryData: (0, telemetry_3.
|
|
381
|
+
type: 'canceled',
|
|
382
|
+
reason: 'after completions delay',
|
|
383
|
+
telemetryData: (0, telemetry_3.mkCanceledResultTelemetry)(telemetryData),
|
|
699
384
|
};
|
|
700
385
|
}
|
|
701
|
-
choices = [[c[0]], ResultType.Async];
|
|
702
386
|
}
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
387
|
+
const results = [];
|
|
388
|
+
for (const choice of postProcessedChoicesArray) {
|
|
389
|
+
// Do this to get a new object for each choice
|
|
390
|
+
const choiceTelemetryData = telemetryWithAddData(completionState.textDocument, requestContext, choice, telemetryData);
|
|
391
|
+
const suffixCoverage = inlineSuggestion
|
|
392
|
+
? (0, suggestions_1.checkSuffix)(completionState.textDocument, completionState.position, choice)
|
|
393
|
+
: 0;
|
|
394
|
+
// We want to use `newTrailingWs` as the trailing whitespace
|
|
395
|
+
const ghostCompletion = adjustLeadingWhitespace(choice.choiceIndex, choice.completionText, prompt.trailingWs);
|
|
396
|
+
const res = {
|
|
397
|
+
completion: ghostCompletion,
|
|
398
|
+
telemetry: choiceTelemetryData,
|
|
399
|
+
isMiddleOfTheLine: inlineSuggestion,
|
|
400
|
+
suffixCoverage,
|
|
401
|
+
copilotAnnotations: choice.copilotAnnotations,
|
|
402
|
+
clientCompletionId: choice.clientCompletionId,
|
|
403
|
+
};
|
|
404
|
+
results.push(res);
|
|
405
|
+
}
|
|
406
|
+
// Lift clientCompletionId out of the result in order to include it in the telemetry payload computed by mkBasicResultTelemetry.
|
|
407
|
+
telemetryData.properties.clientCompletionId = results[0]?.clientCompletionId;
|
|
408
|
+
// If reading from the cache or async, capture the look back offset used
|
|
409
|
+
telemetryData.measurements.foundOffset = results?.[0]?.telemetry?.measurements?.foundOffset ?? -1;
|
|
410
|
+
this.logger.debug(`Produced ${results.length} results from ${(0, telemetry_3.resultTypeToString)(resultType)} at ${telemetryData.measurements.foundOffset} offset`);
|
|
411
|
+
if (isCompletionRequestCancelled(this.currentGhostText, ourRequestId, cancellationToken)) {
|
|
728
412
|
return {
|
|
729
413
|
type: 'canceled',
|
|
730
|
-
reason: 'after completions
|
|
414
|
+
reason: 'after post processing completions',
|
|
731
415
|
telemetryData: (0, telemetry_3.mkCanceledResultTelemetry)(telemetryData),
|
|
732
416
|
};
|
|
733
417
|
}
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
const suffixCoverage = inlineSuggestion
|
|
740
|
-
? (0, suggestions_1.checkSuffix)(completionState.textDocument, completionState.position, choice)
|
|
741
|
-
: 0;
|
|
742
|
-
// We want to use `newTrailingWs` as the trailing whitespace
|
|
743
|
-
const ghostCompletion = adjustLeadingWhitespace(choice.choiceIndex, choice.completionText, prompt.trailingWs);
|
|
744
|
-
const res = {
|
|
745
|
-
completion: ghostCompletion,
|
|
746
|
-
telemetry: choiceTelemetryData,
|
|
747
|
-
isMiddleOfTheLine: inlineSuggestion,
|
|
748
|
-
suffixCoverage,
|
|
749
|
-
copilotAnnotations: choice.copilotAnnotations,
|
|
750
|
-
clientCompletionId: choice.clientCompletionId,
|
|
751
|
-
};
|
|
752
|
-
results.push(res);
|
|
753
|
-
}
|
|
754
|
-
// Lift clientCompletionId out of the result in order to include it in the telemetry payload computed by mkBasicResultTelemetry.
|
|
755
|
-
telemetryData.properties.clientCompletionId = results[0]?.clientCompletionId;
|
|
756
|
-
// If reading from the cache or async, capture the look back offset used
|
|
757
|
-
telemetryData.measurements.foundOffset = results?.[0]?.telemetry?.measurements?.foundOffset ?? -1;
|
|
758
|
-
ghostTextLogger.debug(logTarget, `Produced ${results.length} results from ${(0, telemetry_3.resultTypeToString)(resultType)} at ${telemetryData.measurements.foundOffset} offset`);
|
|
759
|
-
if (isCompletionRequestCancelled(currentGhostText, ourRequestId, cancellationToken)) {
|
|
760
|
-
return {
|
|
761
|
-
type: 'canceled',
|
|
762
|
-
reason: 'after post processing completions',
|
|
763
|
-
telemetryData: (0, telemetry_3.mkCanceledResultTelemetry)(telemetryData),
|
|
764
|
-
};
|
|
765
|
-
}
|
|
766
|
-
if (!ghostTextOptions.isSpeculative) {
|
|
767
|
-
// Update the current ghost text with the new response before returning for the "typing as suggested" UX
|
|
768
|
-
currentGhostText.setGhostText(prefix, prompt.prompt.suffix, postProcessedChoicesArray, resultType);
|
|
769
|
-
}
|
|
770
|
-
recordPerformance('complete');
|
|
771
|
-
return {
|
|
772
|
-
type: 'success',
|
|
773
|
-
value: [results, resultType],
|
|
774
|
-
telemetryData: (0, telemetry_3.mkBasicResultTelemetry)(telemetryData),
|
|
775
|
-
telemetryBlob: telemetryData,
|
|
776
|
-
resultType,
|
|
777
|
-
performanceMetrics,
|
|
778
|
-
};
|
|
779
|
-
});
|
|
780
|
-
}
|
|
781
|
-
async function getGhostText(accessor, completionState, token, options) {
|
|
782
|
-
const id = (0, uuid_1.generateUuid)();
|
|
783
|
-
const instantiationService = accessor.get(instantiation_1.IInstantiationService);
|
|
784
|
-
const telemetryService = accessor.get(telemetry_1.ITelemetryService);
|
|
785
|
-
const notifierService = accessor.get(completionNotifier_1.ICompletionsNotifierService);
|
|
786
|
-
const contextProviderBridge = accessor.get(contextProviderBridge_1.ICompletionsContextProviderBridgeService);
|
|
787
|
-
const currentGhostText = accessor.get(current_1.ICompletionsCurrentGhostText);
|
|
788
|
-
const contextproviderStatistics = accessor.get(contextProviderStatistics_1.ICompletionsContextProviderService);
|
|
789
|
-
currentGhostText.currentRequestId = id;
|
|
790
|
-
const telemetryData = await createTelemetryWithExp(accessor, completionState.textDocument, id, options);
|
|
791
|
-
// A CLS consumer has an LSP bug where it erroneously makes method requests before `initialize` has returned, which
|
|
792
|
-
// means we can't use `initialize` to actually initialize anything expensive. This the primary user of the
|
|
793
|
-
// tokenizer, so settle for initializing here instead. We don't use waitForTokenizers() because in the event of a
|
|
794
|
-
// tokenizer load failure, that would spam handleException() on every request.
|
|
795
|
-
await tokenization_1.initializeTokenizers.catch(() => { });
|
|
796
|
-
try {
|
|
797
|
-
contextProviderBridge.schedule(completionState, id, options?.opportunityId ?? '', telemetryData, token, options);
|
|
798
|
-
notifierService.notifyRequest(completionState, id, telemetryData, token, options);
|
|
799
|
-
const result = await instantiationService.invokeFunction(getGhostTextWithoutAbortHandling, completionState, id, telemetryData, token, options);
|
|
800
|
-
const statistics = contextproviderStatistics.getStatisticsForCompletion(id);
|
|
801
|
-
const opportunityId = options?.opportunityId ?? 'unknown';
|
|
802
|
-
for (const [providerId, statistic] of statistics.getAllUsageStatistics()) {
|
|
803
|
-
/* __GDPR__
|
|
804
|
-
"context-provider.completion-stats" : {
|
|
805
|
-
"owner": "dirkb",
|
|
806
|
-
"comment": "Telemetry for copilot inline completion context",
|
|
807
|
-
"requestId": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "The request correlation id" },
|
|
808
|
-
"opportunityId": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "The opportunity id" },
|
|
809
|
-
"providerId": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "The context provider id" },
|
|
810
|
-
"resolution": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "The resolution of the context" },
|
|
811
|
-
"usage": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "How the context was used" },
|
|
812
|
-
"usageDetails": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Additional details about the usage as a JSON string" }
|
|
813
|
-
}
|
|
814
|
-
*/
|
|
815
|
-
telemetryService.sendMSFTTelemetryEvent('context-provider.completion-stats', {
|
|
816
|
-
requestId: id,
|
|
817
|
-
opportunityId,
|
|
818
|
-
providerId,
|
|
819
|
-
resolution: statistic.resolution,
|
|
820
|
-
usage: statistic.usage,
|
|
821
|
-
usageDetails: JSON.stringify(statistic.usageDetails),
|
|
822
|
-
}, {});
|
|
823
|
-
}
|
|
824
|
-
return result;
|
|
825
|
-
}
|
|
826
|
-
catch (e) {
|
|
827
|
-
// The cancellation token may be called after the request is done but while we still process data.
|
|
828
|
-
// The underlying implementation catches abort errors for specific scenarios but we still have uncovered paths.
|
|
829
|
-
// To avoid returning an error to the editor, this acts as an fault barrier here.
|
|
830
|
-
if ((0, networking_1.isAbortError)(e)) {
|
|
418
|
+
if (!ghostTextOptions.isSpeculative) {
|
|
419
|
+
// Update the current ghost text with the new response before returning for the "typing as suggested" UX
|
|
420
|
+
this.currentGhostText.setGhostText(prefix, prompt.prompt.suffix, postProcessedChoicesArray, resultType);
|
|
421
|
+
}
|
|
422
|
+
recordPerformance('complete');
|
|
831
423
|
return {
|
|
832
|
-
type: '
|
|
833
|
-
|
|
834
|
-
telemetryData: (0, telemetry_3.
|
|
835
|
-
|
|
836
|
-
|
|
424
|
+
type: 'success',
|
|
425
|
+
value: [results, resultType],
|
|
426
|
+
telemetryData: (0, telemetry_3.mkBasicResultTelemetry)(telemetryData),
|
|
427
|
+
telemetryBlob: telemetryData,
|
|
428
|
+
resultType,
|
|
429
|
+
performanceMetrics,
|
|
837
430
|
};
|
|
838
|
-
}
|
|
839
|
-
throw e;
|
|
431
|
+
});
|
|
840
432
|
}
|
|
433
|
+
};
|
|
434
|
+
exports.GhostTextComputer = GhostTextComputer;
|
|
435
|
+
exports.GhostTextComputer = GhostTextComputer = __decorate([
|
|
436
|
+
__param(0, instantiation_1.IInstantiationService),
|
|
437
|
+
__param(1, telemetry_1.ITelemetryService),
|
|
438
|
+
__param(2, completionNotifier_1.ICompletionsNotifierService),
|
|
439
|
+
__param(3, contextProviderBridge_1.ICompletionsContextProviderBridgeService),
|
|
440
|
+
__param(4, current_1.ICompletionsCurrentGhostText),
|
|
441
|
+
__param(5, contextProviderStatistics_1.ICompletionsContextProviderService),
|
|
442
|
+
__param(6, asyncCompletions_1.ICompletionsAsyncManagerService),
|
|
443
|
+
__param(7, featuresService_1.ICompletionsFeaturesService),
|
|
444
|
+
__param(8, logger_1.ICompletionsLogTargetService),
|
|
445
|
+
__param(9, progress_1.ICompletionsStatusReporter),
|
|
446
|
+
__param(10, logService_1.ILogService)
|
|
447
|
+
], GhostTextComputer);
|
|
448
|
+
async function getGhostText(accessor, completionState, token, options) {
|
|
449
|
+
const instaService = accessor.get(instantiation_1.IInstantiationService);
|
|
450
|
+
const ghostTextComputer = instaService.createInstance(GhostTextComputer);
|
|
451
|
+
return ghostTextComputer.getGhostText(completionState, token, options);
|
|
841
452
|
}
|
|
842
453
|
/**
|
|
843
454
|
* Attempt to get InlineSuggestion locally, in one of two ways:
|
|
@@ -853,10 +464,10 @@ function getLocalInlineSuggestion(accessor, prefix, prompt, requestMultiline) {
|
|
|
853
464
|
// are first so that the shown completion doesn't disappear.
|
|
854
465
|
// Filter duplicates by completionText
|
|
855
466
|
const choicesCacheDeduped = (choicesCache ?? []).filter(c => !choicesTyping.some(t => t.completionText === c.completionText));
|
|
856
|
-
return [choicesTyping.concat(choicesCacheDeduped), ResultType.TypingAsSuggested];
|
|
467
|
+
return [choicesTyping.concat(choicesCacheDeduped), resultType_1.ResultType.TypingAsSuggested];
|
|
857
468
|
}
|
|
858
469
|
if (choicesCache && choicesCache.length > 0) {
|
|
859
|
-
return [choicesCache, ResultType.Cache];
|
|
470
|
+
return [choicesCache, resultType_1.ResultType.Cache];
|
|
860
471
|
}
|
|
861
472
|
}
|
|
862
473
|
/** Checks if the position is valid inline suggestion position. Returns `undefined` if it's position where ghost text shouldn't be displayed */
|
|
@@ -885,12 +496,6 @@ function isValidMiddleOfTheLinePosition(selectionPosition, doc) {
|
|
|
885
496
|
const endOfLine = line.text.substr(selectionPosition.character).trim();
|
|
886
497
|
return /^\s*[)>}\]"'`]*\s*[:{;,]?\s*$/.test(endOfLine);
|
|
887
498
|
}
|
|
888
|
-
/** Checks if position is the beginning of an empty line (including indentation) */
|
|
889
|
-
function isNewLine(selectionPosition, doc) {
|
|
890
|
-
const line = doc.lineAt(selectionPosition);
|
|
891
|
-
const lineTrimmed = line.text.trim();
|
|
892
|
-
return lineTrimmed.length === 0;
|
|
893
|
-
}
|
|
894
499
|
// This enables tests to control multi line behavior
|
|
895
500
|
class ForceMultiLine {
|
|
896
501
|
static { this.default = new ForceMultiLine(); }
|
|
@@ -899,60 +504,6 @@ class ForceMultiLine {
|
|
|
899
504
|
}
|
|
900
505
|
}
|
|
901
506
|
exports.ForceMultiLine = ForceMultiLine;
|
|
902
|
-
async function shouldRequestMultiline(accessor, blockMode, document, position, inlineSuggestion, afterAccept, prompt) {
|
|
903
|
-
// Parsing long files for multiline completions is slow, so we only do
|
|
904
|
-
// it for files with less than 8000 lines
|
|
905
|
-
if (document.lineCount >= 8000) {
|
|
906
|
-
(0, telemetry_2.telemetry)(accessor, 'ghostText.longFileMultilineSkip', telemetry_2.TelemetryData.createAndMarkAsIssued({
|
|
907
|
-
languageId: document.detectedLanguageId,
|
|
908
|
-
lineCount: String(document.lineCount),
|
|
909
|
-
currentLine: String(position.line),
|
|
910
|
-
}));
|
|
911
|
-
}
|
|
912
|
-
else {
|
|
913
|
-
if (blockMode === config_1.BlockMode.MoreMultiline && blockTrimmer_1.BlockTrimmer.isSupported(document.detectedLanguageId)) {
|
|
914
|
-
if (!afterAccept) {
|
|
915
|
-
return { requestMultiline: false };
|
|
916
|
-
}
|
|
917
|
-
const blockPosition = await (0, blockTrimmer_1.getBlockPositionType)(document, position);
|
|
918
|
-
return { requestMultiline: true, blockPosition };
|
|
919
|
-
}
|
|
920
|
-
const targetLanguagesNewLine = ['typescript', 'typescriptreact'];
|
|
921
|
-
if (targetLanguagesNewLine.includes(document.detectedLanguageId)) {
|
|
922
|
-
const newLine = isNewLine(position, document);
|
|
923
|
-
if (newLine) {
|
|
924
|
-
return { requestMultiline: true };
|
|
925
|
-
}
|
|
926
|
-
}
|
|
927
|
-
let requestMultiline = false;
|
|
928
|
-
if (!inlineSuggestion && (0, parse_1.isSupportedLanguageId)(document.detectedLanguageId)) {
|
|
929
|
-
// Can only check block-level nodes of languages we support
|
|
930
|
-
requestMultiline = await (0, parseBlock_1.isEmptyBlockStartUtil)(document, position);
|
|
931
|
-
}
|
|
932
|
-
else if (inlineSuggestion && (0, parse_1.isSupportedLanguageId)(document.detectedLanguageId)) {
|
|
933
|
-
//If we are inline, check if we would suggest multiline for current position or if we would suggest a multiline completion if we were at the end of the line
|
|
934
|
-
requestMultiline =
|
|
935
|
-
(await (0, parseBlock_1.isEmptyBlockStartUtil)(document, position)) ||
|
|
936
|
-
(await (0, parseBlock_1.isEmptyBlockStartUtil)(document, document.lineAt(position).range.end));
|
|
937
|
-
}
|
|
938
|
-
// If requestMultiline is false, for specific languages check multiline score
|
|
939
|
-
if (!requestMultiline) {
|
|
940
|
-
const requestMultiModelThreshold = 0.5;
|
|
941
|
-
const targetLanguagesModel = ['javascript', 'javascriptreact', 'python'];
|
|
942
|
-
if (targetLanguagesModel.includes(document.detectedLanguageId)) {
|
|
943
|
-
// Call multiline model if not multiline and EXP flag is set.
|
|
944
|
-
const multiModelScore = (0, multilineModel_1.requestMultilineScore)(prompt.prompt, document.detectedLanguageId);
|
|
945
|
-
requestMultiline = multiModelScore > requestMultiModelThreshold;
|
|
946
|
-
}
|
|
947
|
-
}
|
|
948
|
-
return { requestMultiline };
|
|
949
|
-
}
|
|
950
|
-
return { requestMultiline: false };
|
|
951
|
-
}
|
|
952
|
-
/** Appends completions to existing entry in cache or creates new entry. */
|
|
953
|
-
function appendToCache(competionsCacheService, requestContext, choice) {
|
|
954
|
-
competionsCacheService.append(requestContext.prefix, requestContext.prompt.suffix, choice);
|
|
955
|
-
}
|
|
956
507
|
function adjustLeadingWhitespace(index, text, ws) {
|
|
957
508
|
if (ws.length > 0) {
|
|
958
509
|
if (text.startsWith(ws)) {
|
|
@@ -1000,14 +551,14 @@ function adjustLeadingWhitespace(index, text, ws) {
|
|
|
1000
551
|
* remaining current prefix.
|
|
1001
552
|
*/
|
|
1002
553
|
function getCompletionsFromCache(accessor, prefix, suffix, multiline) {
|
|
1003
|
-
const
|
|
554
|
+
const logger = accessor.get(logService_1.ILogService).createSubLogger(['ghostText', 'getCompletionsFromCache']);
|
|
1004
555
|
const choices = accessor.get(completionsCache_1.ICompletionsCacheService).findAll(prefix, suffix);
|
|
1005
556
|
if (choices.length === 0) {
|
|
1006
|
-
|
|
557
|
+
logger.debug('Found no completions in cache');
|
|
1007
558
|
return [];
|
|
1008
559
|
}
|
|
1009
|
-
|
|
1010
|
-
return choices.map(choice => makeGhostAPIChoice(choice, { forceSingleLine: !multiline }));
|
|
560
|
+
logger.debug(`Found ${choices.length} completions in cache`);
|
|
561
|
+
return choices.map(choice => (0, completionsFromNetwork_1.makeGhostAPIChoice)(choice, { forceSingleLine: !multiline }));
|
|
1011
562
|
}
|
|
1012
563
|
/** Create a TelemetryWithExp instance for a ghost text request. */
|
|
1013
564
|
async function createTelemetryWithExp(accessor, document, headerRequestId, options) {
|
|
@@ -1125,19 +676,4 @@ function addDocumentTelemetry(telemetry, document) {
|
|
|
1125
676
|
telemetry.measurements.documentLength = document.getText().length;
|
|
1126
677
|
telemetry.measurements.documentLineCount = document.lineCount;
|
|
1127
678
|
}
|
|
1128
|
-
function telemetryPerformance(accessor, performanceKind, choice, requestStart, processingTimeMs) {
|
|
1129
|
-
const requestTimeMs = Date.now() - requestStart;
|
|
1130
|
-
const deltaMs = requestTimeMs - processingTimeMs;
|
|
1131
|
-
const telemetryData = choice.telemetryData.extendedBy({}, {
|
|
1132
|
-
completionCharLen: choice.completionText.length,
|
|
1133
|
-
requestTimeMs: requestTimeMs,
|
|
1134
|
-
processingTimeMs: processingTimeMs,
|
|
1135
|
-
deltaMs: deltaMs,
|
|
1136
|
-
// Choice properties
|
|
1137
|
-
meanLogProb: choice.meanLogProb || NaN,
|
|
1138
|
-
meanAlternativeLogProb: choice.meanAlternativeLogProb || NaN,
|
|
1139
|
-
});
|
|
1140
|
-
telemetryData.extendWithRequestId(choice.requestId);
|
|
1141
|
-
(0, telemetry_2.telemetry)(accessor, `ghostText.${performanceKind}`, telemetryData);
|
|
1142
|
-
}
|
|
1143
679
|
//# sourceMappingURL=ghostText.js.map
|