Skip to content

Commit b3324f4

Browse files
committed
Adds support for InlineCompletion.correlationId
1 parent d451f41 commit b3324f4

File tree

6 files changed

+21
-0
lines changed

6 files changed

+21
-0
lines changed

src/vs/editor/common/languages.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,11 @@ export interface InlineCompletion {
832832
readonly warning?: InlineCompletionWarning;
833833

834834
readonly displayLocation?: InlineCompletionDisplayLocation;
835+
836+
/**
837+
* Used for telemetry.
838+
*/
839+
readonly correlationId?: string | undefined;
835840
}
836841

837842
export interface InlineCompletionWarning {
@@ -1000,6 +1005,7 @@ export type InlineCompletionEndOfLifeReason<TInlineCompletion = InlineCompletion
10001005

10011006
export type LifetimeSummary = {
10021007
requestUuid: string;
1008+
correlationId: string | undefined;
10031009
partiallyAccepted: number;
10041010
partiallyAcceptedCountSinceOriginal: number;
10051011
partiallyAcceptedRatioSinceOriginal: number;

src/vs/editor/contrib/inlineCompletions/browser/model/provideInlineCompletions.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ function toInlineSuggestData(
242242
inlineCompletion.isInlineEdit ?? false,
243243
requestInfo,
244244
providerRequestInfo,
245+
inlineCompletion.correlationId,
245246
);
246247
}
247248

@@ -301,6 +302,7 @@ export class InlineSuggestData {
301302

302303
private readonly _requestInfo: InlineSuggestRequestInfo,
303304
private readonly _providerRequestInfo: InlineSuggestProviderRequestInfo,
305+
private readonly _correlationId: string | undefined,
304306
) {
305307
this._viewData = { editorType: _requestInfo.editorType };
306308
}
@@ -368,6 +370,7 @@ export class InlineSuggestData {
368370
if (this.source.provider.handleEndOfLifetime) {
369371
const summary: LifetimeSummary = {
370372
requestUuid: this.context.requestUuid,
373+
correlationId: this._correlationId,
371374
partiallyAccepted: this._partiallyAcceptedCount,
372375
partiallyAcceptedCountSinceOriginal: this._partiallyAcceptedSinceOriginal.count,
373376
partiallyAcceptedRatioSinceOriginal: this._partiallyAcceptedSinceOriginal.ratio,

src/vs/monaco.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7527,6 +7527,10 @@ declare namespace monaco.languages {
75277527
readonly showRange?: IRange;
75287528
readonly warning?: InlineCompletionWarning;
75297529
readonly displayLocation?: InlineCompletionDisplayLocation;
7530+
/**
7531+
* Used for telemetry.
7532+
*/
7533+
readonly correlationId?: string | undefined;
75307534
}
75317535

75327536
export interface InlineCompletionWarning {
@@ -7633,6 +7637,7 @@ declare namespace monaco.languages {
76337637

76347638
export type LifetimeSummary = {
76357639
requestUuid: string;
7640+
correlationId: string | undefined;
76367641
partiallyAccepted: number;
76377642
partiallyAcceptedCountSinceOriginal: number;
76387643
partiallyAcceptedRatioSinceOriginal: number;

src/vs/workbench/api/browser/mainThreadLanguageFeatures.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,7 @@ export class MainThreadLanguageFeatures extends Disposable implements MainThread
652652
const endOfLifeSummary: InlineCompletionEndOfLifeEvent = {
653653
id: lifetimeSummary.requestUuid,
654654
opportunityId: lifetimeSummary.requestUuid,
655+
correlationId: lifetimeSummary.correlationId,
655656
shown: lifetimeSummary.shown,
656657
shownDuration: lifetimeSummary.shownDuration,
657658
shownDurationUncollapsed: lifetimeSummary.shownDurationUncollapsed,
@@ -1315,6 +1316,7 @@ type InlineCompletionEndOfLifeEvent = {
13151316
*/
13161317
id: string;
13171318
opportunityId: string;
1319+
correlationId: string | undefined;
13181320
extensionId: string;
13191321
extensionVersion: string;
13201322
shown: boolean;
@@ -1352,6 +1354,7 @@ type InlineCompletionsEndOfLifeClassification = {
13521354
comment: 'Inline completions ended';
13531355
id: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The identifier for the inline completion request' };
13541356
opportunityId: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Unique identifier for an opportunity to show an inline completion or NES' };
1357+
correlationId: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The correlation identifier for the inline completion' };
13551358
extensionId: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The identifier for the extension that contributed the inline completion' };
13561359
extensionVersion: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The version of the extension that contributed the inline completion' };
13571360
shown: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Whether the inline completion was shown to the user' };

src/vs/workbench/api/common/extHostLanguageFeatures.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1437,6 +1437,7 @@ class InlineCompletionAdapter {
14371437
message: typeConvert.MarkdownString.from(item.warning.message),
14381438
icon: item.warning.icon ? typeConvert.IconPath.fromThemeIcon(item.warning.icon) : undefined,
14391439
} : undefined,
1440+
correlationId: this._isAdditionsProposedApiEnabled ? item.correlationId : undefined,
14401441
});
14411442
}),
14421443
commands: commands.map(c => {

src/vscode-dts/vscode.proposed.inlineCompletionsAdditions.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ declare module 'vscode' {
4646
action?: Command;
4747

4848
displayLocation?: InlineCompletionDisplayLocation;
49+
50+
/** Used for telemetry. Can be an arbitrary string. */
51+
correlationId?: string;
4952
}
5053

5154
export enum InlineCompletionDisplayLocationKind {

0 commit comments

Comments
 (0)