src/goLanguageServer: add gopls version to opt-out survey
Change-Id: Iaa981cf22ff328143b961ddfb61035d31f9e15b2
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/303118
Trust: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
diff --git a/src/goLanguageServer.ts b/src/goLanguageServer.ts
index 3d2adfc..3f13329 100644
--- a/src/goLanguageServer.ts
+++ b/src/goLanguageServer.ts
@@ -209,7 +209,7 @@
if (!usingGopls(cfg)) {
// This shouldn't happen, but if the user has a non-gopls language
// server enabled, we shouldn't prompt them to change.
- if (cfg.serverName !== '') {
+ if (cfg.serverName !== '' && cfg.serverName !== 'gopls') {
return;
}
// Prompt the user to enable gopls and record what actions they took.
@@ -232,7 +232,6 @@
}
maybePromptForGoplsSurvey();
};
-
setTimeout(update, 10 * timeMinute);
setTimeout(survey, 30 * timeMinute);
}
@@ -313,10 +312,18 @@
if (!s) {
return cfg;
}
+ let goplsVersion = await getLocalGoplsVersion(latestConfig);
+ if (!goplsVersion) {
+ goplsVersion = 'not found';
+ }
switch (s.title) {
case 'Yes':
cfg.prompt = false;
- await vscode.env.openExternal(vscode.Uri.parse('https://forms.gle/hwC8CncV7Cyc2yBN6'));
+ await vscode.env.openExternal(
+ vscode.Uri.parse(
+ `https://docs.google.com/forms/d/e/1FAIpQLSdeqOas92JBD3Qkr-XyIiCuPeZvjmUuL07vu3WFNeaZZvrJDQ/viewform?entry.1049591455=${goplsVersion}&resourcekey=0-VmBGvZtiC8z9qytyA8ThnA`
+ )
+ );
break;
case 'No':
break;
@@ -446,7 +453,6 @@
if (isInPreviewMode()) {
documentSelector.push({ language: 'tmpl', scheme: 'file' }, { language: 'tmpl', scheme: 'untitled' });
}
-
const c = new LanguageClient(
'go', // id
cfg.serverName, // name e.g. gopls
@@ -935,10 +941,6 @@
env: toolExecutionEnvironment(),
checkForUpdates: getCheckForToolsUpdatesConfig(goConfig)
};
- // Don't look for the path if the server is not enabled.
- if (!cfg.enabled) {
- return cfg;
- }
const languageServerPath = getLanguageServerToolPath();
if (!languageServerPath) {
// Assume the getLanguageServerToolPath will show the relevant
@@ -949,6 +951,10 @@
cfg.path = languageServerPath;
cfg.serverName = getToolFromToolPath(cfg.path);
+ if (!cfg.enabled) {
+ return cfg;
+ }
+
// Get the mtime of the language server binary so that we always pick up
// the right version.
const stats = fs.statSync(languageServerPath);
@@ -1017,6 +1023,9 @@
if (tool.name !== 'gopls' || (!mustCheck && (cfg.checkForUpdates === 'off' || IsInCloudIDE))) {
return null;
}
+ if (!cfg.enabled) {
+ return null;
+ }
// First, run the "gopls version" command and parse its results.
// TODO(rstambler): Confirm that the gopls binary's modtime matches the