Skip to content

Commit a857688

Browse files
authored
fix(amazonq): improve autoinstall message aws#4737
1 parent b899e82 commit a857688

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

packages/amazonq/src/extensionShared.ts

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import {
2525
DefaultAWSClientBuilder,
2626
globals,
2727
RegionProvider,
28+
getLogger,
2829
} from 'aws-core-vscode/shared'
2930
import { initializeAuth, CredentialsStore, LoginManager, AuthUtils } from 'aws-core-vscode/auth'
3031
import { makeEndpointsProvider, registerCommands } from 'aws-core-vscode'
@@ -45,21 +46,27 @@ export async function activateShared(context: vscode.ExtensionContext) {
4546
const toolkit = vscode.extensions.getExtension(VSCODE_EXTENSION_ID.awstoolkit)
4647
if (toolkit) {
4748
const toolkitVersion = semver.coerce(toolkit.packageJSON.version)
49+
// XXX: can't use `SemVer.prerelease` because Toolkit "prerelease" (git sha) is not a valid
50+
// semver prerelease: it may start with a number.
4851
const isDevVersion = toolkit.packageJSON.version.toString().includes('-')
4952
if (toolkitVersion && toolkitVersion.major < 3 && !isDevVersion) {
5053
await vscode.commands
5154
.executeCommand('workbench.extensions.installExtension', VSCODE_EXTENSION_ID.awstoolkit)
5255
.then(
53-
void vscode.window
54-
.showInformationMessage(
55-
`The Amazon Q extension is incompatible with AWS Toolkit versions 2.9 and below. Your AWS Toolkit was updated to version 3.0 or later.`,
56-
'Reload Now'
57-
)
58-
.then(async resp => {
59-
if (resp === 'Reload Now') {
60-
await vscode.commands.executeCommand('workbench.action.reloadWindow')
61-
}
62-
})
56+
() =>
57+
vscode.window
58+
.showInformationMessage(
59+
`The Amazon Q extension is incompatible with AWS Toolkit ${toolkitVersion} and older. Your AWS Toolkit was updated to version 3.0 or later.`,
60+
'Reload Now'
61+
)
62+
.then(async resp => {
63+
if (resp === 'Reload Now') {
64+
await vscode.commands.executeCommand('workbench.action.reloadWindow')
65+
}
66+
}),
67+
reason => {
68+
getLogger().error('workbench.extensions.installExtension failed: %O', reason)
69+
}
6370
)
6471
return
6572
}

0 commit comments

Comments
 (0)