diff --git a/src/vs/code/electron-main/windows.ts b/src/vs/code/electron-main/windows.ts index d62136f2993..284e1185178 100644 --- a/src/vs/code/electron-main/windows.ts +++ b/src/vs/code/electron-main/windows.ts @@ -1626,7 +1626,7 @@ export class WindowsManager extends Disposable implements IWindowsMainService { cli = { ...cli, remote }; } - const forceReuseWindow = options && options.reuse; + const forceReuseWindow = options && options.forceReuseWindow; const forceNewWindow = !forceReuseWindow; return this.open({ context, cli, forceEmpty: true, forceNewWindow, forceReuseWindow }); diff --git a/src/vs/platform/electron/electron-main/electronMainService.ts b/src/vs/platform/electron/electron-main/electronMainService.ts index f4990f13d02..d78b9d4dba6 100644 --- a/src/vs/platform/electron/electron-main/electronMainService.ts +++ b/src/vs/platform/electron/electron-main/electronMainService.ts @@ -6,7 +6,7 @@ import { Event } from 'vs/base/common/event'; import { IWindowsMainService } from 'vs/platform/windows/electron-main/windows'; import { MessageBoxOptions, MessageBoxReturnValue, shell, OpenDevToolsOptions, SaveDialogOptions, SaveDialogReturnValue, OpenDialogOptions, OpenDialogReturnValue, CrashReporterStartOptions, crashReporter, Menu, BrowserWindow, app } from 'electron'; -import { INativeOpenInWindowOptions } from 'vs/platform/windows/node/window'; +import { INativeOpenWindowOptions } from 'vs/platform/windows/node/window'; import { ILifecycleMainService } from 'vs/platform/lifecycle/electron-main/lifecycleMainService'; import { IOpenedWindow, OpenContext, IWindowOpenable, IOpenEmptyWindowOptions } from 'vs/platform/windows/common/windows'; import { INativeOpenDialogOptions } from 'vs/platform/dialogs/node/dialogs'; @@ -69,11 +69,17 @@ export class ElectronMainService implements AddFirstParameterToFunctions { - this.windowsMainService.openEmptyWindow(OpenContext.API, options); + openWindow(windowId: number, options?: IOpenEmptyWindowOptions): Promise; + openWindow(windowId: number, toOpen: IWindowOpenable[], options?: INativeOpenWindowOptions): Promise; + openWindow(windowId: number, arg1?: IOpenEmptyWindowOptions | IWindowOpenable[], arg2?: INativeOpenWindowOptions): Promise { + if (Array.isArray(arg1)) { + return this.doOpenWindow(windowId, arg1, arg2); + } + + return this.doOpenEmptyWindow(windowId, arg1); } - async openInWindow(windowId: number, toOpen: IWindowOpenable[], options: INativeOpenInWindowOptions = Object.create(null)): Promise { + private async doOpenWindow(windowId: number, toOpen: IWindowOpenable[], options: INativeOpenWindowOptions = Object.create(null)): Promise { if (toOpen.length > 0) { this.windowsMainService.open({ context: OpenContext.API, @@ -91,6 +97,10 @@ export class ElectronMainService implements AddFirstParameterToFunctions { + this.windowsMainService.openEmptyWindow(OpenContext.API, options); + } + async toggleFullScreen(windowId: number): Promise { const window = this.windowsMainService.getWindowById(windowId); if (window) { @@ -267,7 +277,7 @@ export class ElectronMainService implements AddFirstParameterToFunctions { + async closeWorkspace(windowId: number): Promise { const window = this.windowsMainService.getWindowById(windowId); if (window) { return this.windowsMainService.closeWorkspace(window); diff --git a/src/vs/platform/electron/node/electron.ts b/src/vs/platform/electron/node/electron.ts index 3d4221373ff..e097c7a1eba 100644 --- a/src/vs/platform/electron/node/electron.ts +++ b/src/vs/platform/electron/node/electron.ts @@ -11,7 +11,7 @@ import { INativeOpenDialogOptions } from 'vs/platform/dialogs/node/dialogs'; import { ISerializableCommandAction } from 'vs/platform/actions/common/actions'; import { ParsedArgs } from 'vscode-minimist'; import { IProcessEnvironment } from 'vs/base/common/platform'; -import { INativeOpenInWindowOptions } from 'vs/platform/windows/node/window'; +import { INativeOpenWindowOptions } from 'vs/platform/windows/node/window'; export const IElectronService = createDecorator('electronService'); @@ -33,8 +33,8 @@ export interface IElectronService { getWindowCount(): Promise; getActiveWindowId(): Promise; - openEmptyWindow(options?: IOpenEmptyWindowOptions): Promise; - openInWindow(toOpen: IWindowOpenable[], options?: INativeOpenInWindowOptions): Promise; + openWindow(options?: IOpenEmptyWindowOptions): Promise; + openWindow(toOpen: IWindowOpenable[], options?: INativeOpenWindowOptions): Promise; toggleFullScreen(): Promise; @@ -76,7 +76,7 @@ export interface IElectronService { // Lifecycle relaunch(options?: { addArgs?: string[], removeArgs?: string[] }): Promise; reload(): Promise; - closeWorkpsace(): Promise; + closeWorkspace(): Promise; closeWindow(): Promise; quit(): Promise; diff --git a/src/vs/platform/windows/common/windows.ts b/src/vs/platform/windows/common/windows.ts index a14b45cca82..5f63355e8b0 100644 --- a/src/vs/platform/windows/common/windows.ts +++ b/src/vs/platform/windows/common/windows.ts @@ -19,15 +19,17 @@ export interface IOpenedWindow { filename?: string; } -export interface IOpenInWindowOptions { - forceNewWindow?: boolean; +export interface IBaseOpenWindowsOptions { forceReuseWindow?: boolean; +} + +export interface IOpenWindowOptions extends IBaseOpenWindowsOptions { + forceNewWindow?: boolean; noRecentEntry?: boolean; } -export interface IOpenEmptyWindowOptions { - reuse?: boolean; +export interface IOpenEmptyWindowOptions extends IBaseOpenWindowsOptions { remoteAuthority?: string; } diff --git a/src/vs/platform/windows/node/window.ts b/src/vs/platform/windows/node/window.ts index a201aa309a5..b2120a4a043 100644 --- a/src/vs/platform/windows/node/window.ts +++ b/src/vs/platform/windows/node/window.ts @@ -3,10 +3,10 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { IOpenInWindowOptions } from 'vs/platform/windows/common/windows'; +import { IOpenWindowOptions } from 'vs/platform/windows/common/windows'; import { URI } from 'vs/base/common/uri'; -export interface INativeOpenInWindowOptions extends IOpenInWindowOptions { +export interface INativeOpenWindowOptions extends IOpenWindowOptions { diffMode?: boolean; addMode?: boolean; gotoLineMode?: boolean; diff --git a/src/vs/workbench/api/common/apiCommands.ts b/src/vs/workbench/api/common/apiCommands.ts index 3ea4db4364f..a1f752a77a0 100644 --- a/src/vs/workbench/api/common/apiCommands.ts +++ b/src/vs/workbench/api/common/apiCommands.ts @@ -11,7 +11,7 @@ import { ITextEditorOptions } from 'vs/platform/editor/common/editor'; import { EditorViewColumn } from 'vs/workbench/api/common/shared/editor'; import { EditorGroupLayout } from 'vs/workbench/services/editor/common/editorGroupsService'; import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; -import { IOpenInWindowOptions, IWindowOpenable } from 'vs/platform/windows/common/windows'; +import { IOpenWindowOptions, IWindowOpenable, IOpenEmptyWindowOptions } from 'vs/platform/windows/common/windows'; import { IWorkspacesService, hasWorkspaceFileExtension, IRecent } from 'vs/platform/workspaces/common/workspaces'; import { Schemas } from 'vs/base/common/network'; @@ -49,7 +49,7 @@ export class OpenFolderAPICommand { if (!uri) { return executor.executeCommand('_files.pickFolderAndOpen', { forceNewWindow: arg.forceNewWindow }); } - const options: IOpenInWindowOptions = { forceNewWindow: arg.forceNewWindow, forceReuseWindow: arg.forceReuseWindow, noRecentEntry: arg.noRecentEntry }; + const options: IOpenWindowOptions = { forceNewWindow: arg.forceNewWindow, forceReuseWindow: arg.forceReuseWindow, noRecentEntry: arg.noRecentEntry }; uri = URI.revive(uri); const uriToOpen: IWindowOpenable = (hasWorkspaceFileExtension(uri) || uri.scheme === Schemas.untitled) ? { workspaceUri: uri } : { folderUri: uri }; return executor.executeCommand('_files.windowOpen', [uriToOpen], options); @@ -75,10 +75,12 @@ interface INewWindowAPICommandOptions { export class NewWindowAPICommand { public static ID = 'vscode.newWindow'; public static execute(executor: ICommandsExecutor, options?: INewWindowAPICommandOptions): Promise { - return executor.executeCommand('_files.newWindow', { - reuse: options && options.reuseWindow, + const commandOptions: IOpenEmptyWindowOptions = { + forceReuseWindow: options && options.reuseWindow, remoteAuthority: options && options.remoteAuthority - }); + }; + + return executor.executeCommand('_files.newWindow', commandOptions); } } CommandsRegistry.registerCommand({ diff --git a/src/vs/workbench/api/node/extHostCLIServer.ts b/src/vs/workbench/api/node/extHostCLIServer.ts index f0a3c70ec91..e5d3c44e63b 100644 --- a/src/vs/workbench/api/node/extHostCLIServer.ts +++ b/src/vs/workbench/api/node/extHostCLIServer.ts @@ -10,7 +10,7 @@ import { IExtHostCommands } from 'vs/workbench/api/common/extHostCommands'; import { IWindowOpenable } from 'vs/platform/windows/common/windows'; import { URI } from 'vs/base/common/uri'; import { hasWorkspaceFileExtension } from 'vs/platform/workspaces/common/workspaces'; -import { INativeOpenInWindowOptions } from 'vs/platform/windows/node/window'; +import { INativeOpenWindowOptions } from 'vs/platform/windows/node/window'; export interface OpenCommandPipeArgs { type: 'open'; @@ -127,7 +127,7 @@ export class CLIServer { } if (urisToOpen.length) { const waitMarkerFileURI = waitMarkerFilePath ? URI.file(waitMarkerFilePath) : undefined; - const windowOpenArgs: INativeOpenInWindowOptions = { forceNewWindow, diffMode, addMode, gotoLineMode, forceReuseWindow, waitMarkerFileURI }; + const windowOpenArgs: INativeOpenWindowOptions = { forceNewWindow, diffMode, addMode, gotoLineMode, forceReuseWindow, waitMarkerFileURI }; this._commands.executeCommand('_files.windowOpen', urisToOpen, windowOpenArgs); } res.writeHead(200); diff --git a/src/vs/workbench/browser/actions/windowActions.ts b/src/vs/workbench/browser/actions/windowActions.ts index af1e57bc60a..9a0bb2545e2 100644 --- a/src/vs/workbench/browser/actions/windowActions.ts +++ b/src/vs/workbench/browser/actions/windowActions.ts @@ -135,7 +135,7 @@ abstract class BaseOpenRecentAction extends Action { }); if (pick) { - return this.hostService.openInWindow([pick.openable], { forceNewWindow: keyMods && keyMods.ctrlCmd }); + return this.hostService.openWindow([pick.openable], { forceNewWindow: keyMods && keyMods.ctrlCmd }); } } } @@ -260,7 +260,7 @@ export class NewWindowAction extends Action { } run(): Promise { - return this.hostService.openEmptyWindow(); + return this.hostService.openWindow(); } } diff --git a/src/vs/workbench/browser/dnd.ts b/src/vs/workbench/browser/dnd.ts index c2d63566787..005a025aa9b 100644 --- a/src/vs/workbench/browser/dnd.ts +++ b/src/vs/workbench/browser/dnd.ts @@ -297,7 +297,7 @@ export class ResourcesDropHandler { // Open in separate windows if we drop workspaces or just one folder if (toOpen.length > folderURIs.length || folderURIs.length === 1) { - await this.hostService.openInWindow(toOpen, { forceReuseWindow: true }); + await this.hostService.openWindow(toOpen, { forceReuseWindow: true }); } // folders.length > 1: Multiple folders: Create new workspace with folders and open diff --git a/src/vs/workbench/browser/parts/editor/editorWidgets.ts b/src/vs/workbench/browser/parts/editor/editorWidgets.ts index e086ecdc76f..1588d1a9341 100644 --- a/src/vs/workbench/browser/parts/editor/editorWidgets.ts +++ b/src/vs/workbench/browser/parts/editor/editorWidgets.ts @@ -163,7 +163,7 @@ export class OpenWorkspaceButtonContribution extends Disposable implements IEdit this._register(this.openWorkspaceButton.onClick(() => { const model = this.editor.getModel(); if (model) { - this.hostService.openInWindow([{ workspaceUri: model.uri }]); + this.hostService.openWindow([{ workspaceUri: model.uri }]); } })); diff --git a/src/vs/workbench/browser/parts/titlebar/menubarControl.ts b/src/vs/workbench/browser/parts/titlebar/menubarControl.ts index 5c67b37664a..112067306da 100644 --- a/src/vs/workbench/browser/parts/titlebar/menubarControl.ts +++ b/src/vs/workbench/browser/parts/titlebar/menubarControl.ts @@ -222,7 +222,7 @@ export abstract class MenubarControl extends Disposable { const ret: IAction = new Action(commandId, unmnemonicLabel(label), undefined, undefined, (event) => { const openInNewWindow = event && ((!isMacintosh && (event.ctrlKey || event.shiftKey)) || (isMacintosh && (event.metaKey || event.altKey))); - return this.hostService.openInWindow([openable], { + return this.hostService.openWindow([openable], { forceNewWindow: openInNewWindow }); }); diff --git a/src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts b/src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts index db05deb3e72..0efac2f4a02 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts @@ -20,7 +20,7 @@ import { ExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/brow import { OpenExtensionsViewletAction, InstallExtensionsAction, ShowOutdatedExtensionsAction, ShowRecommendedExtensionsAction, ShowRecommendedKeymapExtensionsAction, ShowPopularExtensionsAction, ShowEnabledExtensionsAction, ShowInstalledExtensionsAction, ShowDisabledExtensionsAction, ShowBuiltInExtensionsAction, UpdateAllAction, - EnableAllAction, EnableAllWorkpsaceAction, DisableAllAction, DisableAllWorkpsaceAction, CheckForUpdatesAction, ShowLanguageExtensionsAction, ShowAzureExtensionsAction, EnableAutoUpdateAction, DisableAutoUpdateAction, ConfigureRecommendedExtensionsCommandsContributor, InstallVSIXAction, ReinstallAction, InstallSpecificVersionOfExtensionAction + EnableAllAction, EnableAllWorkspaceAction, DisableAllAction, DisableAllWorkspaceAction, CheckForUpdatesAction, ShowLanguageExtensionsAction, ShowAzureExtensionsAction, EnableAutoUpdateAction, DisableAutoUpdateAction, ConfigureRecommendedExtensionsCommandsContributor, InstallVSIXAction, ReinstallAction, InstallSpecificVersionOfExtensionAction } from 'vs/workbench/contrib/extensions/browser/extensionsActions'; import { ExtensionsInput } from 'vs/workbench/contrib/extensions/common/extensionsInput'; import { ViewletRegistry, Extensions as ViewletExtensions, ViewletDescriptor } from 'vs/workbench/browser/viewlet'; @@ -136,13 +136,13 @@ actionRegistry.registerWorkbenchAction(installVSIXActionDescriptor, 'Extensions: const disableAllAction = new SyncActionDescriptor(DisableAllAction, DisableAllAction.ID, DisableAllAction.LABEL); actionRegistry.registerWorkbenchAction(disableAllAction, 'Extensions: Disable All Installed Extensions', ExtensionsLabel); -const disableAllWorkspaceAction = new SyncActionDescriptor(DisableAllWorkpsaceAction, DisableAllWorkpsaceAction.ID, DisableAllWorkpsaceAction.LABEL); +const disableAllWorkspaceAction = new SyncActionDescriptor(DisableAllWorkspaceAction, DisableAllWorkspaceAction.ID, DisableAllWorkspaceAction.LABEL); actionRegistry.registerWorkbenchAction(disableAllWorkspaceAction, 'Extensions: Disable All Installed Extensions for this Workspace', ExtensionsLabel); const enableAllAction = new SyncActionDescriptor(EnableAllAction, EnableAllAction.ID, EnableAllAction.LABEL); actionRegistry.registerWorkbenchAction(enableAllAction, 'Extensions: Enable All Extensions', ExtensionsLabel); -const enableAllWorkspaceAction = new SyncActionDescriptor(EnableAllWorkpsaceAction, EnableAllWorkpsaceAction.ID, EnableAllWorkpsaceAction.LABEL); +const enableAllWorkspaceAction = new SyncActionDescriptor(EnableAllWorkspaceAction, EnableAllWorkspaceAction.ID, EnableAllWorkspaceAction.LABEL); actionRegistry.registerWorkbenchAction(enableAllWorkspaceAction, 'Extensions: Enable All Extensions for this Workspace', ExtensionsLabel); const checkForUpdatesAction = new SyncActionDescriptor(CheckForUpdatesAction, CheckForUpdatesAction.ID, CheckForUpdatesAction.LABEL); diff --git a/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts b/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts index 592c89debcb..d8be403fe9e 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts @@ -2684,14 +2684,14 @@ export class DisableAllAction extends Action { } } -export class DisableAllWorkpsaceAction extends Action { +export class DisableAllWorkspaceAction extends Action { static readonly ID = 'workbench.extensions.action.disableAllWorkspace'; static LABEL = localize('disableAllWorkspace', "Disable All Installed Extensions for this Workspace"); constructor( - id: string = DisableAllWorkpsaceAction.ID, label: string = DisableAllWorkpsaceAction.LABEL, + id: string = DisableAllWorkspaceAction.ID, label: string = DisableAllWorkspaceAction.LABEL, @IWorkspaceContextService private readonly workspaceContextService: IWorkspaceContextService, @IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService, @IExtensionEnablementService private readonly extensionEnablementService: IExtensionEnablementService @@ -2736,14 +2736,14 @@ export class EnableAllAction extends Action { } } -export class EnableAllWorkpsaceAction extends Action { +export class EnableAllWorkspaceAction extends Action { static readonly ID = 'workbench.extensions.action.enableAllWorkspace'; static LABEL = localize('enableAllWorkspace', "Enable All Extensions for this Workspace"); constructor( - id: string = EnableAllWorkpsaceAction.ID, label: string = EnableAllWorkpsaceAction.LABEL, + id: string = EnableAllWorkspaceAction.ID, label: string = EnableAllWorkspaceAction.LABEL, @IWorkspaceContextService private readonly workspaceContextService: IWorkspaceContextService, @IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService, @IExtensionEnablementService private readonly extensionEnablementService: IExtensionEnablementService diff --git a/src/vs/workbench/contrib/extensions/browser/extensionsViews.ts b/src/vs/workbench/contrib/extensions/browser/extensionsViews.ts index 13628c07e1f..9230ee1708c 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensionsViews.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensionsViews.ts @@ -619,28 +619,28 @@ export class ExtensionsListView extends ViewletPanel { } // Given all recommendations, trims and returns recommendations in the relevant order after filtering out installed extensions - private getTrimmedRecommendations(installedExtensions: IExtension[], value: string, fileBasedRecommendations: IExtensionRecommendation[], otherRecommendations: IExtensionRecommendation[], workpsaceRecommendations: IExtensionRecommendation[]): string[] { + private getTrimmedRecommendations(installedExtensions: IExtension[], value: string, fileBasedRecommendations: IExtensionRecommendation[], otherRecommendations: IExtensionRecommendation[], workspaceRecommendations: IExtensionRecommendation[]): string[] { const totalCount = 8; - workpsaceRecommendations = workpsaceRecommendations + workspaceRecommendations = workspaceRecommendations .filter(recommendation => { return !this.isRecommendationInstalled(recommendation, installedExtensions) && recommendation.extensionId.toLowerCase().indexOf(value) > -1; }); fileBasedRecommendations = fileBasedRecommendations.filter(recommendation => { return !this.isRecommendationInstalled(recommendation, installedExtensions) - && workpsaceRecommendations.every(workspaceRecommendation => workspaceRecommendation.extensionId !== recommendation.extensionId) + && workspaceRecommendations.every(workspaceRecommendation => workspaceRecommendation.extensionId !== recommendation.extensionId) && recommendation.extensionId.toLowerCase().indexOf(value) > -1; }); otherRecommendations = otherRecommendations.filter(recommendation => { return !this.isRecommendationInstalled(recommendation, installedExtensions) && fileBasedRecommendations.every(fileBasedRecommendation => fileBasedRecommendation.extensionId !== recommendation.extensionId) - && workpsaceRecommendations.every(workspaceRecommendation => workspaceRecommendation.extensionId !== recommendation.extensionId) + && workspaceRecommendations.every(workspaceRecommendation => workspaceRecommendation.extensionId !== recommendation.extensionId) && recommendation.extensionId.toLowerCase().indexOf(value) > -1; }); const otherCount = Math.min(2, otherRecommendations.length); - const fileBasedCount = Math.min(fileBasedRecommendations.length, totalCount - workpsaceRecommendations.length - otherCount); - const recommendations = workpsaceRecommendations; + const fileBasedCount = Math.min(fileBasedRecommendations.length, totalCount - workspaceRecommendations.length - otherCount); + const recommendations = workspaceRecommendations; recommendations.push(...fileBasedRecommendations.splice(0, fileBasedCount)); recommendations.push(...otherRecommendations.splice(0, otherCount)); diff --git a/src/vs/workbench/contrib/files/browser/fileActions.ts b/src/vs/workbench/contrib/files/browser/fileActions.ts index 1a0057d0e42..3cdcb6c65e5 100644 --- a/src/vs/workbench/contrib/files/browser/fileActions.ts +++ b/src/vs/workbench/contrib/files/browser/fileActions.ts @@ -737,7 +737,7 @@ export class ShowOpenedFileInNewWindow extends Action { const fileResource = toResource(this.editorService.activeEditor, { supportSideBySide: SideBySideEditor.MASTER }); if (fileResource) { if (this.fileService.canHandleResource(fileResource)) { - this.hostService.openInWindow([{ fileUri: fileResource }], { forceNewWindow: true }); + this.hostService.openWindow([{ fileUri: fileResource }], { forceNewWindow: true }); } else { this.notificationService.info(nls.localize('openFileToShowInNewWindow.unsupportedschema', "The active editor must contain an openable resource.")); } diff --git a/src/vs/workbench/contrib/files/browser/fileCommands.ts b/src/vs/workbench/contrib/files/browser/fileCommands.ts index 367a5c39559..69a28bd2f83 100644 --- a/src/vs/workbench/contrib/files/browser/fileCommands.ts +++ b/src/vs/workbench/contrib/files/browser/fileCommands.ts @@ -6,7 +6,7 @@ import * as nls from 'vs/nls'; import { URI } from 'vs/base/common/uri'; import { toResource, IEditorCommandsContext, SideBySideEditor } from 'vs/workbench/common/editor'; -import { IWindowOpenable, IOpenInWindowOptions, isWorkspaceToOpen, IOpenEmptyWindowOptions } from 'vs/platform/windows/common/windows'; +import { IWindowOpenable, IOpenWindowOptions, isWorkspaceToOpen, IOpenEmptyWindowOptions } from 'vs/platform/windows/common/windows'; import { IHostService } from 'vs/workbench/services/host/browser/host'; import { ServicesAccessor, IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; @@ -78,7 +78,7 @@ export const ResourceSelectedForCompareContext = new RawContextKey('res export const REMOVE_ROOT_FOLDER_COMMAND_ID = 'removeRootFolder'; export const REMOVE_ROOT_FOLDER_LABEL = nls.localize('removeFolderFromWorkspace', "Remove Folder from Workspace"); -export const openWindowCommand = (accessor: ServicesAccessor, toOpen: IWindowOpenable[], options?: IOpenInWindowOptions) => { +export const openWindowCommand = (accessor: ServicesAccessor, toOpen: IWindowOpenable[], options?: IOpenWindowOptions) => { if (Array.isArray(toOpen)) { const hostService = accessor.get(IHostService); const environmentService = accessor.get(IEnvironmentService); @@ -94,13 +94,13 @@ export const openWindowCommand = (accessor: ServicesAccessor, toOpen: IWindowOpe return openable; }); - hostService.openInWindow(toOpen, options); + hostService.openWindow(toOpen, options); } }; export const newWindowCommand = (accessor: ServicesAccessor, options?: IOpenEmptyWindowOptions) => { const hostService = accessor.get(IHostService); - hostService.openEmptyWindow(options); + hostService.openWindow(options); }; async function save( diff --git a/src/vs/workbench/contrib/performance/electron-browser/startupTimings.ts b/src/vs/workbench/contrib/performance/electron-browser/startupTimings.ts index 2a945fc8e68..789a38d7dbb 100644 --- a/src/vs/workbench/contrib/performance/electron-browser/startupTimings.ts +++ b/src/vs/workbench/contrib/performance/electron-browser/startupTimings.ts @@ -21,7 +21,6 @@ import { IPanelService } from 'vs/workbench/services/panel/common/panelService'; import { didUseCachedData, ITimerService } from 'vs/workbench/services/timer/electron-browser/timerService'; import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; import { getEntries } from 'vs/base/common/performance'; -import { IHostService } from 'vs/workbench/services/host/browser/host'; export class StartupTimings implements IWorkbenchContribution { @@ -34,8 +33,7 @@ export class StartupTimings implements IWorkbenchContribution { @ITelemetryService private readonly _telemetryService: ITelemetryService, @ILifecycleService private readonly _lifecycleService: ILifecycleService, @IUpdateService private readonly _updateService: IUpdateService, - @IEnvironmentService private readonly _envService: IEnvironmentService, - @IHostService private readonly _hostService: IHostService + @IEnvironmentService private readonly _envService: IEnvironmentService ) { // this._report().catch(onUnexpectedError); @@ -93,7 +91,7 @@ export class StartupTimings implements IWorkbenchContribution { if (this._lifecycleService.startupKind !== StartupKind.NewWindow) { return false; } - if (await this._hostService.windowCount !== 1) { + if (await this._electronService.getWindowCount() !== 1) { return false; } const activeViewlet = this._viewletService.getActiveViewlet(); diff --git a/src/vs/workbench/contrib/preferences/browser/preferences.contribution.ts b/src/vs/workbench/contrib/preferences/browser/preferences.contribution.ts index 78ae46235bf..5e544b6a1c5 100644 --- a/src/vs/workbench/contrib/preferences/browser/preferences.contribution.ts +++ b/src/vs/workbench/contrib/preferences/browser/preferences.contribution.ts @@ -374,7 +374,7 @@ class PreferencesActionsContribution extends Disposable implements IWorkbenchCon constructor( @IWorkbenchEnvironmentService environmentService: IWorkbenchEnvironmentService, @IPreferencesService private readonly preferencesService: IPreferencesService, - @IWorkspaceContextService private readonly workpsaceContextService: IWorkspaceContextService, + @IWorkspaceContextService private readonly workspaceContextService: IWorkspaceContextService, @ILabelService labelService: ILabelService, @IExtensionService extensionService: IExtensionService, ) { @@ -410,8 +410,8 @@ class PreferencesActionsContribution extends Disposable implements IWorkbenchCon }); this.updatePreferencesEditorMenuItem(); - this._register(workpsaceContextService.onDidChangeWorkbenchState(() => this.updatePreferencesEditorMenuItem())); - this._register(workpsaceContextService.onDidChangeWorkspaceFolders(() => this.updatePreferencesEditorMenuItemForWorkspaceFolders())); + this._register(workspaceContextService.onDidChangeWorkbenchState(() => this.updatePreferencesEditorMenuItem())); + this._register(workspaceContextService.onDidChangeWorkspaceFolders(() => this.updatePreferencesEditorMenuItemForWorkspaceFolders())); extensionService.whenInstalledExtensionsRegistered() .then(() => { @@ -434,7 +434,7 @@ class PreferencesActionsContribution extends Disposable implements IWorkbenchCon private updatePreferencesEditorMenuItem() { const commandId = '_workbench.openWorkspaceSettingsEditor'; - if (this.workpsaceContextService.getWorkbenchState() === WorkbenchState.WORKSPACE && !CommandsRegistry.getCommand(commandId)) { + if (this.workspaceContextService.getWorkbenchState() === WorkbenchState.WORKSPACE && !CommandsRegistry.getCommand(commandId)) { CommandsRegistry.registerCommand(commandId, () => this.preferencesService.openWorkspaceSettings(false)); MenuRegistry.appendMenuItem(MenuId.EditorTitle, { command: { @@ -454,11 +454,11 @@ class PreferencesActionsContribution extends Disposable implements IWorkbenchCon } private updatePreferencesEditorMenuItemForWorkspaceFolders() { - for (const folder of this.workpsaceContextService.getWorkspace().folders) { + for (const folder of this.workspaceContextService.getWorkspace().folders) { const commandId = `_workbench.openFolderSettings.${folder.uri.toString()}`; if (!CommandsRegistry.getCommand(commandId)) { CommandsRegistry.registerCommand(commandId, () => { - if (this.workpsaceContextService.getWorkbenchState() === WorkbenchState.FOLDER) { + if (this.workspaceContextService.getWorkbenchState() === WorkbenchState.FOLDER) { return this.preferencesService.openWorkspaceSettings(false); } else { return this.preferencesService.openFolderSettings(folder.uri, false); 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 144faa240b6..5770a6e4389 100644 --- a/src/vs/workbench/contrib/remote/electron-browser/remote.contribution.ts +++ b/src/vs/workbench/contrib/remote/electron-browser/remote.contribution.ts @@ -91,7 +91,7 @@ export class RemoteWindowActiveIndicator extends Disposable implements IWorkbenc menu: { menuId: MenuId.CommandPalette }, - handler: (_accessor) => this.remoteAuthority && hostService.openEmptyWindow({ reuse: true }) + handler: (_accessor) => this.remoteAuthority && hostService.openWindow({ forceReuseWindow: true }) }); // Pending entry until extensions are ready diff --git a/src/vs/workbench/contrib/stats/electron-browser/workspaceStatsService.ts b/src/vs/workbench/contrib/stats/electron-browser/workspaceStatsService.ts index a8e512b8508..78a1b216c31 100644 --- a/src/vs/workbench/contrib/stats/electron-browser/workspaceStatsService.ts +++ b/src/vs/workbench/contrib/stats/electron-browser/workspaceStatsService.ts @@ -454,7 +454,7 @@ export class WorkspaceStatsService implements IWorkspaceStatsService { this.notificationService.prompt(Severity.Info, localize('workspaceFound', "This folder contains a workspace file '{0}'. Do you want to open it? [Learn more]({1}) about workspace files.", workspaceFile, 'https://go.microsoft.com/fwlink/?linkid=2025315'), [{ label: localize('openWorkspace', "Open Workspace"), - run: () => this.hostService.openInWindow([{ workspaceUri: joinPath(folder, workspaceFile) }]) + run: () => this.hostService.openWindow([{ workspaceUri: joinPath(folder, workspaceFile) }]) }], { neverShowAgain }); } @@ -467,7 +467,7 @@ export class WorkspaceStatsService implements IWorkspaceStatsService { workspaces.map(workspace => ({ label: workspace } as IQuickPickItem)), { placeHolder: localize('selectToOpen', "Select a workspace to open") }).then(pick => { if (pick) { - this.hostService.openInWindow([{ workspaceUri: joinPath(folder, pick.label) }]); + this.hostService.openWindow([{ workspaceUri: joinPath(folder, pick.label) }]); } }); } diff --git a/src/vs/workbench/contrib/welcome/gettingStarted/browser/gettingStarted.contribution.ts b/src/vs/workbench/contrib/welcome/gettingStarted/browser/gettingStarted.contribution.ts index 1c11cd4a4c1..ab15e8a07ee 100644 --- a/src/vs/workbench/contrib/welcome/gettingStarted/browser/gettingStarted.contribution.ts +++ b/src/vs/workbench/contrib/welcome/gettingStarted/browser/gettingStarted.contribution.ts @@ -4,10 +4,8 @@ *--------------------------------------------------------------------------------------------*/ import { Registry } from 'vs/platform/registry/common/platform'; -import { TelemetryOptOut } from './telemetryOptOut'; +import { BrowserTelemetryOptOut } from 'vs/workbench/contrib/welcome/gettingStarted/browser/telemetryOptOut'; import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions'; import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; -Registry - .as(WorkbenchExtensions.Workbench) - .registerWorkbenchContribution(TelemetryOptOut, LifecyclePhase.Eventually); +Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution(BrowserTelemetryOptOut, LifecyclePhase.Eventually); diff --git a/src/vs/workbench/contrib/welcome/gettingStarted/browser/telemetryOptOut.ts b/src/vs/workbench/contrib/welcome/gettingStarted/browser/telemetryOptOut.ts index 4da3e1ea4ad..2d4448c5099 100644 --- a/src/vs/workbench/contrib/welcome/gettingStarted/browser/telemetryOptOut.ts +++ b/src/vs/workbench/contrib/welcome/gettingStarted/browser/telemetryOptOut.ts @@ -19,7 +19,7 @@ import { CancellationToken } from 'vs/base/common/cancellation'; import { IProductService } from 'vs/platform/product/common/productService'; import { IHostService } from 'vs/workbench/services/host/browser/host'; -export class TelemetryOptOut implements IWorkbenchContribution { +export abstract class AbstractTelemetryOptOut implements IWorkbenchContribution { private static TELEMETRY_OPT_OUT_SHOWN = 'workbench.telemetryOptOutShown'; private privacyUrl: string | undefined; @@ -35,18 +35,18 @@ export class TelemetryOptOut implements IWorkbenchContribution { @IExtensionGalleryService private readonly galleryService: IExtensionGalleryService, @IProductService productService: IProductService ) { - if (!productService.telemetryOptOutUrl || storageService.get(TelemetryOptOut.TELEMETRY_OPT_OUT_SHOWN, StorageScope.GLOBAL)) { + if (!productService.telemetryOptOutUrl || storageService.get(AbstractTelemetryOptOut.TELEMETRY_OPT_OUT_SHOWN, StorageScope.GLOBAL)) { return; } const experimentId = 'telemetryOptOut'; Promise.all([ - hostService.windowCount, + this.getWindowCount(), experimentService.getExperimentById(experimentId) ]).then(([count, experimentState]) => { if (!hostService.hasFocus && count > 1) { return; } - storageService.store(TelemetryOptOut.TELEMETRY_OPT_OUT_SHOWN, true, StorageScope.GLOBAL); + storageService.store(AbstractTelemetryOptOut.TELEMETRY_OPT_OUT_SHOWN, true, StorageScope.GLOBAL); this.privacyUrl = productService.privacyStatementUrl || productService.telemetryOptOutUrl; @@ -74,6 +74,8 @@ export class TelemetryOptOut implements IWorkbenchContribution { .then(undefined, onUnexpectedError); } + protected abstract getWindowCount(): Promise; + private runExperiment(experimentId: string) { const promptMessageKey = 'telemetryOptOut.optOutOption'; const yesLabelKey = 'telemetryOptOut.OptIn'; @@ -148,3 +150,10 @@ export class TelemetryOptOut implements IWorkbenchContribution { }); } } + +export class BrowserTelemetryOptOut extends AbstractTelemetryOptOut { + + protected async getWindowCount(): Promise { + return 1; + } +} diff --git a/src/vs/workbench/contrib/welcome/gettingStarted/electron-browser/openWebsite.contribution.ts b/src/vs/workbench/contrib/welcome/gettingStarted/electron-browser/gettingStarted.contribution.ts similarity index 52% rename from src/vs/workbench/contrib/welcome/gettingStarted/electron-browser/openWebsite.contribution.ts rename to src/vs/workbench/contrib/welcome/gettingStarted/electron-browser/gettingStarted.contribution.ts index bdcee7756a2..e634543ae81 100644 --- a/src/vs/workbench/contrib/welcome/gettingStarted/electron-browser/openWebsite.contribution.ts +++ b/src/vs/workbench/contrib/welcome/gettingStarted/electron-browser/gettingStarted.contribution.ts @@ -4,10 +4,10 @@ *--------------------------------------------------------------------------------------------*/ import { Registry } from 'vs/platform/registry/common/platform'; -import { OpenWelcomePageInBrowser } from './openWebsite'; import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions'; import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; +import { NativeTelemetryOptOut } from 'vs/workbench/contrib/welcome/gettingStarted/electron-browser/telemetryOptOut'; +import { OpenWelcomePageInBrowser } from 'vs/workbench/contrib/welcome/gettingStarted/electron-browser/openWebsite'; -Registry - .as(WorkbenchExtensions.Workbench) - .registerWorkbenchContribution(OpenWelcomePageInBrowser, LifecyclePhase.Restored); +Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution(OpenWelcomePageInBrowser, LifecyclePhase.Restored); +Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution(NativeTelemetryOptOut, LifecyclePhase.Eventually); diff --git a/src/vs/workbench/contrib/welcome/gettingStarted/electron-browser/telemetryOptOut.ts b/src/vs/workbench/contrib/welcome/gettingStarted/electron-browser/telemetryOptOut.ts new file mode 100644 index 00000000000..7c6cb2bfb6e --- /dev/null +++ b/src/vs/workbench/contrib/welcome/gettingStarted/electron-browser/telemetryOptOut.ts @@ -0,0 +1,38 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { IStorageService } from 'vs/platform/storage/common/storage'; +import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; +import { IOpenerService } from 'vs/platform/opener/common/opener'; +import { INotificationService } from 'vs/platform/notification/common/notification'; +import { IExperimentService } from 'vs/workbench/contrib/experiments/common/experimentService'; +import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; +import { IExtensionGalleryService } from 'vs/platform/extensionManagement/common/extensionManagement'; +import { IProductService } from 'vs/platform/product/common/productService'; +import { IHostService } from 'vs/workbench/services/host/browser/host'; +import { AbstractTelemetryOptOut } from 'vs/workbench/contrib/welcome/gettingStarted/browser/telemetryOptOut'; +import { IElectronService } from 'vs/platform/electron/node/electron'; + +export class NativeTelemetryOptOut extends AbstractTelemetryOptOut { + + constructor( + @IStorageService storageService: IStorageService, + @IOpenerService openerService: IOpenerService, + @INotificationService notificationService: INotificationService, + @IHostService hostService: IHostService, + @ITelemetryService telemetryService: ITelemetryService, + @IExperimentService experimentService: IExperimentService, + @IConfigurationService configurationService: IConfigurationService, + @IExtensionGalleryService galleryService: IExtensionGalleryService, + @IProductService productService: IProductService, + @IElectronService private readonly electronService: IElectronService + ) { + super(storageService, openerService, notificationService, hostService, telemetryService, experimentService, configurationService, galleryService, productService); + } + + protected getWindowCount(): Promise { + return this.electronService.getWindowCount(); + } +} diff --git a/src/vs/workbench/contrib/welcome/page/browser/welcomePage.ts b/src/vs/workbench/contrib/welcome/page/browser/welcomePage.ts index 51a01b4c23c..f4a36a39767 100644 --- a/src/vs/workbench/contrib/welcome/page/browser/welcomePage.ts +++ b/src/vs/workbench/contrib/welcome/page/browser/welcomePage.ts @@ -365,7 +365,7 @@ class WelcomePage extends Disposable { id: 'openRecentFolder', from: telemetryFrom }); - this.hostService.openInWindow([windowOpenable], { forceNewWindow: e.ctrlKey || e.metaKey }); + this.hostService.openWindow([windowOpenable], { forceNewWindow: e.ctrlKey || e.metaKey }); e.preventDefault(); e.stopPropagation(); }); diff --git a/src/vs/workbench/electron-browser/actions/workspaceActions.ts b/src/vs/workbench/electron-browser/actions/workspaceActions.ts index 4f77543b29d..ca7bcfab229 100644 --- a/src/vs/workbench/electron-browser/actions/workspaceActions.ts +++ b/src/vs/workbench/electron-browser/actions/workspaceActions.ts @@ -65,6 +65,6 @@ export class DuplicateWorkspaceInNewWindowAction extends Action { const newWorkspace = await this.workspacesService.createUntitledWorkspace(folders, remoteAuthority); await this.workspaceEditingService.copyWorkspaceSettings(newWorkspace); - return this.hostService.openInWindow([{ workspaceUri: newWorkspace.configPath }], { forceNewWindow: true }); + return this.hostService.openWindow([{ workspaceUri: newWorkspace.configPath }], { forceNewWindow: true }); } } diff --git a/src/vs/workbench/services/dialogs/browser/abstractFileDialogService.ts b/src/vs/workbench/services/dialogs/browser/abstractFileDialogService.ts index 225cd33eb91..8b5f42ee02e 100644 --- a/src/vs/workbench/services/dialogs/browser/abstractFileDialogService.ts +++ b/src/vs/workbench/services/dialogs/browser/abstractFileDialogService.ts @@ -91,7 +91,7 @@ export abstract class AbstractFileDialogService { const toOpen: IWindowOpenable = stat.isDirectory ? { folderUri: uri } : { fileUri: uri }; if (stat.isDirectory || options.forceNewWindow || preferNewWindow) { - return this.hostService.openInWindow([toOpen], { forceNewWindow: options.forceNewWindow }); + return this.hostService.openWindow([toOpen], { forceNewWindow: options.forceNewWindow }); } else { return this.openerService.open(uri); } @@ -105,7 +105,7 @@ export abstract class AbstractFileDialogService { const uri = await this.pickResource({ canSelectFiles: true, canSelectFolders: false, canSelectMany: false, defaultUri: options.defaultUri, title, availableFileSystems }); if (uri) { if (options.forceNewWindow || preferNewWindow) { - return this.hostService.openInWindow([{ fileUri: uri }], { forceNewWindow: options.forceNewWindow }); + return this.hostService.openWindow([{ fileUri: uri }], { forceNewWindow: options.forceNewWindow }); } else { return this.openerService.open(uri); } @@ -118,7 +118,7 @@ export abstract class AbstractFileDialogService { const uri = await this.pickResource({ canSelectFiles: false, canSelectFolders: true, canSelectMany: false, defaultUri: options.defaultUri, title, availableFileSystems }); if (uri) { - return this.hostService.openInWindow([{ folderUri: uri }], { forceNewWindow: options.forceNewWindow }); + return this.hostService.openWindow([{ folderUri: uri }], { forceNewWindow: options.forceNewWindow }); } } @@ -129,7 +129,7 @@ export abstract class AbstractFileDialogService { const uri = await this.pickResource({ canSelectFiles: true, canSelectFolders: false, canSelectMany: false, defaultUri: options.defaultUri, title, filters, availableFileSystems }); if (uri) { - return this.hostService.openInWindow([{ workspaceUri: uri }], { forceNewWindow: options.forceNewWindow }); + return this.hostService.openWindow([{ workspaceUri: uri }], { forceNewWindow: options.forceNewWindow }); } } diff --git a/src/vs/workbench/services/host/browser/browserHostService.ts b/src/vs/workbench/services/host/browser/browserHostService.ts index 230f1425f51..b9b4527ae6e 100644 --- a/src/vs/workbench/services/host/browser/browserHostService.ts +++ b/src/vs/workbench/services/host/browser/browserHostService.ts @@ -9,7 +9,7 @@ import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService'; import { IResourceEditor, IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; -import { IWindowSettings, IWindowOpenable, IOpenInWindowOptions, isFolderToOpen, isWorkspaceToOpen, isFileToOpen, IOpenEmptyWindowOptions } from 'vs/platform/windows/common/windows'; +import { IWindowSettings, IWindowOpenable, IOpenWindowOptions, isFolderToOpen, isWorkspaceToOpen, isFileToOpen, IOpenEmptyWindowOptions } from 'vs/platform/windows/common/windows'; import { pathsToEditors } from 'vs/workbench/common/editor'; import { IFileService } from 'vs/platform/files/common/files'; import { ILabelService } from 'vs/platform/label/common/label'; @@ -46,13 +46,6 @@ export class BrowserHostService extends Disposable implements IHostService { _serviceBrand: undefined; - //#region Events - - get onDidChangeFocus(): Event { return this._onDidChangeFocus; } - private _onDidChangeFocus: Event; - - //#endregion - private workspaceProvider: IWorkspaceProvider; constructor( @@ -87,11 +80,28 @@ export class BrowserHostService extends Disposable implements IHostService { ); } - //#region Window + get onDidChangeFocus(): Event { return this._onDidChangeFocus; } + private _onDidChangeFocus: Event; - readonly windowCount = Promise.resolve(1); + get hasFocus(): boolean { + return document.hasFocus(); + } - async openInWindow(toOpen: IWindowOpenable[], options?: IOpenInWindowOptions): Promise { + async focus(): Promise { + window.focus(); + } + + openWindow(options?: IOpenEmptyWindowOptions): Promise; + openWindow(toOpen: IWindowOpenable[], options?: IOpenWindowOptions): Promise; + openWindow(arg1?: IOpenEmptyWindowOptions | IWindowOpenable[], arg2?: IOpenWindowOptions): Promise { + if (Array.isArray(arg1)) { + return this.doOpenWindow(arg1, arg2); + } + + return this.doOpenEmptyWindow(arg1); + } + + private async doOpenWindow(toOpen: IWindowOpenable[], options?: IOpenWindowOptions): Promise { for (let i = 0; i < toOpen.length; i++) { const openable = toOpen[i]; openable.label = openable.label || this.getRecentLabel(openable); @@ -126,7 +136,7 @@ export class BrowserHostService extends Disposable implements IHostService { return this.labelService.getUriLabel(openable.fileUri); } - private shouldReuse(options: IOpenInWindowOptions = {}): boolean { + private shouldReuse(options: IOpenWindowOptions = {}): boolean { const windowConfig = this.configurationService.getValue('window'); const openFolderInNewWindowConfig = (windowConfig && windowConfig.openFoldersInNewWindow) || 'default' /* default */; @@ -138,8 +148,8 @@ export class BrowserHostService extends Disposable implements IHostService { return !openFolderInNewWindow; } - async openEmptyWindow(options?: IOpenEmptyWindowOptions): Promise { - this.workspaceProvider.open(undefined, { reuse: options && options.reuse }); + private async doOpenEmptyWindow(options?: IOpenEmptyWindowOptions): Promise { + this.workspaceProvider.open(undefined, { reuse: options && options.forceReuseWindow }); } async toggleFullScreen(): Promise { @@ -176,16 +186,6 @@ export class BrowserHostService extends Disposable implements IHostService { } } - get hasFocus(): boolean { - return document.hasFocus(); - } - - async focus(): Promise { - window.focus(); - } - - //#endregion - async restart(): Promise { this.reload(); } @@ -195,7 +195,7 @@ export class BrowserHostService extends Disposable implements IHostService { } async closeWorkspace(): Promise { - return this.openEmptyWindow({ reuse: true }); + return this.doOpenEmptyWindow({ forceReuseWindow: true }); } } diff --git a/src/vs/workbench/services/host/browser/host.ts b/src/vs/workbench/services/host/browser/host.ts index 9460e9d372c..b27f23f0e27 100644 --- a/src/vs/workbench/services/host/browser/host.ts +++ b/src/vs/workbench/services/host/browser/host.ts @@ -5,7 +5,7 @@ import { Event } from 'vs/base/common/event'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; -import { IWindowOpenable, IOpenInWindowOptions, IOpenEmptyWindowOptions } from 'vs/platform/windows/common/windows'; +import { IWindowOpenable, IOpenWindowOptions, IOpenEmptyWindowOptions } from 'vs/platform/windows/common/windows'; export const IHostService = createDecorator('hostService'); @@ -13,38 +13,13 @@ export interface IHostService { _serviceBrand: undefined; - //#region Events + //#region Focus /** * Emitted when the window focus changes. */ readonly onDidChangeFocus: Event; - //#endregion - - //#region Window - - /** - * The number of windows that belong to the current client session. - */ - readonly windowCount: Promise; - - /** - * Opens the provided array of openables in a window with the provided options. - */ - openInWindow(toOpen: IWindowOpenable[], options?: IOpenInWindowOptions): Promise; - - /** - * Opens an empty window. The optional parameter allows to define if - * a new window should open or the existing one change to an empty. - */ - openEmptyWindow(options?: IOpenEmptyWindowOptions): Promise; - - /** - * Switch between fullscreen and normal window. - */ - toggleFullScreen(): Promise; - /** * Find out if the window has focus or not. */ @@ -57,6 +32,28 @@ export interface IHostService { //#endregion + + //#region Window + + /** + * Opens an empty window. The optional parameter allows to define if + * a new window should open or the existing one change to an empty. + */ + openWindow(options?: IOpenEmptyWindowOptions): Promise; + + /** + * Opens the provided array of openables in a window with the provided options. + */ + openWindow(toOpen: IWindowOpenable[], options?: IOpenWindowOptions): Promise; + + /** + * Switch between fullscreen and normal window. + */ + toggleFullScreen(): Promise; + + //#endregion + + //#region Lifecycle /** diff --git a/src/vs/workbench/services/host/electron-browser/desktopHostService.ts b/src/vs/workbench/services/host/electron-browser/desktopHostService.ts index 8b6dc4a7799..0d6ff8a2a7a 100644 --- a/src/vs/workbench/services/host/electron-browser/desktopHostService.ts +++ b/src/vs/workbench/services/host/electron-browser/desktopHostService.ts @@ -9,7 +9,7 @@ import { IElectronService } from 'vs/platform/electron/node/electron'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { ILabelService } from 'vs/platform/label/common/label'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; -import { IWindowOpenable, IOpenInWindowOptions, isFolderToOpen, isWorkspaceToOpen, IOpenEmptyWindowOptions } from 'vs/platform/windows/common/windows'; +import { IWindowOpenable, IOpenWindowOptions, isFolderToOpen, isWorkspaceToOpen, IOpenEmptyWindowOptions } from 'vs/platform/windows/common/windows'; import { Disposable } from 'vs/base/common/lifecycle'; import { IElectronEnvironmentService } from 'vs/workbench/services/electron/electron-browser/electronEnvironmentService'; @@ -17,16 +17,6 @@ export class DesktopHostService extends Disposable implements IHostService { _serviceBrand: undefined; - //#region Events - - get onDidChangeFocus(): Event { return this._onDidChangeFocus; } - private _onDidChangeFocus: Event = Event.any( - Event.map(Event.filter(this.electronService.onWindowFocus, id => id === this.electronEnvironmentService.windowId), _ => true), - Event.map(Event.filter(this.electronService.onWindowBlur, id => id === this.electronEnvironmentService.windowId), _ => false) - ); - - //#endregion - constructor( @IElectronService private readonly electronService: IElectronService, @ILabelService private readonly labelService: ILabelService, @@ -46,19 +36,31 @@ export class DesktopHostService extends Disposable implements IHostService { this._register(this.onDidChangeFocus(focus => this._hasFocus = focus)); } - //#region Window + get onDidChangeFocus(): Event { return this._onDidChangeFocus; } + private _onDidChangeFocus: Event = Event.any( + Event.map(Event.filter(this.electronService.onWindowFocus, id => id === this.electronEnvironmentService.windowId), _ => true), + Event.map(Event.filter(this.electronService.onWindowBlur, id => id === this.electronEnvironmentService.windowId), _ => false) + ); private _hasFocus: boolean; get hasFocus(): boolean { return this._hasFocus; } - get windowCount(): Promise { return this.electronService.getWindowCount(); } + openWindow(options?: IOpenEmptyWindowOptions): Promise; + openWindow(toOpen: IWindowOpenable[], options?: IOpenWindowOptions): Promise; + openWindow(arg1?: IOpenEmptyWindowOptions | IWindowOpenable[], arg2?: IOpenWindowOptions): Promise { + if (Array.isArray(arg1)) { + return this.doOpenWindow(arg1, arg2); + } - openInWindow(toOpen: IWindowOpenable[], options?: IOpenInWindowOptions): Promise { + return this.doOpenEmptyWindow(arg1); + } + + private doOpenWindow(toOpen: IWindowOpenable[], options?: IOpenWindowOptions): Promise { if (!!this.environmentService.configuration.remoteAuthority) { toOpen.forEach(openable => openable.label = openable.label || this.getRecentLabel(openable)); } - return this.electronService.openInWindow(toOpen, options); + return this.electronService.openWindow(toOpen, options); } private getRecentLabel(openable: IWindowOpenable): string { @@ -73,8 +75,8 @@ export class DesktopHostService extends Disposable implements IHostService { return this.labelService.getUriLabel(openable.fileUri); } - openEmptyWindow(options?: IOpenEmptyWindowOptions): Promise { - return this.electronService.openEmptyWindow(options); + private doOpenEmptyWindow(options?: IOpenEmptyWindowOptions): Promise { + return this.electronService.openWindow(options); } toggleFullScreen(): Promise { @@ -85,8 +87,6 @@ export class DesktopHostService extends Disposable implements IHostService { return this.electronService.focusWindow(); } - //#endregion - restart(): Promise { return this.electronService.relaunch(); } @@ -96,7 +96,7 @@ export class DesktopHostService extends Disposable implements IHostService { } closeWorkspace(): Promise { - return this.electronService.closeWorkpsace(); + return this.electronService.closeWorkspace(); } } diff --git a/src/vs/workbench/services/textfile/browser/browserTextFileService.ts b/src/vs/workbench/services/textfile/browser/browserTextFileService.ts index 4cdfa523db0..4e5c7f6e51d 100644 --- a/src/vs/workbench/services/textfile/browser/browserTextFileService.ts +++ b/src/vs/workbench/services/textfile/browser/browserTextFileService.ts @@ -57,6 +57,10 @@ export class BrowserTextFileService extends AbstractTextFileService { return false; // dirty with backups: no veto } + + protected async getWindowCount(): Promise { + return 1; // Browser only ever is 1 window + } } registerSingleton(ITextFileService, BrowserTextFileService); diff --git a/src/vs/workbench/services/textfile/browser/textFileService.ts b/src/vs/workbench/services/textfile/browser/textFileService.ts index 8b50e38b709..8a399708d0c 100644 --- a/src/vs/workbench/services/textfile/browser/textFileService.ts +++ b/src/vs/workbench/services/textfile/browser/textFileService.ts @@ -39,7 +39,6 @@ import { VSBuffer } from 'vs/base/common/buffer'; import { ITextSnapshot } from 'vs/editor/common/model'; import { ITextResourceConfigurationService } from 'vs/editor/common/services/resourceConfiguration'; import { PLAINTEXT_MODE_ID } from 'vs/editor/common/modes/modesRegistry'; -import { IHostService } from 'vs/workbench/services/host/browser/host'; /** * The workbench file service implementation implements the raw file service spec and adds additional methods on top. @@ -74,14 +73,13 @@ export abstract class AbstractTextFileService extends Disposable implements ITex @IFileService protected readonly fileService: IFileService, @IUntitledEditorService protected readonly untitledEditorService: IUntitledEditorService, @ILifecycleService private readonly lifecycleService: ILifecycleService, - @IInstantiationService protected instantiationService: IInstantiationService, + @IInstantiationService protected readonly instantiationService: IInstantiationService, @IConfigurationService private readonly configurationService: IConfigurationService, @IModeService private readonly modeService: IModeService, @IModelService private readonly modelService: IModelService, @IWorkbenchEnvironmentService protected readonly environmentService: IWorkbenchEnvironmentService, @INotificationService private readonly notificationService: INotificationService, @IBackupFileService private readonly backupFileService: IBackupFileService, - @IHostService private readonly hostService: IHostService, @IHistoryService private readonly historyService: IHistoryService, @IContextKeyService contextKeyService: IContextKeyService, @IDialogService private readonly dialogService: IDialogService, @@ -180,7 +178,7 @@ export abstract class AbstractTextFileService extends Disposable implements ITex case ShutdownReason.CLOSE: if (this.contextService.getWorkbenchState() !== WorkbenchState.EMPTY && this.configuredHotExit === HotExitConfiguration.ON_EXIT_AND_WINDOW_CLOSE) { doBackup = true; // backup if a folder is open and onExitAndWindowClose is configured - } else if (await this.hostService.windowCount > 1 || platform.isMacintosh) { + } else if (await this.getWindowCount() > 1 || platform.isMacintosh) { doBackup = false; // do not backup if a window is closed that does not cause quitting of the application } else { doBackup = true; // backup if last window is closed on win/linux where the application quits right after @@ -213,6 +211,8 @@ export abstract class AbstractTextFileService extends Disposable implements ITex return true; } + protected abstract getWindowCount(): Promise; + private backupAll(dirtyToBackup: URI[]): Promise { // split up between files and untitled diff --git a/src/vs/workbench/services/textfile/electron-browser/nativeTextFileService.ts b/src/vs/workbench/services/textfile/electron-browser/nativeTextFileService.ts index d621479da05..6c7b6033307 100644 --- a/src/vs/workbench/services/textfile/electron-browser/nativeTextFileService.ts +++ b/src/vs/workbench/services/textfile/electron-browser/nativeTextFileService.ts @@ -27,9 +27,46 @@ import { Readable } from 'stream'; import { createTextBufferFactoryFromStream } from 'vs/editor/common/model/textModel'; import { ITextSnapshot } from 'vs/editor/common/model'; import { nodeReadableToString, streamToNodeReadable, nodeStreamToVSBufferReadable } from 'vs/base/node/stream'; +import { IElectronService } from 'vs/platform/electron/node/electron'; +import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService'; +import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle'; +import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; +import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; +import { IModeService } from 'vs/editor/common/services/modeService'; +import { IModelService } from 'vs/editor/common/services/modelService'; +import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; +import { INotificationService } from 'vs/platform/notification/common/notification'; +import { IBackupFileService } from 'vs/workbench/services/backup/common/backup'; +import { IHistoryService } from 'vs/workbench/services/history/common/history'; +import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; +import { IDialogService, IFileDialogService } from 'vs/platform/dialogs/common/dialogs'; +import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; export class NativeTextFileService extends AbstractTextFileService { + constructor( + @IWorkspaceContextService contextService: IWorkspaceContextService, + @IFileService fileService: IFileService, + @IUntitledEditorService untitledEditorService: IUntitledEditorService, + @ILifecycleService lifecycleService: ILifecycleService, + @IInstantiationService instantiationService: IInstantiationService, + @IConfigurationService configurationService: IConfigurationService, + @IModeService modeService: IModeService, + @IModelService modelService: IModelService, + @IWorkbenchEnvironmentService environmentService: IWorkbenchEnvironmentService, + @INotificationService notificationService: INotificationService, + @IBackupFileService backupFileService: IBackupFileService, + @IHistoryService historyService: IHistoryService, + @IContextKeyService contextKeyService: IContextKeyService, + @IDialogService dialogService: IDialogService, + @IFileDialogService fileDialogService: IFileDialogService, + @IEditorService editorService: IEditorService, + @ITextResourceConfigurationService textResourceConfigurationService: ITextResourceConfigurationService, + @IElectronService private readonly electronService: IElectronService + ) { + super(contextService, fileService, untitledEditorService, lifecycleService, instantiationService, configurationService, modeService, modelService, environmentService, notificationService, backupFileService, historyService, contextKeyService, dialogService, fileDialogService, editorService, textResourceConfigurationService); + } + private _encoding!: EncodingOracle; get encoding(): EncodingOracle { if (!this._encoding) { @@ -255,6 +292,10 @@ export class NativeTextFileService extends AbstractTextFileService { }); }); } + + protected getWindowCount(): Promise { + return this.electronService.getWindowCount(); + } } export interface IEncodingOverride { diff --git a/src/vs/workbench/services/textfile/test/textFileService.test.ts b/src/vs/workbench/services/textfile/test/textFileService.test.ts index aefecca6e8b..e1eda1bcc27 100644 --- a/src/vs/workbench/services/textfile/test/textFileService.test.ts +++ b/src/vs/workbench/services/textfile/test/textFileService.test.ts @@ -7,7 +7,7 @@ import * as sinon from 'sinon'; import * as platform from 'vs/base/common/platform'; import { URI } from 'vs/base/common/uri'; import { ILifecycleService, BeforeShutdownEvent, ShutdownReason } from 'vs/platform/lifecycle/common/lifecycle'; -import { workbenchInstantiationService, TestLifecycleService, TestTextFileService, TestContextService, TestFileService, TestHostService } from 'vs/workbench/test/workbenchTestServices'; +import { workbenchInstantiationService, TestLifecycleService, TestTextFileService, TestContextService, TestFileService, TestElectronService } from 'vs/workbench/test/workbenchTestServices'; import { toResource } from 'vs/base/test/common/utils'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { TextFileEditorModel } from 'vs/workbench/services/textfile/common/textFileEditorModel'; @@ -20,7 +20,7 @@ import { IWorkspaceContextService, Workspace } from 'vs/platform/workspace/commo import { IModelService } from 'vs/editor/common/services/modelService'; import { ModelServiceImpl } from 'vs/editor/common/services/modelServiceImpl'; import { Schemas } from 'vs/base/common/network'; -import { IHostService } from 'vs/workbench/services/host/browser/host'; +import { IElectronService } from 'vs/platform/electron/node/electron'; class ServiceAccessor { constructor( @@ -30,7 +30,7 @@ class ServiceAccessor { @IWorkspaceContextService public contextService: TestContextService, @IModelService public modelService: ModelServiceImpl, @IFileService public fileService: TestFileService, - @IHostService public hostService: TestHostService + @IElectronService public electronService: TestElectronService ) { } } @@ -424,7 +424,7 @@ suite('Files - TextFileService', () => { } // Set multiple windows if required if (multipleWindows) { - accessor.hostService.windowCount = Promise.resolve(2); + accessor.electronService.windowCount = Promise.resolve(2); } // Set cancel to force a veto if hot exit does not trigger service.setConfirmResult(ConfirmResult.CANCEL); diff --git a/src/vs/workbench/services/timer/electron-browser/timerService.ts b/src/vs/workbench/services/timer/electron-browser/timerService.ts index aefb915e2b6..1f761754f54 100644 --- a/src/vs/workbench/services/timer/electron-browser/timerService.ts +++ b/src/vs/workbench/services/timer/electron-browser/timerService.ts @@ -7,7 +7,7 @@ import { createDecorator } from 'vs/platform/instantiation/common/instantiation' import { virtualMachineHint } from 'vs/base/node/id'; import * as perf from 'vs/base/common/performance'; import * as os from 'os'; -import { IHostService } from 'vs/workbench/services/host/browser/host'; +import { IElectronService } from 'vs/platform/electron/node/electron'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace'; import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; @@ -308,7 +308,7 @@ class TimerService implements ITimerService { private _startupMetrics?: Promise; constructor( - @IHostService private readonly _hostService: IHostService, + @IElectronService private readonly _electronService: IElectronService, @IWorkbenchEnvironmentService private readonly _environmentService: IWorkbenchEnvironmentService, @ILifecycleService private readonly _lifecycleService: ILifecycleService, @IWorkspaceContextService private readonly _contextService: IWorkspaceContextService, @@ -380,7 +380,7 @@ class TimerService implements ITimerService { isLatestVersion: Boolean(await this._updateService.isLatestVersion()), didUseCachedData: didUseCachedData(), windowKind: this._lifecycleService.startupKind, - windowCount: await this._hostService.windowCount, + windowCount: await this._electronService.getWindowCount(), viewletId: activeViewlet ? activeViewlet.getId() : undefined, editorIds: this._editorService.visibleEditors.map(input => input.getTypeId()), panelId: activePanel ? activePanel.getId() : undefined, diff --git a/src/vs/workbench/services/workspaces/electron-browser/workspaceEditingService.ts b/src/vs/workbench/services/workspaces/electron-browser/workspaceEditingService.ts index 74825065662..5c983b207b1 100644 --- a/src/vs/workbench/services/workspaces/electron-browser/workspaceEditingService.ts +++ b/src/vs/workbench/services/workspaces/electron-browser/workspaceEditingService.ts @@ -78,8 +78,7 @@ export class NativeWorkspaceEditingService extends AbstractWorkspaceEditingServi return false; // only care about untitled workspaces to ask for saving } - const windowCount = await this.hostService.windowCount; - + const windowCount = await this.electronService.getWindowCount(); if (reason === ShutdownReason.CLOSE && !isMacintosh && windowCount === 1) { return false; // Windows/Linux: quits when last window is closed, so do not ask then } diff --git a/src/vs/workbench/test/workbenchTestServices.ts b/src/vs/workbench/test/workbenchTestServices.ts index a0e8bbe4055..5dc75ce4f00 100644 --- a/src/vs/workbench/test/workbenchTestServices.ts +++ b/src/vs/workbench/test/workbenchTestServices.ts @@ -8,7 +8,7 @@ import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileE import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock'; import { join } from 'vs/base/common/path'; import * as resources from 'vs/base/common/resources'; -import { URI } from 'vs/base/common/uri'; +import { URI, UriComponents } from 'vs/base/common/uri'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtils'; import { ConfirmResult, IEditorInputWithOptions, CloseDirection, IEditorIdentifier, IUntitledResourceInput, IResourceDiffInput, IResourceSideBySideInput, IEditorInput, IEditor, IEditorCloseEvent, IEditorPartOptions } from 'vs/workbench/common/editor'; @@ -35,7 +35,7 @@ import { IModeService } from 'vs/editor/common/services/modeService'; import { IHistoryService } from 'vs/workbench/services/history/common/history'; import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService'; -import { MenuBarVisibility, IWindowConfiguration, IWindowOpenable, IOpenInWindowOptions, IOpenEmptyWindowOptions } from 'vs/platform/windows/common/windows'; +import { MenuBarVisibility, IWindowConfiguration, IWindowOpenable, IOpenWindowOptions, IOpenEmptyWindowOptions, IOpenedWindow } from 'vs/platform/windows/common/windows'; import { TestWorkspace } from 'vs/platform/workspace/test/common/testWorkspace'; import { createTextBufferFactoryFromStream } from 'vs/editor/common/model/textModel'; import { IEnvironmentService } from 'vs/platform/environment/common/environment'; @@ -70,7 +70,7 @@ import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; import { ViewletDescriptor, Viewlet } from 'vs/workbench/browser/viewlet'; import { IViewlet } from 'vs/workbench/common/viewlet'; import { IStorageService, InMemoryStorageService } from 'vs/platform/storage/common/storage'; -import { isLinux, isMacintosh } from 'vs/base/common/platform'; +import { isLinux, isMacintosh, IProcessEnvironment } from 'vs/base/common/platform'; import { LabelService } from 'vs/workbench/services/label/common/labelService'; import { IDimension } from 'vs/platform/layout/browser/layoutService'; import { Part } from 'vs/workbench/browser/part'; @@ -86,6 +86,8 @@ import { Schemas } from 'vs/base/common/network'; import { IProductService } from 'vs/platform/product/common/productService'; import product from 'vs/platform/product/common/product'; import { IHostService } from 'vs/workbench/services/host/browser/host'; +import { IElectronService } from 'vs/platform/electron/node/electron'; +import { INativeOpenDialogOptions } from 'vs/platform/dialogs/node/dialogs'; export function createFileInput(instantiationService: IInstantiationService, resource: URI): FileEditorInput { return instantiationService.createInstance(FileEditorInput, resource, undefined, undefined); @@ -199,13 +201,13 @@ export class TestTextFileService extends NativeTextFileService { @IWorkbenchEnvironmentService environmentService: IWorkbenchEnvironmentService, @INotificationService notificationService: INotificationService, @IBackupFileService backupFileService: IBackupFileService, - @IHostService hostService: IHostService, @IHistoryService historyService: IHistoryService, @IContextKeyService contextKeyService: IContextKeyService, @IDialogService dialogService: IDialogService, @IFileDialogService fileDialogService: IFileDialogService, @IEditorService editorService: IEditorService, - @ITextResourceConfigurationService textResourceConfigurationService: ITextResourceConfigurationService + @ITextResourceConfigurationService textResourceConfigurationService: ITextResourceConfigurationService, + @IElectronService electronService: IElectronService ) { super( contextService, @@ -219,13 +221,13 @@ export class TestTextFileService extends NativeTextFileService { environmentService, notificationService, backupFileService, - hostService, historyService, contextKeyService, dialogService, fileDialogService, editorService, - textResourceConfigurationService + textResourceConfigurationService, + electronService ); } @@ -296,6 +298,7 @@ export function workbenchInstantiationService(): IInstantiationService { instantiationService.stub(IUntitledEditorService, instantiationService.createInstance(UntitledEditorService)); instantiationService.stub(IStorageService, new TestStorageService()); instantiationService.stub(IWorkbenchLayoutService, new TestLayoutService()); + instantiationService.stub(IElectronService, new TestElectronService()); instantiationService.stub(IModeService, instantiationService.createInstance(ModeServiceImpl)); instantiationService.stub(IHistoryService, new TestHistoryService()); instantiationService.stub(ITextResourcePropertiesService, new TestTextResourcePropertiesService(configService)); @@ -1309,16 +1312,72 @@ export class TestHostService implements IHostService { readonly hasFocus: boolean = true; readonly onDidChangeFocus: Event = Event.None; - windowCount = Promise.resolve(1); - async restart(): Promise { } async reload(): Promise { } async closeWorkspace(): Promise { } async focus(): Promise { } - async openEmptyWindow(options?: IOpenEmptyWindowOptions): Promise { } - async openInWindow(toOpen: IWindowOpenable[], options?: IOpenInWindowOptions): Promise { } + async openWindow(arg1?: IOpenEmptyWindowOptions | IWindowOpenable[], arg2?: IOpenWindowOptions): Promise { } async toggleFullScreen(): Promise { } } + +export class TestElectronService implements IElectronService { + _serviceBrand: undefined; + + onWindowOpen: Event = Event.None; + onWindowMaximize: Event = Event.None; + onWindowUnmaximize: Event = Event.None; + onWindowFocus: Event = Event.None; + onWindowBlur: Event = Event.None; + + windowCount = Promise.resolve(1); + getWindowCount(): Promise { return this.windowCount; } + + async getWindows(): Promise { return []; } + async getActiveWindowId(): Promise { return undefined; } + + openWindow(options?: IOpenEmptyWindowOptions): Promise; + openWindow(toOpen: IWindowOpenable[], options?: IOpenWindowOptions): Promise; + openWindow(arg1?: IOpenEmptyWindowOptions | IWindowOpenable[], arg2?: IOpenWindowOptions): Promise { + throw new Error('Method not implemented.'); + } + + async toggleFullScreen(): Promise { } + async handleTitleDoubleClick(): Promise { } + async isMaximized(): Promise { return true; } + async maximizeWindow(): Promise { } + async unmaximizeWindow(): Promise { } + async minimizeWindow(): Promise { } + async isWindowFocused(): Promise { return true; } + async focusWindow(options?: { windowId?: number | undefined; } | undefined): Promise { } + async showMessageBox(options: Electron.MessageBoxOptions): Promise { throw new Error('Method not implemented.'); } + async showSaveDialog(options: Electron.SaveDialogOptions): Promise { throw new Error('Method not implemented.'); } + async showOpenDialog(options: Electron.OpenDialogOptions): Promise { throw new Error('Method not implemented.'); } + async pickFileFolderAndOpen(options: INativeOpenDialogOptions): Promise { } + async pickFileAndOpen(options: INativeOpenDialogOptions): Promise { } + async pickFolderAndOpen(options: INativeOpenDialogOptions): Promise { } + async pickWorkspaceAndOpen(options: INativeOpenDialogOptions): Promise { } + async showItemInFolder(path: string): Promise { } + async setRepresentedFilename(path: string): Promise { } + async setDocumentEdited(edited: boolean): Promise { } + async openExternal(url: string): Promise { return false; } + async updateTouchBar(items: { id: string; title: string | { value: string; original: string; }; category?: string | { value: string; original: string; } | undefined; iconLocation?: { dark: UriComponents; light?: { readonly scheme: string; readonly authority: string; readonly path: string; readonly query: string; readonly fragment: string; readonly fsPath: string; with: {}; toString: {}; toJSON: {}; } | undefined; } | undefined; precondition?: { getType: {}; equals: {}; evaluate: {}; serialize: {}; keys: {}; map: {}; negate: {}; } | undefined; toggled?: { getType: {}; equals: {}; evaluate: {}; serialize: {}; keys: {}; map: {}; negate: {}; } | undefined; }[][]): Promise { } + async newWindowTab(): Promise { } + async showPreviousWindowTab(): Promise { } + async showNextWindowTab(): Promise { } + async moveWindowTabToNewWindow(): Promise { } + async mergeAllWindowTabs(): Promise { } + async toggleWindowTabsBar(): Promise { } + async relaunch(options?: { addArgs?: string[] | undefined; removeArgs?: string[] | undefined; } | undefined): Promise { } + async reload(): Promise { } + async closeWorkspace(): Promise { } + async closeWindow(): Promise { } + async quit(): Promise { } + async openDevTools(options?: Electron.OpenDevToolsOptions | undefined): Promise { } + async toggleDevTools(): Promise { } + async startCrashReporter(options: Electron.CrashReporterStartOptions): Promise { } + async resolveProxy(url: string): Promise { return undefined; } + async openExtensionDevelopmentHostWindow(args: minimist.ParsedArgs, env: IProcessEnvironment): Promise { } +} diff --git a/src/vs/workbench/workbench.common.main.ts b/src/vs/workbench/workbench.common.main.ts index 883940d19a5..4016b316a38 100644 --- a/src/vs/workbench/workbench.common.main.ts +++ b/src/vs/workbench/workbench.common.main.ts @@ -235,7 +235,6 @@ import 'vs/workbench/contrib/surveys/browser/languageSurveys.contribution'; import 'vs/workbench/contrib/welcome/overlay/browser/welcomeOverlay'; import 'vs/workbench/contrib/welcome/page/browser/welcomePage.contribution'; import 'vs/workbench/contrib/welcome/walkThrough/browser/walkThrough.contribution'; -import 'vs/workbench/contrib/welcome/gettingStarted/browser/gettingStarted.contribution'; // Call Hierarchy import 'vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution'; diff --git a/src/vs/workbench/workbench.desktop.main.ts b/src/vs/workbench/workbench.desktop.main.ts index 89d92b243ec..3dd3700dc0d 100644 --- a/src/vs/workbench/workbench.desktop.main.ts +++ b/src/vs/workbench/workbench.desktop.main.ts @@ -133,7 +133,7 @@ import 'vs/workbench/contrib/tasks/electron-browser/taskService'; import 'vs/workbench/contrib/userDataSync/electron-browser/userDataSync.contribution'; // Welcome -import 'vs/workbench/contrib/welcome/gettingStarted/electron-browser/openWebsite.contribution'; +import 'vs/workbench/contrib/welcome/gettingStarted/electron-browser/gettingStarted.contribution'; // Configuration Exporter import 'vs/workbench/contrib/configExporter/node/configurationExportHelper.contribution'; diff --git a/src/vs/workbench/workbench.web.main.ts b/src/vs/workbench/workbench.web.main.ts index 6ac8789dd5b..f5fe40a4cae 100644 --- a/src/vs/workbench/workbench.web.main.ts +++ b/src/vs/workbench/workbench.web.main.ts @@ -105,4 +105,7 @@ import 'vs/workbench/contrib/terminal/browser/terminalInstanceService'; // Tasks import 'vs/workbench/contrib/tasks/browser/taskService'; +// Welcome +import 'vs/workbench/contrib/welcome/gettingStarted/browser/gettingStarted.contribution'; + //#endregion