@@ -746,82 +746,6 @@ 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 {
750- }
751- export class ConnectionLostEvent {
752- public readonly type = PersistentConnectionEventType.ConnectionLost;
753- + constructor(
754- + public readonly connectionAttempt?: number
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 connectionAttempt?: number,
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 connectionAttempt?: number
773- + ) { }
774- }
775- export class ConnectionGainEvent {
776- public readonly type = PersistentConnectionEventType.ConnectionGain;
777- + constructor(
778- + public readonly connectionAttempt?: number
779- + ) { }
780- }
781- export class ReconnectionPermanentFailureEvent {
782- public readonly type = PersistentConnectionEventType.ReconnectionPermanentFailure;
783- + constructor(
784- + public readonly connectionAttempt?: number
785- + ) { }
786- }
787- export type PersistenConnectionEvent = ConnectionGainEvent | ConnectionLostEvent | ReconnectionWaitEvent | ReconnectionRunningEvent | ReconnectionPermanentFailureEvent;
788-
789- @@ -411,8 +424,9 @@ abstract class PersistentConnection extends Disposable {
790- }
791- const logPrefix = commonLogPrefix(this._connectionType, this.reconnectionToken, true);
792- this._options.logService.info(`${logPrefix} starting reconnecting loop. You can get more information with the trace log level.`);
793- - this._onDidStateChange.fire(new ConnectionLostEvent());
794- + this._onDidStateChange.fire(new ConnectionLostEvent(0));
795- const TIMES = [5, 5, 10, 10, 10, 10, 10, 30];
796- +
797- const disconnectStartTime = Date.now();
798- let attempt = -1;
799- do {
800- @@ -420,7 +434,7 @@ abstract class PersistentConnection extends Disposable {
801- const waitTime = (attempt < TIMES.length ? TIMES[attempt] : TIMES[TIMES.length - 1]);
802- try {
803- const sleepPromise = sleep(waitTime);
804- - this._onDidStateChange.fire(new ReconnectionWaitEvent(waitTime, sleepPromise));
805- + this._onDidStateChange.fire(new ReconnectionWaitEvent(waitTime, sleepPromise, attempt));
806-
807- this._options.logService.info(`${logPrefix} waiting for ${waitTime} seconds before reconnecting...`);
808- try {
809- @@ -433,13 +447,13 @@ abstract class PersistentConnection extends Disposable {
810- }
811-
812- // connection was lost, let's try to re-establish it
813- - this._onDidStateChange.fire(new ReconnectionRunningEvent());
814- + this._onDidStateChange.fire(new ReconnectionRunningEvent(attempt));
815- this._options.logService.info(`${logPrefix} resolving connection...`);
816- const simpleOptions = await resolveConnectionOptions(this._options, this.reconnectionToken, this.protocol);
817- this._options.logService.info(`${logPrefix} connecting to ${simpleOptions.host}:${simpleOptions.port}...`);
818- await connectWithTimeLimit(simpleOptions.logService, this._reconnect(simpleOptions), RECONNECT_TIMEOUT);
819- this._options.logService.info(`${logPrefix} reconnected!`);
820- - this._onDidStateChange.fire(new ConnectionGainEvent());
821- + this._onDidStateChange.fire(new ConnectionGainEvent(attempt));
822-
823- break;
824- } catch (err) {
825749diff --git a/src/vs/platform/storage/browser/storageService.ts b/src/vs/platform/storage/browser/storageService.ts
826750index ab3fd347b69f8a3d9b96e706cd87c911b8ffed6b..9d351037b577f9f1edfd18ae9b3c48a211f4467f 100644
827751--- a/src/vs/platform/storage/browser/storageService.ts
@@ -3951,84 +3875,6 @@ index 94e7e7a4bac154c45078a1b5034e50634a7a43af..8164200dcef1efbc65b50eef9c270af3
39513875 this._filenameKey.set(value ? basename(value) : null);
39523876 this._dirnameKey.set(value ? dirname(value).fsPath : null);
39533877 this._pathKey.set(value ? value.fsPath : null);
3954- diff --git a/src/vs/workbench/contrib/remote/browser/remote.ts b/src/vs/workbench/contrib/remote/browser/remote.ts
3955- index 98573a206f14928fc3fdf18fe927cb75034e4ad1..1430666aa94f941bda086df503fec8b35aa2b25f 100644
3956- --- a/src/vs/workbench/contrib/remote/browser/remote.ts
3957- +++ b/src/vs/workbench/contrib/remote/browser/remote.ts
3958- @@ -730,6 +730,7 @@ class RemoteAgentConnectionStatusListener implements IWorkbenchContribution {
3959- @IContextKeyService contextKeyService: IContextKeyService
3960- ) {
3961- const connection = remoteAgentService.getConnection();
3962- + const SHOW_POPUP_ON_ATTEMPT = 2 // aka third attempt
3963- if (connection) {
3964- let visibleProgress: VisibleProgress | null = null;
3965- let lastLocation: ProgressLocation.Dialog | ProgressLocation.Notification | null = null;
3966- @@ -793,33 +794,47 @@ class RemoteAgentConnectionStatusListener implements IWorkbenchContribution {
3967- disposableListener.dispose();
3968- disposableListener = null;
3969- }
3970- + let suppressPopup = (typeof e.connectionAttempt == 'number' && e.connectionAttempt < SHOW_POPUP_ON_ATTEMPT)
3971- + let forceDialog = (typeof e.connectionAttempt == 'number' && e.connectionAttempt == SHOW_POPUP_ON_ATTEMPT)
3972- switch (e.type) {
3973- case PersistentConnectionEventType.ConnectionLost:
3974- - if (!visibleProgress) {
3975- - visibleProgress = showProgress(ProgressLocation.Dialog, [reconnectButton, reloadButton]);
3976- + if (suppressPopup) {
3977- + hideProgress()
3978- + } else {
3979- + if (!visibleProgress) {
3980- + visibleProgress = showProgress(ProgressLocation.Dialog, [reconnectButton, reloadButton]);
3981- + }
3982- + visibleProgress.report(nls.localize('connectionLost', "Connection Lost"));
3983- }
3984- - visibleProgress.report(nls.localize('connectionLost', "Connection Lost"));
3985- break;
3986- case PersistentConnectionEventType.ReconnectionWait:
3987- reconnectWaitEvent = e;
3988- - visibleProgress = showProgress(lastLocation || ProgressLocation.Notification, [reconnectButton, reloadButton]);
3989- - visibleProgress.startTimer(Date.now() + 1000 * e.durationSeconds);
3990- + if (suppressPopup) {
3991- + hideProgress()
3992- + } else {
3993- + const location = forceDialog ? ProgressLocation.Dialog : (lastLocation || ProgressLocation.Notification)
3994- + visibleProgress = showProgress(location, [reconnectButton, reloadButton]);
3995- + visibleProgress.startTimer(Date.now() + 1000 * e.durationSeconds);
3996- + }
3997- break;
3998- case PersistentConnectionEventType.ReconnectionRunning:
3999- - visibleProgress = showProgress(lastLocation || ProgressLocation.Notification, [reloadButton]);
4000- - visibleProgress.report(nls.localize('reconnectionRunning', "Attempting to reconnect..."));
4001- -
4002- - // Register to listen for quick input is opened
4003- - disposableListener = contextKeyService.onDidChangeContext((contextKeyChangeEvent) => {
4004- - const reconnectInteraction = new Set<string>([inQuickPickContextKeyValue]);
4005- - if (contextKeyChangeEvent.affectsSome(reconnectInteraction)) {
4006- - // Need to move from dialog if being shown and user needs to type in a prompt
4007- - if (lastLocation === ProgressLocation.Dialog && visibleProgress !== null) {
4008- - visibleProgress = showProgress(ProgressLocation.Notification, [reloadButton], visibleProgress.lastReport);
4009- + if (suppressPopup) {
4010- + hideProgress()
4011- + } else {
4012- + visibleProgress = showProgress(lastLocation || ProgressLocation.Notification, [reloadButton]);
4013- + visibleProgress.report(nls.localize('reconnectionRunning', "Attempting to reconnect..."));
4014- +
4015- + // Register to listen for quick input is opened
4016- + disposableListener = contextKeyService.onDidChangeContext((contextKeyChangeEvent) => {
4017- + const reconnectInteraction = new Set<string>([inQuickPickContextKeyValue]);
4018- + if (contextKeyChangeEvent.affectsSome(reconnectInteraction)) {
4019- + // Need to move from dialog if being shown and user needs to type in a prompt
4020- + if (lastLocation === ProgressLocation.Dialog && visibleProgress !== null) {
4021- + visibleProgress = showProgress(ProgressLocation.Notification, [reloadButton], visibleProgress.lastReport);
4022- + }
4023- }
4024- - }
4025- - });
4026- -
4027- + });
4028- + }
4029- break;
4030- case PersistentConnectionEventType.ReconnectionPermanentFailure:
4031- hideProgress();
40323878diff --git a/src/vs/workbench/contrib/scm/browser/media/scm.css b/src/vs/workbench/contrib/scm/browser/media/scm.css
40333879index 74f6922e98b4bb6a7fb100f5aac015afe9fc171b..3243a97c2d378013d96ffbe87e9df6dd4a66776d 100644
40343880--- a/src/vs/workbench/contrib/scm/browser/media/scm.css
0 commit comments