@@ -971,63 +971,56 @@ export class DefaultClient implements Client {
971
971
paths . push ( localize ( "installCompiler.string" , "Help me install a compiler" ) ) ;
972
972
paths . push ( localize ( "noConfig.string" , "Do not configure a compiler (not recommended)" ) ) ;
973
973
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 ;
996
982
}
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 ;
1003
990
}
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
+ }
1017
1004
}
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 ] ;
1023
1016
}
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 } ) ;
1027
1023
}
1028
- util . addTrustedCompiler ( compilerPaths , settings . defaultCompiler ) ;
1029
- compilerDefaults = await this . requestCompiler ( compilerPaths ) ;
1030
- DefaultClient . updateClientConfigurations ( ) ;
1031
1024
}
1032
1025
1033
1026
async promptSelectCompiler ( isCommand : boolean ) : Promise < void > {
@@ -1037,6 +1030,7 @@ export class DefaultClient implements Client {
1037
1030
}
1038
1031
const selectCompiler : string = localize ( "selectCompiler.string" , "Select Compiler" ) ;
1039
1032
const confirmCompiler : string = localize ( "confirmCompiler.string" , "Yes" ) ;
1033
+ let action : string ;
1040
1034
const settings : OtherSettings = new OtherSettings ( ) ;
1041
1035
if ( isCommand || compilerDefaults . compilerPath !== "" ) {
1042
1036
if ( ! isCommand && ( compilerDefaults . compilerPath !== undefined ) ) {
@@ -1046,11 +1040,15 @@ export class DefaultClient implements Client {
1046
1040
settings . defaultCompiler = compilerDefaults . compilerPath ;
1047
1041
compilerDefaults = await this . requestCompiler ( compilerPaths ) ;
1048
1042
DefaultClient . updateClientConfigurations ( ) ;
1043
+ action = "confirm compiler" ;
1049
1044
} else if ( value === selectCompiler ) {
1050
1045
this . handleCompilerQuickPick ( true ) ;
1046
+ action = "show quickpick" ;
1051
1047
} else {
1052
1048
this . showPrompt ( selectCompiler , true ) ;
1049
+ action = "dismissed" ;
1053
1050
}
1051
+ telemetry . logLanguageServerEvent ( 'compilerNotification' , { action } ) ;
1054
1052
} else if ( ! isCommand && ( compilerDefaults . compilerPath === undefined ) ) {
1055
1053
this . showPrompt ( selectCompiler , false ) ;
1056
1054
} else {
0 commit comments