Skip to content

Commit 4e8b682

Browse files
committed
solution with forceDialog for attempt 3 and no change to VisibleProgress class
1 parent 43ff3cf commit 4e8b682

File tree

1 file changed

+62
-71
lines changed

1 file changed

+62
-71
lines changed

ci/dev/vscode.patch

+62-71
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ index 3715cbb8e6ee41c3d9b5090918d243b723ae2d00..c65de8ad37e727d66da97a8f8b170cbc
689689
-
690690
-
691691
diff --git a/src/vs/platform/remote/common/remoteAgentConnection.ts b/src/vs/platform/remote/common/remoteAgentConnection.ts
692-
index 18d3d04fd20335975293e37b3b641120dd92da20..ddc85643fc414991bf885f099f982d9de1b9eae2 100644
692+
index 18d3d04fd20335975293e37b3b641120dd92da20..4ec77056f8b707cb9cfc6af28f995d644b127506 100644
693693
--- a/src/vs/platform/remote/common/remoteAgentConnection.ts
694694
+++ b/src/vs/platform/remote/common/remoteAgentConnection.ts
695695
@@ -92,7 +92,7 @@ async function connectToRemoteExtensionHostAgent(options: ISimpleConnectionOptio
@@ -701,7 +701,7 @@ index 18d3d04fd20335975293e37b3b641120dd92da20..ddc85643fc414991bf885f099f982d9d
701701
(err: any, socket: ISocket | undefined) => {
702702
if (err || !socket) {
703703
options.logService.error(`${logPrefix} socketFactory.connect() failed. Error:`);
704-
@@ -331,12 +331,16 @@ export const enum PersistentConnectionEventType {
704+
@@ -331,12 +331,17 @@ export const enum PersistentConnectionEventType {
705705
}
706706
export class ConnectionLostEvent {
707707
public readonly type = PersistentConnectionEventType.ConnectionLost;
@@ -715,11 +715,12 @@ index 18d3d04fd20335975293e37b3b641120dd92da20..ddc85643fc414991bf885f099f982d9d
715715
public readonly durationSeconds: number,
716716
- private readonly cancellableTimer: CancelablePromise<void>
717717
+ private readonly cancellableTimer: CancelablePromise<void>,
718-
+ public readonly suppressPopup?: boolean
718+
+ public readonly suppressPopup?: boolean,
719+
+ public readonly forceDialog?: boolean
719720
) { }
720721

721722
public skipWait(): void {
722-
@@ -345,12 +349,21 @@ export class ReconnectionWaitEvent {
723+
@@ -345,12 +350,21 @@ export class ReconnectionWaitEvent {
723724
}
724725
export class ReconnectionRunningEvent {
725726
public readonly type = PersistentConnectionEventType.ReconnectionRunning;
@@ -741,30 +742,33 @@ index 18d3d04fd20335975293e37b3b641120dd92da20..ddc85643fc414991bf885f099f982d9d
741742
}
742743
export type PersistenConnectionEvent = ConnectionGainEvent | ConnectionLostEvent | ReconnectionWaitEvent | ReconnectionRunningEvent | ReconnectionPermanentFailureEvent;
743744

744-
@@ -411,16 +424,20 @@ abstract class PersistentConnection extends Disposable {
745+
@@ -411,16 +425,22 @@ abstract class PersistentConnection extends Disposable {
745746
}
746747
const logPrefix = commonLogPrefix(this._connectionType, this.reconnectionToken, true);
747748
this._options.logService.info(`${logPrefix} starting reconnecting loop. You can get more information with the trace log level.`);
748749
- this._onDidStateChange.fire(new ConnectionLostEvent());
750+
- const TIMES = [5, 5, 10, 10, 10, 10, 10, 30];
749751
+ let suppressPopup = true;
752+
+ let forceDialog = false;
750753
+ this._onDidStateChange.fire(new ConnectionLostEvent(suppressPopup));
751-
const TIMES = [5, 5, 10, 10, 10, 10, 10, 30];
754+
+ const TIMES = [1, 2, 3, 10, 10, 10, 10, 30];
752755
+ const SHOW_POPUP_ON_ATTEMPT = 2 // aka third attempt
753756
+
754757
const disconnectStartTime = Date.now();
755758
let attempt = -1;
756759
do {
757760
attempt++;
758761
+ suppressPopup = (attempt < SHOW_POPUP_ON_ATTEMPT) ? true : false
762+
+ forceDialog = (attempt == SHOW_POPUP_ON_ATTEMPT)
759763
const waitTime = (attempt < TIMES.length ? TIMES[attempt] : TIMES[TIMES.length - 1]);
760764
try {
761765
const sleepPromise = sleep(waitTime);
762766
- this._onDidStateChange.fire(new ReconnectionWaitEvent(waitTime, sleepPromise));
763-
+ this._onDidStateChange.fire(new ReconnectionWaitEvent(waitTime, sleepPromise, suppressPopup));
767+
+ this._onDidStateChange.fire(new ReconnectionWaitEvent(waitTime, sleepPromise, suppressPopup, forceDialog));
764768

765769
this._options.logService.info(`${logPrefix} waiting for ${waitTime} seconds before reconnecting...`);
766770
try {
767-
@@ -433,7 +450,7 @@ abstract class PersistentConnection extends Disposable {
771+
@@ -433,7 +453,7 @@ abstract class PersistentConnection extends Disposable {
768772
}
769773

770774
// connection was lost, let's try to re-establish it
@@ -3272,84 +3276,71 @@ index 94e7e7a4bac154c45078a1b5034e50634a7a43af..8164200dcef1efbc65b50eef9c270af3
32723276
this._dirnameKey.set(value ? dirname(value).fsPath : null);
32733277
this._pathKey.set(value ? value.fsPath : null);
32743278
diff --git a/src/vs/workbench/contrib/remote/browser/remote.ts b/src/vs/workbench/contrib/remote/browser/remote.ts
3275-
index 98573a206f14928fc3fdf18fe927cb75034e4ad1..3ffe27b816e2d0a630985a24dd1af910877c2295 100644
3279+
index 98573a206f14928fc3fdf18fe927cb75034e4ad1..a031f76924abf8f10c510ea9c043f670c5b43074 100644
32763280
--- a/src/vs/workbench/contrib/remote/browser/remote.ts
32773281
+++ b/src/vs/workbench/contrib/remote/browser/remote.ts
3278-
@@ -635,7 +635,7 @@ class VisibleProgress {
3279-
return this._lastReport;
3280-
}
3281-
3282-
- constructor(progressService: IProgressService, location: ProgressLocation, initialReport: string | null, buttons: string[], onDidCancel: (choice: number | undefined, lastReport: string | null) => void) {
3283-
+ constructor(progressService: IProgressService, location: ProgressLocation, initialReport: string | null, buttons: string[], onDidCancel: (choice: number | undefined, lastReport: string | null) => void, suppressPopup: Boolean | undefined) {
3284-
this._isDisposed = false;
3285-
this._lastReport = initialReport;
3286-
this._currentProgressPromiseResolve = null;
3287-
@@ -644,8 +644,10 @@ class VisibleProgress {
3288-
3289-
const promise = new Promise<void>((resolve) => this._currentProgressPromiseResolve = resolve);
3290-
3291-
+ const options = suppressPopup ? { location: location, buttons: buttons, silent: suppressPopup } : { location: location, buttons: buttons }
3292-
+
3293-
progressService.withProgress(
3294-
- { location: location, buttons: buttons },
3295-
+ options,
3296-
(progress) => { if (!this._isDisposed) { this._currentProgress = progress; } return promise; },
3297-
(choice) => onDidCancel(choice, this._lastReport)
3298-
);
3299-
@@ -736,7 +738,7 @@ class RemoteAgentConnectionStatusListener implements IWorkbenchContribution {
3300-
let reconnectWaitEvent: ReconnectionWaitEvent | null = null;
3301-
let disposableListener: IDisposable | null = null;
3302-
3303-
- function showProgress(location: ProgressLocation.Dialog | ProgressLocation.Notification, buttons: { label: string, callback: () => void }[], initialReport: string | null = null): VisibleProgress {
3304-
+ function showProgress(location: ProgressLocation.Dialog | ProgressLocation.Notification, buttons: { label: string, callback: () => void }[], initialReport: string | null = null, suppressPopup: Boolean | undefined): VisibleProgress {
3305-
if (visibleProgress) {
3306-
visibleProgress.dispose();
3307-
visibleProgress = null;
3308-
@@ -752,12 +754,12 @@ class RemoteAgentConnectionStatusListener implements IWorkbenchContribution {
3309-
buttons[choice].callback();
3310-
} else {
3311-
if (location === ProgressLocation.Dialog) {
3312-
- visibleProgress = showProgress(ProgressLocation.Notification, buttons, lastReport);
3313-
+ visibleProgress = showProgress(ProgressLocation.Notification, buttons, lastReport, suppressPopup);
3314-
} else {
3315-
hideProgress();
3316-
}
3317-
}
3318-
- }
3319-
+ }, suppressPopup
3320-
);
3321-
}
3322-
3323-
@@ -796,17 +798,17 @@ class RemoteAgentConnectionStatusListener implements IWorkbenchContribution {
3282+
@@ -795,31 +795,43 @@ class RemoteAgentConnectionStatusListener implements IWorkbenchContribution {
3283+
}
33243284
switch (e.type) {
33253285
case PersistentConnectionEventType.ConnectionLost:
3326-
if (!visibleProgress) {
3286+
- if (!visibleProgress) {
33273287
- visibleProgress = showProgress(ProgressLocation.Dialog, [reconnectButton, reloadButton]);
3328-
+ visibleProgress = showProgress(ProgressLocation.Notification, [reconnectButton, reloadButton], null, e.suppressPopup);
3288+
+ if (e.suppressPopup) {
3289+
+ hideProgress()
3290+
+ } else {
3291+
+ if (!visibleProgress) {
3292+
+ visibleProgress = showProgress(ProgressLocation.Dialog, [reconnectButton, reloadButton]);
3293+
+ }
3294+
+ visibleProgress.report(nls.localize('connectionLost', "Connection Lost"));
33293295
}
3330-
visibleProgress.report(nls.localize('connectionLost', "Connection Lost"));
3296+
- visibleProgress.report(nls.localize('connectionLost', "Connection Lost"));
33313297
break;
33323298
case PersistentConnectionEventType.ReconnectionWait:
33333299
reconnectWaitEvent = e;
33343300
- visibleProgress = showProgress(lastLocation || ProgressLocation.Notification, [reconnectButton, reloadButton]);
3335-
+ visibleProgress = showProgress(lastLocation || ProgressLocation.Dialog, [reconnectButton, reloadButton], null, e.suppressPopup);
3336-
visibleProgress.startTimer(Date.now() + 1000 * e.durationSeconds);
3301+
- visibleProgress.startTimer(Date.now() + 1000 * e.durationSeconds);
3302+
+ if (e.suppressPopup) {
3303+
+ hideProgress()
3304+
+ } else {
3305+
+ const location = e.forceDialog ? ProgressLocation.Dialog : (lastLocation || ProgressLocation.Notification)
3306+
+ visibleProgress = showProgress(location, [reconnectButton, reloadButton]);
3307+
+ visibleProgress.startTimer(Date.now() + 1000 * e.durationSeconds);
3308+
+ }
33373309
break;
33383310
case PersistentConnectionEventType.ReconnectionRunning:
33393311
- visibleProgress = showProgress(lastLocation || ProgressLocation.Notification, [reloadButton]);
3340-
+ visibleProgress = showProgress(lastLocation || ProgressLocation.Notification, [reloadButton], null, e.suppressPopup);
3341-
visibleProgress.report(nls.localize('reconnectionRunning', "Attempting to reconnect..."));
3342-
3343-
// Register to listen for quick input is opened
3344-
@@ -815,7 +817,7 @@ class RemoteAgentConnectionStatusListener implements IWorkbenchContribution {
3345-
if (contextKeyChangeEvent.affectsSome(reconnectInteraction)) {
3346-
// Need to move from dialog if being shown and user needs to type in a prompt
3347-
if (lastLocation === ProgressLocation.Dialog && visibleProgress !== null) {
3312+
- visibleProgress.report(nls.localize('reconnectionRunning', "Attempting to reconnect..."));
3313+
-
3314+
- // Register to listen for quick input is opened
3315+
- disposableListener = contextKeyService.onDidChangeContext((contextKeyChangeEvent) => {
3316+
- const reconnectInteraction = new Set<string>([inQuickPickContextKeyValue]);
3317+
- if (contextKeyChangeEvent.affectsSome(reconnectInteraction)) {
3318+
- // Need to move from dialog if being shown and user needs to type in a prompt
3319+
- if (lastLocation === ProgressLocation.Dialog && visibleProgress !== null) {
33483320
- visibleProgress = showProgress(ProgressLocation.Notification, [reloadButton], visibleProgress.lastReport);
3349-
+ visibleProgress = showProgress(ProgressLocation.Notification, [reloadButton], visibleProgress.lastReport, e.suppressPopup);
3321+
+ if (e.suppressPopup) {
3322+
+ hideProgress()
3323+
+ } else {
3324+
+ visibleProgress = showProgress(lastLocation || ProgressLocation.Notification, [reloadButton]);
3325+
+ visibleProgress.report(nls.localize('reconnectionRunning', "Attempting to reconnect..."));
3326+
+
3327+
+ // Register to listen for quick input is opened
3328+
+ disposableListener = contextKeyService.onDidChangeContext((contextKeyChangeEvent) => {
3329+
+ const reconnectInteraction = new Set<string>([inQuickPickContextKeyValue]);
3330+
+ if (contextKeyChangeEvent.affectsSome(reconnectInteraction)) {
3331+
+ // Need to move from dialog if being shown and user needs to type in a prompt
3332+
+ if (lastLocation === ProgressLocation.Dialog && visibleProgress !== null) {
3333+
+ visibleProgress = showProgress(ProgressLocation.Notification, [reloadButton], visibleProgress.lastReport);
3334+
+ }
33503335
}
3351-
}
3352-
});
3336+
- }
3337+
- });
3338+
-
3339+
+ });
3340+
+ }
3341+
break;
3342+
case PersistentConnectionEventType.ReconnectionPermanentFailure:
3343+
hideProgress();
33533344
diff --git a/src/vs/workbench/contrib/scm/browser/media/scm.css b/src/vs/workbench/contrib/scm/browser/media/scm.css
33543345
index ac44ad3bae428def66e22fe9cc1c54648d429f6b..faa63023c4c586b51fa3c2a48ff3641b9cb0e145 100644
33553346
--- a/src/vs/workbench/contrib/scm/browser/media/scm.css

0 commit comments

Comments
 (0)