From 11d06f3e2a27390a265b3d91ec2edbab3eee4534 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Wed, 17 Aug 2016 12:09:57 +0200 Subject: [PATCH] more env and cli alignment --- src/vs/code/electron-main/env.ts | 18 +++++++++--------- src/vs/code/electron-main/window.ts | 2 +- src/vs/code/electron-main/windows.ts | 2 +- .../platform/environment/common/environment.ts | 1 + .../environment/node/environmentService.ts | 1 + src/vs/platform/workspace/common/workspace.ts | 2 -- src/vs/workbench/electron-browser/actions.ts | 5 +++-- .../electron-browser/bootstrap/index.js | 8 ++++++-- 8 files changed, 22 insertions(+), 17 deletions(-) diff --git a/src/vs/code/electron-main/env.ts b/src/vs/code/electron-main/env.ts index 51ea063ec88..f8372de635f 100644 --- a/src/vs/code/electron-main/env.ts +++ b/src/vs/code/electron-main/env.ts @@ -31,15 +31,15 @@ export interface ICommandLineArguments { verbose: boolean; debugPluginHost: string; debugBrkPluginHost: boolean; - debugBrkFileWatcherPort: number; + debugBrkFileWatcherPort: string; logExtensionHostCommunication: boolean; - disableExtensions: boolean; - extensionsHomePath: string; + 'disable-extensions': boolean; + extensionHomePath: string; extensionDevelopmentPath: string; extensionTestsPath: string; programStart: number; pathArguments?: string[]; - enablePerformance?: boolean; + performance?: boolean; openNewWindow?: boolean; openInSameWindow?: boolean; gotoLineMode?: boolean; @@ -170,27 +170,27 @@ export class EnvService implements IEnvService { this._cliArgs = Object.freeze({ pathArguments: pathArguments, programStart: types.isNumber(timestamp) ? timestamp : 0, - enablePerformance: argv.performance, + performance: argv.performance, verbose: argv.verbose, debugPluginHost, debugBrkPluginHost: !!debugBrkExtensionHostPort, logExtensionHostCommunication: argv.logExtensionHostCommunication, - debugBrkFileWatcherPort: debugBrkFileWatcherPort, + debugBrkFileWatcherPort: debugBrkFileWatcherPort ? String(debugBrkFileWatcherPort) : void 0, openNewWindow: argv['new-window'], openInSameWindow: argv['reuse-window'], gotoLineMode: argv.goto, diffMode: argv.diff && pathArguments.length === 2, - extensionsHomePath: normalizePath(argv.extensionHomePath), + extensionHomePath: normalizePath(argv.extensionHomePath), extensionDevelopmentPath: normalizePath(argv.extensionDevelopmentPath), extensionTestsPath: normalizePath(argv.extensionTestsPath), - disableExtensions: argv['disable-extensions'], + 'disable-extensions': argv['disable-extensions'], locale: argv.locale, waitForWindowClose: argv.wait }); this._isTestingFromCli = this.cliArgs.extensionTestsPath && !this.cliArgs.debugBrkPluginHost; this._userHome = path.join(os.homedir(), product.dataFolderName); - this._userExtensionsHome = this.cliArgs.extensionsHomePath || path.join(this._userHome, 'extensions'); + this._userExtensionsHome = this.cliArgs.extensionHomePath || path.join(this._userHome, 'extensions'); const prefix = this.getIPCHandleBaseName(); const suffix = process.platform === 'win32' ? '-sock' : '.sock'; diff --git a/src/vs/code/electron-main/window.ts b/src/vs/code/electron-main/window.ts index 32858eff9f2..9c3ff13c409 100644 --- a/src/vs/code/electron-main/window.ts +++ b/src/vs/code/electron-main/window.ts @@ -413,7 +413,7 @@ export class VSCodeWindow { configuration.debugBrkFileWatcherPort = cli.debugBrkFileWatcherPort; configuration.debugPluginHost = cli.debugPluginHost; configuration.debugBrkPluginHost = cli.debugBrkPluginHost; - configuration.extensionsHomePath = cli.extensionsHomePath; + configuration.extensionHomePath = cli.extensionHomePath; } // Load config diff --git a/src/vs/code/electron-main/windows.ts b/src/vs/code/electron-main/windows.ts index f4d6956cd6f..242340a50ac 100644 --- a/src/vs/code/electron-main/windows.ts +++ b/src/vs/code/electron-main/windows.ts @@ -928,7 +928,7 @@ export class WindowsManager implements IWindowsService { configuration.debugBrkFileWatcherPort = currentWindowConfig.debugBrkFileWatcherPort; configuration.debugBrkPluginHost = currentWindowConfig.debugBrkPluginHost; configuration.debugPluginHost = currentWindowConfig.debugPluginHost; - configuration.extensionsHomePath = currentWindowConfig.extensionsHomePath; + configuration.extensionHomePath = currentWindowConfig.extensionHomePath; } } diff --git a/src/vs/platform/environment/common/environment.ts b/src/vs/platform/environment/common/environment.ts index ee6a56cc776..8d58bd909db 100644 --- a/src/vs/platform/environment/common/environment.ts +++ b/src/vs/platform/environment/common/environment.ts @@ -27,6 +27,7 @@ export interface IEnvironmentService { isBuilt: boolean; verbose: boolean; + performance: boolean; debugBrkFileWatcherPort: number; } \ No newline at end of file diff --git a/src/vs/platform/environment/node/environmentService.ts b/src/vs/platform/environment/node/environmentService.ts index 00c422f0bce..869baa2bde3 100644 --- a/src/vs/platform/environment/node/environmentService.ts +++ b/src/vs/platform/environment/node/environmentService.ts @@ -47,6 +47,7 @@ export class EnvironmentService implements IEnvironmentService { get isBuilt(): boolean { return !process.env['VSCODE_DEV']; } get verbose(): boolean { return this.args.verbose; } + get performance(): boolean { return this.args.performance; } private _debugBrkFileWatcherPort: number; get debugBrkFileWatcherPort(): number { return this._debugBrkFileWatcherPort; } diff --git a/src/vs/platform/workspace/common/workspace.ts b/src/vs/platform/workspace/common/workspace.ts index a21b5e07198..44024e78e79 100644 --- a/src/vs/platform/workspace/common/workspace.ts +++ b/src/vs/platform/workspace/common/workspace.ts @@ -121,8 +121,6 @@ export interface IEnvironment { disableExtensions: boolean; logExtensionHostCommunication: boolean; - debugBrkFileWatcherPort: number; - enablePerformance: boolean; userExtensionsHome: string; sharedIPCHandle: string; diff --git a/src/vs/workbench/electron-browser/actions.ts b/src/vs/workbench/electron-browser/actions.ts index 0d468d05be4..67e340e4ae1 100644 --- a/src/vs/workbench/electron-browser/actions.ts +++ b/src/vs/workbench/electron-browser/actions.ts @@ -19,6 +19,7 @@ import nls = require('vs/nls'); import {IMessageService, Severity} from 'vs/platform/message/common/message'; import {IWindowConfiguration} from 'vs/workbench/electron-browser/window'; import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace'; +import {IEnvironmentService} from 'vs/platform/environment/common/environment'; import {IQuickOpenService, IPickOpenEntry} from 'vs/workbench/services/quickopen/common/quickOpenService'; import {KeyMod} from 'vs/base/common/keyCodes'; import {IConfigurationService} from 'vs/platform/configuration/common/configuration'; @@ -262,11 +263,11 @@ export class ShowStartupPerformance extends Action { id: string, label: string, @IWindowService private windowService: IWindowService, - @IWorkspaceContextService private contextService: IWorkspaceContextService + @IEnvironmentService private environmentService: IEnvironmentService ) { super(id, label); - this.enabled = contextService.getConfiguration().env.enablePerformance; + this.enabled = environmentService.performance; } private _analyzeLoaderTimes(): any[] { diff --git a/src/vs/workbench/electron-browser/bootstrap/index.js b/src/vs/workbench/electron-browser/bootstrap/index.js index a2f96984a4a..e4ef117c7da 100644 --- a/src/vs/workbench/electron-browser/bootstrap/index.js +++ b/src/vs/workbench/electron-browser/bootstrap/index.js @@ -145,18 +145,21 @@ function main() { // Load the loader and start loading the workbench const rootUrl = uriFromPath(configuration.appRoot) + '/out'; + // In the bundled version the nls plugin is packaged with the loader so the NLS Plugins // loads as soon as the loader loads. To be able to have pseudo translation createScript(rootUrl + '/vs/loader.js', function () { define('fs', ['original-fs'], function (originalFS) { return originalFS; }); // replace the patched electron fs with the original node fs for all AMD code + require.config({ baseUrl: rootUrl, 'vs/nls': nlsConfig, - recordStats: configuration.enablePerformance, + recordStats: !!configuration.performance, ignoreDuplicateModules: [ 'vs/workbench/parts/search/common/searchQuery' ] }); + if (nlsConfig.pseudo) { require(['vs/nls'], function (nlsPlugin) { nlsPlugin.setPseudoTranslation(nlsConfig.pseudo); @@ -164,11 +167,12 @@ function main() { } window.MonacoEnvironment = {}; + const timers = window.MonacoEnvironment.timers = { start: new Date() }; - if (configuration.enablePerformance) { + if (!!configuration.performance) { const programStart = remote.getGlobal('programStart'); const vscodeStart = remote.getGlobal('vscodeStart');