@@ -746,15 +746,78 @@ index fdd5890c69f72025b94913380f0d226226e8c8fb..e084236526b38c1144d47b8b3000b367
746746 (err: any, socket: ISocket | undefined) => {
747747 if (err || !socket) {
748748 options.logService.error(`${logPrefix} socketFactory.connect() failed. Error:`);
749- @@ -413,6 +413,8 @@ abstract class PersistentConnection extends Disposable {
749+ @@ -331,12 +331,16 @@ export const enum PersistentConnectionEventType {
750+ }
751+ export class ConnectionLostEvent {
752+ public readonly type = PersistentConnectionEventType.ConnectionLost;
753+ + constructor(
754+ + public readonly suppressPopup?: boolean
755+ + ) { }
756+ }
757+ export class ReconnectionWaitEvent {
758+ public readonly type = PersistentConnectionEventType.ReconnectionWait;
759+ constructor(
760+ public readonly durationSeconds: number,
761+ - private readonly cancellableTimer: CancelablePromise<void>
762+ + private readonly cancellableTimer: CancelablePromise<void>,
763+ + public readonly suppressPopup?: boolean
764+ ) { }
765+
766+ public skipWait(): void {
767+ @@ -345,12 +349,21 @@ export class ReconnectionWaitEvent {
768+ }
769+ export class ReconnectionRunningEvent {
770+ public readonly type = PersistentConnectionEventType.ReconnectionRunning;
771+ + constructor(
772+ + public readonly suppressPopup?: boolean
773+ + ) { }
774+ }
775+ export class ConnectionGainEvent {
776+ public readonly type = PersistentConnectionEventType.ConnectionGain;
777+ + constructor(
778+ + public readonly suppressPopup?: boolean
779+ + ) { }
780+ }
781+ export class ReconnectionPermanentFailureEvent {
782+ public readonly type = PersistentConnectionEventType.ReconnectionPermanentFailure;
783+ + constructor(
784+ + public readonly suppressPopup?: boolean | undefined
785+ + ) { }
786+ }
787+ export type PersistenConnectionEvent = ConnectionGainEvent | ConnectionLostEvent | ReconnectionWaitEvent | ReconnectionRunningEvent | ReconnectionPermanentFailureEvent;
788+
789+ @@ -411,16 +424,20 @@ abstract class PersistentConnection extends Disposable {
790+ }
791+ const logPrefix = commonLogPrefix(this._connectionType, this.reconnectionToken, true);
750792 this._options.logService.info(`${logPrefix} starting reconnecting loop. You can get more information with the trace log level.`);
751- this._onDidStateChange.fire(new ConnectionLostEvent());
793+ - this._onDidStateChange.fire(new ConnectionLostEvent());
794+ + let suppressPopup = true;
795+ + this._onDidStateChange.fire(new ConnectionLostEvent(suppressPopup));
752796 const TIMES = [5, 5, 10, 10, 10, 10, 10, 30];
753- + // const SHOW_POPUP_ON_ATTEMPT = 2 // aka third attempt
797+ + const SHOW_POPUP_ON_ATTEMPT = 2 // aka third attempt
754798+
755799 const disconnectStartTime = Date.now();
756800 let attempt = -1;
757801 do {
802+ attempt++;
803+ + suppressPopup = (attempt < SHOW_POPUP_ON_ATTEMPT) ? true : false
804+ const waitTime = (attempt < TIMES.length ? TIMES[attempt] : TIMES[TIMES.length - 1]);
805+ try {
806+ const sleepPromise = sleep(waitTime);
807+ - this._onDidStateChange.fire(new ReconnectionWaitEvent(waitTime, sleepPromise));
808+ + this._onDidStateChange.fire(new ReconnectionWaitEvent(waitTime, sleepPromise, suppressPopup));
809+
810+ this._options.logService.info(`${logPrefix} waiting for ${waitTime} seconds before reconnecting...`);
811+ try {
812+ @@ -433,7 +450,7 @@ abstract class PersistentConnection extends Disposable {
813+ }
814+
815+ // connection was lost, let's try to re-establish it
816+ - this._onDidStateChange.fire(new ReconnectionRunningEvent());
817+ + this._onDidStateChange.fire(new ReconnectionRunningEvent(suppressPopup));
818+ this._options.logService.info(`${logPrefix} resolving connection...`);
819+ const simpleOptions = await resolveConnectionOptions(this._options, this.reconnectionToken, this.protocol);
820+ this._options.logService.info(`${logPrefix} connecting to ${simpleOptions.host}:${simpleOptions.port}...`);
758821diff --git a/src/vs/platform/storage/browser/storageService.ts b/src/vs/platform/storage/browser/storageService.ts
759822index ab3fd347b69f8a3d9b96e706cd87c911b8ffed6b..9d351037b577f9f1edfd18ae9b3c48a211f4467f 100644
760823--- a/src/vs/platform/storage/browser/storageService.ts
@@ -3885,24 +3948,84 @@ index 94e7e7a4bac154c45078a1b5034e50634a7a43af..8164200dcef1efbc65b50eef9c270af3
38853948 this._dirnameKey.set(value ? dirname(value).fsPath : null);
38863949 this._pathKey.set(value ? value.fsPath : null);
38873950diff --git a/src/vs/workbench/contrib/remote/browser/remote.ts b/src/vs/workbench/contrib/remote/browser/remote.ts
3888- index 98573a206f14928fc3fdf18fe927cb75034e4ad1..2f6a2fd6733e286024d20530773e3fbc26ffe16c 100644
3951+ index 98573a206f14928fc3fdf18fe927cb75034e4ad1..3ffe27b816e2d0a630985a24dd1af910877c2295 100644
38893952--- a/src/vs/workbench/contrib/remote/browser/remote.ts
38903953+++ b/src/vs/workbench/contrib/remote/browser/remote.ts
3891- @@ -795,10 +795,10 @@ class RemoteAgentConnectionStatusListener implements IWorkbenchContribution {
3892- }
3954+ @@ -635,7 +635,7 @@ class VisibleProgress {
3955+ return this._lastReport;
3956+ }
3957+
3958+ - constructor(progressService: IProgressService, location: ProgressLocation, initialReport: string | null, buttons: string[], onDidCancel: (choice: number | undefined, lastReport: string | null) => void) {
3959+ + constructor(progressService: IProgressService, location: ProgressLocation, initialReport: string | null, buttons: string[], onDidCancel: (choice: number | undefined, lastReport: string | null) => void, suppressPopup: Boolean | undefined) {
3960+ this._isDisposed = false;
3961+ this._lastReport = initialReport;
3962+ this._currentProgressPromiseResolve = null;
3963+ @@ -644,8 +644,10 @@ class VisibleProgress {
3964+
3965+ const promise = new Promise<void>((resolve) => this._currentProgressPromiseResolve = resolve);
3966+
3967+ + const options = suppressPopup ? { location: location, buttons: buttons, silent: suppressPopup } : { location: location, buttons: buttons }
3968+ +
3969+ progressService.withProgress(
3970+ - { location: location, buttons: buttons },
3971+ + options,
3972+ (progress) => { if (!this._isDisposed) { this._currentProgress = progress; } return promise; },
3973+ (choice) => onDidCancel(choice, this._lastReport)
3974+ );
3975+ @@ -736,7 +738,7 @@ class RemoteAgentConnectionStatusListener implements IWorkbenchContribution {
3976+ let reconnectWaitEvent: ReconnectionWaitEvent | null = null;
3977+ let disposableListener: IDisposable | null = null;
3978+
3979+ - function showProgress(location: ProgressLocation.Dialog | ProgressLocation.Notification, buttons: { label: string, callback: () => void }[], initialReport: string | null = null): VisibleProgress {
3980+ + function showProgress(location: ProgressLocation.Dialog | ProgressLocation.Notification, buttons: { label: string, callback: () => void }[], initialReport: string | null = null, suppressPopup: Boolean | undefined): VisibleProgress {
3981+ if (visibleProgress) {
3982+ visibleProgress.dispose();
3983+ visibleProgress = null;
3984+ @@ -752,12 +754,12 @@ class RemoteAgentConnectionStatusListener implements IWorkbenchContribution {
3985+ buttons[choice].callback();
3986+ } else {
3987+ if (location === ProgressLocation.Dialog) {
3988+ - visibleProgress = showProgress(ProgressLocation.Notification, buttons, lastReport);
3989+ + visibleProgress = showProgress(ProgressLocation.Notification, buttons, lastReport, suppressPopup);
3990+ } else {
3991+ hideProgress();
3992+ }
3993+ }
3994+ - }
3995+ + }, suppressPopup
3996+ );
3997+ }
3998+
3999+ @@ -796,17 +798,17 @@ class RemoteAgentConnectionStatusListener implements IWorkbenchContribution {
38934000 switch (e.type) {
38944001 case PersistentConnectionEventType.ConnectionLost:
3895- - if (!visibleProgress) {
4002+ if (!visibleProgress) {
38964003- visibleProgress = showProgress(ProgressLocation.Dialog, [reconnectButton, reloadButton]);
3897- - }
3898- - visibleProgress.report(nls.localize('connectionLost', "Connection Lost"));
3899- + // if (!visibleProgress) {
3900- + // visibleProgress = showProgress(ProgressLocation.Dialog, [reconnectButton, reloadButton]);
3901- + // }
3902- + // visibleProgress.report(nls.localize('connectionLost', "Connection Lost"));
4004+ + visibleProgress = showProgress(ProgressLocation.Notification, [reconnectButton, reloadButton], null, e.suppressPopup);
4005+ }
4006+ visibleProgress.report(nls.localize('connectionLost', "Connection Lost"));
39034007 break;
39044008 case PersistentConnectionEventType.ReconnectionWait:
39054009 reconnectWaitEvent = e;
4010+ - visibleProgress = showProgress(lastLocation || ProgressLocation.Notification, [reconnectButton, reloadButton]);
4011+ + visibleProgress = showProgress(lastLocation || ProgressLocation.Dialog, [reconnectButton, reloadButton], null, e.suppressPopup);
4012+ visibleProgress.startTimer(Date.now() + 1000 * e.durationSeconds);
4013+ break;
4014+ case PersistentConnectionEventType.ReconnectionRunning:
4015+ - visibleProgress = showProgress(lastLocation || ProgressLocation.Notification, [reloadButton]);
4016+ + visibleProgress = showProgress(lastLocation || ProgressLocation.Notification, [reloadButton], null, e.suppressPopup);
4017+ visibleProgress.report(nls.localize('reconnectionRunning', "Attempting to reconnect..."));
4018+
4019+ // Register to listen for quick input is opened
4020+ @@ -815,7 +817,7 @@ class RemoteAgentConnectionStatusListener implements IWorkbenchContribution {
4021+ if (contextKeyChangeEvent.affectsSome(reconnectInteraction)) {
4022+ // Need to move from dialog if being shown and user needs to type in a prompt
4023+ if (lastLocation === ProgressLocation.Dialog && visibleProgress !== null) {
4024+ - visibleProgress = showProgress(ProgressLocation.Notification, [reloadButton], visibleProgress.lastReport);
4025+ + visibleProgress = showProgress(ProgressLocation.Notification, [reloadButton], visibleProgress.lastReport, e.suppressPopup);
4026+ }
4027+ }
4028+ });
39064029diff --git a/src/vs/workbench/contrib/scm/browser/media/scm.css b/src/vs/workbench/contrib/scm/browser/media/scm.css
39074030index 74f6922e98b4bb6a7fb100f5aac015afe9fc171b..3243a97c2d378013d96ffbe87e9df6dd4a66776d 100644
39084031--- a/src/vs/workbench/contrib/scm/browser/media/scm.css
0 commit comments