Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/extension/inlineEdits/node/nextEditProviderTelemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,7 @@ export class TelemetrySender implements IDisposable {
"providerId": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "NES provider identifier (StatelessNextEditProvider)" },
"modelName": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Name of the model used to provide the NES" },
"activeDocumentLanguageId": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "LanguageId of the active document" },
"mergeConflictExpanded": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "If and how edit window expanded to include merge conflict lines ('normal' or 'only' or undefined if not expanded)" },
"acceptance": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "User acceptance of the edit" },
"disposalReason": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Reason for disposal of NES" },
"supersededByOpportunityId": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "UUID of the opportunity that superseded this edit" },
Expand Down Expand Up @@ -829,6 +830,7 @@ export class TelemetrySender implements IDisposable {
providerId,
modelName,
activeDocumentLanguageId,
mergeConflictExpanded: telemetry.mergeConflictExpanded,
acceptance,
disposalReason,
supersededByOpportunityId,
Expand Down
5 changes: 3 additions & 2 deletions src/extension/xtab/node/xtabProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ export class XtabProvider implements IStatelessNextEditProvider {

const maxMergeConflictLines = this.configService.getExperimentBasedConfig(ConfigKey.Internal.InlineEditsXtabMaxMergeConflictLines, this.expService);

const editWindowLinesRange = this.computeEditWindowLinesRange(currentFileContentLines, cursorLineIdx, request, maxMergeConflictLines, retryState);
const editWindowLinesRange = this.computeEditWindowLinesRange(currentFileContentLines, cursorLineIdx, request, maxMergeConflictLines, retryState, telemetryBuilder);

const cursorOriginalLinesOffset = Math.max(0, cursorLineIdx - editWindowLinesRange.start);
const editWindowLastLineLength = activeDocument.documentAfterEdits.getTransformer().getLineLength(editWindowLinesRange.endExclusive);
Expand Down Expand Up @@ -786,7 +786,7 @@ export class XtabProvider implements IStatelessNextEditProvider {
return new OffsetRange(areaAroundStart, areaAroundEndExcl);
}

private computeEditWindowLinesRange(currentDocLines: string[], cursorLine: number, request: StatelessNextEditRequest, maxMergeConflictLines: number | undefined, retryState: RetryState): OffsetRange {
private computeEditWindowLinesRange(currentDocLines: string[], cursorLine: number, request: StatelessNextEditRequest, maxMergeConflictLines: number | undefined, retryState: RetryState, telemetry: StatelessNextEditTelemetryBuilder): OffsetRange {
let nLinesAbove: number;
{
const useVaryingLinesAbove = this.configService.getExperimentBasedConfig(ConfigKey.Internal.InlineEditsXtabProviderUseVaryingLinesAbove, this.expService);
Expand Down Expand Up @@ -838,6 +838,7 @@ export class XtabProvider implements IStatelessNextEditProvider {
const mergeConflictRange = findMergeConflictMarkersRange(currentDocLines, tentativeEditWindow, maxMergeConflictLines);
if (mergeConflictRange) {
const onlyMergeConflictLines = this.configService.getExperimentBasedConfig(ConfigKey.Internal.InlineEditsXtabOnlyMergeConflictLines, this.expService);
telemetry.setMergeConflictExpanded(onlyMergeConflictLines ? 'only' : 'normal');
if (onlyMergeConflictLines) {
this.tracer.trace(`Expanding edit window to include ONLY merge conflict markers: ${mergeConflictRange.toString()}`);
codeToEditStart = mergeConflictRange.start;
Expand Down
8 changes: 8 additions & 0 deletions src/platform/inlineEdits/common/statelessNextEditProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ export interface IStatelessNextEditTelemetry {
readonly prompt: string | undefined;
readonly promptLineCount: number | undefined;
readonly promptCharCount: number | undefined;
readonly mergeConflictExpanded: 'normal' | 'only' | undefined;

/* fetch request info */

Expand Down Expand Up @@ -353,6 +354,7 @@ export class StatelessNextEditTelemetryBuilder {

statelessNextEditProviderDuration: timeSpent,
logProbThreshold: this._logProbThreshold,
mergeConflictExpanded: this._mergeConflictExpanded,
nLinesOfCurrentFileInPrompt: this._nLinesOfCurrentFileInPrompt,
modelName: this._modelName,
prompt,
Expand All @@ -376,6 +378,12 @@ export class StatelessNextEditTelemetryBuilder {
return this;
}

private _mergeConflictExpanded: 'normal' | 'only' | undefined;
public setMergeConflictExpanded(mergeConflictExpanded: 'normal' | 'only'): this {
this._mergeConflictExpanded = mergeConflictExpanded;
return this;
}

private _hadLowLogProbSuggestion: boolean | undefined;
public setHadLowLogProbSuggestion(hadLowLogProbSuggestions: boolean): this {
this._hadLowLogProbSuggestion = hadLowLogProbSuggestions;
Expand Down