@@ -36,7 +36,8 @@ import { ILogService } from 'vs/platform/log/common/log';
36
36
import { INotificationService } from 'vs/platform/notification/common/notification' ;
37
37
import { IEditorProgressService } from 'vs/platform/progress/common/progress' ;
38
38
import { Registry } from 'vs/platform/registry/common/platform' ;
39
- import { CONTEXT_RENAME_INPUT_FOCUSED , CONTEXT_RENAME_INPUT_VISIBLE , RenameInputField } from './renameInputField' ;
39
+ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry' ;
40
+ import { CONTEXT_RENAME_INPUT_FOCUSED , CONTEXT_RENAME_INPUT_VISIBLE , RenameInputField , RenameInputFieldResult } from './renameInputField' ;
40
41
41
42
class RenameSkeleton {
42
43
@@ -149,6 +150,7 @@ class RenameController implements IEditorContribution {
149
150
@ILogService private readonly _logService : ILogService ,
150
151
@ITextResourceConfigurationService private readonly _configService : ITextResourceConfigurationService ,
151
152
@ILanguageFeaturesService private readonly _languageFeaturesService : ILanguageFeaturesService ,
153
+ @ITelemetryService private readonly _telemetryService : ITelemetryService ,
152
154
) {
153
155
this . _renameInputField = this . _disposableStore . add ( this . _instaService . createInstance ( RenameInputField , this . editor , [ 'acceptRenameInput' , 'acceptRenameInputWithPreview' ] ) ) ;
154
156
}
@@ -240,6 +242,8 @@ class RenameController implements IEditorContribution {
240
242
const inputFieldResult = await this . _renameInputField . getInput ( loc . range , loc . text , selectionStart , selectionEnd , supportPreview , newSymbolNameProvidersResults , renameCandidatesCts ) ;
241
243
trace ( 'received response from rename input field' ) ;
242
244
245
+ this . _reportTelemetry ( inputFieldResult ) ;
246
+
243
247
// no result, only hint to focus the editor or not
244
248
if ( typeof inputFieldResult === 'boolean' ) {
245
249
trace ( `returning early - rename input field response - ${ inputFieldResult } ` ) ;
@@ -325,6 +329,38 @@ class RenameController implements IEditorContribution {
325
329
focusPreviousRenameSuggestion ( ) : void {
326
330
this . _renameInputField . focusPreviousRenameSuggestion ( ) ;
327
331
}
332
+
333
+ private _reportTelemetry ( inputFieldResult : boolean | RenameInputFieldResult ) {
334
+ type RenameInvokedEvent =
335
+ {
336
+ kind : 'accepted' | 'cancelled' ;
337
+ /** provided only if kind = 'accepted' */
338
+ wantsPreview ?: boolean ;
339
+ /** provided only if kind = 'accepted' */
340
+ source ?: RenameInputFieldResult [ 'source' ] ;
341
+ /** provided only if kind = 'accepted' */
342
+ hadRenameSuggestions ?: boolean ;
343
+ } ;
344
+
345
+ type RenameInvokedClassification = {
346
+ owner : 'ulugbekna' ;
347
+ comment : 'A rename operation was invoked.' ;
348
+ kind : { classification : 'SystemMetaData' ; purpose : 'FeatureInsight' ; comment : 'Whether the rename operation was cancelled or accepted.' } ;
349
+ wantsPreview ?: { classification : 'SystemMetaData' ; purpose : 'FeatureInsight' ; comment : 'If user wanted preview.' ; isMeasurement : true } ;
350
+ source ?: { classification : 'SystemMetaData' ; purpose : 'FeatureInsight' ; comment : 'Whether the new name came from the input field or rename suggestions.' } ;
351
+ hadRenameSuggestions ?: { classification : 'SystemMetaData' ; purpose : 'FeatureInsight' ; comment : 'Whether the user had rename suggestions.' ; isMeasurement : true } ;
352
+ } ;
353
+
354
+ this . _telemetryService . publicLog2 < RenameInvokedEvent , RenameInvokedClassification > (
355
+ 'renameInvokedEvent' ,
356
+ typeof inputFieldResult === 'boolean' ? { kind : 'cancelled' } : {
357
+ kind : 'accepted' ,
358
+ wantsPreview : inputFieldResult . wantsPreview ,
359
+ source : inputFieldResult . source ,
360
+ hadRenameSuggestions : inputFieldResult . hadRenameSuggestions ,
361
+ }
362
+ ) ;
363
+ }
328
364
}
329
365
330
366
// ---- action implementation
0 commit comments