Skip to content

Commit fb973b6

Browse files
committed
add telemetry to know how often an item is inserted before resolve is done
1 parent c591894 commit fb973b6

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/vs/editor/contrib/suggest/browser/suggestController.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ export class SuggestController implements IEditorContribution {
332332
// keep item in memory
333333
this._memoryService.memorize(model, this.editor.getPosition(), item);
334334

335+
const isResolved = item.isResolved;
335336

336337
if (Array.isArray(item.completion.additionalTextEdits)) {
337338

@@ -346,7 +347,7 @@ export class SuggestController implements IEditorContribution {
346347
);
347348
scrollState.restoreRelativeVerticalPositionOfCursor(this.editor);
348349

349-
} else if (!item.isResolved) {
350+
} else if (!isResolved) {
350351
// async additional edits
351352
const sw = new StopWatch(true);
352353
let position: IPosition | undefined;
@@ -467,28 +468,29 @@ export class SuggestController implements IEditorContribution {
467468

468469
// clear only now - after all tasks are done
469470
Promise.all(tasks).finally(() => {
470-
this._reportSuggestionAcceptedTelemetry(item, model, event);
471+
this._reportSuggestionAcceptedTelemetry(item, model, event, isResolved);
471472

472473
this.model.clear();
473474
cts.dispose();
474475
});
475476
}
476477

477478
private _telemetryGate: number = 0;
478-
private _reportSuggestionAcceptedTelemetry(item: CompletionItem, model: ITextModel, acceptedSuggestion: ISelectedSuggestion) {
479+
private _reportSuggestionAcceptedTelemetry(item: CompletionItem, model: ITextModel, acceptedSuggestion: ISelectedSuggestion, itemResolved: boolean) {
479480
if (this._telemetryGate++ % 100 !== 0) {
480481
return;
481482
}
482483

483-
type AcceptedSuggestion = { providerId: string; fileExtension: string; languageId: string; basenameHash: string; kind: number };
484+
type AcceptedSuggestion = { providerId: string; fileExtension: string; languageId: string; basenameHash: string; kind: number; itemResolved: boolean };
484485
type AcceptedSuggestionClassification = {
485486
owner: 'jrieken';
486487
comment: 'Information accepting completion items';
487488
providerId: { classification: 'PublicNonPersonalData'; purpose: 'FeatureInsight'; comment: 'Provider of the completions item' };
488489
basenameHash: { classification: 'PublicNonPersonalData'; purpose: 'FeatureInsight'; comment: 'Hash of the basename of the file into which the completion was inserted' };
489490
fileExtension: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'File extension of the file into which the completion was inserted' };
490491
languageId: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Language type of the file into which the completion was inserted' };
491-
kind: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The completion item kind' };
492+
kind: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'The completion item kind' };
493+
itemResolved: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; isMeasurement: true; comment: 'If the item was inserted before resolving was done' };
492494
};
493495
// _debugDisplayName looks like `vscode.css-language-features(/-:)`, where the last bit is the trigger chars
494496
// normalize it to just the extension ID and lowercase
@@ -499,6 +501,7 @@ export class SuggestController implements IEditorContribution {
499501
basenameHash: hash(basename(model.uri)).toString(16),
500502
languageId: model.getLanguageId(),
501503
fileExtension: extname(model.uri),
504+
itemResolved
502505
});
503506
}
504507

0 commit comments

Comments
 (0)