提交 5a7da8c6 编写于 作者: S Sandeep Somavarapu

💄

上级 bba73a47
......@@ -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
}
......
......@@ -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;
......
......@@ -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;
......
......@@ -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)
});
......
......@@ -75,7 +75,7 @@ export function findWindowOnWorkspace<W extends ISimpleWindow>(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;
}
}
......
......@@ -124,7 +124,7 @@ export interface IOpenConfiguration {
contextWindowId?: number;
cli: ParsedArgs;
userEnv?: IProcessEnvironment;
pathsToOpen?: URI[];
urisToOpen?: URI[];
preferNewWindow?: boolean;
forceNewWindow?: boolean;
forceReuseWindow?: boolean;
......
......@@ -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<boolean> {
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);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册