From 5a7da8c6876fa5804a0f90cfd547abf73a67eb6c Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Thu, 19 Jul 2018 12:48:50 +0200 Subject: [PATCH] :lipstick: --- src/vs/code/electron-main/app.ts | 4 ++-- src/vs/code/electron-main/menubar.ts | 2 +- src/vs/code/electron-main/menus.ts | 10 +++++----- src/vs/code/electron-main/windows.ts | 14 +++++--------- src/vs/code/node/windowsFinder.ts | 2 +- src/vs/platform/windows/electron-main/windows.ts | 2 +- .../windows/electron-main/windowsService.ts | 6 +++--- 7 files changed, 18 insertions(+), 22 deletions(-) diff --git a/src/vs/code/electron-main/app.ts b/src/vs/code/electron-main/app.ts index 9ef1c329ee3..204bb002fa6 100644 --- a/src/vs/code/electron-main/app.ts +++ b/src/vs/code/electron-main/app.ts @@ -175,7 +175,7 @@ export class CodeApplication { this.windowsMainService.open({ context: OpenContext.DOCK /* can also be opening from finder while app is running */, cli: this.environmentService.args, - pathsToOpen: macOpenFileURIs, + urisToOpen: macOpenFileURIs, preferNewWindow: true /* dropping on the dock or opening from finder prefers to open in a new window */ }); macOpenFileURIs = []; @@ -465,7 +465,7 @@ export class CodeApplication { if (args['new-window'] && args._.length === 0) { this.windowsMainService.open({ context, cli: args, forceNewWindow: true, forceEmpty: true, initialStartup: true }); // new window if "-n" was used without paths } else if (macOpenFiles && macOpenFiles.length && (!args._ || !args._.length)) { - this.windowsMainService.open({ context: OpenContext.DOCK, cli: args, pathsToOpen: macOpenFiles.map(file => URI.file(file)), initialStartup: true }); // mac: open-file event received on startup + this.windowsMainService.open({ context: OpenContext.DOCK, cli: args, urisToOpen: macOpenFiles.map(file => URI.file(file)), initialStartup: true }); // mac: open-file event received on startup } else { this.windowsMainService.open({ context, cli: args, forceNewWindow: args['new-window'] || (!args._.length && args['unity-launch']), diffMode: args.diff, initialStartup: true }); // default: read paths from cli } diff --git a/src/vs/code/electron-main/menubar.ts b/src/vs/code/electron-main/menubar.ts index 8d4f62489d2..84c15cd5cf0 100644 --- a/src/vs/code/electron-main/menubar.ts +++ b/src/vs/code/electron-main/menubar.ts @@ -533,7 +533,7 @@ export class Menubar { const success = this.windowsMainService.open({ context: OpenContext.MENU, cli: this.environmentService.args, - pathsToOpen: [uri], + urisToOpen: [uri], forceNewWindow: openInNewWindow, forceOpenWorkspaceAsFile: isFile }).length > 0; diff --git a/src/vs/code/electron-main/menus.ts b/src/vs/code/electron-main/menus.ts index 89b23681c78..6cef41ae966 100644 --- a/src/vs/code/electron-main/menus.ts +++ b/src/vs/code/electron-main/menus.ts @@ -490,16 +490,16 @@ export class CodeMenu { private createOpenRecentMenuItem(workspace: IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier | string, commandId: string, isFile: boolean): Electron.MenuItem { let label: string; - let resource: URI; + let uri: URI; if (isSingleFolderWorkspaceIdentifier(workspace)) { label = unmnemonicLabel(getWorkspaceLabel(workspace, this.environmentService, { verbose: true })); - resource = workspace; + uri = workspace; } else if (isWorkspaceIdentifier(workspace)) { label = getWorkspaceLabel(workspace, this.environmentService, { verbose: true }); - resource = URI.file(workspace.configPath); + uri = URI.file(workspace.configPath); } else { label = unmnemonicLabel(getPathLabel(workspace, this.environmentService, null)); - resource = URI.file(workspace); + uri = URI.file(workspace); } return new MenuItem(this.likeAction(commandId, { @@ -509,7 +509,7 @@ export class CodeMenu { const success = this.windowsMainService.open({ context: OpenContext.MENU, cli: this.environmentService.args, - pathsToOpen: [resource], forceNewWindow: openInNewWindow, + urisToOpen: [uri], forceNewWindow: openInNewWindow, forceOpenWorkspaceAsFile: isFile }).length > 0; diff --git a/src/vs/code/electron-main/windows.ts b/src/vs/code/electron-main/windows.ts index c6adbabb780..2cc708de104 100644 --- a/src/vs/code/electron-main/windows.ts +++ b/src/vs/code/electron-main/windows.ts @@ -421,7 +421,7 @@ export class WindowsManager implements IWindowsMainService { // Make sure to pass focus to the most relevant of the windows if we open multiple if (usedWindows.length > 1) { - let focusLastActive = this.windowsState.lastActiveWindow && !openConfig.forceEmpty && !openConfig.cli._.length && (!openConfig.pathsToOpen || !openConfig.pathsToOpen.length); + let focusLastActive = this.windowsState.lastActiveWindow && !openConfig.forceEmpty && !openConfig.cli._.length && (!openConfig.urisToOpen || !openConfig.urisToOpen.length); let focusLastOpened = true; let focusLastWindow = true; @@ -671,7 +671,7 @@ export class WindowsManager implements IWindowsMainService { // Open remaining ones allFoldersToOpen.forEach(folderToOpen => { - if (windowsOnFolderPath.some(win => isEqual(win.openedFolderUri, folderToOpen, hasToIgnoreCase(win.openedFolderUri)))) { //TODO:#54483 + if (windowsOnFolderPath.some(win => isEqual(win.openedFolderUri, folderToOpen, hasToIgnoreCase(win.openedFolderUri)))) { return; // ignore folders that are already open } @@ -773,13 +773,12 @@ export class WindowsManager implements IWindowsMainService { return browserWindow; } - //TODO:#54483 (Checked) private getPathsToOpen(openConfig: IOpenConfiguration): IPathToOpen[] { let windowsToOpen: IPathToOpen[]; let isCommandLineOrAPICall = false; // Extract paths: from API - if (openConfig.pathsToOpen && openConfig.pathsToOpen.length > 0) { + if (openConfig.urisToOpen && openConfig.urisToOpen.length > 0) { windowsToOpen = this.doExtractPathsFromAPI(openConfig); isCommandLineOrAPICall = true; } @@ -818,9 +817,8 @@ export class WindowsManager implements IWindowsMainService { return windowsToOpen; } - //TODO:#54483 (Checked) private doExtractPathsFromAPI(openConfig: IOpenConfiguration): IPath[] { - let pathsToOpen = openConfig.pathsToOpen.map(pathToOpen => { + let pathsToOpen = openConfig.urisToOpen.map(pathToOpen => { const path = this.parseUri(pathToOpen, { gotoLineMode: openConfig.cli && openConfig.cli.goto, forceOpenWorkspaceAsFile: openConfig.forceOpenWorkspaceAsFile }); // Warn if the requested path to open does not exist @@ -965,7 +963,6 @@ export class WindowsManager implements IWindowsMainService { return restoreWindows; } - //TODO:#54483 private parseUri(anyUri: URI, options?: { ignoreFileNotFound?: boolean, gotoLineMode?: boolean, forceOpenWorkspaceAsFile?: boolean; }): IPathToOpen { if (!anyUri) { return null; @@ -993,7 +990,6 @@ export class WindowsManager implements IWindowsMainService { anyPath = parsedPath.path; } - //TODO:#54483 const candidate = normalize(anyPath); try { const candidateStat = fs.statSync(candidate); @@ -1705,7 +1701,7 @@ class Dialogs { this.windowsMainService.open({ context: OpenContext.DIALOG, cli: this.environmentService.args, - pathsToOpen: paths, + urisToOpen: paths, forceNewWindow: options.forceNewWindow, forceOpenWorkspaceAsFile: options.dialogOptions && !equals(options.dialogOptions.filters, WORKSPACE_FILTER) }); diff --git a/src/vs/code/node/windowsFinder.ts b/src/vs/code/node/windowsFinder.ts index a0771e862c2..99219a37f2f 100644 --- a/src/vs/code/node/windowsFinder.ts +++ b/src/vs/code/node/windowsFinder.ts @@ -75,7 +75,7 @@ export function findWindowOnWorkspace(windows: W[], wor // match on folder if (isSingleFolderWorkspaceIdentifier(workspace)) { - if (window.openedFolderUri && isEqual(window.openedFolderUri, workspace, hasToIgnoreCase(window.openedFolderUri))) { //TODO:#54483 + if (window.openedFolderUri && isEqual(window.openedFolderUri, workspace, hasToIgnoreCase(window.openedFolderUri))) { return true; } } diff --git a/src/vs/platform/windows/electron-main/windows.ts b/src/vs/platform/windows/electron-main/windows.ts index f9e83ecaefd..1c38b451768 100644 --- a/src/vs/platform/windows/electron-main/windows.ts +++ b/src/vs/platform/windows/electron-main/windows.ts @@ -124,7 +124,7 @@ export interface IOpenConfiguration { contextWindowId?: number; cli: ParsedArgs; userEnv?: IProcessEnvironment; - pathsToOpen?: URI[]; + urisToOpen?: URI[]; preferNewWindow?: boolean; forceNewWindow?: boolean; forceReuseWindow?: boolean; diff --git a/src/vs/platform/windows/electron-main/windowsService.ts b/src/vs/platform/windows/electron-main/windowsService.ts index 5ba8aa58f89..bb7c5fcf51b 100644 --- a/src/vs/platform/windows/electron-main/windowsService.ts +++ b/src/vs/platform/windows/electron-main/windowsService.ts @@ -402,7 +402,7 @@ export class WindowsService implements IWindowsService, IURLHandler, IDisposable context: OpenContext.API, contextWindowId: windowId, cli: this.environmentService.args, - pathsToOpen: paths, + urisToOpen: paths, forceNewWindow: options && options.forceNewWindow, forceReuseWindow: options && options.forceReuseWindow, forceOpenWorkspaceAsFile: options && options.forceOpenWorkspaceAsFile @@ -563,9 +563,9 @@ export class WindowsService implements IWindowsService, IURLHandler, IDisposable private openFileForURI(uri: URI): TPromise { const cli = assign(Object.create(null), this.environmentService.args, { goto: true }); - const pathsToOpen = [uri]; + const urisToOpen = [uri]; - this.windowsMainService.open({ context: OpenContext.API, cli, pathsToOpen }); + this.windowsMainService.open({ context: OpenContext.API, cli, urisToOpen }); return TPromise.wrap(true); } -- GitLab