@@ -44,6 +44,7 @@ export interface RemoteDetails extends vscode.Disposable{
4444}
4545
4646export class Remote {
47+ // Used to race between the login dialog and the logging in from a different window
4748private loginDetectedResolver : ( ( ) => void ) | undefined ;
4849private loginDetectedPromise : Promise < void > = Promise . resolve ( ) ;
4950
@@ -59,7 +60,6 @@ export class Remote{
5960
6061/**
6162 * Creates a new promise that will be resolved when login is detected in another window.
62- * This should be called when starting a setup operation that might need login.
6363 */
6464private createLoginDetectionPromise ( ) : void {
6565this . loginDetectedPromise = new Promise < void > ( ( resolve ) => {
@@ -69,7 +69,6 @@ export class Remote{
6969
7070/**
7171 * Resolves the current login detection promise if one exists.
72- * This should be called from the extension when login is detected.
7372 */
7473public resolveLoginDetected ( ) : void {
7574if ( this . loginDetectedResolver ) {
@@ -241,14 +240,13 @@ export class Remote{
241240// Migrate "session_token" file to "session", if needed.
242241await this . migrateSessionToken ( parts . label ) ;
243242
244- // Try to detect any login event that might happen after we read the current configs
245- this . createLoginDetectionPromise ( ) ;
246243// Get the URL and token belonging to this host.
247244const { url : baseUrlRaw , token } = await this . cliManager . readConfig (
248245parts . label ,
249246) ;
250247
251248const showLoginDialog = async ( message : string ) => {
249+ this . createLoginDetectionPromise ( ) ;
252250const dialogPromise = this . vscodeProposed . window . showInformationMessage (
253251message ,
254252{
@@ -359,8 +357,6 @@ export class Remote{
359357// Next is to find the workspace from the URI scheme provided.
360358let workspace : Workspace ;
361359try {
362- // We could've logged out in the meantime
363- this . createLoginDetectionPromise ( ) ;
364360this . logger . info ( `Looking for workspace ${ workspaceName } ...` ) ;
365361workspace = await workspaceClient . getWorkspaceByOwnerAndName (
366362parts . username ,
0 commit comments