@@ -25,6 +25,7 @@ import {
25
25
DefaultAWSClientBuilder ,
26
26
globals ,
27
27
RegionProvider ,
28
+ getLogger ,
28
29
} from 'aws-core-vscode/shared'
29
30
import { initializeAuth , CredentialsStore , LoginManager , AuthUtils } from 'aws-core-vscode/auth'
30
31
import { makeEndpointsProvider , registerCommands } from 'aws-core-vscode'
@@ -45,21 +46,27 @@ export async function activateShared(context: vscode.ExtensionContext) {
45
46
const toolkit = vscode . extensions . getExtension ( VSCODE_EXTENSION_ID . awstoolkit )
46
47
if ( toolkit ) {
47
48
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.
48
51
const isDevVersion = toolkit . packageJSON . version . toString ( ) . includes ( '-' )
49
52
if ( toolkitVersion && toolkitVersion . major < 3 && ! isDevVersion ) {
50
53
await vscode . commands
51
54
. executeCommand ( 'workbench.extensions.installExtension' , VSCODE_EXTENSION_ID . awstoolkit )
52
55
. 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
+ }
63
70
)
64
71
return
65
72
}
0 commit comments