mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-04 15:25:47 +01:00
incorperate review comments
This commit is contained in:
@@ -65,7 +65,7 @@ import { MenubarService } from 'vs/platform/menubar/electron-main/menubarService
|
||||
import { MenubarChannel } from 'vs/platform/menubar/common/menubarIpc';
|
||||
import { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay';
|
||||
import { CodeMenu } from 'vs/code/electron-main/menus';
|
||||
import { hasArgs } from 'vs/code/node/args';
|
||||
import { hasArgs } from 'vs/platform/environment/node/argv';
|
||||
import { RunOnceScheduler } from 'vs/base/common/async';
|
||||
|
||||
export class CodeApplication {
|
||||
|
||||
@@ -20,7 +20,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
|
||||
import URI, { UriComponents } from 'vs/base/common/uri';
|
||||
import { BrowserWindow } from 'electron';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { hasArgs } from 'vs/code/node/args';
|
||||
import { hasArgs } from 'vs/platform/environment/node/argv';
|
||||
|
||||
export const ID = 'launchService';
|
||||
export const ILaunchService = createDecorator<ILaunchService>(ID);
|
||||
|
||||
@@ -14,7 +14,7 @@ import { IBackupMainService } from 'vs/platform/backup/common/backup';
|
||||
import { IEnvironmentService, ParsedArgs } from 'vs/platform/environment/common/environment';
|
||||
import { IStateService } from 'vs/platform/state/common/state';
|
||||
import { CodeWindow, defaultWindowState } from 'vs/code/electron-main/window';
|
||||
import { asArray, hasArgs } from 'vs/code/node/args';
|
||||
import { hasArgs, asArray } from 'vs/platform/environment/node/argv';
|
||||
import { ipcMain as ipc, screen, BrowserWindow, dialog, systemPreferences, app } from 'electron';
|
||||
import { IPathWithLineAndColumn, parseLineAndColumnAware } from 'vs/code/node/paths';
|
||||
import { ILifecycleService, UnloadReason, IWindowUnloadEvent } from 'vs/platform/lifecycle/electron-main/lifecycleMain';
|
||||
@@ -423,7 +423,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 && !hasArgs(openConfig.cli._) && !hasArgs(openConfig.cli['file-uri']) && !hasArgs(openConfig.cli['folder-uri']) && !hasArgs(openConfig.urisToOpen);
|
||||
let focusLastActive = this.windowsState.lastActiveWindow && !openConfig.forceEmpty && !hasArgs(openConfig.cli._) && !hasArgs(openConfig.cli['file-uri']) && !hasArgs(openConfig.cli['folder-uri']) && !(openConfig.urisToOpen && openConfig.urisToOpen.length);
|
||||
let focusLastOpened = true;
|
||||
let focusLastWindow = true;
|
||||
|
||||
@@ -999,12 +999,12 @@ export class WindowsManager implements IWindowsMainService {
|
||||
try {
|
||||
let uri = URI.parse(arg);
|
||||
if (!uri.scheme) {
|
||||
console.log(`Invalid URI string, scheme missing: ${arg}`);
|
||||
this.logService.error(`Invalid URI input string, scheme missing: ${arg}`);
|
||||
return null;
|
||||
}
|
||||
return uri;
|
||||
} catch (e) {
|
||||
console.log(`Invalid URI string, scheme missing: ${e.message}`);
|
||||
this.logService.error(`Invalid URI input string: ${arg}, ${e.message}`);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Converts an argument into an array
|
||||
* @param arg a argument value. Can be undefined, en entry or an array
|
||||
*/
|
||||
export function asArray<T>(arg: T | T[] | undefined): T[] {
|
||||
if (arg) {
|
||||
if (Array.isArray(arg)) {
|
||||
return arg;
|
||||
}
|
||||
return [arg];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether an argument is present.
|
||||
*/
|
||||
export function hasArgs<T>(arg: T | T[] | undefined): boolean {
|
||||
if (arg) {
|
||||
if (Array.isArray(arg)) {
|
||||
return !!arg.length;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
Reference in New Issue
Block a user