src/goInstallTools: prompt again after showing 'release notes'
Users may want to update after reviewing the release notes.
Fixes golang/vscode-go#646
Change-Id: I46dbb89476eec741f4f7222d9a7e2817796a91dd
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/255047
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
diff --git a/src/goInstallTools.ts b/src/goInstallTools.ts
index 1ac3335..d4919f5 100644
--- a/src/goInstallTools.ts
+++ b/src/goInstallTools.ts
@@ -319,27 +319,33 @@
}
const goVersion = await getGoVersion();
let updateMsg = `Your version of ${tool.name} appears to be out of date. Please update for an improved experience.`;
- const choices: string[] = ['Update'];
+ let choices: string[] = ['Update'];
if (toolName === `gopls`) {
choices.push('Release Notes');
}
if (newVersion) {
updateMsg = `A new version of ${tool.name} (v${newVersion}) is available. Please update for an improved experience.`;
}
- const selected = await vscode.window.showInformationMessage(updateMsg, ...choices);
- switch (selected) {
- case 'Update':
- await installTools([toolVersion], goVersion);
- break;
- case 'Release Notes':
- vscode.commands.executeCommand(
- 'vscode.open',
- vscode.Uri.parse(`https://github.com/golang/tools/releases/tag/${tool.name}/v${newVersion}`)
- );
- break;
- default:
- declinedUpdates.push(tool);
- break;
+
+ while (choices.length > 0) {
+ const selected = await vscode.window.showInformationMessage(updateMsg, ...choices);
+ switch (selected) {
+ case 'Update':
+ choices = [];
+ await installTools([toolVersion], goVersion);
+ break;
+ case 'Release Notes':
+ choices = choices.filter((value) => value !== 'Release Notes');
+ vscode.commands.executeCommand(
+ 'vscode.open',
+ vscode.Uri.parse(`https://github.com/golang/tools/releases/tag/${tool.name}/v${newVersion}`)
+ );
+ break;
+ default:
+ choices = [];
+ declinedUpdates.push(tool);
+ break;
+ }
}
}