@@ -15,7 +15,7 @@ import { showViewLogsMessage } from '../shared/utilities/messages'
15
15
import { CodeCatalystAuthenticationProvider } from './auth'
16
16
import { getCodeCatalystDevEnvId } from '../shared/vscode/env'
17
17
import globals from '../shared/extensionGlobals'
18
- import { recordSource } from './utils'
18
+ import { isDevenvVscode , recordSource } from './utils'
19
19
20
20
const localize = nls . loadMessageBundle ( )
21
21
@@ -28,6 +28,7 @@ export function watchRestartingDevEnvs(ctx: ExtContext, authProvider: CodeCataly
28
28
if ( restartHandled || conn === undefined || authProvider . auth . getConnectionState ( conn ) !== 'valid' ) {
29
29
return
30
30
}
31
+ getLogger ( ) . info ( `codecatalyst: reconnect: onDidChangeActiveConnection: startUrl=${ conn . startUrl } ` )
31
32
32
33
const client = await createClient ( conn )
33
34
const envId = getCodeCatalystDevEnvId ( )
@@ -81,7 +82,7 @@ async function reconnectDevEnvs(client: CodeCatalystClient, ctx: ExtContext): Pr
81
82
const polledDevEnvs = devenvNames . join ( ', ' )
82
83
const progressTitle = localize (
83
84
'AWS.codecatalyst.reconnect.restarting' ,
84
- 'The following devenvs are restarting: {0}' ,
85
+ 'Dev Environments restarting: {0}' ,
85
86
polledDevEnvs
86
87
)
87
88
vscode . window . withProgress (
@@ -143,6 +144,7 @@ async function pollDevEnvs(
143
144
await setWatchedDevEnvStatus ( memento , devenvs , true )
144
145
145
146
const shouldCloseRootInstance = Object . keys ( devenvs ) . length === 1
147
+ getLogger ( ) . info ( `codecatalyst: reconnect: pollDevEnvs: ${ Object . keys ( devenvs ) . length } ` )
146
148
147
149
while ( Object . keys ( devenvs ) . length > 0 ) {
148
150
if ( token . isCancellationRequested ) {
@@ -152,7 +154,6 @@ async function pollDevEnvs(
152
154
153
155
for ( const id in devenvs ) {
154
156
const details = devenvs [ id ]
155
-
156
157
const devenvName = getDevEnvName ( details . alias , id )
157
158
158
159
try {
@@ -162,18 +163,31 @@ async function pollDevEnvs(
162
163
projectName : details . projectName ,
163
164
} )
164
165
166
+ const ide = metadata . ides ?. [ 0 ] ?. name
167
+ getLogger ( ) . info ( `codecatalyst: reconnect: ides=${ ide } statusReason=${ metadata . statusReason } ` )
168
+
165
169
if ( metadata ?. status === 'RUNNING' ) {
166
170
progress . report ( {
167
171
message : `Dev Environment ${ devenvName } is now running. Attempting to reconnect.` ,
168
172
} )
169
173
170
174
openReconnectedDevEnv ( client , id , details , shouldCloseRootInstance )
171
175
172
- // We no longer need to watch this devenv anymore because it's already being re-opened in SSH
176
+ // Don't watch this devenv, it is already being re-opened in SSH.
177
+ delete devenvs [ id ]
178
+ } else if ( ! isDevenvVscode ( metadata . ides ) ) {
179
+ // Technically vscode _can_ connect to a ideRuntime=jetbrains/cloud9 devenv, but
180
+ // we refuse to anyway so that the experience is consistent with other IDEs
181
+ // (jetbrains/cloud9) which are not capable of connecting to a devenv that lacks
182
+ // their runtime/bootstrap files.
183
+ const ide = metadata . ides ?. [ 0 ]
184
+ const toIde = ide ? ` to "${ ide . name } "` : ''
185
+ progress . report ( { message : `Dev Environment ${ devenvName } was switched${ toIde } ` } )
186
+ // Don't watch devenv that is no longer connectable.
173
187
delete devenvs [ id ]
174
188
} else if ( isTerminating ( metadata ) ) {
175
189
progress . report ( { message : `Dev Environment ${ devenvName } is terminating` } )
176
- // We no longer need to watch a devenv that is in a terminating state
190
+ // Don't watch devenv that is terminating.
177
191
delete devenvs [ id ]
178
192
} else if ( isExpired ( details . previousConnectionTimestamp ) ) {
179
193
progress . report ( { message : `Dev Environment ${ devenvName } has expired` } )
@@ -192,7 +206,6 @@ function isTerminating(devenv: Pick<DevEnvironment, 'status'>): boolean {
192
206
if ( ! devenv . status ) {
193
207
return false
194
208
}
195
-
196
209
return devenv . status === 'FAILED' || devenv . status === 'DELETING' || devenv . status === 'DELETED'
197
210
}
198
211
0 commit comments