@@ -109,7 +109,11 @@ export class Remote {
109
109
// Next is to find the workspace from the URI scheme provided.
110
110
let workspace : Workspace
111
111
try {
112
+ this . storage . writeToCoderOutputChannel ( `Looking for workspace ${ workspaceName } ...` )
112
113
workspace = await workspaceRestClient . getWorkspaceByOwnerAndName ( parts . username , parts . workspace )
114
+ this . storage . writeToCoderOutputChannel (
115
+ `Found workspace ${ workspaceName } with status ${ workspace . latest_build . status } ` ,
116
+ )
113
117
this . commands . workspace = workspace
114
118
} catch ( error ) {
115
119
if ( ! isAxiosError ( error ) ) {
@@ -186,11 +190,13 @@ export class Remote {
186
190
} ) ,
187
191
)
188
192
193
+ this . storage . writeToCoderOutputChannel ( `Trying to start ${ workspaceName } ...` )
189
194
const latestBuild = await workspaceRestClient . startWorkspace ( workspace . id , versionID )
190
195
workspace = {
191
196
...workspace ,
192
197
latest_build : latestBuild ,
193
198
}
199
+ this . storage . writeToCoderOutputChannel ( `${ workspaceName } is now ${ workspace . latest_build . status } ` )
194
200
this . commands . workspace = workspace
195
201
}
196
202
@@ -201,6 +207,7 @@ export class Remote {
201
207
workspace . latest_build . status === "starting" ||
202
208
workspace . latest_build . status === "stopping"
203
209
) {
210
+ this . storage . writeToCoderOutputChannel ( `Waiting for ${ workspaceName } ...` )
204
211
const writeEmitter = new vscode . EventEmitter < string > ( )
205
212
// We use a terminal instead of an output channel because it feels more
206
213
// familiar to a user!
@@ -257,30 +264,31 @@ export class Remote {
257
264
workspace = await workspaceRestClient . getWorkspace ( workspace . id )
258
265
this . commands . workspace = workspace
259
266
terminal . dispose ( )
267
+ }
260
268
261
- if ( buildComplete ) {
262
- buildComplete ( )
263
- }
269
+ if ( buildComplete ) {
270
+ buildComplete ( )
271
+ }
264
272
265
- if ( workspace . latest_build . status === "stopped" ) {
266
- const result = await this . vscodeProposed . window . showInformationMessage (
267
- `This workspace is stopped!` ,
268
- {
269
- modal : true ,
270
- detail : `Click below to start and open ${ workspaceName } .` ,
271
- useCustom : true ,
272
- } ,
273
- "Start Workspace" ,
274
- )
275
- if ( ! result ) {
276
- await this . closeRemote ( )
277
- }
278
- await this . reloadWindow ( )
279
- return
273
+ if ( workspace . latest_build . status === "stopped" ) {
274
+ const result = await this . vscodeProposed . window . showInformationMessage (
275
+ `This workspace is stopped!` ,
276
+ {
277
+ modal : true ,
278
+ detail : `Click below to start and open ${ workspaceName } .` ,
279
+ useCustom : true ,
280
+ } ,
281
+ "Start Workspace" ,
282
+ )
283
+ if ( ! result ) {
284
+ await this . closeRemote ( )
280
285
}
286
+ await this . reloadWindow ( )
287
+ return
281
288
}
282
289
283
290
// Pick an agent.
291
+ this . storage . writeToCoderOutputChannel ( `Finding agent for ${ workspaceName } ...` )
284
292
const agents = workspace . latest_build . resources . reduce ( ( acc , resource ) => {
285
293
return acc . concat ( resource . agents || [ ] )
286
294
} , [ ] as WorkspaceAgent [ ] )
@@ -303,8 +311,10 @@ export class Remote {
303
311
}
304
312
agent = matchingAgents [ 0 ]
305
313
}
314
+ this . storage . writeToCoderOutputChannel ( `Found agent ${ agent . name } with status ${ agent . status } ` )
306
315
307
316
// Do some janky setting manipulation.
317
+ this . storage . writeToCoderOutputChannel ( "Modifying settings..." )
308
318
const remotePlatforms = this . vscodeProposed . workspace
309
319
. getConfiguration ( )
310
320
. get < Record < string , string > > ( "remote.SSH.remotePlatform" , { } )
@@ -365,6 +375,7 @@ export class Remote {
365
375
}
366
376
367
377
// Watch for workspace updates.
378
+ this . storage . writeToCoderOutputChannel ( `Establishing watcher for ${ workspaceName } ...` )
368
379
const workspaceUpdate = new vscode . EventEmitter < Workspace > ( )
369
380
const watchURL = new URL ( `${ baseUrlRaw } /api/v2/workspaces/${ workspace . id } /watch` )
370
381
const eventSource = new EventSource ( watchURL . toString ( ) , {
@@ -450,6 +461,7 @@ export class Remote {
450
461
451
462
// Wait for the agent to connect.
452
463
if ( agent . status === "connecting" ) {
464
+ this . storage . writeToCoderOutputChannel ( `Waiting for ${ workspaceName } /${ agent . name } ...` )
453
465
await vscode . window . withProgress (
454
466
{
455
467
title : "Waiting for the agent to connect..." ,
@@ -484,12 +496,14 @@ export class Remote {
484
496
} )
485
497
} ,
486
498
)
499
+ this . storage . writeToCoderOutputChannel ( `Agent ${ agent . name } status is now ${ agent . status } ` )
487
500
}
488
501
489
502
// Make sure agent did not time out.
490
503
// TODO: Seems like maybe we should check for all the good states rather
491
504
// than one bad state? Agents can error in many ways.
492
505
if ( agent . status === "timeout" ) {
506
+ this . storage . writeToCoderOutputChannel ( `${ workspaceName } /${ agent . name } timed out` )
493
507
const result = await this . vscodeProposed . window . showErrorMessage ( "Connection timed out..." , {
494
508
useCustom : true ,
495
509
modal : true ,
@@ -509,6 +523,7 @@ export class Remote {
509
523
// If we didn't write to the SSH config file, connecting would fail with
510
524
// "Host not found".
511
525
try {
526
+ this . storage . writeToCoderOutputChannel ( "Updating SSH config..." )
512
527
await this . updateSSHConfig ( workspaceRestClient , parts . label , parts . host , hasCoderLogs )
513
528
} catch ( error ) {
514
529
this . storage . writeToCoderOutputChannel ( `Failed to configure SSH: ${ error } ` )
@@ -533,6 +548,8 @@ export class Remote {
533
548
} ) ,
534
549
)
535
550
551
+ this . storage . writeToCoderOutputChannel ( "Remote setup complete" )
552
+
536
553
// Returning the URL and token allows the plugin to authenticate its own
537
554
// client, for example to display the list of workspaces belonging to this
538
555
// deployment in the sidebar. We use our own client in here for reasons
0 commit comments