more env and cli alignment

This commit is contained in:
Benjamin Pasero 2016-08-17 12:09:57 +02:00
parent a0b8579547
commit 11d06f3e2a
8 changed files with 22 additions and 17 deletions

View file

@ -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';

View file

@ -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

View file

@ -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;
}
}

View file

@ -27,6 +27,7 @@ export interface IEnvironmentService {
isBuilt: boolean;
verbose: boolean;
performance: boolean;
debugBrkFileWatcherPort: number;
}

View file

@ -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; }

View file

@ -121,8 +121,6 @@ export interface IEnvironment {
disableExtensions: boolean;
logExtensionHostCommunication: boolean;
debugBrkFileWatcherPort: number;
enablePerformance: boolean;
userExtensionsHome: string;
sharedIPCHandle: string;

View file

@ -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[] {

View file

@ -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');