src/goLanguageServer: prompt for the survey regardless of gopls usage
We've agreed that the survey should be generalized to the entire
extension, regardless of whether the user uses gopls.
Change-Id: Ie2c0bd6d2dff6bfd1e05b935a7d23370d98b98b4
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/313534
Trust: Rebecca Stambler <rstambler@golang.org>
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
diff --git a/src/goLanguageServer.ts b/src/goLanguageServer.ts
index ddbaef6..a6107a6 100644
--- a/src/goLanguageServer.ts
+++ b/src/goLanguageServer.ts
@@ -226,11 +226,7 @@
const survey = async () => {
setTimeout(survey, timeDay);
- const cfg = buildLanguageServerConfig(getGoConfig());
- if (!usingGopls(cfg)) {
- return;
- }
- maybePromptForGoplsSurvey();
+ maybePromptForSurvey();
};
setTimeout(update, 10 * timeMinute);
setTimeout(survey, 30 * timeMinute);
@@ -1288,9 +1284,9 @@
lastDateAccepted?: Date;
}
-function maybePromptForGoplsSurvey() {
+function maybePromptForSurvey() {
const now = new Date();
- let cfg = shouldPromptForGoplsSurvey(now, getSurveyConfig());
+ let cfg = shouldPromptForSurvey(now, getSurveyConfig());
if (!cfg) {
return;
}
@@ -1315,7 +1311,7 @@
setTimeout(callback, ms);
}
-export function shouldPromptForGoplsSurvey(now: Date, cfg: SurveyConfig): SurveyConfig {
+export function shouldPromptForSurvey(now: Date, cfg: SurveyConfig): SurveyConfig {
// If the prompt value is not set, assume we haven't prompted the user
// and should do so.
if (cfg.prompt === undefined) {
@@ -1375,8 +1371,8 @@
async function promptForSurvey(cfg: SurveyConfig, now: Date): Promise<SurveyConfig> {
const selected = await vscode.window.showInformationMessage(
- `Looks like you're using gopls, the Go language server.
-Would you be willing to fill out a quick survey about your experience with gopls?`,
+ `Looks like you are using the Go extension for VS Code.
+Could you help us improve this extension by filling out a 1-2 minute survey about your experience with it?`,
'Yes',
'Not now',
'Never'
@@ -1390,10 +1386,11 @@
{
cfg.lastDateAccepted = now;
cfg.prompt = true;
+ const goplsEnabled = latestConfig.enabled;
const usersGoplsVersion = await getLocalGoplsVersion(latestConfig);
await vscode.env.openExternal(
vscode.Uri.parse(
- `https://google.qualtrics.com/jfe/form/SV_ekAdHVcVcvKUojX?gopls=${usersGoplsVersion}&extid=${extensionId}`
+ `https://google.qualtrics.com/jfe/form/SV_ekAdHVcVcvKUojX?usingGopls=${goplsEnabled}&gopls=${usersGoplsVersion}&extid=${extensionId}`
)
);
}
@@ -1472,7 +1469,7 @@
promptForSurvey(getSurveyConfig(), new Date());
break;
case 'Maybe':
- maybePromptForGoplsSurvey();
+ maybePromptForSurvey();
break;
default:
break;
diff --git a/test/gopls/survey.test.ts b/test/gopls/survey.test.ts
index b5b8424..f065510 100644
--- a/test/gopls/survey.test.ts
+++ b/test/gopls/survey.test.ts
@@ -70,7 +70,7 @@
sinon.replace(Math, 'random', () => 0);
const now = new Date('2020-04-29');
- const gotPrompt = goLanguageServer.shouldPromptForGoplsSurvey(now, testConfig);
+ const gotPrompt = goLanguageServer.shouldPromptForSurvey(now, testConfig);
if (wantPrompt) {
assert.ok(gotPrompt, `prompt determination failed for ${i}`);
} else {