@@ -746,7 +746,7 @@ index fdd5890c69f72025b94913380f0d226226e8c8fb..e084236526b38c1144d47b8b3000b367
746746 (err: any, socket: ISocket | undefined) => {
747747 if (err || !socket) {
748748 options.logService.error(`${logPrefix} socketFactory.connect() failed. Error:`);
749- @@ -331,12 +331,16 @@ export const enum PersistentConnectionEventType {
749+ @@ -331,12 +331,17 @@ export const enum PersistentConnectionEventType {
750750 }
751751 export class ConnectionLostEvent {
752752 public readonly type = PersistentConnectionEventType.ConnectionLost;
@@ -760,11 +760,12 @@ index fdd5890c69f72025b94913380f0d226226e8c8fb..e084236526b38c1144d47b8b3000b367
760760 public readonly durationSeconds: number,
761761- private readonly cancellableTimer: CancelablePromise<void>
762762+ private readonly cancellableTimer: CancelablePromise<void>,
763- + public readonly suppressPopup?: boolean
763+ + public readonly suppressPopup?: boolean,
764+ + public readonly forceDialog?: boolean
764765 ) { }
765766
766767 public skipWait(): void {
767- @@ -345,12 +349 ,21 @@ export class ReconnectionWaitEvent {
768+ @@ -345,12 +350 ,21 @@ export class ReconnectionWaitEvent {
768769 }
769770 export class ReconnectionRunningEvent {
770771 public readonly type = PersistentConnectionEventType.ReconnectionRunning;
@@ -786,30 +787,33 @@ index fdd5890c69f72025b94913380f0d226226e8c8fb..e084236526b38c1144d47b8b3000b367
786787 }
787788 export type PersistenConnectionEvent = ConnectionGainEvent | ConnectionLostEvent | ReconnectionWaitEvent | ReconnectionRunningEvent | ReconnectionPermanentFailureEvent;
788789
789- @@ -411,16 +424,20 @@ abstract class PersistentConnection extends Disposable {
790+ @@ -411,16 +425,22 @@ abstract class PersistentConnection extends Disposable {
790791 }
791792 const logPrefix = commonLogPrefix(this._connectionType, this.reconnectionToken, true);
792793 this._options.logService.info(`${logPrefix} starting reconnecting loop. You can get more information with the trace log level.`);
793794- this._onDidStateChange.fire(new ConnectionLostEvent());
795+ - const TIMES = [5, 5, 10, 10, 10, 10, 10, 30];
794796+ let suppressPopup = true;
797+ + let forceDialog = false;
795798+ this._onDidStateChange.fire(new ConnectionLostEvent(suppressPopup));
796- const TIMES = [5, 5, 10 , 10, 10, 10, 10, 30];
799+ + const TIMES = [1, 2, 3 , 10, 10, 10, 10, 30];
797800+ const SHOW_POPUP_ON_ATTEMPT = 2 // aka third attempt
798801+
799802 const disconnectStartTime = Date.now();
800803 let attempt = -1;
801804 do {
802805 attempt++;
803806+ suppressPopup = (attempt < SHOW_POPUP_ON_ATTEMPT) ? true : false
807+ + forceDialog = (attempt == SHOW_POPUP_ON_ATTEMPT)
804808 const waitTime = (attempt < TIMES.length ? TIMES[attempt] : TIMES[TIMES.length - 1]);
805809 try {
806810 const sleepPromise = sleep(waitTime);
807811- this._onDidStateChange.fire(new ReconnectionWaitEvent(waitTime, sleepPromise));
808- + this._onDidStateChange.fire(new ReconnectionWaitEvent(waitTime, sleepPromise, suppressPopup));
812+ + this._onDidStateChange.fire(new ReconnectionWaitEvent(waitTime, sleepPromise, suppressPopup, forceDialog ));
809813
810814 this._options.logService.info(`${logPrefix} waiting for ${waitTime} seconds before reconnecting...`);
811815 try {
812- @@ -433,7 +450 ,7 @@ abstract class PersistentConnection extends Disposable {
816+ @@ -433,7 +453 ,7 @@ abstract class PersistentConnection extends Disposable {
813817 }
814818
815819 // connection was lost, let's try to re-establish it
@@ -3948,84 +3952,71 @@ index 94e7e7a4bac154c45078a1b5034e50634a7a43af..8164200dcef1efbc65b50eef9c270af3
39483952 this._dirnameKey.set(value ? dirname(value).fsPath : null);
39493953 this._pathKey.set(value ? value.fsPath : null);
39503954diff --git a/src/vs/workbench/contrib/remote/browser/remote.ts b/src/vs/workbench/contrib/remote/browser/remote.ts
3951- index 98573a206f14928fc3fdf18fe927cb75034e4ad1..3ffe27b816e2d0a630985a24dd1af910877c2295 100644
3955+ index 98573a206f14928fc3fdf18fe927cb75034e4ad1..a031f76924abf8f10c510ea9c043f670c5b43074 100644
39523956--- a/src/vs/workbench/contrib/remote/browser/remote.ts
39533957+++ b/src/vs/workbench/contrib/remote/browser/remote.ts
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 {
3958+ @@ -795,31 +795,43 @@ class RemoteAgentConnectionStatusListener implements IWorkbenchContribution {
3959+ }
40003960 switch (e.type) {
40013961 case PersistentConnectionEventType.ConnectionLost:
4002- if (!visibleProgress) {
3962+ - if (!visibleProgress) {
40033963- visibleProgress = showProgress(ProgressLocation.Dialog, [reconnectButton, reloadButton]);
4004- + visibleProgress = showProgress(ProgressLocation.Notification, [reconnectButton, reloadButton], null, e.suppressPopup);
3964+ + if (e.suppressPopup) {
3965+ + hideProgress()
3966+ + } else {
3967+ + if (!visibleProgress) {
3968+ + visibleProgress = showProgress(ProgressLocation.Dialog, [reconnectButton, reloadButton]);
3969+ + }
3970+ + visibleProgress.report(nls.localize('connectionLost', "Connection Lost"));
40053971 }
4006- visibleProgress.report(nls.localize('connectionLost', "Connection Lost"));
3972+ - visibleProgress.report(nls.localize('connectionLost', "Connection Lost"));
40073973 break;
40083974 case PersistentConnectionEventType.ReconnectionWait:
40093975 reconnectWaitEvent = e;
40103976- 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);
3977+ - visibleProgress.startTimer(Date.now() + 1000 * e.durationSeconds);
3978+ + if (e.suppressPopup) {
3979+ + hideProgress()
3980+ + } else {
3981+ + const location = e.forceDialog ? ProgressLocation.Dialog : (lastLocation || ProgressLocation.Notification)
3982+ + visibleProgress = showProgress(location, [reconnectButton, reloadButton]);
3983+ + visibleProgress.startTimer(Date.now() + 1000 * e.durationSeconds);
3984+ + }
40133985 break;
40143986 case PersistentConnectionEventType.ReconnectionRunning:
40153987- 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) {
3988+ - visibleProgress.report(nls.localize('reconnectionRunning', "Attempting to reconnect...") );
3989+ -
3990+ - // Register to listen for quick input is opened
3991+ - disposableListener = contextKeyService.onDidChangeContext((contextKeyChangeEvent) => {
3992+ - const reconnectInteraction = new Set<string>([inQuickPickContextKeyValue]);
3993+ - if (contextKeyChangeEvent.affectsSome(reconnectInteraction)) {
3994+ - // Need to move from dialog if being shown and user needs to type in a prompt
3995+ - if (lastLocation === ProgressLocation.Dialog && visibleProgress !== null) {
40243996- visibleProgress = showProgress(ProgressLocation.Notification, [reloadButton], visibleProgress.lastReport);
4025- + visibleProgress = showProgress(ProgressLocation.Notification, [reloadButton], visibleProgress.lastReport, e.suppressPopup);
3997+ + if (e.suppressPopup) {
3998+ + hideProgress()
3999+ + } else {
4000+ + visibleProgress = showProgress(lastLocation || ProgressLocation.Notification, [reloadButton]);
4001+ + visibleProgress.report(nls.localize('reconnectionRunning', "Attempting to reconnect..."));
4002+ +
4003+ + // Register to listen for quick input is opened
4004+ + disposableListener = contextKeyService.onDidChangeContext((contextKeyChangeEvent) => {
4005+ + const reconnectInteraction = new Set<string>([inQuickPickContextKeyValue]);
4006+ + if (contextKeyChangeEvent.affectsSome(reconnectInteraction)) {
4007+ + // Need to move from dialog if being shown and user needs to type in a prompt
4008+ + if (lastLocation === ProgressLocation.Dialog && visibleProgress !== null) {
4009+ + visibleProgress = showProgress(ProgressLocation.Notification, [reloadButton], visibleProgress.lastReport);
4010+ + }
40264011 }
4027- }
4028- });
4012+ - }
4013+ - });
4014+ -
4015+ + });
4016+ + }
4017+ break;
4018+ case PersistentConnectionEventType.ReconnectionPermanentFailure:
4019+ hideProgress();
40294020diff --git a/src/vs/workbench/contrib/scm/browser/media/scm.css b/src/vs/workbench/contrib/scm/browser/media/scm.css
40304021index 74f6922e98b4bb6a7fb100f5aac015afe9fc171b..3243a97c2d378013d96ffbe87e9df6dd4a66776d 100644
40314022--- a/src/vs/workbench/contrib/scm/browser/media/scm.css
0 commit comments