@@ -689,7 +689,7 @@ index 3715cbb8e6ee41c3d9b5090918d243b723ae2d00..c65de8ad37e727d66da97a8f8b170cbc
689
689
-
690
690
-
691
691
diff --git a/src/vs/platform/remote/common/remoteAgentConnection.ts b/src/vs/platform/remote/common/remoteAgentConnection.ts
692
- index 18d3d04fd20335975293e37b3b641120dd92da20..e072fc38ccd950462f42fdf112c8e7e673f351f5 100644
692
+ index 18d3d04fd20335975293e37b3b641120dd92da20..a06f20ece490dba5d88b41268cddaaf6b2f6b64a 100644
693
693
--- a/src/vs/platform/remote/common/remoteAgentConnection.ts
694
694
+++ b/src/vs/platform/remote/common/remoteAgentConnection.ts
695
695
@@ -92,7 +92,7 @@ async function connectToRemoteExtensionHostAgent(options: ISimpleConnectionOptio
@@ -701,53 +701,82 @@ index 18d3d04fd20335975293e37b3b641120dd92da20..e072fc38ccd950462f42fdf112c8e7e6
701
701
(err: any, socket: ISocket | undefined) => {
702
702
if (err || !socket) {
703
703
options.logService.error(`${logPrefix} socketFactory.connect() failed. Error:`);
704
- @@ -411,16 +411,23 @@ abstract class PersistentConnection extends Disposable {
704
+ @@ -331,12 +331,16 @@ export const enum PersistentConnectionEventType {
705
+ }
706
+ export class ConnectionLostEvent {
707
+ public readonly type = PersistentConnectionEventType.ConnectionLost;
708
+ + constructor(
709
+ + public readonly connectionAttempt?: number
710
+ + ) { }
711
+ }
712
+ export class ReconnectionWaitEvent {
713
+ public readonly type = PersistentConnectionEventType.ReconnectionWait;
714
+ constructor(
715
+ public readonly durationSeconds: number,
716
+ - private readonly cancellableTimer: CancelablePromise<void>
717
+ + private readonly cancellableTimer: CancelablePromise<void>,
718
+ + public readonly connectionAttempt?: number,
719
+ ) { }
720
+
721
+ public skipWait(): void {
722
+ @@ -345,12 +349,21 @@ export class ReconnectionWaitEvent {
723
+ }
724
+ export class ReconnectionRunningEvent {
725
+ public readonly type = PersistentConnectionEventType.ReconnectionRunning;
726
+ + constructor(
727
+ + public readonly connectionAttempt?: number
728
+ + ) { }
729
+ }
730
+ export class ConnectionGainEvent {
731
+ public readonly type = PersistentConnectionEventType.ConnectionGain;
732
+ + constructor(
733
+ + public readonly connectionAttempt?: number
734
+ + ) { }
735
+ }
736
+ export class ReconnectionPermanentFailureEvent {
737
+ public readonly type = PersistentConnectionEventType.ReconnectionPermanentFailure;
738
+ + constructor(
739
+ + public readonly connectionAttempt?: number
740
+ + ) { }
741
+ }
742
+ export type PersistenConnectionEvent = ConnectionGainEvent | ConnectionLostEvent | ReconnectionWaitEvent | ReconnectionRunningEvent | ReconnectionPermanentFailureEvent;
743
+
744
+ @@ -411,8 +424,9 @@ abstract class PersistentConnection extends Disposable {
705
745
}
706
746
const logPrefix = commonLogPrefix(this._connectionType, this.reconnectionToken, true);
707
747
this._options.logService.info(`${logPrefix} starting reconnecting loop. You can get more information with the trace log level.`);
708
748
- this._onDidStateChange.fire(new ConnectionLostEvent());
749
+ + this._onDidStateChange.fire(new ConnectionLostEvent(0));
709
750
const TIMES = [5, 5, 10, 10, 10, 10, 10, 30];
710
- + const SHOW_POPUP_ON_ATTEMPT = 2 // aka third attempt
711
751
+
712
752
const disconnectStartTime = Date.now();
713
753
let attempt = -1;
714
754
do {
715
- attempt++;
716
- + if (attempt == SHOW_POPUP_ON_ATTEMPT){
717
- + this._onDidStateChange.fire(new ConnectionLostEvent());
718
- + }
719
- +
755
+ @@ -420,7 +434,7 @@ abstract class PersistentConnection extends Disposable {
720
756
const waitTime = (attempt < TIMES.length ? TIMES[attempt] : TIMES[TIMES.length - 1]);
721
757
try {
722
758
const sleepPromise = sleep(waitTime);
723
759
- this._onDidStateChange.fire(new ReconnectionWaitEvent(waitTime, sleepPromise));
724
- + if (attempt >= SHOW_POPUP_ON_ATTEMPT) {
725
- + this._onDidStateChange.fire(new ReconnectionWaitEvent(waitTime, sleepPromise));
726
- + }
760
+ + this._onDidStateChange.fire(new ReconnectionWaitEvent(waitTime, sleepPromise, attempt));
727
761
728
762
this._options.logService.info(`${logPrefix} waiting for ${waitTime} seconds before reconnecting...`);
729
763
try {
730
- @@ -433,14 +440,17 @@ abstract class PersistentConnection extends Disposable {
764
+ @@ -433,13 +447,13 @@ abstract class PersistentConnection extends Disposable {
731
765
}
732
766
733
767
// connection was lost, let's try to re-establish it
734
768
- this._onDidStateChange.fire(new ReconnectionRunningEvent());
735
- + if (attempt >= SHOW_POPUP_ON_ATTEMPT){
736
- + this._onDidStateChange.fire(new ReconnectionRunningEvent());
737
- + }
769
+ + this._onDidStateChange.fire(new ReconnectionRunningEvent(attempt));
738
770
this._options.logService.info(`${logPrefix} resolving connection...`);
739
771
const simpleOptions = await resolveConnectionOptions(this._options, this.reconnectionToken, this.protocol);
740
772
this._options.logService.info(`${logPrefix} connecting to ${simpleOptions.host}:${simpleOptions.port}...`);
741
773
await connectWithTimeLimit(simpleOptions.logService, this._reconnect(simpleOptions), RECONNECT_TIMEOUT);
742
774
this._options.logService.info(`${logPrefix} reconnected!`);
743
775
- this._onDidStateChange.fire(new ConnectionGainEvent());
744
- -
745
- + if (attempt >= SHOW_POPUP_ON_ATTEMPT) {
746
- + this._onDidStateChange.fire(new ConnectionGainEvent());
747
- + }
776
+ + this._onDidStateChange.fire(new ConnectionGainEvent(attempt));
777
+
748
778
break;
749
779
} catch (err) {
750
- if (err.code === 'VSCODE_CONNECTION_ERROR') {
751
780
diff --git a/src/vs/platform/storage/browser/storageService.ts b/src/vs/platform/storage/browser/storageService.ts
752
781
index ab3fd347b69f8a3d9b96e706cd87c911b8ffed6b..9d351037b577f9f1edfd18ae9b3c48a211f4467f 100644
753
782
--- a/src/vs/platform/storage/browser/storageService.ts
@@ -3246,6 +3275,84 @@ index 94e7e7a4bac154c45078a1b5034e50634a7a43af..8164200dcef1efbc65b50eef9c270af3
3246
3275
this._filenameKey.set(value ? basename(value) : null);
3247
3276
this._dirnameKey.set(value ? dirname(value).fsPath : null);
3248
3277
this._pathKey.set(value ? value.fsPath : null);
3278
+ diff --git a/src/vs/workbench/contrib/remote/browser/remote.ts b/src/vs/workbench/contrib/remote/browser/remote.ts
3279
+ index 98573a206f14928fc3fdf18fe927cb75034e4ad1..1430666aa94f941bda086df503fec8b35aa2b25f 100644
3280
+ --- a/src/vs/workbench/contrib/remote/browser/remote.ts
3281
+ +++ b/src/vs/workbench/contrib/remote/browser/remote.ts
3282
+ @@ -730,6 +730,7 @@ class RemoteAgentConnectionStatusListener implements IWorkbenchContribution {
3283
+ @IContextKeyService contextKeyService: IContextKeyService
3284
+ ) {
3285
+ const connection = remoteAgentService.getConnection();
3286
+ + const SHOW_POPUP_ON_ATTEMPT = 2 // aka third attempt
3287
+ if (connection) {
3288
+ let visibleProgress: VisibleProgress | null = null;
3289
+ let lastLocation: ProgressLocation.Dialog | ProgressLocation.Notification | null = null;
3290
+ @@ -793,33 +794,47 @@ class RemoteAgentConnectionStatusListener implements IWorkbenchContribution {
3291
+ disposableListener.dispose();
3292
+ disposableListener = null;
3293
+ }
3294
+ + let suppressPopup = (typeof e.connectionAttempt == 'number' && e.connectionAttempt < SHOW_POPUP_ON_ATTEMPT)
3295
+ + let forceDialog = (typeof e.connectionAttempt == 'number' && e.connectionAttempt == SHOW_POPUP_ON_ATTEMPT)
3296
+ switch (e.type) {
3297
+ case PersistentConnectionEventType.ConnectionLost:
3298
+ - if (!visibleProgress) {
3299
+ - visibleProgress = showProgress(ProgressLocation.Dialog, [reconnectButton, reloadButton]);
3300
+ + if (suppressPopup) {
3301
+ + hideProgress()
3302
+ + } else {
3303
+ + if (!visibleProgress) {
3304
+ + visibleProgress = showProgress(ProgressLocation.Dialog, [reconnectButton, reloadButton]);
3305
+ + }
3306
+ + visibleProgress.report(nls.localize('connectionLost', "Connection Lost"));
3307
+ }
3308
+ - visibleProgress.report(nls.localize('connectionLost', "Connection Lost"));
3309
+ break;
3310
+ case PersistentConnectionEventType.ReconnectionWait:
3311
+ reconnectWaitEvent = e;
3312
+ - visibleProgress = showProgress(lastLocation || ProgressLocation.Notification, [reconnectButton, reloadButton]);
3313
+ - visibleProgress.startTimer(Date.now() + 1000 * e.durationSeconds);
3314
+ + if (suppressPopup) {
3315
+ + hideProgress()
3316
+ + } else {
3317
+ + const location = forceDialog ? ProgressLocation.Dialog : (lastLocation || ProgressLocation.Notification)
3318
+ + visibleProgress = showProgress(location, [reconnectButton, reloadButton]);
3319
+ + visibleProgress.startTimer(Date.now() + 1000 * e.durationSeconds);
3320
+ + }
3321
+ break;
3322
+ case PersistentConnectionEventType.ReconnectionRunning:
3323
+ - visibleProgress = showProgress(lastLocation || ProgressLocation.Notification, [reloadButton]);
3324
+ - visibleProgress.report(nls.localize('reconnectionRunning', "Attempting to reconnect..."));
3325
+ -
3326
+ - // Register to listen for quick input is opened
3327
+ - disposableListener = contextKeyService.onDidChangeContext((contextKeyChangeEvent) => {
3328
+ - const reconnectInteraction = new Set<string>([inQuickPickContextKeyValue]);
3329
+ - if (contextKeyChangeEvent.affectsSome(reconnectInteraction)) {
3330
+ - // Need to move from dialog if being shown and user needs to type in a prompt
3331
+ - if (lastLocation === ProgressLocation.Dialog && visibleProgress !== null) {
3332
+ - visibleProgress = showProgress(ProgressLocation.Notification, [reloadButton], visibleProgress.lastReport);
3333
+ + if (suppressPopup) {
3334
+ + hideProgress()
3335
+ + } else {
3336
+ + visibleProgress = showProgress(lastLocation || ProgressLocation.Notification, [reloadButton]);
3337
+ + visibleProgress.report(nls.localize('reconnectionRunning', "Attempting to reconnect..."));
3338
+ +
3339
+ + // Register to listen for quick input is opened
3340
+ + disposableListener = contextKeyService.onDidChangeContext((contextKeyChangeEvent) => {
3341
+ + const reconnectInteraction = new Set<string>([inQuickPickContextKeyValue]);
3342
+ + if (contextKeyChangeEvent.affectsSome(reconnectInteraction)) {
3343
+ + // Need to move from dialog if being shown and user needs to type in a prompt
3344
+ + if (lastLocation === ProgressLocation.Dialog && visibleProgress !== null) {
3345
+ + visibleProgress = showProgress(ProgressLocation.Notification, [reloadButton], visibleProgress.lastReport);
3346
+ + }
3347
+ }
3348
+ - }
3349
+ - });
3350
+ -
3351
+ + });
3352
+ + }
3353
+ break;
3354
+ case PersistentConnectionEventType.ReconnectionPermanentFailure:
3355
+ hideProgress();
3249
3356
diff --git a/src/vs/workbench/contrib/scm/browser/media/scm.css b/src/vs/workbench/contrib/scm/browser/media/scm.css
3250
3357
index ac44ad3bae428def66e22fe9cc1c54648d429f6b..faa63023c4c586b51fa3c2a48ff3641b9cb0e145 100644
3251
3358
--- a/src/vs/workbench/contrib/scm/browser/media/scm.css
0 commit comments