goLanguageServer: only prompt for the survey when working on Go code
Didn't add this to the maybePromptForSurvey function because it's used
when inspecting the survey config too.
Change-Id: Ifa18438094f965f06d6e4e8159f77fc2680472d7
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/315911
Trust: Rebecca Stambler <rstambler@golang.org>
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 966483b..2e0186a 100644
--- a/src/goLanguageServer.ts
+++ b/src/goLanguageServer.ts
@@ -227,6 +227,16 @@
const survey = async () => {
setTimeout(survey, timeDay);
+ // Only prompt for the survey if the user is working on Go code.
+ let foundGo = false;
+ for (const doc of vscode.workspace.textDocuments) {
+ if (doc.languageId === 'go') {
+ foundGo = true;
+ }
+ }
+ if (!foundGo) {
+ return;
+ }
maybePromptForSurvey();
};
setTimeout(update, 10 * timeMinute);