mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-30 12:15:32 +01:00
rename suggestions: add extra telemetry on requesting rename suggestions
This commit is contained in:
@@ -359,6 +359,10 @@ class RenameController implements IEditorContribution {
|
||||
timeBeforeFirstInputFieldEdit?: number;
|
||||
/** provided only if kind = 'accepted' */
|
||||
wantsPreview?: boolean;
|
||||
/** provided only if kind = 'accepted' */
|
||||
nRenameSuggestionsInvocations?: number;
|
||||
/** provided only if kind = 'accepted' */
|
||||
hadAutomaticRenameSuggestionsInvocation?: boolean;
|
||||
};
|
||||
|
||||
type RenameInvokedClassification = {
|
||||
@@ -373,6 +377,8 @@ class RenameController implements IEditorContribution {
|
||||
nRenameSuggestions?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Number of rename suggestions user has got' };
|
||||
timeBeforeFirstInputFieldEdit?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Milliseconds before user edits the input field for the first time' };
|
||||
wantsPreview?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'If user wanted preview.' };
|
||||
nRenameSuggestionsInvocations?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Number of times rename suggestions were invoked' };
|
||||
hadAutomaticRenameSuggestionsInvocation?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Whether rename suggestions were invoked automatically' };
|
||||
};
|
||||
|
||||
const value: RenameInvokedEvent =
|
||||
@@ -391,6 +397,8 @@ class RenameController implements IEditorContribution {
|
||||
nRenameSuggestions: inputFieldResult.stats.nRenameSuggestions,
|
||||
timeBeforeFirstInputFieldEdit: inputFieldResult.stats.timeBeforeFirstInputFieldEdit,
|
||||
wantsPreview: inputFieldResult.wantsPreview,
|
||||
nRenameSuggestionsInvocations: inputFieldResult.stats.nRenameSuggestionsInvocations,
|
||||
hadAutomaticRenameSuggestionsInvocation: inputFieldResult.stats.hadAutomaticRenameSuggestionsInvocation,
|
||||
};
|
||||
|
||||
this._telemetryService.publicLog2<RenameInvokedEvent, RenameInvokedClassification>('renameInvokedEvent', value);
|
||||
|
||||
@@ -76,6 +76,8 @@ export type RenameWidgetStats = {
|
||||
nRenameSuggestions: number;
|
||||
source: NewNameSource;
|
||||
timeBeforeFirstInputFieldEdit: number | undefined;
|
||||
nRenameSuggestionsInvocations: number;
|
||||
hadAutomaticRenameSuggestionsInvocation: boolean;
|
||||
};
|
||||
|
||||
export type RenameWidgetResult = {
|
||||
@@ -141,6 +143,10 @@ export class RenameWidget implements IRenameWidget, IContentWidget, IDisposable
|
||||
*/
|
||||
private _timeBeforeFirstInputFieldEdit: number | undefined;
|
||||
|
||||
private _nRenameSuggestionsInvocations: number;
|
||||
|
||||
private _hadAutomaticRenameSuggestionsInvocation: boolean;
|
||||
|
||||
private _renameCandidateProvidersCts: CancellationTokenSource | undefined;
|
||||
private _renameCts: CancellationTokenSource | undefined;
|
||||
|
||||
@@ -159,6 +165,10 @@ export class RenameWidget implements IRenameWidget, IContentWidget, IDisposable
|
||||
|
||||
this._isEditingRenameCandidate = false;
|
||||
|
||||
this._nRenameSuggestionsInvocations = 0;
|
||||
|
||||
this._hadAutomaticRenameSuggestionsInvocation = false;
|
||||
|
||||
this._candidates = new Set();
|
||||
|
||||
this._beforeFirstInputFieldEditSW = new StopWatch();
|
||||
@@ -387,6 +397,10 @@ export class RenameWidget implements IRenameWidget, IContentWidget, IDisposable
|
||||
|
||||
const disposeOnDone = new DisposableStore();
|
||||
|
||||
this._nRenameSuggestionsInvocations = 0;
|
||||
|
||||
this._hadAutomaticRenameSuggestionsInvocation = false;
|
||||
|
||||
if (requestRenameCandidates === undefined) {
|
||||
this._inputWithButton.button.style.display = 'none';
|
||||
} else {
|
||||
@@ -497,6 +511,8 @@ export class RenameWidget implements IRenameWidget, IContentWidget, IDisposable
|
||||
source,
|
||||
nRenameSuggestions,
|
||||
timeBeforeFirstInputFieldEdit: this._timeBeforeFirstInputFieldEdit,
|
||||
nRenameSuggestionsInvocations: this._nRenameSuggestionsInvocations,
|
||||
hadAutomaticRenameSuggestionsInvocation: this._hadAutomaticRenameSuggestionsInvocation,
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -533,6 +549,12 @@ export class RenameWidget implements IRenameWidget, IContentWidget, IDisposable
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isManuallyTriggered) {
|
||||
this._hadAutomaticRenameSuggestionsInvocation = true;
|
||||
}
|
||||
|
||||
this._nRenameSuggestionsInvocations += 1;
|
||||
|
||||
this._inputWithButton.setStopButton();
|
||||
|
||||
this._updateRenameCandidates(candidates, currentName, this._renameCts.token);
|
||||
|
||||
Reference in New Issue
Block a user