Skip to content

Commit f663bea

Browse files
committed
[release] src/goLanguageServer: enable user survey in stable version.
And, add gopls version and extension id to survey link to distinguish results from nightly and stable extensions. Adjust "showSurveyConfig' behavior for easier survey testing. 'Yes' try to prompt for survey, while 'Maybe' will try to run the survey prompt config update (which maybe results in prompting for survey). Fixes #910 Change-Id: I5490620c3c17c6c71de8a9b9cf5e2b6e9a7c6e55 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/275880 Trust: Hyang-Ah Hana Kim <[email protected]> Run-TryBot: Hyang-Ah Hana Kim <[email protected]> TryBot-Result: kokoro <[email protected]> Reviewed-by: Rebecca Stambler <[email protected]> (cherry picked from commit da0f1c6) Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/276216
1 parent d96b8e9 commit f663bea

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/goLanguageServer.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,6 @@ let defaultLanguageProviders: vscode.Disposable[] = [];
9191
// server.
9292
let restartCommand: vscode.Disposable;
9393

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-
9894
// lastUserAction is the time of the last user-triggered change.
9995
// A user-triggered change is a didOpen, didChange, didSave, or didClose event.
10096
let lastUserAction: Date = new Date();
@@ -147,7 +143,7 @@ function scheduleGoplsSuggestions(tool: Tool) {
147143
setTimeout(survey, timeDay);
148144

149145
const cfg = buildLanguageServerConfig(getGoConfig());
150-
if (!goplsSurveyOn || !cfg.enabled) {
146+
if (!cfg.enabled) {
151147
return;
152148
}
153149
maybePromptForGoplsSurvey();
@@ -823,6 +819,9 @@ export const getLatestGoplsVersion = async (tool: Tool) => {
823819
//
824820
// If this command has already been executed, it returns the saved result.
825821
export const getLocalGoplsVersion = async (cfg: LanguageServerConfig) => {
822+
if (!cfg) {
823+
return null;
824+
}
826825
if (cfg.version !== '') {
827826
return cfg.version;
828827
}
@@ -1042,8 +1041,8 @@ Would you be willing to fill out a quick survey about your experience with gopls
10421041
case 'Yes':
10431042
cfg.lastDateAccepted = now;
10441043
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}`));
10471046
break;
10481047
case 'Not now':
10491048
cfg.prompt = true;
@@ -1080,7 +1079,7 @@ function getSurveyConfig(): SurveyConfig {
10801079
}
10811080
return value;
10821081
});
1083-
return cfg;
1082+
return cfg || {};
10841083
} catch (err) {
10851084
console.log(`Error parsing JSON from ${saved}: ${err}`);
10861085
return {};
@@ -1092,9 +1091,12 @@ export async function showSurveyConfig() {
10921091
outputChannel.appendLine(JSON.stringify(getSurveyConfig(), null, 2));
10931092
outputChannel.show();
10941093

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');
10961095
switch (selected) {
10971096
case 'Yes':
1097+
promptForSurvey(getSurveyConfig(), new Date());
1098+
break;
1099+
case 'Maybe':
10981100
maybePromptForGoplsSurvey();
10991101
break;
11001102
default:

0 commit comments

Comments
 (0)