@@ -425,16 +425,25 @@ export function registerCommands(enabled: boolean): void {
425425 commandDisposables . push ( vscode . commands . registerCommand ( 'C_Cpp.CreateDeclarationOrDefinition' , enabled ? onCreateDeclarationOrDefinition : onDisabledCommand ) ) ;
426426}
427427
428- async function logForUIExperiment ( command : string , sender ?: any ) : Promise < void > {
428+ function logForUIExperiment ( command : string , sender ?: any ) : void {
429429 const settings : CppSettings = new CppSettings ( ( vscode . workspace . workspaceFolders && vscode . workspace . workspaceFolders . length > 0 ) ? vscode . workspace . workspaceFolders [ 0 ] ?. uri : undefined ) ;
430430 const properties : { [ key : string ] : string } = {
431431 newUI : ui . isNewUI . toString ( ) ,
432432 uiOverride : ( settings . experimentalFeatures ?? false ) . toString ( ) ,
433- sender : util . isString ( sender ) ? sender : 'commandPalette'
433+ sender : getSenderType ( sender )
434434 } ;
435435 telemetry . logLanguageServerEvent ( `experiment${ command } ` , properties ) ;
436436}
437437
438+ function getSenderType ( sender ?: any ) : string {
439+ if ( util . isString ( sender ) ) {
440+ return sender ;
441+ } else if ( util . isUri ( sender ) ) {
442+ return 'contextMenu' ;
443+ }
444+ return 'commandPalette' ;
445+ }
446+
438447function onDisabledCommand ( ) : void {
439448 const message : string = localize (
440449 {
@@ -675,7 +684,11 @@ async function onDisableAllTypeCodeAnalysisProblems(code: string, identifiersAnd
675684 getActiveClient ( ) . handleDisableAllTypeCodeAnalysisProblems ( code , identifiersAndUris ) ;
676685}
677686
678- async function onCreateDeclarationOrDefinition ( ) : Promise < void > {
687+ async function onCreateDeclarationOrDefinition ( sender ?: any ) : Promise < void > {
688+ const properties : { [ key : string ] : string } = {
689+ sender : getSenderType ( sender )
690+ } ;
691+ telemetry . logLanguageServerEvent ( 'CreateDeclDefn' , properties ) ;
679692 getActiveClient ( ) . handleCreateDeclarationOrDefinition ( ) ;
680693}
681694
0 commit comments