@@ -59,6 +59,7 @@ export class Remote {
5959 private readonly pathResolver : PathResolver ;
6060 private readonly cliManager : CliManager ;
6161
62+ // Used to race between the login dialog and the logging in from a different window
6263 private loginDetectedResolver : ( ( ) => void ) | undefined ;
6364 private loginDetectedPromise : Promise < void > = Promise . resolve ( ) ;
6465
@@ -75,7 +76,6 @@ export class Remote {
7576
7677 /**
7778 * Creates a new promise that will be resolved when login is detected in another window.
78- * This should be called when starting a setup operation that might need login.
7979 */
8080 private createLoginDetectionPromise ( ) : void {
8181 this . loginDetectedPromise = new Promise < void > ( ( resolve ) => {
@@ -85,7 +85,6 @@ export class Remote {
8585
8686 /**
8787 * Resolves the current login detection promise if one exists.
88- * This should be called from the extension when login is detected.
8988 */
9089 public resolveLoginDetected ( ) : void {
9190 if ( this . loginDetectedResolver ) {
@@ -257,14 +256,13 @@ export class Remote {
257256 // Migrate "session_token" file to "session", if needed.
258257 await this . migrateSessionToken ( parts . label ) ;
259258
260- // Try to detect any login event that might happen after we read the current configs
261- this . createLoginDetectionPromise ( ) ;
262259 // Get the URL and token belonging to this host.
263260 const { url : baseUrlRaw , token } = await this . cliManager . readConfig (
264261 parts . label ,
265262 ) ;
266263
267264 const showLoginDialog = async ( message : string ) => {
265+ this . createLoginDetectionPromise ( ) ;
268266 const dialogPromise = this . vscodeProposed . window . showInformationMessage (
269267 message ,
270268 {
@@ -375,8 +373,6 @@ export class Remote {
375373 // Next is to find the workspace from the URI scheme provided.
376374 let workspace : Workspace ;
377375 try {
378- // We could've logged out in the meantime
379- this . createLoginDetectionPromise ( ) ;
380376 this . logger . info ( `Looking for workspace ${ workspaceName } ...` ) ;
381377 workspace = await workspaceClient . getWorkspaceByOwnerAndName (
382378 parts . username ,
0 commit comments