@@ -423,75 +423,16 @@ export function registerCommands(enabled: boolean): void {
423423 commandDisposables . push ( vscode . commands . registerCommand ( 'C_Cpp.RestartIntelliSenseForFile' , enabled ? onRestartIntelliSenseForFile : onDisabledCommand ) ) ;
424424 commandDisposables . push ( vscode . commands . registerCommand ( 'C_Cpp.GenerateDoxygenComment' , enabled ? onGenerateDoxygenComment : onDisabledCommand ) ) ;
425425 commandDisposables . push ( vscode . commands . registerCommand ( 'C_Cpp.CreateDeclarationOrDefinition' , enabled ? onCreateDeclarationOrDefinition : onDisabledCommand ) ) ;
426- // ---------------- Wrappers -------------
427- commandDisposables . push ( vscode . commands . registerCommand ( 'C_Cpp.ConfigurationSelectUI_Telemetry' , enabled ?
428- ( ) => {
429- logForUIExperiment ( "ConfigurationSelect" ) ;
430- onSelectConfiguration ( ) ;
431- }
432- : onDisabledCommand ) ) ;
433- commandDisposables . push ( vscode . commands . registerCommand ( 'C_Cpp.RescanWorkspaceUI_Telemetry' , enabled ?
434- ( ) => {
435- logForUIExperiment ( "RescanWorkspace" ) ;
436- onRescanWorkspace ( ) ;
437- }
438- : onDisabledCommand ) ) ;
439- commandDisposables . push ( vscode . commands . registerCommand ( 'C_Cpp.ShowIdleCodeAnalysisCommandsUI_Telemetry' , enabled ?
440- ( ) => {
441- logForUIExperiment ( "ShowIdleCodeAnalysisCommands" ) ;
442- onShowIdleCodeAnalysisCommands ( ) ;
443- }
444- : onDisabledCommand ) ) ;
445- commandDisposables . push ( vscode . commands . registerCommand ( 'C_Cpp.ShowActiveCodeAnalysisCommandsUI_Telemetry' , enabled ?
446- ( ) => {
447- logForUIExperiment ( "ShowActiveCodeAnalysisCommands" ) ;
448- onShowActiveCodeAnalysisCommands ( ) ;
449- }
450- : onDisabledCommand ) ) ;
451- commandDisposables . push ( vscode . commands . registerCommand ( 'C_Cpp.PauseParsingUI_Telemetry' , enabled ?
452- ( ) => {
453- logForUIExperiment ( "ParsingCommands" ) ;
454- onPauseParsing ( ) ;
455- }
456- : onDisabledCommand ) ) ;
457- commandDisposables . push ( vscode . commands . registerCommand ( 'C_Cpp.ResumeParsingUI_Telemetry' , enabled ?
458- ( ) => {
459- logForUIExperiment ( "ParsingCommands" ) ;
460- onResumeParsing ( ) ;
461- }
462- : onDisabledCommand ) ) ;
463- commandDisposables . push ( vscode . commands . registerCommand ( 'C_Cpp.CheckForCompilerUI_Telemetry' , enabled ?
464- ( ) => {
465- logForUIExperiment ( "CheckForCompiler" ) ;
466- onCheckForCompiler ( ) ;
467- }
468- : onDisabledCommand ) ) ;
469- commandDisposables . push ( vscode . commands . registerCommand ( 'C_Cpp.RestartIntelliSenseForFileUI_Telemetry' , enabled ?
470- ( ) => {
471- logForUIExperiment ( "RestartIntelliSenseForFile" ) ;
472- onRestartIntelliSenseForFile ( ) ;
473- }
474- : onDisabledCommand ) ) ;
475- commandDisposables . push ( vscode . commands . registerCommand ( 'C_Cpp.ShowReferencesProgressUI_Telemetry' , enabled ?
476- ( ) => {
477- logForUIExperiment ( "ShowReferencesProgress" ) ;
478- onShowReferencesProgress ( ) ;
479- }
480- : onDisabledCommand ) ) ;
481- commandDisposables . push ( vscode . commands . registerCommand ( 'C_Cpp.ShowParsingCommandsUI_Telemetry' , enabled ?
482- ( ) => {
483- logForUIExperiment ( "ParsingCommands" ) ;
484- onShowParsingCommands ( ) ;
485- }
486- : onDisabledCommand ) ) ;
487- // ----------------------------------------
488426}
489427
490- async function logForUIExperiment ( command : string ) : Promise < void > {
428+ async function logForUIExperiment ( command : string , sender ?: any ) : Promise < void > {
491429 const settings : CppSettings = new CppSettings ( ( vscode . workspace . workspaceFolders && vscode . workspace . workspaceFolders . length > 0 ) ? vscode . workspace . workspaceFolders [ 0 ] ?. uri : undefined ) ;
492- const isNewUI : string = ui . isNewUI . toString ( ) ;
493- const isOverridden : string = ( settings . experimentalFeatures ?? false ) . toString ( ) ;
494- telemetry . logLanguageServerEvent ( `experiment${ command } ` , { newUI : isNewUI , uiOverride : isOverridden } ) ;
430+ const properties : { [ key : string ] : string } = {
431+ newUI : ui . isNewUI . toString ( ) ,
432+ uiOverride : ( settings . experimentalFeatures ?? false ) . toString ( ) ,
433+ sender : util . isString ( sender ) ? sender : 'commandPalette'
434+ } ;
435+ telemetry . logLanguageServerEvent ( `experiment${ command } ` , properties ) ;
495436}
496437
497438function onDisabledCommand ( ) : void {
@@ -506,7 +447,8 @@ function onDisabledCommand(): void {
506447 vscode . window . showWarningMessage ( message ) ;
507448}
508449
509- function onRestartIntelliSenseForFile ( ) : void {
450+ function onRestartIntelliSenseForFile ( sender ?: any ) : void {
451+ logForUIExperiment ( "RestartIntelliSenseForFile" , sender ) ;
510452 const activeEditor : vscode . TextEditor | undefined = vscode . window . activeTextEditor ;
511453 if ( ! activeEditor || ! activeEditor . document || activeEditor . document . uri . scheme !== "file" ||
512454 ( activeEditor . document . languageId !== "c" && activeEditor . document . languageId !== "cpp" && activeEditor . document . languageId !== "cuda-cpp" ) ) {
@@ -590,7 +532,8 @@ function selectDefaultCompiler(): void {
590532 clients . ActiveClient . promptSelectCompiler ( true ) ;
591533}
592534
593- function onSelectConfiguration ( ) : void {
535+ function onSelectConfiguration ( sender ?: any ) : void {
536+ logForUIExperiment ( "ConfigurationSelect" , sender ) ;
594537 if ( ! isFolderOpen ( ) ) {
595538 vscode . window . showInformationMessage ( localize ( "configuration.select.first" , 'Open a folder first to select a configuration.' ) ) ;
596539 } else {
@@ -656,7 +599,8 @@ function onGoToPrevDirectiveInGroup(): void {
656599 client . handleGoToDirectiveInGroup ( false ) ;
657600}
658601
659- function onCheckForCompiler ( ) : void {
602+ function onCheckForCompiler ( sender ?: any ) : void {
603+ logForUIExperiment ( "CheckForCompiler" , sender ) ;
660604 const client : Client = getActiveClient ( ) ;
661605 client . handleCheckForCompiler ( ) ;
662606}
@@ -769,11 +713,13 @@ function onToggleDimInactiveRegions(): void {
769713 settings . update < boolean > ( "dimInactiveRegions" , ! settings . dimInactiveRegions ) ;
770714}
771715
772- function onPauseParsing ( ) : void {
716+ function onPauseParsing ( sender ?: any ) : void {
717+ logForUIExperiment ( "ParsingCommands" , sender ) ;
773718 clients . ActiveClient . pauseParsing ( ) ;
774719}
775720
776- function onResumeParsing ( ) : void {
721+ function onResumeParsing ( sender ?: any ) : void {
722+ logForUIExperiment ( "ParsingCommands" , sender ) ;
777723 clients . ActiveClient . resumeParsing ( ) ;
778724}
779725
@@ -789,19 +735,23 @@ function onCancelCodeAnalysis(): void {
789735 clients . ActiveClient . CancelCodeAnalysis ( ) ;
790736}
791737
792- function onShowParsingCommands ( ) : void {
738+ function onShowParsingCommands ( sender ?: any ) : void {
739+ logForUIExperiment ( "ParsingCommands" , sender ) ;
793740 clients . ActiveClient . handleShowParsingCommands ( ) ;
794741}
795742
796- function onShowActiveCodeAnalysisCommands ( ) : void {
743+ function onShowActiveCodeAnalysisCommands ( sender ?: any ) : void {
744+ logForUIExperiment ( "ShowActiveCodeAnalysisCommands" , sender ) ;
797745 clients . ActiveClient . handleShowActiveCodeAnalysisCommands ( ) ;
798746}
799747
800- function onShowIdleCodeAnalysisCommands ( ) : void {
748+ function onShowIdleCodeAnalysisCommands ( sender ?: any ) : void {
749+ logForUIExperiment ( "ShowIdleCodeAnalysisCommands" , sender ) ;
801750 clients . ActiveClient . handleShowIdleCodeAnalysisCommands ( ) ;
802751}
803752
804- function onShowReferencesProgress ( ) : void {
753+ function onShowReferencesProgress ( sender ?: any ) : void {
754+ logForUIExperiment ( "ShowReferencesProgress" , sender ) ;
805755 clients . ActiveClient . handleReferencesIcon ( ) ;
806756}
807757
@@ -898,7 +848,8 @@ function onLogDiagnostics(): void {
898848 clients . ActiveClient . logDiagnostics ( ) ;
899849}
900850
901- function onRescanWorkspace ( ) : void {
851+ function onRescanWorkspace ( sender ?: string ) : void {
852+ logForUIExperiment ( "RescanWorkspace" , sender ) ;
902853 clients . ActiveClient . rescanFolder ( ) ;
903854}
904855
0 commit comments