@@ -971,63 +971,56 @@ export class DefaultClient implements Client {
971971 paths . push ( localize ( "installCompiler.string" , "Help me install a compiler" ) ) ;
972972 paths . push ( localize ( "noConfig.string" , "Do not configure a compiler (not recommended)" ) ) ;
973973 const index : number = await this . showSelectDefaultCompiler ( paths ) ;
974- let action : string ;
975- switch ( index ) {
976- case - 1 :
977- action = 'escaped' ;
978- break ;
979- case paths . length - 1 :
980- action = 'disable' ;
981- break ;
982- case paths . length - 2 :
983- action = 'help' ;
984- break ;
985- case paths . length - 3 :
986- action = 'browse' ;
987- break ;
988- default :
989- action = 'select compiler' ;
990- break ;
991- }
992- telemetry . logLanguageServerEvent ( 'compilerSelection' , { action } ) ;
993- if ( index === - 1 ) {
994- if ( showSecondPrompt ) {
995- this . showPrompt ( selectCompiler , true ) ;
974+ let action : string = "" ;
975+ try {
976+ if ( index === - 1 ) {
977+ action = "escaped" ;
978+ if ( showSecondPrompt ) {
979+ this . showPrompt ( selectCompiler , true ) ;
980+ }
981+ return ;
996982 }
997- return ;
998- }
999- if ( index === paths . length - 1 ) {
1000- settings . defaultCompiler = "" ;
1001- if ( showSecondPrompt ) {
1002- this . showPrompt ( selectCompiler , true ) ;
983+ if ( index === paths . length - 1 ) {
984+ action = "disable" ;
985+ settings . defaultCompiler = "" ;
986+ if ( showSecondPrompt ) {
987+ this . showPrompt ( selectCompiler , true ) ;
988+ }
989+ return ;
1003990 }
1004- return ;
1005- }
1006- if ( index === paths . length - 2 ) {
1007- switch ( os . platform ( ) ) {
1008- case 'win32' :
1009- vscode . commands . executeCommand ( 'vscode.open' , "https://go.microsoft.com/fwlink/?linkid=2217614" ) ;
1010- return ;
1011- case 'darwin' :
1012- vscode . commands . executeCommand ( 'vscode.open' , "https://go.microsoft.com/fwlink/?linkid=2217706" ) ;
1013- return ;
1014- default : // Linux
1015- vscode . commands . executeCommand ( 'vscode.open' , "https://go.microsoft.com/fwlink/?linkid=2217615" ) ;
1016- return ;
991+ if ( index === paths . length - 2 ) {
992+ action = "help" ;
993+ switch ( os . platform ( ) ) {
994+ case 'win32' :
995+ vscode . commands . executeCommand ( 'vscode.open' , "https://go.microsoft.com/fwlink/?linkid=2217614" ) ;
996+ return ;
997+ case 'darwin' :
998+ vscode . commands . executeCommand ( 'vscode.open' , "https://go.microsoft.com/fwlink/?linkid=2217706" ) ;
999+ return ;
1000+ default : // Linux
1001+ vscode . commands . executeCommand ( 'vscode.open' , "https://go.microsoft.com/fwlink/?linkid=2217615" ) ;
1002+ return ;
1003+ }
10171004 }
1018- }
1019- if ( index === paths . length - 3 ) {
1020- const result : vscode . Uri [ ] | undefined = await vscode . window . showOpenDialog ( ) ;
1021- if ( result === undefined || result . length === 0 ) {
1022- return ;
1005+ if ( index === paths . length - 3 ) {
1006+ const result : vscode . Uri [ ] | undefined = await vscode . window . showOpenDialog ( ) ;
1007+ if ( result === undefined || result . length === 0 ) {
1008+ action = "browse dismissed" ;
1009+ return ;
1010+ }
1011+ action = "compiler browsed" ;
1012+ settings . defaultCompiler = result [ 0 ] . fsPath ;
1013+ } else {
1014+ action = "select compiler" ;
1015+ settings . defaultCompiler = util . isCl ( paths [ index ] ) ? "cl.exe" : paths [ index ] ;
10231016 }
1024- settings . defaultCompiler = result [ 0 ] . fsPath ;
1025- } else {
1026- settings . defaultCompiler = util . isCl ( paths [ index ] ) ? "cl.exe" : paths [ index ] ;
1017+
1018+ util . addTrustedCompiler ( compilerPaths , settings . defaultCompiler ) ;
1019+ compilerDefaults = await this . requestCompiler ( compilerPaths ) ;
1020+ DefaultClient . updateClientConfigurations ( ) ;
1021+ } finally {
1022+ telemetry . logLanguageServerEvent ( 'compilerSelection' , { action } , { compilerCount : paths . length } ) ;
10271023 }
1028- util . addTrustedCompiler ( compilerPaths , settings . defaultCompiler ) ;
1029- compilerDefaults = await this . requestCompiler ( compilerPaths ) ;
1030- DefaultClient . updateClientConfigurations ( ) ;
10311024 }
10321025
10331026 async promptSelectCompiler ( isCommand : boolean ) : Promise < void > {
@@ -1037,6 +1030,7 @@ export class DefaultClient implements Client {
10371030 }
10381031 const selectCompiler : string = localize ( "selectCompiler.string" , "Select Compiler" ) ;
10391032 const confirmCompiler : string = localize ( "confirmCompiler.string" , "Yes" ) ;
1033+ let action : string ;
10401034 const settings : OtherSettings = new OtherSettings ( ) ;
10411035 if ( isCommand || compilerDefaults . compilerPath !== "" ) {
10421036 if ( ! isCommand && ( compilerDefaults . compilerPath !== undefined ) ) {
@@ -1046,11 +1040,15 @@ export class DefaultClient implements Client {
10461040 settings . defaultCompiler = compilerDefaults . compilerPath ;
10471041 compilerDefaults = await this . requestCompiler ( compilerPaths ) ;
10481042 DefaultClient . updateClientConfigurations ( ) ;
1043+ action = "confirm compiler" ;
10491044 } else if ( value === selectCompiler ) {
10501045 this . handleCompilerQuickPick ( true ) ;
1046+ action = "show quickpick" ;
10511047 } else {
10521048 this . showPrompt ( selectCompiler , true ) ;
1049+ action = "dismissed" ;
10531050 }
1051+ telemetry . logLanguageServerEvent ( 'compilerNotification' , { action } ) ;
10541052 } else if ( ! isCommand && ( compilerDefaults . compilerPath === undefined ) ) {
10551053 this . showPrompt ( selectCompiler , false ) ;
10561054 } else {
0 commit comments