@@ -91,10 +91,6 @@ let defaultLanguageProviders: vscode.Disposable[] = [];
91
91
// server.
92
92
let restartCommand : vscode . Disposable ;
93
93
94
- // When enabled, users may be prompted to fill out the gopls survey.
95
- // For now, we turn it on in the Nightly extension to test it.
96
- const goplsSurveyOn : boolean = isNightly ( ) ;
97
-
98
94
// lastUserAction is the time of the last user-triggered change.
99
95
// A user-triggered change is a didOpen, didChange, didSave, or didClose event.
100
96
let lastUserAction : Date = new Date ( ) ;
@@ -147,7 +143,7 @@ function scheduleGoplsSuggestions(tool: Tool) {
147
143
setTimeout ( survey , timeDay ) ;
148
144
149
145
const cfg = buildLanguageServerConfig ( getGoConfig ( ) ) ;
150
- if ( ! goplsSurveyOn || ! cfg . enabled ) {
146
+ if ( ! cfg . enabled ) {
151
147
return ;
152
148
}
153
149
maybePromptForGoplsSurvey ( ) ;
@@ -823,6 +819,9 @@ export const getLatestGoplsVersion = async (tool: Tool) => {
823
819
//
824
820
// If this command has already been executed, it returns the saved result.
825
821
export const getLocalGoplsVersion = async ( cfg : LanguageServerConfig ) => {
822
+ if ( ! cfg ) {
823
+ return null ;
824
+ }
826
825
if ( cfg . version !== '' ) {
827
826
return cfg . version ;
828
827
}
@@ -1042,8 +1041,8 @@ Would you be willing to fill out a quick survey about your experience with gopls
1042
1041
case 'Yes' :
1043
1042
cfg . lastDateAccepted = now ;
1044
1043
cfg . prompt = true ;
1045
-
1046
- await vscode . env . openExternal ( vscode . Uri . parse ( `https://google.qualtrics.com/jfe/form/SV_ekAdHVcVcvKUojX` ) ) ;
1044
+ const usersGoplsVersion = await getLocalGoplsVersion ( latestConfig ) ;
1045
+ await vscode . env . openExternal ( vscode . Uri . parse ( `https://google.qualtrics.com/jfe/form/SV_ekAdHVcVcvKUojX?gopls= ${ usersGoplsVersion } &extid= ${ extensionId } ` ) ) ;
1047
1046
break ;
1048
1047
case 'Not now' :
1049
1048
cfg . prompt = true ;
@@ -1080,7 +1079,7 @@ function getSurveyConfig(): SurveyConfig {
1080
1079
}
1081
1080
return value ;
1082
1081
} ) ;
1083
- return cfg ;
1082
+ return cfg || { } ;
1084
1083
} catch ( err ) {
1085
1084
console . log ( `Error parsing JSON from ${ saved } : ${ err } ` ) ;
1086
1085
return { } ;
@@ -1092,9 +1091,12 @@ export async function showSurveyConfig() {
1092
1091
outputChannel . appendLine ( JSON . stringify ( getSurveyConfig ( ) , null , 2 ) ) ;
1093
1092
outputChannel . show ( ) ;
1094
1093
1095
- const selected = await vscode . window . showInformationMessage ( `Maybe prompt for survey?` , 'Yes' , 'No' ) ;
1094
+ const selected = await vscode . window . showInformationMessage ( `Prompt for survey?` , 'Yes' , 'Maybe ', 'No' ) ;
1096
1095
switch ( selected ) {
1097
1096
case 'Yes' :
1097
+ promptForSurvey ( getSurveyConfig ( ) , new Date ( ) ) ;
1098
+ break ;
1099
+ case 'Maybe' :
1098
1100
maybePromptForGoplsSurvey ( ) ;
1099
1101
break ;
1100
1102
default :
0 commit comments