From 167e621c0e46b19ea636ea3a029967d979ccf69c Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Sat, 13 Jul 2019 17:00:24 +0200 Subject: [PATCH] Align presentation of empty workbench on startup. Fixes microsoft/vscode-remote-release#954 --- .../electron-browser/remote.contribution.ts | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/vs/workbench/contrib/remote/electron-browser/remote.contribution.ts b/src/vs/workbench/contrib/remote/electron-browser/remote.contribution.ts index 78264965a27..8d9b3dda9f4 100644 --- a/src/vs/workbench/contrib/remote/electron-browser/remote.contribution.ts +++ b/src/vs/workbench/contrib/remote/electron-browser/remote.contribution.ts @@ -397,12 +397,45 @@ class RemoteTelemetryEnablementUpdater extends Disposable implements IWorkbenchC } } +class RemoteEmptyWorkbenchPresentation extends Disposable implements IWorkbenchContribution { + constructor( + @IWorkbenchEnvironmentService environmentService: IWorkbenchEnvironmentService, + @IRemoteAuthorityResolverService remoteAuthorityResolverService: IRemoteAuthorityResolverService, + @IConfigurationService configurationService: IConfigurationService, + @ICommandService commandService: ICommandService, + ) { + super(); + + function shouldShowExplorer(): boolean { + const startupEditor = configurationService.getValue('workbench.startupEditor'); + return startupEditor !== 'welcomePage' && startupEditor !== 'welcomePageInEmptyWorkbench'; + } + + function shouldShowTerminal(): boolean { + return shouldShowExplorer(); + } + + const { remoteAuthority, folderUri, workspace } = environmentService.configuration; + if (remoteAuthority && !folderUri && !workspace) { + remoteAuthorityResolverService.resolveAuthority(remoteAuthority).then(() => { + if (shouldShowExplorer()) { + commandService.executeCommand('workbench.view.explorer'); + } + if (shouldShowTerminal()) { + commandService.executeCommand('workbench.action.terminal.toggleTerminal'); + } + }); + } + } +} + const workbenchContributionsRegistry = Registry.as(WorkbenchContributionsExtensions.Workbench); workbenchContributionsRegistry.registerWorkbenchContribution(RemoteChannelsContribution, LifecyclePhase.Starting); workbenchContributionsRegistry.registerWorkbenchContribution(RemoteAgentDiagnosticListener, LifecyclePhase.Eventually); workbenchContributionsRegistry.registerWorkbenchContribution(RemoteAgentConnectionStatusListener, LifecyclePhase.Eventually); workbenchContributionsRegistry.registerWorkbenchContribution(RemoteWindowActiveIndicator, LifecyclePhase.Starting); workbenchContributionsRegistry.registerWorkbenchContribution(RemoteTelemetryEnablementUpdater, LifecyclePhase.Ready); +workbenchContributionsRegistry.registerWorkbenchContribution(RemoteEmptyWorkbenchPresentation, LifecyclePhase.Starting); Registry.as(ConfigurationExtensions.Configuration) .registerConfiguration({ -- GitLab