From 6dd56684c4231c0636b300131859b7b33d3354fd Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Tue, 24 Aug 2021 15:47:36 +0200 Subject: [PATCH] Add "Open Developer Tools" action when establishing a connection fails --- .../electron-sandbox/remoteAgentServiceImpl.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/services/remote/electron-sandbox/remoteAgentServiceImpl.ts b/src/vs/workbench/services/remote/electron-sandbox/remoteAgentServiceImpl.ts index d30623f6f1f..836cd6b169c 100644 --- a/src/vs/workbench/services/remote/electron-sandbox/remoteAgentServiceImpl.ts +++ b/src/vs/workbench/services/remote/electron-sandbox/remoteAgentServiceImpl.ts @@ -12,12 +12,13 @@ import { AbstractRemoteAgentService } from 'vs/workbench/services/remote/common/ import { ISignService } from 'vs/platform/sign/common/sign'; import { ILogService } from 'vs/platform/log/common/log'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; -import { INotificationService } from 'vs/platform/notification/common/notification'; +import { INotificationService, Severity } from 'vs/platform/notification/common/notification'; import { Registry } from 'vs/platform/registry/common/platform'; import { IWorkbenchContribution, IWorkbenchContributionsRegistry, Extensions } from 'vs/workbench/common/contributions'; import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { getRemoteName } from 'vs/platform/remote/common/remoteHosts'; +import { INativeHostService } from 'vs/platform/native/electron-sandbox/native'; export class RemoteAgentService extends AbstractRemoteAgentService implements IRemoteAgentService { constructor( @@ -38,6 +39,7 @@ class RemoteConnectionFailureNotificationContribution implements IWorkbenchContr @INotificationService notificationService: INotificationService, @IWorkbenchEnvironmentService environmentService: IWorkbenchEnvironmentService, @ITelemetryService telemetryService: ITelemetryService, + @INativeHostService nativeHostService: INativeHostService, ) { // Let's cover the case where connecting to fetch the remote extension info fails remoteAgentService.getRawEnvironment() @@ -60,7 +62,14 @@ class RemoteConnectionFailureNotificationContribution implements IWorkbenchContr }); if (!RemoteAuthorityResolverError.isHandled(err)) { - notificationService.error(nls.localize('connectionError', "Failed to connect to the remote extension host server (Error: {0})", err ? err.message : '')); + notificationService.prompt( + Severity.Error, + nls.localize('connectionError', "Failed to connect to the remote extension host server (Error: {0})", err ? err.message : ''), + [{ + label: nls.localize('devTools', "Open Developer Tools"), + run: () => nativeHostService.openDevTools() + }] + ); } }); }