Merge pull request #10611 from Microsoft/ben/env-debt
Use IEnvironmentService everywhere
This commit is contained in:
commit
954508d62e
|
@ -20,32 +20,15 @@ import URI from 'vs/base/common/uri';
|
||||||
import * as types from 'vs/base/common/types';
|
import * as types from 'vs/base/common/types';
|
||||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||||
import product, { IProductConfiguration } from 'vs/platform/product';
|
import product, { IProductConfiguration } from 'vs/platform/product';
|
||||||
import { parseArgs } from 'vs/code/node/argv';
|
import { parseArgs, ParsedArgs } from 'vs/code/node/argv';
|
||||||
import pkg from 'vs/platform/package';
|
import pkg from 'vs/platform/package';
|
||||||
|
|
||||||
export interface IProcessEnvironment {
|
export interface IProcessEnvironment {
|
||||||
[key: string]: string;
|
[key: string]: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ICommandLineArguments {
|
export interface ICommandLineArguments extends ParsedArgs {
|
||||||
verboseLogging: boolean;
|
|
||||||
debugExtensionHostPort: number;
|
|
||||||
debugBrkExtensionHost: boolean;
|
|
||||||
debugBrkFileWatcherPort: number;
|
|
||||||
logExtensionHostCommunication: boolean;
|
|
||||||
disableExtensions: boolean;
|
|
||||||
extensionsHomePath: string;
|
|
||||||
extensionDevelopmentPath: string;
|
|
||||||
extensionTestsPath: string;
|
|
||||||
programStart: number;
|
|
||||||
pathArguments?: string[];
|
pathArguments?: string[];
|
||||||
enablePerformance?: boolean;
|
|
||||||
openNewWindow?: boolean;
|
|
||||||
openInSameWindow?: boolean;
|
|
||||||
gotoLineMode?: boolean;
|
|
||||||
diffMode?: boolean;
|
|
||||||
locale?: string;
|
|
||||||
waitForWindowClose?: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const IEnvService = createDecorator<IEnvService>('mainEnvironmentService');
|
export const IEnvService = createDecorator<IEnvService>('mainEnvironmentService');
|
||||||
|
@ -162,34 +145,37 @@ export class EnvService implements IEnvService {
|
||||||
|
|
||||||
const debugBrkExtensionHostPort = getNumericValue(argv.debugBrkPluginHost, 5870);
|
const debugBrkExtensionHostPort = getNumericValue(argv.debugBrkPluginHost, 5870);
|
||||||
const debugExtensionHostPort = getNumericValue(argv.debugPluginHost, 5870, this.isBuilt ? void 0 : 5870);
|
const debugExtensionHostPort = getNumericValue(argv.debugPluginHost, 5870, this.isBuilt ? void 0 : 5870);
|
||||||
|
const debugPluginHost = debugBrkExtensionHostPort ? String(debugBrkExtensionHostPort) : debugExtensionHostPort ? String(debugExtensionHostPort): void 0;
|
||||||
|
const debugBrkPluginHost = debugBrkExtensionHostPort ? String(true) : void 0;
|
||||||
const pathArguments = parsePathArguments(this._currentWorkingDirectory, argv._, argv.goto);
|
const pathArguments = parsePathArguments(this._currentWorkingDirectory, argv._, argv.goto);
|
||||||
const timestamp = parseInt(argv.timestamp);
|
const timestamp = parseInt(argv.timestamp);
|
||||||
const debugBrkFileWatcherPort = getNumericValue(argv.debugBrkFileWatcherPort, void 0);
|
const debugBrkFileWatcherPort = getNumericValue(argv.debugBrkFileWatcherPort, void 0);
|
||||||
|
|
||||||
this._cliArgs = Object.freeze({
|
this._cliArgs = Object.freeze({
|
||||||
|
_: [],
|
||||||
pathArguments: pathArguments,
|
pathArguments: pathArguments,
|
||||||
programStart: types.isNumber(timestamp) ? timestamp : 0,
|
timestamp: types.isNumber(timestamp) ? String(timestamp) : '0',
|
||||||
enablePerformance: argv.performance,
|
performance: argv.performance,
|
||||||
verboseLogging: argv.verbose,
|
verbose: argv.verbose,
|
||||||
debugExtensionHostPort: debugBrkExtensionHostPort || debugExtensionHostPort,
|
debugPluginHost,
|
||||||
debugBrkExtensionHost: !!debugBrkExtensionHostPort,
|
debugBrkPluginHost,
|
||||||
logExtensionHostCommunication: argv.logExtensionHostCommunication,
|
logExtensionHostCommunication: argv.logExtensionHostCommunication,
|
||||||
debugBrkFileWatcherPort: debugBrkFileWatcherPort,
|
debugBrkFileWatcherPort: debugBrkFileWatcherPort ? String(debugBrkFileWatcherPort) : void 0,
|
||||||
openNewWindow: argv['new-window'],
|
'new-window': argv['new-window'],
|
||||||
openInSameWindow: argv['reuse-window'],
|
'reuse-window': argv['reuse-window'],
|
||||||
gotoLineMode: argv.goto,
|
goto: argv.goto,
|
||||||
diffMode: argv.diff && pathArguments.length === 2,
|
diff: argv.diff && pathArguments.length === 2,
|
||||||
extensionsHomePath: normalizePath(argv.extensionHomePath),
|
extensionHomePath: normalizePath(argv.extensionHomePath),
|
||||||
extensionDevelopmentPath: normalizePath(argv.extensionDevelopmentPath),
|
extensionDevelopmentPath: normalizePath(argv.extensionDevelopmentPath),
|
||||||
extensionTestsPath: normalizePath(argv.extensionTestsPath),
|
extensionTestsPath: normalizePath(argv.extensionTestsPath),
|
||||||
disableExtensions: argv['disable-extensions'],
|
'disable-extensions': argv['disable-extensions'],
|
||||||
locale: argv.locale,
|
locale: argv.locale,
|
||||||
waitForWindowClose: argv.wait
|
wait: argv.wait
|
||||||
});
|
});
|
||||||
|
|
||||||
this._isTestingFromCli = this.cliArgs.extensionTestsPath && !this.cliArgs.debugBrkExtensionHost;
|
this._isTestingFromCli = this.cliArgs.extensionTestsPath && !this.cliArgs.debugBrkPluginHost;
|
||||||
this._userHome = path.join(os.homedir(), product.dataFolderName);
|
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 prefix = this.getIPCHandleBaseName();
|
||||||
const suffix = process.platform === 'win32' ? '-sock' : '.sock';
|
const suffix = process.platform === 'win32' ? '-sock' : '.sock';
|
||||||
|
|
|
@ -62,7 +62,7 @@ export class LaunchService implements ILaunchService {
|
||||||
let usedWindows: VSCodeWindow[];
|
let usedWindows: VSCodeWindow[];
|
||||||
if (!!args.extensionDevelopmentPath) {
|
if (!!args.extensionDevelopmentPath) {
|
||||||
this.windowsService.openPluginDevelopmentHostWindow({ cli: args, userEnv });
|
this.windowsService.openPluginDevelopmentHostWindow({ cli: args, userEnv });
|
||||||
} else if (args.pathArguments.length === 0 && args.openNewWindow) {
|
} else if (args.pathArguments.length === 0 && args['new-window']) {
|
||||||
usedWindows = this.windowsService.open({ cli: args, userEnv, forceNewWindow: true, forceEmpty: true });
|
usedWindows = this.windowsService.open({ cli: args, userEnv, forceNewWindow: true, forceEmpty: true });
|
||||||
} else if (args.pathArguments.length === 0) {
|
} else if (args.pathArguments.length === 0) {
|
||||||
usedWindows = [this.windowsService.focusLastActive(args)];
|
usedWindows = [this.windowsService.focusLastActive(args)];
|
||||||
|
@ -70,15 +70,15 @@ export class LaunchService implements ILaunchService {
|
||||||
usedWindows = this.windowsService.open({
|
usedWindows = this.windowsService.open({
|
||||||
cli: args,
|
cli: args,
|
||||||
userEnv,
|
userEnv,
|
||||||
forceNewWindow: args.waitForWindowClose || args.openNewWindow,
|
forceNewWindow: args.wait || args['new-window'],
|
||||||
preferNewWindow: !args.openInSameWindow,
|
preferNewWindow: !args['reuse-window'],
|
||||||
diffMode: args.diffMode
|
diffMode: args.diff
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the other instance is waiting to be killed, we hook up a window listener if one window
|
// If the other instance is waiting to be killed, we hook up a window listener if one window
|
||||||
// is being used and only then resolve the startup promise which will kill this second instance
|
// is being used and only then resolve the startup promise which will kill this second instance
|
||||||
if (args.waitForWindowClose && usedWindows && usedWindows.length === 1 && usedWindows[0]) {
|
if (args.wait && usedWindows && usedWindows.length === 1 && usedWindows[0]) {
|
||||||
const windowId = usedWindows[0].id;
|
const windowId = usedWindows[0].id;
|
||||||
|
|
||||||
return new TPromise<void>((c, e) => {
|
return new TPromise<void>((c, e) => {
|
||||||
|
|
|
@ -109,7 +109,7 @@ export class LifecycleService implements ILifecycleService {
|
||||||
// Windows/Linux: we quit when all windows have closed
|
// Windows/Linux: we quit when all windows have closed
|
||||||
// Mac: we only quit when quit was requested
|
// Mac: we only quit when quit was requested
|
||||||
// --wait: we quit when all windows are closed
|
// --wait: we quit when all windows are closed
|
||||||
if (this.quitRequested || process.platform !== 'darwin' || this.envService.cliArgs.waitForWindowClose) {
|
if (this.quitRequested || process.platform !== 'darwin' || this.envService.cliArgs.wait) {
|
||||||
app.quit();
|
app.quit();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -23,9 +23,9 @@ export class MainLogService implements ILogService {
|
||||||
}
|
}
|
||||||
|
|
||||||
log(...args: any[]): void {
|
log(...args: any[]): void {
|
||||||
const { verboseLogging } = this.envService.cliArgs;
|
const { verbose } = this.envService.cliArgs;
|
||||||
|
|
||||||
if (verboseLogging) {
|
if (verbose) {
|
||||||
console.log(`(${new Date().toLocaleTimeString()})`, ...args);
|
console.log(`(${new Date().toLocaleTimeString()})`, ...args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,7 @@ function main(accessor: ServicesAccessor, mainIpcServer: Server, userEnv: IProce
|
||||||
|
|
||||||
// Spawn shared process
|
// Spawn shared process
|
||||||
const sharedProcess = spawnSharedProcess({
|
const sharedProcess = spawnSharedProcess({
|
||||||
allowOutput: !envService.isBuilt || envService.cliArgs.verboseLogging,
|
allowOutput: !envService.isBuilt || envService.cliArgs.verbose,
|
||||||
debugPort: envService.isBuilt ? null : 5871
|
debugPort: envService.isBuilt ? null : 5871
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ function main(accessor: ServicesAccessor, mainIpcServer: Server, userEnv: IProce
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set programStart in the global scope
|
// Set programStart in the global scope
|
||||||
global.programStart = envService.cliArgs.programStart;
|
global.programStart = envService.cliArgs.timestamp;
|
||||||
|
|
||||||
function dispose() {
|
function dispose() {
|
||||||
if (mainIpcServer) {
|
if (mainIpcServer) {
|
||||||
|
@ -195,12 +195,12 @@ function main(accessor: ServicesAccessor, mainIpcServer: Server, userEnv: IProce
|
||||||
updateService.initialize();
|
updateService.initialize();
|
||||||
|
|
||||||
// Open our first window
|
// Open our first window
|
||||||
if (envService.cliArgs.openNewWindow && envService.cliArgs.pathArguments.length === 0) {
|
if (envService.cliArgs['new-window'] && envService.cliArgs.pathArguments.length === 0) {
|
||||||
windowsService.open({ cli: envService.cliArgs, forceNewWindow: true, forceEmpty: true }); // new window if "-n" was used without paths
|
windowsService.open({ cli: envService.cliArgs, forceNewWindow: true, forceEmpty: true }); // new window if "-n" was used without paths
|
||||||
} else if (global.macOpenFiles && global.macOpenFiles.length && (!envService.cliArgs.pathArguments || !envService.cliArgs.pathArguments.length)) {
|
} else if (global.macOpenFiles && global.macOpenFiles.length && (!envService.cliArgs.pathArguments || !envService.cliArgs.pathArguments.length)) {
|
||||||
windowsService.open({ cli: envService.cliArgs, pathsToOpen: global.macOpenFiles }); // mac: open-file event received on startup
|
windowsService.open({ cli: envService.cliArgs, pathsToOpen: global.macOpenFiles }); // mac: open-file event received on startup
|
||||||
} else {
|
} else {
|
||||||
windowsService.open({ cli: envService.cliArgs, forceNewWindow: envService.cliArgs.openNewWindow, diffMode: envService.cliArgs.diffMode }); // default: read paths from cli
|
windowsService.open({ cli: envService.cliArgs, forceNewWindow: envService.cliArgs['new-window'], diffMode: envService.cliArgs.diff }); // default: read paths from cli
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ export class StorageService implements IStorageService {
|
||||||
try {
|
try {
|
||||||
return JSON.parse(fs.readFileSync(this.dbPath).toString()); // invalid JSON or permission issue can happen here
|
return JSON.parse(fs.readFileSync(this.dbPath).toString()); // invalid JSON or permission issue can happen here
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.envService.cliArgs.verboseLogging) {
|
if (this.envService.cliArgs.verbose) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ export class StorageService implements IStorageService {
|
||||||
try {
|
try {
|
||||||
fs.writeFileSync(this.dbPath, JSON.stringify(this.database, null, 4)); // permission issue can happen here
|
fs.writeFileSync(this.dbPath, JSON.stringify(this.database, null, 4)); // permission issue can happen here
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.envService.cliArgs.verboseLogging) {
|
if (this.envService.cliArgs.verbose) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ import { shell, screen, BrowserWindow } from 'electron';
|
||||||
import { TPromise, TValueCallback } from 'vs/base/common/winjs.base';
|
import { TPromise, TValueCallback } from 'vs/base/common/winjs.base';
|
||||||
import { ICommandLineArguments, IEnvService, IProcessEnvironment } from 'vs/code/electron-main/env';
|
import { ICommandLineArguments, IEnvService, IProcessEnvironment } from 'vs/code/electron-main/env';
|
||||||
import { ILogService } from 'vs/code/electron-main/log';
|
import { ILogService } from 'vs/code/electron-main/log';
|
||||||
|
import { parseArgs } from 'vs/code/node/argv';
|
||||||
|
|
||||||
export interface IWindowState {
|
export interface IWindowState {
|
||||||
width?: number;
|
width?: number;
|
||||||
|
@ -88,49 +89,21 @@ export interface IPath {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IWindowConfiguration extends ICommandLineArguments {
|
export interface IWindowConfiguration extends ICommandLineArguments {
|
||||||
execPath: string;
|
|
||||||
version: string;
|
|
||||||
appName: string;
|
|
||||||
applicationName: string;
|
|
||||||
darwinBundleIdentifier: string;
|
|
||||||
appSettingsHome: string;
|
|
||||||
appSettingsPath: string;
|
|
||||||
appKeybindingsPath: string;
|
|
||||||
userExtensionsHome: string;
|
|
||||||
mainIPCHandle: string;
|
|
||||||
sharedIPCHandle: string;
|
|
||||||
appRoot: string;
|
appRoot: string;
|
||||||
isBuilt: boolean;
|
execPath: string;
|
||||||
commitHash: string;
|
|
||||||
updateFeedUrl: string;
|
userEnv: IProcessEnvironment;
|
||||||
updateChannel: string;
|
|
||||||
|
workspacePath?: string;
|
||||||
|
|
||||||
recentFiles: string[];
|
recentFiles: string[];
|
||||||
recentFolders: string[];
|
recentFolders: string[];
|
||||||
workspacePath?: string;
|
|
||||||
filesToOpen?: IPath[];
|
filesToOpen?: IPath[];
|
||||||
filesToCreate?: IPath[];
|
filesToCreate?: IPath[];
|
||||||
filesToDiff?: IPath[];
|
filesToDiff?: IPath[];
|
||||||
|
|
||||||
extensionsToInstall: string[];
|
extensionsToInstall: string[];
|
||||||
crashReporter: Electron.CrashReporterStartOptions;
|
|
||||||
extensionsGallery: {
|
|
||||||
serviceUrl: string;
|
|
||||||
itemUrl: string;
|
|
||||||
};
|
|
||||||
extensionTips: { [id: string]: string; };
|
|
||||||
welcomePage: string;
|
|
||||||
releaseNotesUrl: string;
|
|
||||||
licenseUrl: string;
|
|
||||||
productDownloadUrl: string;
|
|
||||||
enableTelemetry: boolean;
|
|
||||||
userEnv: IProcessEnvironment;
|
|
||||||
aiConfig: {
|
|
||||||
key: string;
|
|
||||||
asimovKey: string;
|
|
||||||
};
|
|
||||||
sendASmile: {
|
|
||||||
reportIssueUrl: string,
|
|
||||||
requestFeatureUrl: string
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class VSCodeWindow {
|
export class VSCodeWindow {
|
||||||
|
@ -384,7 +357,7 @@ export class VSCodeWindow {
|
||||||
this._win.loadURL(this.getUrl(config));
|
this._win.loadURL(this.getUrl(config));
|
||||||
|
|
||||||
// Make window visible if it did not open in N seconds because this indicates an error
|
// Make window visible if it did not open in N seconds because this indicates an error
|
||||||
if (!config.isBuilt) {
|
if (!this.envService.isBuilt) {
|
||||||
this.showTimeoutHandle = setTimeout(() => {
|
this.showTimeoutHandle = setTimeout(() => {
|
||||||
if (this._win && !this._win.isVisible() && !this._win.isMinimized()) {
|
if (this._win && !this._win.isVisible() && !this._win.isMinimized()) {
|
||||||
this._win.show();
|
this._win.show();
|
||||||
|
@ -407,22 +380,24 @@ export class VSCodeWindow {
|
||||||
// Some configuration things get inherited if the window is being reloaded and we are
|
// Some configuration things get inherited if the window is being reloaded and we are
|
||||||
// in plugin development mode. These options are all development related.
|
// in plugin development mode. These options are all development related.
|
||||||
if (this.isPluginDevelopmentHost && cli) {
|
if (this.isPluginDevelopmentHost && cli) {
|
||||||
configuration.verboseLogging = cli.verboseLogging;
|
configuration.verbose = cli.verbose;
|
||||||
configuration.logExtensionHostCommunication = cli.logExtensionHostCommunication;
|
|
||||||
configuration.debugBrkFileWatcherPort = cli.debugBrkFileWatcherPort;
|
configuration.debugBrkFileWatcherPort = cli.debugBrkFileWatcherPort;
|
||||||
configuration.debugExtensionHostPort = cli.debugExtensionHostPort;
|
configuration.debugPluginHost = cli.debugPluginHost;
|
||||||
configuration.debugBrkExtensionHost = cli.debugBrkExtensionHost;
|
configuration.debugBrkPluginHost = cli.debugBrkPluginHost;
|
||||||
configuration.extensionsHomePath = cli.extensionsHomePath;
|
configuration.extensionHomePath = cli.extensionHomePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load config
|
// Load config
|
||||||
this.load(configuration);
|
this.load(configuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
private getUrl(config: IWindowConfiguration): string {
|
private getUrl(windowConfiguration: IWindowConfiguration): string {
|
||||||
let url = require.toUrl('vs/workbench/electron-browser/bootstrap/index.html');
|
let url = require.toUrl('vs/workbench/electron-browser/bootstrap/index.html');
|
||||||
|
|
||||||
// Config
|
// Config (combination of process.argv and window configuration)
|
||||||
|
const environment = parseArgs(process.argv);
|
||||||
|
const config = objects.assign(environment, windowConfiguration);
|
||||||
|
|
||||||
url += '?config=' + encodeURIComponent(JSON.stringify(config));
|
url += '?config=' + encodeURIComponent(JSON.stringify(config));
|
||||||
|
|
||||||
return url;
|
return url;
|
||||||
|
|
|
@ -12,7 +12,6 @@ import * as nls from 'vs/nls';
|
||||||
import * as paths from 'vs/base/common/paths';
|
import * as paths from 'vs/base/common/paths';
|
||||||
import * as arrays from 'vs/base/common/arrays';
|
import * as arrays from 'vs/base/common/arrays';
|
||||||
import { assign, mixin } from 'vs/base/common/objects';
|
import { assign, mixin } from 'vs/base/common/objects';
|
||||||
import pkg from 'vs/platform/package';
|
|
||||||
import { EventEmitter } from 'events';
|
import { EventEmitter } from 'events';
|
||||||
import { IStorageService } from 'vs/code/electron-main/storage';
|
import { IStorageService } from 'vs/code/electron-main/storage';
|
||||||
import { IPath, VSCodeWindow, ReadyState, IWindowConfiguration, IWindowState as ISingleWindowState, defaultWindowState } from 'vs/code/electron-main/window';
|
import { IPath, VSCodeWindow, ReadyState, IWindowConfiguration, IWindowState as ISingleWindowState, defaultWindowState } from 'vs/code/electron-main/window';
|
||||||
|
@ -502,7 +501,7 @@ export class WindowsManager implements IWindowsService {
|
||||||
// Find paths from provided paths if any
|
// Find paths from provided paths if any
|
||||||
if (openConfig.pathsToOpen && openConfig.pathsToOpen.length > 0) {
|
if (openConfig.pathsToOpen && openConfig.pathsToOpen.length > 0) {
|
||||||
iPathsToOpen = openConfig.pathsToOpen.map((pathToOpen) => {
|
iPathsToOpen = openConfig.pathsToOpen.map((pathToOpen) => {
|
||||||
let iPath = this.toIPath(pathToOpen, false, openConfig.cli && openConfig.cli.gotoLineMode);
|
let iPath = this.toIPath(pathToOpen, false, openConfig.cli && openConfig.cli.goto);
|
||||||
|
|
||||||
// Warn if the requested path to open does not exist
|
// Warn if the requested path to open does not exist
|
||||||
if (!iPath) {
|
if (!iPath) {
|
||||||
|
@ -727,38 +726,14 @@ export class WindowsManager implements IWindowsService {
|
||||||
|
|
||||||
private toConfiguration(userEnv: IProcessEnvironment, cli: ICommandLineArguments, workspacePath?: string, filesToOpen?: IPath[], filesToCreate?: IPath[], filesToDiff?: IPath[], extensionsToInstall?: string[]): IWindowConfiguration {
|
private toConfiguration(userEnv: IProcessEnvironment, cli: ICommandLineArguments, workspacePath?: string, filesToOpen?: IPath[], filesToCreate?: IPath[], filesToDiff?: IPath[], extensionsToInstall?: string[]): IWindowConfiguration {
|
||||||
let configuration: IWindowConfiguration = mixin({}, cli); // inherit all properties from CLI
|
let configuration: IWindowConfiguration = mixin({}, cli); // inherit all properties from CLI
|
||||||
|
configuration.appRoot = this.envService.appRoot;
|
||||||
configuration.execPath = process.execPath;
|
configuration.execPath = process.execPath;
|
||||||
|
configuration.userEnv = userEnv;
|
||||||
configuration.workspacePath = workspacePath;
|
configuration.workspacePath = workspacePath;
|
||||||
configuration.filesToOpen = filesToOpen;
|
configuration.filesToOpen = filesToOpen;
|
||||||
configuration.filesToCreate = filesToCreate;
|
configuration.filesToCreate = filesToCreate;
|
||||||
configuration.filesToDiff = filesToDiff;
|
configuration.filesToDiff = filesToDiff;
|
||||||
configuration.extensionsToInstall = extensionsToInstall;
|
configuration.extensionsToInstall = extensionsToInstall;
|
||||||
configuration.appName = this.envService.product.nameLong;
|
|
||||||
configuration.applicationName = this.envService.product.applicationName;
|
|
||||||
configuration.darwinBundleIdentifier = this.envService.product.darwinBundleIdentifier;
|
|
||||||
configuration.appRoot = this.envService.appRoot;
|
|
||||||
configuration.version = pkg.version;
|
|
||||||
configuration.commitHash = this.envService.product.commit;
|
|
||||||
configuration.appSettingsHome = this.envService.appSettingsHome;
|
|
||||||
configuration.appSettingsPath = this.envService.appSettingsPath;
|
|
||||||
configuration.appKeybindingsPath = this.envService.appKeybindingsPath;
|
|
||||||
configuration.userExtensionsHome = this.envService.userExtensionsHome;
|
|
||||||
configuration.extensionTips = this.envService.product.extensionTips;
|
|
||||||
configuration.mainIPCHandle = this.envService.mainIPCHandle;
|
|
||||||
configuration.sharedIPCHandle = this.envService.sharedIPCHandle;
|
|
||||||
configuration.isBuilt = this.envService.isBuilt;
|
|
||||||
configuration.crashReporter = this.envService.product.crashReporter;
|
|
||||||
configuration.extensionsGallery = this.envService.product.extensionsGallery;
|
|
||||||
configuration.welcomePage = this.envService.product.welcomePage;
|
|
||||||
configuration.productDownloadUrl = this.envService.product.downloadUrl;
|
|
||||||
configuration.releaseNotesUrl = this.envService.product.releaseNotesUrl;
|
|
||||||
configuration.licenseUrl = this.envService.product.licenseUrl;
|
|
||||||
configuration.updateFeedUrl = this.updateService.feedUrl;
|
|
||||||
configuration.updateChannel = this.updateService.channel;
|
|
||||||
configuration.aiConfig = this.envService.product.aiConfig;
|
|
||||||
configuration.sendASmile = this.envService.product.sendASmile;
|
|
||||||
configuration.enableTelemetry = this.envService.product.enableTelemetry;
|
|
||||||
configuration.userEnv = userEnv;
|
|
||||||
|
|
||||||
const recents = this.getRecentlyOpenedPaths(workspacePath, filesToOpen);
|
const recents = this.getRecentlyOpenedPaths(workspacePath, filesToOpen);
|
||||||
configuration.recentFiles = recents.files;
|
configuration.recentFiles = recents.files;
|
||||||
|
@ -873,7 +848,7 @@ export class WindowsManager implements IWindowsService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let iPaths = candidates.map((candidate) => this.toIPath(candidate, ignoreFileNotFound, cli.gotoLineMode)).filter((path) => !!path);
|
let iPaths = candidates.map((candidate) => this.toIPath(candidate, ignoreFileNotFound, cli.goto)).filter((path) => !!path);
|
||||||
if (iPaths.length > 0) {
|
if (iPaths.length > 0) {
|
||||||
return iPaths;
|
return iPaths;
|
||||||
}
|
}
|
||||||
|
@ -923,12 +898,11 @@ export class WindowsManager implements IWindowsService {
|
||||||
let currentWindowConfig = vscodeWindow.config;
|
let currentWindowConfig = vscodeWindow.config;
|
||||||
if (!configuration.extensionDevelopmentPath && currentWindowConfig && !!currentWindowConfig.extensionDevelopmentPath) {
|
if (!configuration.extensionDevelopmentPath && currentWindowConfig && !!currentWindowConfig.extensionDevelopmentPath) {
|
||||||
configuration.extensionDevelopmentPath = currentWindowConfig.extensionDevelopmentPath;
|
configuration.extensionDevelopmentPath = currentWindowConfig.extensionDevelopmentPath;
|
||||||
configuration.verboseLogging = currentWindowConfig.verboseLogging;
|
configuration.verbose = currentWindowConfig.verbose;
|
||||||
configuration.logExtensionHostCommunication = currentWindowConfig.logExtensionHostCommunication;
|
|
||||||
configuration.debugBrkFileWatcherPort = currentWindowConfig.debugBrkFileWatcherPort;
|
configuration.debugBrkFileWatcherPort = currentWindowConfig.debugBrkFileWatcherPort;
|
||||||
configuration.debugBrkExtensionHost = currentWindowConfig.debugBrkExtensionHost;
|
configuration.debugBrkPluginHost = currentWindowConfig.debugBrkPluginHost;
|
||||||
configuration.debugExtensionHostPort = currentWindowConfig.debugExtensionHostPort;
|
configuration.debugPluginHost = currentWindowConfig.debugPluginHost;
|
||||||
configuration.extensionsHomePath = currentWindowConfig.extensionsHomePath;
|
configuration.extensionHomePath = currentWindowConfig.extensionHomePath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,29 +8,29 @@ import * as minimist from 'minimist';
|
||||||
import { localize } from 'vs/nls';
|
import { localize } from 'vs/nls';
|
||||||
|
|
||||||
export interface ParsedArgs extends minimist.ParsedArgs {
|
export interface ParsedArgs extends minimist.ParsedArgs {
|
||||||
help: boolean;
|
help?: boolean;
|
||||||
version: boolean;
|
version?: boolean;
|
||||||
wait: boolean;
|
wait?: boolean;
|
||||||
diff: boolean;
|
diff?: boolean;
|
||||||
goto: boolean;
|
goto?: boolean;
|
||||||
'new-window': boolean;
|
'new-window'?: boolean;
|
||||||
'reuse-window': boolean;
|
'reuse-window'?: boolean;
|
||||||
locale: string;
|
locale?: string;
|
||||||
'user-data-dir': string;
|
'user-data-dir'?: string;
|
||||||
performance: boolean;
|
performance?: boolean;
|
||||||
verbose: boolean;
|
verbose?: boolean;
|
||||||
logExtensionHostCommunication: boolean;
|
logExtensionHostCommunication?: boolean;
|
||||||
debugBrkFileWatcherPort: string;
|
debugBrkFileWatcherPort?: string;
|
||||||
'disable-extensions': boolean;
|
'disable-extensions'?: boolean;
|
||||||
extensionHomePath: string;
|
extensionHomePath?: string;
|
||||||
extensionDevelopmentPath: string;
|
extensionDevelopmentPath?: string;
|
||||||
extensionTestsPath: string;
|
extensionTestsPath?: string;
|
||||||
timestamp: string;
|
timestamp?: string;
|
||||||
debugBrkPluginHost: string;
|
debugBrkPluginHost?: string;
|
||||||
debugPluginHost: string;
|
debugPluginHost?: string;
|
||||||
'list-extensions': boolean;
|
'list-extensions'?: boolean;
|
||||||
'install-extension': string | string[];
|
'install-extension'?: string | string[];
|
||||||
'uninstall-extension': string | string[];
|
'uninstall-extension'?: string | string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
const options: minimist.Opts = {
|
const options: minimist.Opts = {
|
||||||
|
|
|
@ -10,6 +10,7 @@ import * as path from 'path';
|
||||||
import { parseArgs, ParsedArgs } from 'vs/code/node/argv';
|
import { parseArgs, ParsedArgs } from 'vs/code/node/argv';
|
||||||
import { TPromise } from 'vs/base/common/winjs.base';
|
import { TPromise } from 'vs/base/common/winjs.base';
|
||||||
import { sequence } from 'vs/base/common/async';
|
import { sequence } from 'vs/base/common/async';
|
||||||
|
import * as objects from 'vs/base/common/objects';
|
||||||
import { IPager } from 'vs/base/common/paging';
|
import { IPager } from 'vs/base/common/paging';
|
||||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||||
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||||
|
@ -145,7 +146,7 @@ const eventPrefix = 'monacoworkbench';
|
||||||
|
|
||||||
export function main(argv: ParsedArgs): TPromise<void> {
|
export function main(argv: ParsedArgs): TPromise<void> {
|
||||||
const services = new ServiceCollection();
|
const services = new ServiceCollection();
|
||||||
services.set(IEnvironmentService, new SyncDescriptor(EnvironmentService, parseArgs(process.argv)));
|
services.set(IEnvironmentService, new SyncDescriptor(EnvironmentService, objects.assign(parseArgs(process.argv), { execPath: process.execPath })));
|
||||||
|
|
||||||
const instantiationService: IInstantiationService = new InstantiationService(services);
|
const instantiationService: IInstantiationService = new InstantiationService(services);
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as platform from 'vs/base/common/platform';
|
import * as platform from 'vs/base/common/platform';
|
||||||
import product from 'vs/platform/product';
|
import product from 'vs/platform/product';
|
||||||
|
import * as objects from 'vs/base/common/objects';
|
||||||
import pkg from 'vs/platform/package';
|
import pkg from 'vs/platform/package';
|
||||||
import { serve, Server, connect } from 'vs/base/parts/ipc/node/ipc.net';
|
import { serve, Server, connect } from 'vs/base/parts/ipc/node/ipc.net';
|
||||||
import { TPromise } from 'vs/base/common/winjs.base';
|
import { TPromise } from 'vs/base/common/winjs.base';
|
||||||
|
@ -58,7 +59,7 @@ function main(server: Server): void {
|
||||||
const services = new ServiceCollection();
|
const services = new ServiceCollection();
|
||||||
|
|
||||||
services.set(IEventService, new SyncDescriptor(EventService));
|
services.set(IEventService, new SyncDescriptor(EventService));
|
||||||
services.set(IEnvironmentService, new SyncDescriptor(EnvironmentService, parseArgs(process.argv)));
|
services.set(IEnvironmentService, new SyncDescriptor(EnvironmentService, objects.assign(parseArgs(process.argv), { execPath: process.execPath })));
|
||||||
services.set(IConfigurationService, new SyncDescriptor(NodeConfigurationService));
|
services.set(IConfigurationService, new SyncDescriptor(NodeConfigurationService));
|
||||||
services.set(IRequestService, new SyncDescriptor(RequestService));
|
services.set(IRequestService, new SyncDescriptor(RequestService));
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ export const IEnvironmentService = createDecorator<IEnvironmentService>('environ
|
||||||
export interface IEnvironmentService {
|
export interface IEnvironmentService {
|
||||||
_serviceBrand: any;
|
_serviceBrand: any;
|
||||||
|
|
||||||
|
execPath: string;
|
||||||
appRoot: string;
|
appRoot: string;
|
||||||
|
|
||||||
userHome: string;
|
userHome: string;
|
||||||
|
@ -19,11 +20,19 @@ export interface IEnvironmentService {
|
||||||
appSettingsPath: string;
|
appSettingsPath: string;
|
||||||
appKeybindingsPath: string;
|
appKeybindingsPath: string;
|
||||||
|
|
||||||
|
disableExtensions: boolean;
|
||||||
extensionsPath: string;
|
extensionsPath: string;
|
||||||
extensionDevelopmentPath: string;
|
extensionDevelopmentPath: string;
|
||||||
|
extensionTestsPath: string;
|
||||||
|
|
||||||
|
debugExtensionHostPort: number;
|
||||||
|
debugBrkExtensionHost: boolean;
|
||||||
|
|
||||||
|
logExtensionHostCommunication: boolean;
|
||||||
|
|
||||||
isBuilt: boolean;
|
isBuilt: boolean;
|
||||||
verbose: boolean;
|
verbose: boolean;
|
||||||
|
performance: boolean;
|
||||||
|
|
||||||
debugBrkFileWatcherPort: number;
|
debugBrkFileWatcherPort: number;
|
||||||
}
|
}
|
|
@ -11,6 +11,12 @@ import * as path from 'path';
|
||||||
import {ParsedArgs} from 'vs/code/node/argv';
|
import {ParsedArgs} from 'vs/code/node/argv';
|
||||||
import URI from 'vs/base/common/uri';
|
import URI from 'vs/base/common/uri';
|
||||||
|
|
||||||
|
// TODO@Ben TODO@Joao this interface should be composed once the main => renderer
|
||||||
|
// communication is also fit for that
|
||||||
|
export interface IEnvironment extends ParsedArgs {
|
||||||
|
execPath: string;
|
||||||
|
}
|
||||||
|
|
||||||
export class EnvironmentService implements IEnvironmentService {
|
export class EnvironmentService implements IEnvironmentService {
|
||||||
|
|
||||||
_serviceBrand: any;
|
_serviceBrand: any;
|
||||||
|
@ -18,6 +24,8 @@ export class EnvironmentService implements IEnvironmentService {
|
||||||
private _appRoot: string;
|
private _appRoot: string;
|
||||||
get appRoot(): string { return this._appRoot; }
|
get appRoot(): string { return this._appRoot; }
|
||||||
|
|
||||||
|
get execPath(): string { return this.args.execPath; }
|
||||||
|
|
||||||
private _userHome: string;
|
private _userHome: string;
|
||||||
get userHome(): string { return this._userHome; }
|
get userHome(): string { return this._userHome; }
|
||||||
|
|
||||||
|
@ -39,12 +47,24 @@ export class EnvironmentService implements IEnvironmentService {
|
||||||
private _extensionDevelopmentPath: string;
|
private _extensionDevelopmentPath: string;
|
||||||
get extensionDevelopmentPath(): string { return this._extensionDevelopmentPath; }
|
get extensionDevelopmentPath(): string { return this._extensionDevelopmentPath; }
|
||||||
|
|
||||||
|
get extensionTestsPath(): string { return this.args.extensionTestsPath; }
|
||||||
|
get disableExtensions(): boolean { return this.args['disable-extensions']; }
|
||||||
|
|
||||||
|
private _debugExtensionHostPort: number;
|
||||||
|
get debugExtensionHostPort(): number { return this._debugExtensionHostPort; }
|
||||||
|
|
||||||
|
private _debugBrkExtensionHost: boolean;
|
||||||
|
get debugBrkExtensionHost(): boolean { return this._debugBrkExtensionHost; }
|
||||||
|
|
||||||
get isBuilt(): boolean { return !process.env['VSCODE_DEV']; }
|
get isBuilt(): boolean { return !process.env['VSCODE_DEV']; }
|
||||||
get verbose(): boolean { return this.args.verbose; }
|
get verbose(): boolean { return this.args.verbose; }
|
||||||
|
get performance(): boolean { return this.args.performance; }
|
||||||
|
get logExtensionHostCommunication(): boolean { return this.args.logExtensionHostCommunication; }
|
||||||
|
|
||||||
get debugBrkFileWatcherPort(): number { return typeof this.args.debugBrkFileWatcherPort === 'string' ? Number(this.args.debugBrkFileWatcherPort) : void 0; }
|
private _debugBrkFileWatcherPort: number;
|
||||||
|
get debugBrkFileWatcherPort(): number { return this._debugBrkFileWatcherPort; }
|
||||||
|
|
||||||
constructor(private args: ParsedArgs) {
|
constructor(private args: IEnvironment) {
|
||||||
this._appRoot = path.dirname(URI.parse(require.toUrl('')).fsPath);
|
this._appRoot = path.dirname(URI.parse(require.toUrl('')).fsPath);
|
||||||
this._userDataPath = args['user-data-dir'] || paths.getDefaultUserDataPath(process.platform);
|
this._userDataPath = args['user-data-dir'] || paths.getDefaultUserDataPath(process.platform);
|
||||||
|
|
||||||
|
@ -57,5 +77,13 @@ export class EnvironmentService implements IEnvironmentService {
|
||||||
this._extensionsPath = path.normalize(this._extensionsPath);
|
this._extensionsPath = path.normalize(this._extensionsPath);
|
||||||
|
|
||||||
this._extensionDevelopmentPath = args.extensionDevelopmentPath;
|
this._extensionDevelopmentPath = args.extensionDevelopmentPath;
|
||||||
|
|
||||||
|
if (args.debugPluginHost) {
|
||||||
|
this._debugExtensionHostPort = Number(args.debugPluginHost);
|
||||||
|
}
|
||||||
|
|
||||||
|
this._debugBrkExtensionHost = Boolean(args.debugBrkPluginHost);
|
||||||
|
|
||||||
|
this._debugBrkFileWatcherPort = (typeof args.debugBrkFileWatcherPort === 'string') ? Number(args.debugBrkFileWatcherPort) : void 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -18,11 +18,6 @@ export interface IWorkspaceContextService {
|
||||||
*/
|
*/
|
||||||
getWorkspace(): IWorkspace;
|
getWorkspace(): IWorkspace;
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides access to the configuration object the platform is running with.
|
|
||||||
*/
|
|
||||||
getConfiguration(): IConfiguration;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides access to the options object the platform is running with.
|
* Provides access to the options object the platform is running with.
|
||||||
*/
|
*/
|
||||||
|
@ -75,75 +70,4 @@ export interface IWorkspace {
|
||||||
* is just derived from the workspace name.
|
* is just derived from the workspace name.
|
||||||
*/
|
*/
|
||||||
uid?: number;
|
uid?: number;
|
||||||
}
|
|
||||||
|
|
||||||
export interface IConfiguration {
|
|
||||||
/**
|
|
||||||
* Some environmental flags
|
|
||||||
*/
|
|
||||||
env?: IEnvironment;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IEnvironment {
|
|
||||||
appName: string;
|
|
||||||
appRoot: string;
|
|
||||||
isBuilt: boolean;
|
|
||||||
execPath: string;
|
|
||||||
|
|
||||||
applicationName: string;
|
|
||||||
darwinBundleIdentifier: string;
|
|
||||||
|
|
||||||
version: string;
|
|
||||||
commitHash: string;
|
|
||||||
|
|
||||||
updateFeedUrl: string;
|
|
||||||
updateChannel: string;
|
|
||||||
|
|
||||||
extensionsGallery: {
|
|
||||||
serviceUrl: string;
|
|
||||||
itemUrl: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
extensionTips: { [id: string]: string; };
|
|
||||||
|
|
||||||
releaseNotesUrl: string;
|
|
||||||
licenseUrl: string;
|
|
||||||
productDownloadUrl: string;
|
|
||||||
|
|
||||||
welcomePage: string;
|
|
||||||
|
|
||||||
crashReporter: any;
|
|
||||||
|
|
||||||
appSettingsHome: string;
|
|
||||||
appSettingsPath: string;
|
|
||||||
appKeybindingsPath: string;
|
|
||||||
|
|
||||||
debugExtensionHostPort: number;
|
|
||||||
debugBrkExtensionHost: boolean;
|
|
||||||
disableExtensions: boolean;
|
|
||||||
|
|
||||||
logExtensionHostCommunication: boolean;
|
|
||||||
debugBrkFileWatcherPort: number;
|
|
||||||
verboseLogging: boolean;
|
|
||||||
enablePerformance: boolean;
|
|
||||||
|
|
||||||
userExtensionsHome: string;
|
|
||||||
sharedIPCHandle: string;
|
|
||||||
extensionDevelopmentPath: string;
|
|
||||||
extensionTestsPath: string;
|
|
||||||
|
|
||||||
recentFiles: string[];
|
|
||||||
recentFolders: string[];
|
|
||||||
|
|
||||||
enableTelemetry: boolean;
|
|
||||||
|
|
||||||
aiConfig: {
|
|
||||||
key: string;
|
|
||||||
asimovKey: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
sendASmile: {
|
|
||||||
reportIssueUrl: string,
|
|
||||||
requestFeatureUrl: string
|
|
||||||
};
|
|
||||||
}
|
}
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
import URI from 'vs/base/common/uri';
|
import URI from 'vs/base/common/uri';
|
||||||
import paths = require('vs/base/common/paths');
|
import paths = require('vs/base/common/paths');
|
||||||
import {IWorkspaceContextService, IWorkspace, IConfiguration} from 'vs/platform/workspace/common/workspace';
|
import {IWorkspaceContextService, IWorkspace} from 'vs/platform/workspace/common/workspace';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple IWorkspaceContextService implementation to allow sharing of this service implementation
|
* Simple IWorkspaceContextService implementation to allow sharing of this service implementation
|
||||||
|
@ -19,11 +19,9 @@ export class BaseWorkspaceContextService implements IWorkspaceContextService {
|
||||||
protected options: any;
|
protected options: any;
|
||||||
|
|
||||||
private workspace: IWorkspace;
|
private workspace: IWorkspace;
|
||||||
private configuration: IConfiguration;
|
|
||||||
|
|
||||||
constructor(workspace: IWorkspace, configuration?: IConfiguration, options: any = {}) {
|
constructor(workspace: IWorkspace, options: any = {}) {
|
||||||
this.workspace = workspace;
|
this.workspace = workspace;
|
||||||
this.configuration = configuration;
|
|
||||||
this.options = options;
|
this.options = options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,10 +29,6 @@ export class BaseWorkspaceContextService implements IWorkspaceContextService {
|
||||||
return this.workspace;
|
return this.workspace;
|
||||||
}
|
}
|
||||||
|
|
||||||
public getConfiguration(): IConfiguration {
|
|
||||||
return this.configuration;
|
|
||||||
}
|
|
||||||
|
|
||||||
public getOptions(): any {
|
public getOptions(): any {
|
||||||
return this.options;
|
return this.options;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,13 +10,12 @@ import { TestInstantiationService } from 'vs/test/utils/instantiationTestUtils';
|
||||||
import EventEmitter = require('vs/base/common/eventEmitter');
|
import EventEmitter = require('vs/base/common/eventEmitter');
|
||||||
import Paths = require('vs/base/common/paths');
|
import Paths = require('vs/base/common/paths');
|
||||||
import URI from 'vs/base/common/uri';
|
import URI from 'vs/base/common/uri';
|
||||||
import {NullTelemetryService, ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
|
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
|
||||||
import Storage = require('vs/workbench/common/storage');
|
import Storage = require('vs/workbench/common/storage');
|
||||||
import {EditorInputEvent, IEditorGroup} from 'vs/workbench/common/editor';
|
import {EditorInputEvent, IEditorGroup} from 'vs/workbench/common/editor';
|
||||||
import Event, {Emitter} from 'vs/base/common/event';
|
import Event, {Emitter} from 'vs/base/common/event';
|
||||||
import Types = require('vs/base/common/types');
|
import Objects = require('vs/base/common/objects');
|
||||||
import Severity from 'vs/base/common/severity';
|
import Severity from 'vs/base/common/severity';
|
||||||
import http = require('vs/base/common/http');
|
|
||||||
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
|
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
|
||||||
import {IContent, IStat} from 'vs/platform/configuration/common/configurationService';
|
import {IContent, IStat} from 'vs/platform/configuration/common/configurationService';
|
||||||
import {IStorageService, StorageScope} from 'vs/platform/storage/common/storage';
|
import {IStorageService, StorageScope} from 'vs/platform/storage/common/storage';
|
||||||
|
@ -28,7 +27,7 @@ import {IEditorInput, IEditorModel, Position, Direction, IEditor, IResourceInput
|
||||||
import {IEventService} from 'vs/platform/event/common/event';
|
import {IEventService} from 'vs/platform/event/common/event';
|
||||||
import {IUntitledEditorService} from 'vs/workbench/services/untitled/common/untitledEditorService';
|
import {IUntitledEditorService} from 'vs/workbench/services/untitled/common/untitledEditorService';
|
||||||
import {IMessageService, IConfirmation} from 'vs/platform/message/common/message';
|
import {IMessageService, IConfirmation} from 'vs/platform/message/common/message';
|
||||||
import {IWorkspace, IConfiguration} from 'vs/platform/workspace/common/workspace';
|
import {IWorkspace} from 'vs/platform/workspace/common/workspace';
|
||||||
import {ILifecycleService, ShutdownEvent} from 'vs/platform/lifecycle/common/lifecycle';
|
import {ILifecycleService, ShutdownEvent} from 'vs/platform/lifecycle/common/lifecycle';
|
||||||
import {EditorStacksModel} from 'vs/workbench/common/editor/editorStacksModel';
|
import {EditorStacksModel} from 'vs/workbench/common/editor/editorStacksModel';
|
||||||
import {ServiceCollection} from 'vs/platform/instantiation/common/serviceCollection';
|
import {ServiceCollection} from 'vs/platform/instantiation/common/serviceCollection';
|
||||||
|
@ -52,22 +51,16 @@ export const TestWorkspace: IWorkspace = {
|
||||||
mtime: new Date().getTime()
|
mtime: new Date().getTime()
|
||||||
};
|
};
|
||||||
|
|
||||||
export const TestConfiguration: IConfiguration = {
|
export const TestEnvironmentService = new EnvironmentService(Objects.assign(parseArgs(process.argv), { execPath: process.execPath }));
|
||||||
env: Object.create(null)
|
|
||||||
};
|
|
||||||
|
|
||||||
export const TestEnvironmentService = new EnvironmentService(parseArgs(process.argv));
|
|
||||||
|
|
||||||
export class TestContextService implements WorkspaceContextService.IWorkspaceContextService {
|
export class TestContextService implements WorkspaceContextService.IWorkspaceContextService {
|
||||||
public _serviceBrand: any;
|
public _serviceBrand: any;
|
||||||
|
|
||||||
private workspace: any;
|
private workspace: any;
|
||||||
private configuration: any;
|
|
||||||
private options: any;
|
private options: any;
|
||||||
|
|
||||||
constructor(workspace: any = TestWorkspace, configuration: any = TestConfiguration, options: any = null) {
|
constructor(workspace: any = TestWorkspace, options: any = null) {
|
||||||
this.workspace = workspace;
|
this.workspace = workspace;
|
||||||
this.configuration = configuration;
|
|
||||||
this.options = options || {
|
this.options = options || {
|
||||||
globalSettings: {
|
globalSettings: {
|
||||||
settings: {}
|
settings: {}
|
||||||
|
@ -79,10 +72,6 @@ export class TestContextService implements WorkspaceContextService.IWorkspaceCon
|
||||||
return this.workspace;
|
return this.workspace;
|
||||||
}
|
}
|
||||||
|
|
||||||
public getConfiguration(): IConfiguration {
|
|
||||||
return this.configuration;
|
|
||||||
}
|
|
||||||
|
|
||||||
public getOptions() {
|
public getOptions() {
|
||||||
return this.options;
|
return this.options;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import * as Platform from 'vs/base/common/platform';
|
||||||
import {IThreadService} from 'vs/workbench/services/thread/common/threadService';
|
import {IThreadService} from 'vs/workbench/services/thread/common/threadService';
|
||||||
import * as errors from 'vs/base/common/errors';
|
import * as errors from 'vs/base/common/errors';
|
||||||
import product from 'vs/platform/product';
|
import product from 'vs/platform/product';
|
||||||
|
import pkg from 'vs/platform/package';
|
||||||
import {ExtHostFileSystemEventService} from 'vs/workbench/api/node/extHostFileSystemEventService';
|
import {ExtHostFileSystemEventService} from 'vs/workbench/api/node/extHostFileSystemEventService';
|
||||||
import {ExtHostDocuments} from 'vs/workbench/api/node/extHostDocuments';
|
import {ExtHostDocuments} from 'vs/workbench/api/node/extHostDocuments';
|
||||||
import {ExtHostConfiguration} from 'vs/workbench/api/node/extHostConfiguration';
|
import {ExtHostConfiguration} from 'vs/workbench/api/node/extHostConfiguration';
|
||||||
|
@ -128,7 +129,7 @@ export class ExtHostAPIImplementation {
|
||||||
registerApiCommands(extHostCommands);
|
registerApiCommands(extHostCommands);
|
||||||
|
|
||||||
|
|
||||||
this.version = contextService.getConfiguration().env.version;
|
this.version = pkg.version;
|
||||||
this.Uri = URI;
|
this.Uri = URI;
|
||||||
this.Location = extHostTypes.Location;
|
this.Location = extHostTypes.Location;
|
||||||
this.Diagnostic = extHostTypes.Diagnostic;
|
this.Diagnostic = extHostTypes.Diagnostic;
|
||||||
|
|
|
@ -10,7 +10,6 @@ import {QuickOpenController} from 'vs/workbench/browser/parts/quickopen/quickOpe
|
||||||
import {Sash, ISashEvent, IVerticalSashLayoutProvider, IHorizontalSashLayoutProvider, Orientation} from 'vs/base/browser/ui/sash/sash';
|
import {Sash, ISashEvent, IVerticalSashLayoutProvider, IHorizontalSashLayoutProvider, Orientation} from 'vs/base/browser/ui/sash/sash';
|
||||||
import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService';
|
import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService';
|
||||||
import {IPartService, Position} from 'vs/workbench/services/part/common/partService';
|
import {IPartService, Position} from 'vs/workbench/services/part/common/partService';
|
||||||
import {IWorkspaceContextService} from 'vs/workbench/services/workspace/common/contextService';
|
|
||||||
import {IViewletService} from 'vs/workbench/services/viewlet/common/viewletService';
|
import {IViewletService} from 'vs/workbench/services/viewlet/common/viewletService';
|
||||||
import {IStorageService, StorageScope} from 'vs/platform/storage/common/storage';
|
import {IStorageService, StorageScope} from 'vs/platform/storage/common/storage';
|
||||||
import {IContextViewService} from 'vs/platform/contextview/browser/contextView';
|
import {IContextViewService} from 'vs/platform/contextview/browser/contextView';
|
||||||
|
@ -94,7 +93,6 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
|
||||||
@IContextViewService private contextViewService: IContextViewService,
|
@IContextViewService private contextViewService: IContextViewService,
|
||||||
@IWorkbenchEditorService private editorService: IWorkbenchEditorService,
|
@IWorkbenchEditorService private editorService: IWorkbenchEditorService,
|
||||||
@IEditorGroupService private editorGroupService: IEditorGroupService,
|
@IEditorGroupService private editorGroupService: IEditorGroupService,
|
||||||
@IWorkspaceContextService private contextService: IWorkspaceContextService,
|
|
||||||
@IPartService private partService: IPartService,
|
@IPartService private partService: IPartService,
|
||||||
@IViewletService private viewletService: IViewletService,
|
@IViewletService private viewletService: IViewletService,
|
||||||
@IThemeService themeService: IThemeService
|
@IThemeService themeService: IThemeService
|
||||||
|
|
|
@ -46,6 +46,12 @@ export interface IOptions {
|
||||||
*/
|
*/
|
||||||
editor?: IEditorOptions;
|
editor?: IEditorOptions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recent files and folders
|
||||||
|
*/
|
||||||
|
recentFiles?: string[];
|
||||||
|
recentFolders?: string[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The global application settings if any.
|
* The global application settings if any.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -40,7 +40,7 @@ export class Storage implements IStorageService {
|
||||||
workspaceStorage: IStorage,
|
workspaceStorage: IStorage,
|
||||||
@IWorkspaceContextService contextService: IWorkspaceContextService
|
@IWorkspaceContextService contextService: IWorkspaceContextService
|
||||||
) {
|
) {
|
||||||
let workspace = contextService.getWorkspace();
|
const workspace = contextService.getWorkspace();
|
||||||
|
|
||||||
this.globalStorage = globalStorage;
|
this.globalStorage = globalStorage;
|
||||||
this.workspaceStorage = workspaceStorage || globalStorage;
|
this.workspaceStorage = workspaceStorage || globalStorage;
|
||||||
|
@ -49,7 +49,7 @@ export class Storage implements IStorageService {
|
||||||
this.workspaceKey = this.getWorkspaceKey(workspace);
|
this.workspaceKey = this.getWorkspaceKey(workspace);
|
||||||
|
|
||||||
// Make sure to delete all workspace storage if the workspace has been recreated meanwhile
|
// Make sure to delete all workspace storage if the workspace has been recreated meanwhile
|
||||||
let workspaceUniqueId: number = workspace ? workspace.uid : null;
|
const workspaceUniqueId: number = workspace ? workspace.uid : null;
|
||||||
if (types.isNumber(workspaceUniqueId)) {
|
if (types.isNumber(workspaceUniqueId)) {
|
||||||
this.cleanupWorkspaceScope(workspaceUniqueId, workspace.name);
|
this.cleanupWorkspaceScope(workspaceUniqueId, workspace.name);
|
||||||
}
|
}
|
||||||
|
@ -65,8 +65,8 @@ export class Storage implements IStorageService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private calculateWorkspaceKey(workspaceUrl: string): string {
|
private calculateWorkspaceKey(workspaceUrl: string): string {
|
||||||
let root = 'file:///';
|
const root = 'file:///';
|
||||||
let index = workspaceUrl.indexOf(root);
|
const index = workspaceUrl.indexOf(root);
|
||||||
if (index === 0) {
|
if (index === 0) {
|
||||||
return strings.rtrim(workspaceUrl.substr(root.length), '/') + '/';
|
return strings.rtrim(workspaceUrl.substr(root.length), '/') + '/';
|
||||||
}
|
}
|
||||||
|
@ -77,16 +77,16 @@ export class Storage implements IStorageService {
|
||||||
private cleanupWorkspaceScope(workspaceId: number, workspaceName: string): void {
|
private cleanupWorkspaceScope(workspaceId: number, workspaceName: string): void {
|
||||||
|
|
||||||
// Get stored identifier from storage
|
// Get stored identifier from storage
|
||||||
let id = this.getInteger(Storage.WORKSPACE_IDENTIFIER, StorageScope.WORKSPACE);
|
const id = this.getInteger(Storage.WORKSPACE_IDENTIFIER, StorageScope.WORKSPACE);
|
||||||
|
|
||||||
// If identifier differs, assume the workspace got recreated and thus clean all storage for this workspace
|
// If identifier differs, assume the workspace got recreated and thus clean all storage for this workspace
|
||||||
if (types.isNumber(id) && workspaceId !== id) {
|
if (types.isNumber(id) && workspaceId !== id) {
|
||||||
let keyPrefix = this.toStorageKey('', StorageScope.WORKSPACE);
|
const keyPrefix = this.toStorageKey('', StorageScope.WORKSPACE);
|
||||||
let toDelete: string[] = [];
|
const toDelete: string[] = [];
|
||||||
let length = this.workspaceStorage.length;
|
const length = this.workspaceStorage.length;
|
||||||
|
|
||||||
for (let i = 0; i < length; i++) {
|
for (let i = 0; i < length; i++) {
|
||||||
let key = this.workspaceStorage.key(i);
|
const key = this.workspaceStorage.key(i);
|
||||||
if (key.indexOf(Storage.WORKSPACE_PREFIX) < 0) {
|
if (key.indexOf(Storage.WORKSPACE_PREFIX) < 0) {
|
||||||
continue; // ignore stored things that don't belong to storage service or are defined globally
|
continue; // ignore stored things that don't belong to storage service or are defined globally
|
||||||
}
|
}
|
||||||
|
@ -119,14 +119,14 @@ export class Storage implements IStorageService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public store(key: string, value: any, scope = StorageScope.GLOBAL): void {
|
public store(key: string, value: any, scope = StorageScope.GLOBAL): void {
|
||||||
let storage = (scope === StorageScope.GLOBAL) ? this.globalStorage : this.workspaceStorage;
|
const storage = (scope === StorageScope.GLOBAL) ? this.globalStorage : this.workspaceStorage;
|
||||||
|
|
||||||
if (types.isUndefinedOrNull(value)) {
|
if (types.isUndefinedOrNull(value)) {
|
||||||
this.remove(key, scope); // we cannot store null or undefined, in that case we remove the key
|
this.remove(key, scope); // we cannot store null or undefined, in that case we remove the key
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let storageKey = this.toStorageKey(key, scope);
|
const storageKey = this.toStorageKey(key, scope);
|
||||||
|
|
||||||
// Store
|
// Store
|
||||||
try {
|
try {
|
||||||
|
@ -137,9 +137,9 @@ export class Storage implements IStorageService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public get(key: string, scope = StorageScope.GLOBAL, defaultValue?: any): string {
|
public get(key: string, scope = StorageScope.GLOBAL, defaultValue?: any): string {
|
||||||
let storage = (scope === StorageScope.GLOBAL) ? this.globalStorage : this.workspaceStorage;
|
const storage = (scope === StorageScope.GLOBAL) ? this.globalStorage : this.workspaceStorage;
|
||||||
|
|
||||||
let value = storage.getItem(this.toStorageKey(key, scope));
|
const value = storage.getItem(this.toStorageKey(key, scope));
|
||||||
if (types.isUndefinedOrNull(value)) {
|
if (types.isUndefinedOrNull(value)) {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
@ -148,15 +148,15 @@ export class Storage implements IStorageService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public remove(key: string, scope = StorageScope.GLOBAL): void {
|
public remove(key: string, scope = StorageScope.GLOBAL): void {
|
||||||
let storage = (scope === StorageScope.GLOBAL) ? this.globalStorage : this.workspaceStorage;
|
const storage = (scope === StorageScope.GLOBAL) ? this.globalStorage : this.workspaceStorage;
|
||||||
let storageKey = this.toStorageKey(key, scope);
|
const storageKey = this.toStorageKey(key, scope);
|
||||||
|
|
||||||
// Remove
|
// Remove
|
||||||
storage.removeItem(storageKey);
|
storage.removeItem(storageKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
public swap(key: string, valueA: any, valueB: any, scope = StorageScope.GLOBAL, defaultValue?: any): void {
|
public swap(key: string, valueA: any, valueB: any, scope = StorageScope.GLOBAL, defaultValue?: any): void {
|
||||||
let value = this.get(key, scope);
|
const value = this.get(key, scope);
|
||||||
if (types.isUndefinedOrNull(value) && defaultValue) {
|
if (types.isUndefinedOrNull(value) && defaultValue) {
|
||||||
this.store(key, defaultValue, scope);
|
this.store(key, defaultValue, scope);
|
||||||
} else if (value === valueA.toString()) { // Convert to string because store is string based
|
} else if (value === valueA.toString()) { // Convert to string because store is string based
|
||||||
|
@ -167,7 +167,7 @@ export class Storage implements IStorageService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public getInteger(key: string, scope = StorageScope.GLOBAL, defaultValue?: number): number {
|
public getInteger(key: string, scope = StorageScope.GLOBAL, defaultValue?: number): number {
|
||||||
let value = this.get(key, scope, defaultValue);
|
const value = this.get(key, scope, defaultValue);
|
||||||
|
|
||||||
if (types.isUndefinedOrNull(value)) {
|
if (types.isUndefinedOrNull(value)) {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
|
@ -177,7 +177,7 @@ export class Storage implements IStorageService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public getBoolean(key: string, scope = StorageScope.GLOBAL, defaultValue?: boolean): boolean {
|
public getBoolean(key: string, scope = StorageScope.GLOBAL, defaultValue?: boolean): boolean {
|
||||||
let value = this.get(key, scope, defaultValue);
|
const value = this.get(key, scope, defaultValue);
|
||||||
|
|
||||||
if (types.isUndefinedOrNull(value)) {
|
if (types.isUndefinedOrNull(value)) {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
|
@ -212,7 +212,7 @@ export class InMemoryLocalStorage implements IStorage {
|
||||||
}
|
}
|
||||||
|
|
||||||
public key(index: number): string {
|
public key(index: number): string {
|
||||||
let keys = Object.keys(this.store);
|
const keys = Object.keys(this.store);
|
||||||
if (keys.length > index) {
|
if (keys.length > index) {
|
||||||
return keys[index];
|
return keys[index];
|
||||||
}
|
}
|
||||||
|
@ -229,7 +229,7 @@ export class InMemoryLocalStorage implements IStorage {
|
||||||
}
|
}
|
||||||
|
|
||||||
public getItem(key: string): string {
|
public getItem(key: string): string {
|
||||||
let item = this.store[key];
|
const item = this.store[key];
|
||||||
if (!types.isUndefinedOrNull(item)) {
|
if (!types.isUndefinedOrNull(item)) {
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ import nls = require('vs/nls');
|
||||||
import {IMessageService, Severity} from 'vs/platform/message/common/message';
|
import {IMessageService, Severity} from 'vs/platform/message/common/message';
|
||||||
import {IWindowConfiguration} from 'vs/workbench/electron-browser/window';
|
import {IWindowConfiguration} from 'vs/workbench/electron-browser/window';
|
||||||
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
|
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 {IQuickOpenService, IPickOpenEntry} from 'vs/workbench/services/quickopen/common/quickOpenService';
|
||||||
import {KeyMod} from 'vs/base/common/keyCodes';
|
import {KeyMod} from 'vs/base/common/keyCodes';
|
||||||
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
|
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
|
||||||
|
@ -262,11 +263,11 @@ export class ShowStartupPerformance extends Action {
|
||||||
id: string,
|
id: string,
|
||||||
label: string,
|
label: string,
|
||||||
@IWindowService private windowService: IWindowService,
|
@IWindowService private windowService: IWindowService,
|
||||||
@IWorkspaceContextService private contextService: IWorkspaceContextService
|
@IEnvironmentService private environmentService: IEnvironmentService
|
||||||
) {
|
) {
|
||||||
super(id, label);
|
super(id, label);
|
||||||
|
|
||||||
this.enabled = contextService.getConfiguration().env.enablePerformance;
|
this.enabled = environmentService.performance;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _analyzeLoaderTimes(): any[] {
|
private _analyzeLoaderTimes(): any[] {
|
||||||
|
@ -381,8 +382,8 @@ export class OpenRecentAction extends Action {
|
||||||
}
|
}
|
||||||
|
|
||||||
public run(): TPromise<boolean> {
|
public run(): TPromise<boolean> {
|
||||||
const recentFolders = this.contextService.getConfiguration().env.recentFolders;
|
const recentFolders = this.contextService.getOptions().recentFolders;
|
||||||
const recentFiles = this.contextService.getConfiguration().env.recentFiles;
|
const recentFiles = this.contextService.getOptions().recentFiles;
|
||||||
|
|
||||||
const folderPicks: IPickOpenEntry[] = recentFolders.map((p, index) => {
|
const folderPicks: IPickOpenEntry[] = recentFolders.map((p, index) => {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -104,7 +104,7 @@ function main() {
|
||||||
const webFrame = require('electron').webFrame;
|
const webFrame = require('electron').webFrame;
|
||||||
const args = parseURLQueryArgs();
|
const args = parseURLQueryArgs();
|
||||||
const configuration = JSON.parse(args['config'] || '{}') || {};
|
const configuration = JSON.parse(args['config'] || '{}') || {};
|
||||||
const enableDeveloperTools = !configuration.isBuilt || !!configuration.extensionDevelopmentPath;
|
const enableDeveloperTools = process.env['VSCODE_DEV'] || !!configuration.extensionDevelopmentPath;
|
||||||
|
|
||||||
// Correctly inherit the parent's environment
|
// Correctly inherit the parent's environment
|
||||||
assign(process.env, configuration.userEnv);
|
assign(process.env, configuration.userEnv);
|
||||||
|
@ -145,18 +145,21 @@ function main() {
|
||||||
|
|
||||||
// Load the loader and start loading the workbench
|
// Load the loader and start loading the workbench
|
||||||
const rootUrl = uriFromPath(configuration.appRoot) + '/out';
|
const rootUrl = uriFromPath(configuration.appRoot) + '/out';
|
||||||
|
|
||||||
// In the bundled version the nls plugin is packaged with the loader so the NLS Plugins
|
// 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
|
// loads as soon as the loader loads. To be able to have pseudo translation
|
||||||
createScript(rootUrl + '/vs/loader.js', function () {
|
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
|
define('fs', ['original-fs'], function (originalFS) { return originalFS; }); // replace the patched electron fs with the original node fs for all AMD code
|
||||||
|
|
||||||
require.config({
|
require.config({
|
||||||
baseUrl: rootUrl,
|
baseUrl: rootUrl,
|
||||||
'vs/nls': nlsConfig,
|
'vs/nls': nlsConfig,
|
||||||
recordStats: configuration.enablePerformance,
|
recordStats: !!configuration.performance,
|
||||||
ignoreDuplicateModules: [
|
ignoreDuplicateModules: [
|
||||||
'vs/workbench/parts/search/common/searchQuery'
|
'vs/workbench/parts/search/common/searchQuery'
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
if (nlsConfig.pseudo) {
|
if (nlsConfig.pseudo) {
|
||||||
require(['vs/nls'], function (nlsPlugin) {
|
require(['vs/nls'], function (nlsPlugin) {
|
||||||
nlsPlugin.setPseudoTranslation(nlsConfig.pseudo);
|
nlsPlugin.setPseudoTranslation(nlsConfig.pseudo);
|
||||||
|
@ -164,11 +167,12 @@ function main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
window.MonacoEnvironment = {};
|
window.MonacoEnvironment = {};
|
||||||
|
|
||||||
const timers = window.MonacoEnvironment.timers = {
|
const timers = window.MonacoEnvironment.timers = {
|
||||||
start: new Date()
|
start: new Date()
|
||||||
};
|
};
|
||||||
|
|
||||||
if (configuration.enablePerformance) {
|
if (!!configuration.performance) {
|
||||||
const programStart = remote.getGlobal('programStart');
|
const programStart = remote.getGlobal('programStart');
|
||||||
const vscodeStart = remote.getGlobal('vscodeStart');
|
const vscodeStart = remote.getGlobal('vscodeStart');
|
||||||
|
|
||||||
|
|
|
@ -16,11 +16,11 @@ import uri from 'vs/base/common/uri';
|
||||||
import strings = require('vs/base/common/strings');
|
import strings = require('vs/base/common/strings');
|
||||||
import {IResourceInput} from 'vs/platform/editor/common/editor';
|
import {IResourceInput} from 'vs/platform/editor/common/editor';
|
||||||
import {EventService} from 'vs/platform/event/common/eventService';
|
import {EventService} from 'vs/platform/event/common/eventService';
|
||||||
import {ParsedArgs, parseArgs} from 'vs/code/node/argv';
|
|
||||||
import {WorkspaceContextService} from 'vs/workbench/services/workspace/common/contextService';
|
import {WorkspaceContextService} from 'vs/workbench/services/workspace/common/contextService';
|
||||||
import {IWorkspace, IConfiguration, IEnvironment} from 'vs/platform/workspace/common/workspace';
|
import {IWorkspace} from 'vs/platform/workspace/common/workspace';
|
||||||
import {ConfigurationService} from 'vs/workbench/services/configuration/node/configurationService';
|
import {ConfigurationService} from 'vs/workbench/services/configuration/node/configurationService';
|
||||||
import {EnvironmentService} from 'vs/platform/environment/node/environmentService';
|
import {IProcessEnvironment} from 'vs/code/electron-main/env';
|
||||||
|
import {EnvironmentService, IEnvironment} from 'vs/platform/environment/node/environmentService';
|
||||||
import path = require('path');
|
import path = require('path');
|
||||||
import fs = require('fs');
|
import fs = require('fs');
|
||||||
import gracefulFs = require('graceful-fs');
|
import gracefulFs = require('graceful-fs');
|
||||||
|
@ -46,47 +46,47 @@ export interface IPath {
|
||||||
columnNumber?: number;
|
columnNumber?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IMainEnvironment extends IEnvironment {
|
export interface IWindowConfiguration extends IEnvironment {
|
||||||
|
appRoot: string;
|
||||||
|
execPath: string;
|
||||||
|
|
||||||
|
userEnv: IProcessEnvironment;
|
||||||
|
|
||||||
workspacePath?: string;
|
workspacePath?: string;
|
||||||
|
|
||||||
|
recentFiles?: string[];
|
||||||
|
recentFolders?: string[];
|
||||||
|
|
||||||
filesToOpen?: IPath[];
|
filesToOpen?: IPath[];
|
||||||
filesToCreate?: IPath[];
|
filesToCreate?: IPath[];
|
||||||
filesToDiff?: IPath[];
|
filesToDiff?: IPath[];
|
||||||
|
|
||||||
extensionsToInstall?: string[];
|
extensionsToInstall?: string[];
|
||||||
userEnv: { [key: string]: string; };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function startup(environment: IMainEnvironment, globalSettings: IGlobalSettings): winjs.TPromise<void> {
|
export function startup(configuration: IWindowConfiguration, globalSettings: IGlobalSettings): winjs.TPromise<void> {
|
||||||
|
|
||||||
// Args (TODO@Ben clean up explicit overwrite of args)
|
|
||||||
const parsedArgs = parseArgs(process.argv);
|
|
||||||
if (typeof environment.extensionDevelopmentPath === 'string') {
|
|
||||||
parsedArgs.extensionDevelopmentPath = environment.extensionDevelopmentPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Shell Configuration
|
|
||||||
const shellConfiguration: IConfiguration = {
|
|
||||||
env: environment
|
|
||||||
};
|
|
||||||
|
|
||||||
// Shell Options
|
// Shell Options
|
||||||
const filesToOpen = environment.filesToOpen && environment.filesToOpen.length ? toInputs(environment.filesToOpen) : null;
|
const filesToOpen = configuration.filesToOpen && configuration.filesToOpen.length ? toInputs(configuration.filesToOpen) : null;
|
||||||
const filesToCreate = environment.filesToCreate && environment.filesToCreate.length ? toInputs(environment.filesToCreate) : null;
|
const filesToCreate = configuration.filesToCreate && configuration.filesToCreate.length ? toInputs(configuration.filesToCreate) : null;
|
||||||
const filesToDiff = environment.filesToDiff && environment.filesToDiff.length ? toInputs(environment.filesToDiff) : null;
|
const filesToDiff = configuration.filesToDiff && configuration.filesToDiff.length ? toInputs(configuration.filesToDiff) : null;
|
||||||
const shellOptions: IOptions = {
|
const shellOptions: IOptions = {
|
||||||
singleFileMode: !environment.workspacePath,
|
singleFileMode: !configuration.workspacePath,
|
||||||
filesToOpen: filesToOpen,
|
filesToOpen,
|
||||||
filesToCreate: filesToCreate,
|
filesToCreate,
|
||||||
filesToDiff: filesToDiff,
|
filesToDiff,
|
||||||
extensionsToInstall: environment.extensionsToInstall,
|
recentFiles: configuration.recentFiles,
|
||||||
globalSettings: globalSettings
|
recentFolders: configuration.recentFolders,
|
||||||
|
extensionsToInstall: configuration.extensionsToInstall,
|
||||||
|
globalSettings
|
||||||
};
|
};
|
||||||
|
|
||||||
if (environment.enablePerformance) {
|
if (configuration.performance) {
|
||||||
timer.ENABLE_TIMER = true;
|
timer.ENABLE_TIMER = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open workbench
|
// Open workbench
|
||||||
return openWorkbench(parsedArgs, getWorkspace(environment), shellConfiguration, shellOptions);
|
return openWorkbench(configuration, getWorkspace(configuration.workspacePath), shellOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
function toInputs(paths: IPath[]): IResourceInput[] {
|
function toInputs(paths: IPath[]): IResourceInput[] {
|
||||||
|
@ -108,12 +108,12 @@ function toInputs(paths: IPath[]): IResourceInput[] {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getWorkspace(environment: IMainEnvironment): IWorkspace {
|
function getWorkspace(workspacePath: string): IWorkspace {
|
||||||
if (!environment.workspacePath) {
|
if (!workspacePath) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
let realWorkspacePath = path.normalize(fs.realpathSync(environment.workspacePath));
|
let realWorkspacePath = path.normalize(fs.realpathSync(workspacePath));
|
||||||
if (paths.isUNC(realWorkspacePath) && strings.endsWith(realWorkspacePath, paths.nativeSep)) {
|
if (paths.isUNC(realWorkspacePath) && strings.endsWith(realWorkspacePath, paths.nativeSep)) {
|
||||||
// for some weird reason, node adds a trailing slash to UNC paths
|
// for some weird reason, node adds a trailing slash to UNC paths
|
||||||
// we never ever want trailing slashes as our workspace path unless
|
// we never ever want trailing slashes as our workspace path unless
|
||||||
|
@ -135,10 +135,10 @@ function getWorkspace(environment: IMainEnvironment): IWorkspace {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function openWorkbench(args: ParsedArgs, workspace: IWorkspace, configuration: IConfiguration, options: IOptions): winjs.TPromise<void> {
|
function openWorkbench(environment: IEnvironment, workspace: IWorkspace, options: IOptions): winjs.TPromise<void> {
|
||||||
const eventService = new EventService();
|
const eventService = new EventService();
|
||||||
const environmentService = new EnvironmentService(args);
|
const environmentService = new EnvironmentService(environment);
|
||||||
const contextService = new WorkspaceContextService(eventService, workspace, configuration, options);
|
const contextService = new WorkspaceContextService(eventService, workspace, options);
|
||||||
const configurationService = new ConfigurationService(contextService, eventService, environmentService);
|
const configurationService = new ConfigurationService(contextService, eventService, environmentService);
|
||||||
|
|
||||||
// Since the configuration service is one of the core services that is used in so many places, we initialize it
|
// Since the configuration service is one of the core services that is used in so many places, we initialize it
|
||||||
|
@ -156,7 +156,7 @@ function openWorkbench(args: ParsedArgs, workspace: IWorkspace, configuration: I
|
||||||
eventService,
|
eventService,
|
||||||
contextService,
|
contextService,
|
||||||
environmentService
|
environmentService
|
||||||
}, configuration, options);
|
}, options);
|
||||||
shell.open();
|
shell.open();
|
||||||
|
|
||||||
shell.joinCreation().then(() => {
|
shell.joinCreation().then(() => {
|
||||||
|
|
|
@ -64,7 +64,7 @@ import {ISearchService} from 'vs/platform/search/common/search';
|
||||||
import {IThreadService} from 'vs/workbench/services/thread/common/threadService';
|
import {IThreadService} from 'vs/workbench/services/thread/common/threadService';
|
||||||
import {ICommandService} from 'vs/platform/commands/common/commands';
|
import {ICommandService} from 'vs/platform/commands/common/commands';
|
||||||
import {CommandService} from 'vs/platform/commands/common/commandService';
|
import {CommandService} from 'vs/platform/commands/common/commandService';
|
||||||
import {IWorkspaceContextService, IConfiguration, IWorkspace} from 'vs/platform/workspace/common/workspace';
|
import {IWorkspaceContextService, IWorkspace} from 'vs/platform/workspace/common/workspace';
|
||||||
import {IExtensionService} from 'vs/platform/extensions/common/extensions';
|
import {IExtensionService} from 'vs/platform/extensions/common/extensions';
|
||||||
import {MainThreadModeServiceImpl} from 'vs/editor/common/services/modeServiceImpl';
|
import {MainThreadModeServiceImpl} from 'vs/editor/common/services/modeServiceImpl';
|
||||||
import {IModeService} from 'vs/editor/common/services/modeService';
|
import {IModeService} from 'vs/editor/common/services/modeService';
|
||||||
|
@ -119,16 +119,14 @@ export class WorkbenchShell {
|
||||||
private content: HTMLElement;
|
private content: HTMLElement;
|
||||||
private contentsContainer: Builder;
|
private contentsContainer: Builder;
|
||||||
|
|
||||||
private configuration: IConfiguration;
|
|
||||||
private workspace: IWorkspace;
|
private workspace: IWorkspace;
|
||||||
private options: IOptions;
|
private options: IOptions;
|
||||||
private workbench: Workbench;
|
private workbench: Workbench;
|
||||||
|
|
||||||
constructor(container: HTMLElement, workspace: IWorkspace, services: ICoreServices, configuration: IConfiguration, options: IOptions) {
|
constructor(container: HTMLElement, workspace: IWorkspace, services: ICoreServices, options: IOptions) {
|
||||||
this.container = container;
|
this.container = container;
|
||||||
|
|
||||||
this.workspace = workspace;
|
this.workspace = workspace;
|
||||||
this.configuration = configuration;
|
|
||||||
this.options = options;
|
this.options = options;
|
||||||
|
|
||||||
this.contextService = services.contextService;
|
this.contextService = services.contextService;
|
||||||
|
@ -152,13 +150,13 @@ export class WorkbenchShell {
|
||||||
const [instantiationService, serviceCollection] = this.initServiceCollection();
|
const [instantiationService, serviceCollection] = this.initServiceCollection();
|
||||||
|
|
||||||
//crash reporting
|
//crash reporting
|
||||||
if (!!this.configuration.env.crashReporter) {
|
if (!!product.crashReporter) {
|
||||||
const crashReporter = instantiationService.createInstance(CrashReporter, this.configuration.env.version, this.configuration.env.commitHash);
|
const crashReporter = instantiationService.createInstance(CrashReporter, pkg.version, product.commit);
|
||||||
crashReporter.start(this.configuration.env.crashReporter);
|
crashReporter.start(product.crashReporter);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Workbench
|
// Workbench
|
||||||
this.workbench = instantiationService.createInstance(Workbench, workbenchContainer.getHTMLElement(), this.workspace, this.configuration, this.options, serviceCollection);
|
this.workbench = instantiationService.createInstance(Workbench, workbenchContainer.getHTMLElement(), this.workspace, this.options, serviceCollection);
|
||||||
this.workbench.startup({
|
this.workbench.startup({
|
||||||
onWorkbenchStarted: (customKeybindingsCount) => {
|
onWorkbenchStarted: (customKeybindingsCount) => {
|
||||||
this.onWorkbenchStarted(customKeybindingsCount);
|
this.onWorkbenchStarted(customKeybindingsCount);
|
||||||
|
@ -239,12 +237,12 @@ export class WorkbenchShell {
|
||||||
serviceCollection.set(IWindowService, this.windowService);
|
serviceCollection.set(IWindowService, this.windowService);
|
||||||
|
|
||||||
// Storage
|
// Storage
|
||||||
const disableWorkspaceStorage = this.configuration.env.extensionTestsPath || (!this.workspace && !this.environmentService.extensionDevelopmentPath); // without workspace or in any extension test, we use inMemory storage unless we develop an extension where we want to preserve state
|
const disableWorkspaceStorage = this.environmentService.extensionTestsPath || (!this.workspace && !this.environmentService.extensionDevelopmentPath); // without workspace or in any extension test, we use inMemory storage unless we develop an extension where we want to preserve state
|
||||||
this.storageService = instantiationService.createInstance(Storage, window.localStorage, disableWorkspaceStorage ? inMemoryLocalStorageInstance : window.localStorage);
|
this.storageService = instantiationService.createInstance(Storage, window.localStorage, disableWorkspaceStorage ? inMemoryLocalStorageInstance : window.localStorage);
|
||||||
serviceCollection.set(IStorageService, this.storageService);
|
serviceCollection.set(IStorageService, this.storageService);
|
||||||
|
|
||||||
// Telemetry
|
// Telemetry
|
||||||
if (this.configuration.env.isBuilt && !this.environmentService.extensionDevelopmentPath && !!this.configuration.env.enableTelemetry) {
|
if (this.environmentService.isBuilt && !this.environmentService.extensionDevelopmentPath && !!product.enableTelemetry) {
|
||||||
const channel = getDelayedChannel<ITelemetryAppenderChannel>(sharedProcess.then(c => c.getChannel('telemetryAppender')));
|
const channel = getDelayedChannel<ITelemetryAppenderChannel>(sharedProcess.then(c => c.getChannel('telemetryAppender')));
|
||||||
const commit = product.commit;
|
const commit = product.commit;
|
||||||
const version = pkg.version;
|
const version = pkg.version;
|
||||||
|
@ -252,7 +250,7 @@ export class WorkbenchShell {
|
||||||
const config: ITelemetryServiceConfig = {
|
const config: ITelemetryServiceConfig = {
|
||||||
appender: new TelemetryAppenderClient(channel),
|
appender: new TelemetryAppenderClient(channel),
|
||||||
commonProperties: resolveWorkbenchCommonProperties(this.storageService, commit, version),
|
commonProperties: resolveWorkbenchCommonProperties(this.storageService, commit, version),
|
||||||
piiPaths: [this.configuration.env.appRoot, this.configuration.env.userExtensionsHome]
|
piiPaths: [this.environmentService.appRoot, this.environmentService.extensionsPath]
|
||||||
};
|
};
|
||||||
|
|
||||||
const telemetryService = instantiationService.createInstance(TelemetryService, config);
|
const telemetryService = instantiationService.createInstance(TelemetryService, config);
|
||||||
|
|
|
@ -16,7 +16,6 @@ import {IViewletService} from 'vs/workbench/services/viewlet/common/viewletServi
|
||||||
import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService';
|
import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService';
|
||||||
import {IStorageService} from 'vs/platform/storage/common/storage';
|
import {IStorageService} from 'vs/platform/storage/common/storage';
|
||||||
import {IEventService} from 'vs/platform/event/common/event';
|
import {IEventService} from 'vs/platform/event/common/event';
|
||||||
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
|
|
||||||
import {IEditorGroupService} from 'vs/workbench/services/group/common/groupService';
|
import {IEditorGroupService} from 'vs/workbench/services/group/common/groupService';
|
||||||
|
|
||||||
import {ipcRenderer as ipc, shell, remote} from 'electron';
|
import {ipcRenderer as ipc, shell, remote} from 'electron';
|
||||||
|
@ -48,7 +47,6 @@ export class ElectronWindow {
|
||||||
constructor(
|
constructor(
|
||||||
win: Electron.BrowserWindow,
|
win: Electron.BrowserWindow,
|
||||||
shellContainer: HTMLElement,
|
shellContainer: HTMLElement,
|
||||||
@IWorkspaceContextService private contextService: IWorkspaceContextService,
|
|
||||||
@IEventService private eventService: IEventService,
|
@IEventService private eventService: IEventService,
|
||||||
@IStorageService private storageService: IStorageService,
|
@IStorageService private storageService: IStorageService,
|
||||||
@IWorkbenchEditorService private editorService: IWorkbenchEditorService,
|
@IWorkbenchEditorService private editorService: IWorkbenchEditorService,
|
||||||
|
|
|
@ -46,7 +46,7 @@ import {IStorageService, StorageScope} from 'vs/platform/storage/common/storage'
|
||||||
import {ContextMenuService} from 'vs/workbench/services/contextview/electron-browser/contextmenuService';
|
import {ContextMenuService} from 'vs/workbench/services/contextview/electron-browser/contextmenuService';
|
||||||
import {WorkbenchKeybindingService} from 'vs/workbench/services/keybinding/electron-browser/keybindingService';
|
import {WorkbenchKeybindingService} from 'vs/workbench/services/keybinding/electron-browser/keybindingService';
|
||||||
import {ContextKeyService} from 'vs/platform/contextkey/browser/contextKeyService';
|
import {ContextKeyService} from 'vs/platform/contextkey/browser/contextKeyService';
|
||||||
import {IWorkspace, IConfiguration} from 'vs/platform/workspace/common/workspace';
|
import {IWorkspace} from 'vs/platform/workspace/common/workspace';
|
||||||
import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
|
import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
|
||||||
import {ContextKeyExpr, RawContextKey, IContextKeyService, IContextKey} from 'vs/platform/contextkey/common/contextkey';
|
import {ContextKeyExpr, RawContextKey, IContextKeyService, IContextKey} from 'vs/platform/contextkey/common/contextkey';
|
||||||
import {IActivityService} from 'vs/workbench/services/activity/common/activityService';
|
import {IActivityService} from 'vs/workbench/services/activity/common/activityService';
|
||||||
|
@ -68,6 +68,7 @@ import {IStatusbarService} from 'vs/platform/statusbar/common/statusbar';
|
||||||
import {IMenuService} from 'vs/platform/actions/common/actions';
|
import {IMenuService} from 'vs/platform/actions/common/actions';
|
||||||
import {MenuService} from 'vs/platform/actions/common/menuService';
|
import {MenuService} from 'vs/platform/actions/common/menuService';
|
||||||
import {IContextMenuService} from 'vs/platform/contextview/browser/contextView';
|
import {IContextMenuService} from 'vs/platform/contextview/browser/contextView';
|
||||||
|
import {IEnvironmentService} from 'vs/platform/environment/common/environment';
|
||||||
|
|
||||||
export const MessagesVisibleContext = new RawContextKey<boolean>('globalMessageVisible', false);
|
export const MessagesVisibleContext = new RawContextKey<boolean>('globalMessageVisible', false);
|
||||||
export const EditorsVisibleContext = new RawContextKey<boolean>('editorIsOpen', false);
|
export const EditorsVisibleContext = new RawContextKey<boolean>('editorIsOpen', false);
|
||||||
|
@ -75,7 +76,6 @@ export const NoEditorsVisibleContext:ContextKeyExpr = EditorsVisibleContext.toNe
|
||||||
|
|
||||||
interface WorkbenchParams {
|
interface WorkbenchParams {
|
||||||
workspace?: IWorkspace;
|
workspace?: IWorkspace;
|
||||||
configuration: IConfiguration;
|
|
||||||
options: IOptions;
|
options: IOptions;
|
||||||
serviceCollection: ServiceCollection;
|
serviceCollection: ServiceCollection;
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,6 @@ export class Workbench implements IPartService {
|
||||||
constructor(
|
constructor(
|
||||||
container: HTMLElement,
|
container: HTMLElement,
|
||||||
workspace: IWorkspace,
|
workspace: IWorkspace,
|
||||||
configuration: IConfiguration,
|
|
||||||
options: IOptions,
|
options: IOptions,
|
||||||
serviceCollection: ServiceCollection,
|
serviceCollection: ServiceCollection,
|
||||||
@IInstantiationService private instantiationService: IInstantiationService,
|
@IInstantiationService private instantiationService: IInstantiationService,
|
||||||
|
@ -140,11 +139,12 @@ export class Workbench implements IPartService {
|
||||||
@IStorageService private storageService: IStorageService,
|
@IStorageService private storageService: IStorageService,
|
||||||
@ILifecycleService private lifecycleService: ILifecycleService,
|
@ILifecycleService private lifecycleService: ILifecycleService,
|
||||||
@IMessageService private messageService: IMessageService,
|
@IMessageService private messageService: IMessageService,
|
||||||
@IThreadService private threadService: IThreadService
|
@IThreadService private threadService: IThreadService,
|
||||||
|
@IEnvironmentService private environmentService: IEnvironmentService
|
||||||
) {
|
) {
|
||||||
|
|
||||||
// Validate params
|
// Validate params
|
||||||
this.validateParams(container, configuration, options);
|
this.validateParams(container, options);
|
||||||
|
|
||||||
// If String passed in as container, try to find it in DOM
|
// If String passed in as container, try to find it in DOM
|
||||||
if (types.isString(container)) {
|
if (types.isString(container)) {
|
||||||
|
@ -159,7 +159,6 @@ export class Workbench implements IPartService {
|
||||||
|
|
||||||
this.workbenchParams = {
|
this.workbenchParams = {
|
||||||
workspace: workspace,
|
workspace: workspace,
|
||||||
configuration: configuration,
|
|
||||||
options: options || {},
|
options: options || {},
|
||||||
serviceCollection
|
serviceCollection
|
||||||
};
|
};
|
||||||
|
@ -173,7 +172,7 @@ export class Workbench implements IPartService {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private validateParams(container: HTMLElement, configuration: IConfiguration, options: IOptions): void {
|
private validateParams(container: HTMLElement, options: IOptions): void {
|
||||||
|
|
||||||
// Container
|
// Container
|
||||||
assert.ok(container, 'Workbench requires a container to be created with');
|
assert.ok(container, 'Workbench requires a container to be created with');
|
||||||
|
@ -229,7 +228,7 @@ export class Workbench implements IPartService {
|
||||||
// Load Viewlet
|
// Load Viewlet
|
||||||
const viewletRegistry = (<ViewletRegistry>Registry.as(ViewletExtensions.Viewlets));
|
const viewletRegistry = (<ViewletRegistry>Registry.as(ViewletExtensions.Viewlets));
|
||||||
let viewletId = viewletRegistry.getDefaultViewletId();
|
let viewletId = viewletRegistry.getDefaultViewletId();
|
||||||
if (!this.workbenchParams.configuration.env.isBuilt) {
|
if (!this.environmentService.isBuilt) {
|
||||||
viewletId = this.storageService.get(SidebarPart.activeViewletSettingsKey, StorageScope.WORKSPACE, viewletRegistry.getDefaultViewletId()); // help developers and restore last view
|
viewletId = this.storageService.get(SidebarPart.activeViewletSettingsKey, StorageScope.WORKSPACE, viewletRegistry.getDefaultViewletId()); // help developers and restore last view
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ import pfs = require('vs/base/node/pfs');
|
||||||
import URI from 'vs/base/common/uri';
|
import URI from 'vs/base/common/uri';
|
||||||
import {TPromise} from 'vs/base/common/winjs.base';
|
import {TPromise} from 'vs/base/common/winjs.base';
|
||||||
import paths = require('vs/base/common/paths');
|
import paths = require('vs/base/common/paths');
|
||||||
|
import pkg from 'vs/platform/package';
|
||||||
import {IExtensionDescription} from 'vs/platform/extensions/common/extensions';
|
import {IExtensionDescription} from 'vs/platform/extensions/common/extensions';
|
||||||
import {ExtensionsRegistry} from 'vs/platform/extensions/common/extensionsRegistry';
|
import {ExtensionsRegistry} from 'vs/platform/extensions/common/extensionsRegistry';
|
||||||
import {ExtHostAPIImplementation, defineAPI} from 'vs/workbench/api/node/extHost.api.impl';
|
import {ExtHostAPIImplementation, defineAPI} from 'vs/workbench/api/node/extHost.api.impl';
|
||||||
|
@ -30,11 +31,19 @@ const DIRNAME = URI.parse(require.toUrl('./')).fsPath;
|
||||||
const BASE_PATH = paths.normalize(paths.join(DIRNAME, '../../../..'));
|
const BASE_PATH = paths.normalize(paths.join(DIRNAME, '../../../..'));
|
||||||
const BUILTIN_EXTENSIONS_PATH = paths.join(BASE_PATH, 'extensions');
|
const BUILTIN_EXTENSIONS_PATH = paths.join(BASE_PATH, 'extensions');
|
||||||
|
|
||||||
|
export interface IEnvironment {
|
||||||
|
appSettingsHome: string;
|
||||||
|
disableExtensions: boolean;
|
||||||
|
userExtensionsHome: string;
|
||||||
|
extensionDevelopmentPath: string;
|
||||||
|
extensionTestsPath: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface IInitData {
|
export interface IInitData {
|
||||||
|
environment: IEnvironment;
|
||||||
threadService: any;
|
threadService: any;
|
||||||
contextService: {
|
contextService: {
|
||||||
workspace: any;
|
workspace: any;
|
||||||
configuration: any;
|
|
||||||
options: any;
|
options: any;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -56,12 +65,15 @@ export class ExtensionHostMain {
|
||||||
|
|
||||||
private _isTerminating: boolean;
|
private _isTerminating: boolean;
|
||||||
private _contextService: IWorkspaceContextService;
|
private _contextService: IWorkspaceContextService;
|
||||||
|
private _environment: IEnvironment;
|
||||||
private _extensionService: ExtHostExtensionService;
|
private _extensionService: ExtHostExtensionService;
|
||||||
|
|
||||||
constructor(remoteCom: IMainProcessExtHostIPC, initData: IInitData, sharedProcessClient: Client) {
|
constructor(remoteCom: IMainProcessExtHostIPC, initData: IInitData, sharedProcessClient: Client) {
|
||||||
this._isTerminating = false;
|
this._isTerminating = false;
|
||||||
|
|
||||||
this._contextService = new BaseWorkspaceContextService(initData.contextService.workspace, initData.contextService.configuration, initData.contextService.options);
|
this._environment = initData.environment;
|
||||||
|
|
||||||
|
this._contextService = new BaseWorkspaceContextService(initData.contextService.workspace, initData.contextService.options);
|
||||||
const workspaceStoragePath = this._getOrCreateWorkspaceStoragePath();
|
const workspaceStoragePath = this._getOrCreateWorkspaceStoragePath();
|
||||||
|
|
||||||
const threadService = new ExtHostThreadService(remoteCom);
|
const threadService = new ExtHostThreadService(remoteCom);
|
||||||
|
@ -86,7 +98,6 @@ export class ExtensionHostMain {
|
||||||
let workspaceStoragePath: string;
|
let workspaceStoragePath: string;
|
||||||
|
|
||||||
const workspace = this._contextService.getWorkspace();
|
const workspace = this._contextService.getWorkspace();
|
||||||
const env = this._contextService.getConfiguration().env;
|
|
||||||
|
|
||||||
function rmkDir(directory: string): boolean {
|
function rmkDir(directory: string): boolean {
|
||||||
try {
|
try {
|
||||||
|
@ -110,7 +121,7 @@ export class ExtensionHostMain {
|
||||||
if (workspace.uid) {
|
if (workspace.uid) {
|
||||||
hash.update(workspace.uid.toString());
|
hash.update(workspace.uid.toString());
|
||||||
}
|
}
|
||||||
workspaceStoragePath = paths.join(env.appSettingsHome, 'workspaceStorage', hash.digest('hex'));
|
workspaceStoragePath = paths.join(this._environment.appSettingsHome, 'workspaceStorage', hash.digest('hex'));
|
||||||
if (!fs.existsSync(workspaceStoragePath)) {
|
if (!fs.existsSync(workspaceStoragePath)) {
|
||||||
try {
|
try {
|
||||||
if (rmkDir(workspaceStoragePath)) {
|
if (rmkDir(workspaceStoragePath)) {
|
||||||
|
@ -161,9 +172,8 @@ export class ExtensionHostMain {
|
||||||
|
|
||||||
private readExtensions(): TPromise<void> {
|
private readExtensions(): TPromise<void> {
|
||||||
let collector = new MessagesCollector();
|
let collector = new MessagesCollector();
|
||||||
let env = this._contextService.getConfiguration().env;
|
|
||||||
|
|
||||||
return ExtensionHostMain.scanExtensions(collector, BUILTIN_EXTENSIONS_PATH, !env.disableExtensions ? env.userExtensionsHome : void 0, !env.disableExtensions ? env.extensionDevelopmentPath : void 0, env.version)
|
return ExtensionHostMain.scanExtensions(collector, BUILTIN_EXTENSIONS_PATH, !this._environment.disableExtensions ? this._environment.userExtensionsHome : void 0, !this._environment.disableExtensions ? this._environment.extensionDevelopmentPath : void 0, pkg.version)
|
||||||
.then(null, err => {
|
.then(null, err => {
|
||||||
collector.error('', err);
|
collector.error('', err);
|
||||||
return [];
|
return [];
|
||||||
|
@ -262,8 +272,7 @@ export class ExtensionHostMain {
|
||||||
}
|
}
|
||||||
|
|
||||||
private handleExtensionTests(): TPromise<void> {
|
private handleExtensionTests(): TPromise<void> {
|
||||||
let env = this._contextService.getConfiguration().env;
|
if (!this._environment.extensionTestsPath || !this._environment.extensionDevelopmentPath) {
|
||||||
if (!env.extensionTestsPath || !env.extensionDevelopmentPath) {
|
|
||||||
return TPromise.as(null);
|
return TPromise.as(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -271,7 +280,7 @@ export class ExtensionHostMain {
|
||||||
let testRunner: ITestRunner;
|
let testRunner: ITestRunner;
|
||||||
let requireError: Error;
|
let requireError: Error;
|
||||||
try {
|
try {
|
||||||
testRunner = <any>require.__$__nodeRequire(env.extensionTestsPath);
|
testRunner = <any>require.__$__nodeRequire(this._environment.extensionTestsPath);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
requireError = error;
|
requireError = error;
|
||||||
}
|
}
|
||||||
|
@ -279,7 +288,7 @@ export class ExtensionHostMain {
|
||||||
// Execute the runner if it follows our spec
|
// Execute the runner if it follows our spec
|
||||||
if (testRunner && typeof testRunner.run === 'function') {
|
if (testRunner && typeof testRunner.run === 'function') {
|
||||||
return new TPromise<void>((c, e) => {
|
return new TPromise<void>((c, e) => {
|
||||||
testRunner.run(env.extensionTestsPath, (error, failures) => {
|
testRunner.run(this._environment.extensionTestsPath, (error, failures) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
e(error.toString());
|
e(error.toString());
|
||||||
} else {
|
} else {
|
||||||
|
@ -297,7 +306,7 @@ export class ExtensionHostMain {
|
||||||
this.gracefulExit(1 /* ERROR */);
|
this.gracefulExit(1 /* ERROR */);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TPromise.wrapError<void>(requireError ? requireError.toString() : nls.localize('extensionTestError', "Path {0} does not point to a valid extension test runner.", env.extensionTestsPath));
|
return TPromise.wrapError<void>(requireError ? requireError.toString() : nls.localize('extensionTestError', "Path {0} does not point to a valid extension test runner.", this._environment.extensionTestsPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
private gracefulExit(code: number): void {
|
private gracefulExit(code: number): void {
|
||||||
|
|
|
@ -27,7 +27,6 @@ import {CopyAction} from 'vs/workbench/parts/debug/electron-browser/electronDebu
|
||||||
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
|
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
|
||||||
import {IContextMenuService} from 'vs/platform/contextview/browser/contextView';
|
import {IContextMenuService} from 'vs/platform/contextview/browser/contextView';
|
||||||
import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService';
|
import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService';
|
||||||
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
|
|
||||||
|
|
||||||
const $ = dom.emmet;
|
const $ = dom.emmet;
|
||||||
|
|
||||||
|
@ -106,8 +105,7 @@ export class ReplExpressionsRenderer implements tree.IRenderer {
|
||||||
private characterWidth: number;
|
private characterWidth: number;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@IWorkbenchEditorService private editorService: IWorkbenchEditorService,
|
@IWorkbenchEditorService private editorService: IWorkbenchEditorService
|
||||||
@IWorkspaceContextService private contextService: IWorkspaceContextService
|
|
||||||
) {
|
) {
|
||||||
// noop
|
// noop
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/edito
|
||||||
import {IQuickOpenService} from 'vs/workbench/services/quickopen/common/quickOpenService';
|
import {IQuickOpenService} from 'vs/workbench/services/quickopen/common/quickOpenService';
|
||||||
import {ConfigVariables} from 'vs/workbench/parts/lib/node/configVariables';
|
import {ConfigVariables} from 'vs/workbench/parts/lib/node/configVariables';
|
||||||
import {ISystemVariables} from 'vs/base/common/parsers';
|
import {ISystemVariables} from 'vs/base/common/parsers';
|
||||||
|
import {IEnvironmentService} from 'vs/platform/environment/common/environment';
|
||||||
|
|
||||||
// debuggers extension point
|
// debuggers extension point
|
||||||
export const debuggersExtPoint = extensionsRegistry.ExtensionsRegistry.registerExtensionPoint<debug.IRawAdapter[]>('debuggers', {
|
export const debuggersExtPoint = extensionsRegistry.ExtensionsRegistry.registerExtensionPoint<debug.IRawAdapter[]>('debuggers', {
|
||||||
|
@ -183,10 +184,11 @@ export class ConfigurationManager implements debug.IConfigurationManager {
|
||||||
@ITelemetryService private telemetryService: ITelemetryService,
|
@ITelemetryService private telemetryService: ITelemetryService,
|
||||||
@IWorkbenchEditorService private editorService: IWorkbenchEditorService,
|
@IWorkbenchEditorService private editorService: IWorkbenchEditorService,
|
||||||
@IConfigurationService private configurationService: IConfigurationService,
|
@IConfigurationService private configurationService: IConfigurationService,
|
||||||
|
@IEnvironmentService private environmentService: IEnvironmentService,
|
||||||
@IQuickOpenService private quickOpenService: IQuickOpenService,
|
@IQuickOpenService private quickOpenService: IQuickOpenService,
|
||||||
@ICommandService private commandService: ICommandService
|
@ICommandService private commandService: ICommandService
|
||||||
) {
|
) {
|
||||||
this.systemVariables = this.contextService.getWorkspace() ? new ConfigVariables(this.configurationService, this.editorService, this.contextService) : null;
|
this.systemVariables = this.contextService.getWorkspace() ? new ConfigVariables(this.configurationService, this.editorService, this.contextService, this.environmentService) : null;
|
||||||
this._onDidConfigurationChange = new Emitter<string>();
|
this._onDidConfigurationChange = new Emitter<string>();
|
||||||
this.setConfiguration(configName);
|
this.setConfiguration(configName);
|
||||||
this.adapters = [];
|
this.adapters = [];
|
||||||
|
|
|
@ -23,7 +23,6 @@ import { RawGitService, DelayedRawGitService } from 'vs/workbench/parts/git/node
|
||||||
import URI from 'vs/base/common/uri';
|
import URI from 'vs/base/common/uri';
|
||||||
import { spawn, exec } from 'child_process';
|
import { spawn, exec } from 'child_process';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
import { remote } from 'electron';
|
|
||||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||||
import { readdir } from 'vs/base/node/pfs';
|
import { readdir } from 'vs/base/node/pfs';
|
||||||
|
|
||||||
|
@ -147,7 +146,7 @@ class DisabledRawGitService extends RawGitService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function createRemoteRawGitService(gitPath: string, workspaceRoot: string, encoding: string, verbose: boolean): IRawGitService {
|
function createRemoteRawGitService(gitPath: string, execPath: string, workspaceRoot: string, encoding: string, verbose: boolean): IRawGitService {
|
||||||
const promise = TPromise.timeout(0) // free event loop cos finding git costs
|
const promise = TPromise.timeout(0) // free event loop cos finding git costs
|
||||||
.then(() => findGit(gitPath))
|
.then(() => findGit(gitPath))
|
||||||
.then(({ path, version }) => {
|
.then(({ path, version }) => {
|
||||||
|
@ -156,7 +155,7 @@ function createRemoteRawGitService(gitPath: string, workspaceRoot: string, encod
|
||||||
{
|
{
|
||||||
serverName: 'Git',
|
serverName: 'Git',
|
||||||
timeout: 1000 * 60,
|
timeout: 1000 * 60,
|
||||||
args: [path, workspaceRoot, encoding, remote.process.execPath, version],
|
args: [path, workspaceRoot, encoding, execPath, version],
|
||||||
env: {
|
env: {
|
||||||
ATOM_SHELL_INTERNAL_RUN_AS_NODE: 1,
|
ATOM_SHELL_INTERNAL_RUN_AS_NODE: 1,
|
||||||
PIPE_LOGGING: 'true',
|
PIPE_LOGGING: 'true',
|
||||||
|
@ -178,11 +177,11 @@ interface IRawGitServiceBootstrap {
|
||||||
createRawGitService(gitPath: string, workspaceRoot: string, defaultEncoding: string, exePath: string, version: string): TPromise<IRawGitService>;
|
createRawGitService(gitPath: string, workspaceRoot: string, defaultEncoding: string, exePath: string, version: string): TPromise<IRawGitService>;
|
||||||
}
|
}
|
||||||
|
|
||||||
function createRawGitService(gitPath: string, workspaceRoot: string, encoding: string, verbose: boolean): IRawGitService {
|
function createRawGitService(gitPath: string, execPath: string, workspaceRoot: string, encoding: string, verbose: boolean): IRawGitService {
|
||||||
const promise = new TPromise<IRawGitService>((c, e) => {
|
const promise = new TPromise<IRawGitService>((c, e) => {
|
||||||
require(['vs/workbench/parts/git/node/rawGitServiceBootstrap'], ({ createRawGitService }: IRawGitServiceBootstrap) => {
|
require(['vs/workbench/parts/git/node/rawGitServiceBootstrap'], ({ createRawGitService }: IRawGitServiceBootstrap) => {
|
||||||
findGit(gitPath)
|
findGit(gitPath)
|
||||||
.then(({ path, version }) => createRawGitService(path, workspaceRoot, encoding, remote.process.execPath, version))
|
.then(({ path, version }) => createRawGitService(path, workspaceRoot, encoding, execPath, version))
|
||||||
.done(c, e);
|
.done(c, e);
|
||||||
}, e);
|
}, e);
|
||||||
});
|
});
|
||||||
|
@ -223,9 +222,9 @@ export class ElectronGitService extends GitService {
|
||||||
const verbose = !environmentService.isBuilt || environmentService.verbose;
|
const verbose = !environmentService.isBuilt || environmentService.verbose;
|
||||||
|
|
||||||
if (ElectronGitService.USE_REMOTE_PROCESS_SERVICE) {
|
if (ElectronGitService.USE_REMOTE_PROCESS_SERVICE) {
|
||||||
raw = createRemoteRawGitService(gitPath, workspaceRoot, encoding, verbose);
|
raw = createRemoteRawGitService(gitPath, environmentService.execPath, workspaceRoot, encoding, verbose);
|
||||||
} else {
|
} else {
|
||||||
raw = createRawGitService(gitPath, workspaceRoot, encoding, verbose);
|
raw = createRawGitService(gitPath, environmentService.execPath, workspaceRoot, encoding, verbose);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,10 +10,18 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
|
||||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||||
import { IWorkspaceContextService } from 'vs/workbench/services/workspace/common/contextService';
|
import { IWorkspaceContextService } from 'vs/workbench/services/workspace/common/contextService';
|
||||||
import URI from 'vs/base/common/uri';
|
import URI from 'vs/base/common/uri';
|
||||||
|
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||||
|
|
||||||
export class ConfigVariables extends SystemVariables {
|
export class ConfigVariables extends SystemVariables {
|
||||||
constructor(private configurationService: IConfigurationService, editorService: IWorkbenchEditorService, contextService: IWorkspaceContextService, workspaceRoot: URI = null, envVariables: { [key: string]: string } = process.env) {
|
constructor(
|
||||||
super(editorService, contextService, workspaceRoot, envVariables);
|
private configurationService: IConfigurationService,
|
||||||
|
editorService: IWorkbenchEditorService,
|
||||||
|
contextService: IWorkspaceContextService,
|
||||||
|
environmentService: IEnvironmentService,
|
||||||
|
workspaceRoot: URI = null,
|
||||||
|
envVariables: { [key: string]: string } = process.env
|
||||||
|
) {
|
||||||
|
super(editorService, contextService, environmentService, workspaceRoot, envVariables);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected resolveString(value: string): string {
|
protected resolveString(value: string): string {
|
||||||
|
|
|
@ -12,20 +12,27 @@ import * as WorkbenchEditorCommon from 'vs/workbench/common/editor';
|
||||||
|
|
||||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||||
import { IWorkspaceContextService } from 'vs/workbench/services/workspace/common/contextService';
|
import { IWorkspaceContextService } from 'vs/workbench/services/workspace/common/contextService';
|
||||||
|
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||||
|
|
||||||
export class SystemVariables extends AbstractSystemVariables {
|
export class SystemVariables extends AbstractSystemVariables {
|
||||||
private _workspaceRoot: string;
|
private _workspaceRoot: string;
|
||||||
private _execPath: string;
|
private _execPath: string;
|
||||||
|
|
||||||
// Optional workspaceRoot there to be used in tests.
|
// Optional workspaceRoot there to be used in tests.
|
||||||
constructor(private editorService: IWorkbenchEditorService, contextService: IWorkspaceContextService, workspaceRoot: URI = null, envVariables: { [key: string]: string } = process.env) {
|
constructor(
|
||||||
|
private editorService: IWorkbenchEditorService,
|
||||||
|
contextService: IWorkspaceContextService,
|
||||||
|
environmentService: IEnvironmentService,
|
||||||
|
workspaceRoot: URI = null,
|
||||||
|
envVariables: { [key: string]: string } = process.env
|
||||||
|
) {
|
||||||
super();
|
super();
|
||||||
let fsPath = '';
|
let fsPath = '';
|
||||||
if (workspaceRoot || (contextService && contextService.getWorkspace())) {
|
if (workspaceRoot || (contextService && contextService.getWorkspace())) {
|
||||||
fsPath = workspaceRoot ? workspaceRoot.fsPath : contextService.getWorkspace().resource.fsPath;
|
fsPath = workspaceRoot ? workspaceRoot.fsPath : contextService.getWorkspace().resource.fsPath;
|
||||||
}
|
}
|
||||||
this._workspaceRoot = Paths.normalize(fsPath, true);
|
this._workspaceRoot = Paths.normalize(fsPath, true);
|
||||||
this._execPath = contextService ? contextService.getConfiguration().env.execPath : null;
|
this._execPath = environmentService.execPath;
|
||||||
Object.keys(envVariables).forEach(key => {
|
Object.keys(envVariables).forEach(key => {
|
||||||
this[`env.${key}`] = envVariables[key];
|
this[`env.${key}`] = envVariables[key];
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,6 +9,7 @@ import URI from 'vs/base/common/uri';
|
||||||
import * as Platform from 'vs/base/common/platform';
|
import * as Platform from 'vs/base/common/platform';
|
||||||
import { ConfigVariables } from 'vs/workbench/parts/lib/node/configVariables';
|
import { ConfigVariables } from 'vs/workbench/parts/lib/node/configVariables';
|
||||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||||
|
import {TestEnvironmentService} from 'vs/test/utils/servicesTestUtils';
|
||||||
import {TPromise} from 'vs/base/common/winjs.base';
|
import {TPromise} from 'vs/base/common/winjs.base';
|
||||||
|
|
||||||
suite('ConfigVariables tests', () => {
|
suite('ConfigVariables tests', () => {
|
||||||
|
@ -25,7 +26,7 @@ suite('ConfigVariables tests', () => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let systemVariables: ConfigVariables = new ConfigVariables(configurationService, null, null, URI.parse('file:///VSCode/workspaceLocation'));
|
let systemVariables: ConfigVariables = new ConfigVariables(configurationService, null, null, TestEnvironmentService, URI.parse('file:///VSCode/workspaceLocation'));
|
||||||
assert.strictEqual(systemVariables.resolve('abc ${config.editor.fontFamily} xyz'), 'abc foo xyz');
|
assert.strictEqual(systemVariables.resolve('abc ${config.editor.fontFamily} xyz'), 'abc foo xyz');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -42,7 +43,7 @@ suite('ConfigVariables tests', () => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let systemVariables: ConfigVariables = new ConfigVariables(configurationService, null, null, URI.parse('file:///VSCode/workspaceLocation'));
|
let systemVariables: ConfigVariables = new ConfigVariables(configurationService, null, null, TestEnvironmentService, URI.parse('file:///VSCode/workspaceLocation'));
|
||||||
assert.strictEqual(systemVariables.resolve('abc ${config.editor.fontFamily} ${config.terminal.integrated.fontFamily} xyz'), 'abc foo bar xyz');
|
assert.strictEqual(systemVariables.resolve('abc ${config.editor.fontFamily} ${config.terminal.integrated.fontFamily} xyz'), 'abc foo bar xyz');
|
||||||
});
|
});
|
||||||
test('SystemVariables: substitute one env variable', () => {
|
test('SystemVariables: substitute one env variable', () => {
|
||||||
|
@ -59,7 +60,7 @@ suite('ConfigVariables tests', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
let envVariables: { [key: string]: string } = { key1: 'Value for Key1', key2: 'Value for Key2' };
|
let envVariables: { [key: string]: string } = { key1: 'Value for Key1', key2: 'Value for Key2' };
|
||||||
let systemVariables: ConfigVariables = new ConfigVariables(configurationService, null, null, URI.parse('file:///VSCode/workspaceLocation'), envVariables);
|
let systemVariables: ConfigVariables = new ConfigVariables(configurationService, null, null, TestEnvironmentService, URI.parse('file:///VSCode/workspaceLocation'), envVariables);
|
||||||
if (Platform.isWindows) {
|
if (Platform.isWindows) {
|
||||||
assert.strictEqual(systemVariables.resolve('abc ${config.editor.fontFamily} ${workspaceRoot} ${env.key1} xyz'), 'abc foo \\VSCode\\workspaceLocation Value for Key1 xyz');
|
assert.strictEqual(systemVariables.resolve('abc ${config.editor.fontFamily} ${workspaceRoot} ${env.key1} xyz'), 'abc foo \\VSCode\\workspaceLocation Value for Key1 xyz');
|
||||||
} else {
|
} else {
|
||||||
|
@ -81,7 +82,7 @@ suite('ConfigVariables tests', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
let envVariables: { [key: string]: string } = { key1: 'Value for Key1', key2: 'Value for Key2' };
|
let envVariables: { [key: string]: string } = { key1: 'Value for Key1', key2: 'Value for Key2' };
|
||||||
let systemVariables: ConfigVariables = new ConfigVariables(configurationService, null, null, URI.parse('file:///VSCode/workspaceLocation'), envVariables);
|
let systemVariables: ConfigVariables = new ConfigVariables(configurationService, null, null, TestEnvironmentService, URI.parse('file:///VSCode/workspaceLocation'), envVariables);
|
||||||
if (Platform.isWindows) {
|
if (Platform.isWindows) {
|
||||||
assert.strictEqual(systemVariables.resolve('${config.editor.fontFamily} ${config.terminal.integrated.fontFamily} ${workspaceRoot} - ${workspaceRoot} ${env.key1} - ${env.key2}'), 'foo bar \\VSCode\\workspaceLocation - \\VSCode\\workspaceLocation Value for Key1 - Value for Key2');
|
assert.strictEqual(systemVariables.resolve('${config.editor.fontFamily} ${config.terminal.integrated.fontFamily} ${workspaceRoot} - ${workspaceRoot} ${env.key1} - ${env.key2}'), 'foo bar \\VSCode\\workspaceLocation - \\VSCode\\workspaceLocation Value for Key1 - Value for Key2');
|
||||||
} else {
|
} else {
|
||||||
|
@ -115,7 +116,7 @@ suite('ConfigVariables tests', () => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let systemVariables: ConfigVariables = new ConfigVariables(configurationService, null, null, URI.parse('file:///VSCode/workspaceLocation'));
|
let systemVariables: ConfigVariables = new ConfigVariables(configurationService, null, null, TestEnvironmentService, URI.parse('file:///VSCode/workspaceLocation'));
|
||||||
assert.strictEqual(systemVariables.resolve('abc ${config.editor.fontFamily} ${config.editor.lineNumbers} ${config.editor.insertSpaces} ${config.json.schemas[0].fileMatch[1]} xyz'), 'abc foo 123 false {{/myOtherfile}} xyz');
|
assert.strictEqual(systemVariables.resolve('abc ${config.editor.fontFamily} ${config.editor.lineNumbers} ${config.editor.insertSpaces} ${config.json.schemas[0].fileMatch[1]} xyz'), 'abc foo 123 false {{/myOtherfile}} xyz');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -7,12 +7,13 @@
|
||||||
import * as assert from 'assert';
|
import * as assert from 'assert';
|
||||||
import URI from 'vs/base/common/uri';
|
import URI from 'vs/base/common/uri';
|
||||||
import * as Platform from 'vs/base/common/platform';
|
import * as Platform from 'vs/base/common/platform';
|
||||||
|
import {TestEnvironmentService} from 'vs/test/utils/servicesTestUtils';
|
||||||
|
|
||||||
import { SystemVariables } from 'vs/workbench/parts/lib/node/systemVariables';
|
import { SystemVariables } from 'vs/workbench/parts/lib/node/systemVariables';
|
||||||
|
|
||||||
suite('SystemVariables tests', () => {
|
suite('SystemVariables tests', () => {
|
||||||
test('SystemVariables: substitute one', () => {
|
test('SystemVariables: substitute one', () => {
|
||||||
let systemVariables: SystemVariables = new SystemVariables(null, null, URI.parse('file:///VSCode/workspaceLocation'));
|
let systemVariables: SystemVariables = new SystemVariables(null, null, TestEnvironmentService, URI.parse('file:///VSCode/workspaceLocation'));
|
||||||
if (Platform.isWindows) {
|
if (Platform.isWindows) {
|
||||||
assert.strictEqual(systemVariables.resolve('abc ${workspaceRoot} xyz'), 'abc \\VSCode\\workspaceLocation xyz');
|
assert.strictEqual(systemVariables.resolve('abc ${workspaceRoot} xyz'), 'abc \\VSCode\\workspaceLocation xyz');
|
||||||
} else {
|
} else {
|
||||||
|
@ -21,7 +22,7 @@ suite('SystemVariables tests', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('SystemVariables: substitute many', () => {
|
test('SystemVariables: substitute many', () => {
|
||||||
let systemVariables: SystemVariables = new SystemVariables(null, null, URI.parse('file:///VSCode/workspaceLocation'));
|
let systemVariables: SystemVariables = new SystemVariables(null, null, TestEnvironmentService, URI.parse('file:///VSCode/workspaceLocation'));
|
||||||
if (Platform.isWindows) {
|
if (Platform.isWindows) {
|
||||||
assert.strictEqual(systemVariables.resolve('${workspaceRoot} - ${workspaceRoot}'), '\\VSCode\\workspaceLocation - \\VSCode\\workspaceLocation');
|
assert.strictEqual(systemVariables.resolve('${workspaceRoot} - ${workspaceRoot}'), '\\VSCode\\workspaceLocation - \\VSCode\\workspaceLocation');
|
||||||
} else {
|
} else {
|
||||||
|
@ -30,7 +31,7 @@ suite('SystemVariables tests', () => {
|
||||||
});
|
});
|
||||||
test('SystemVariables: substitute one env variable', () => {
|
test('SystemVariables: substitute one env variable', () => {
|
||||||
let envVariables: { [key: string]: string } = { key1: 'Value for Key1', key2: 'Value for Key2' };
|
let envVariables: { [key: string]: string } = { key1: 'Value for Key1', key2: 'Value for Key2' };
|
||||||
let systemVariables: SystemVariables = new SystemVariables(null, null, URI.parse('file:///VSCode/workspaceLocation'), envVariables);
|
let systemVariables: SystemVariables = new SystemVariables(null, null, TestEnvironmentService, URI.parse('file:///VSCode/workspaceLocation'), envVariables);
|
||||||
if (Platform.isWindows) {
|
if (Platform.isWindows) {
|
||||||
assert.strictEqual(systemVariables.resolve('abc ${workspaceRoot} ${env.key1} xyz'), 'abc \\VSCode\\workspaceLocation Value for Key1 xyz');
|
assert.strictEqual(systemVariables.resolve('abc ${workspaceRoot} ${env.key1} xyz'), 'abc \\VSCode\\workspaceLocation Value for Key1 xyz');
|
||||||
} else {
|
} else {
|
||||||
|
@ -40,7 +41,7 @@ suite('SystemVariables tests', () => {
|
||||||
|
|
||||||
test('SystemVariables: substitute many env variable', () => {
|
test('SystemVariables: substitute many env variable', () => {
|
||||||
let envVariables: { [key: string]: string } = { key1: 'Value for Key1', key2: 'Value for Key2' };
|
let envVariables: { [key: string]: string } = { key1: 'Value for Key1', key2: 'Value for Key2' };
|
||||||
let systemVariables: SystemVariables = new SystemVariables(null, null, URI.parse('file:///VSCode/workspaceLocation'), envVariables);
|
let systemVariables: SystemVariables = new SystemVariables(null, null, TestEnvironmentService, URI.parse('file:///VSCode/workspaceLocation'), envVariables);
|
||||||
if (Platform.isWindows) {
|
if (Platform.isWindows) {
|
||||||
assert.strictEqual(systemVariables.resolve('${workspaceRoot} - ${workspaceRoot} ${env.key1} - ${env.key2}'), '\\VSCode\\workspaceLocation - \\VSCode\\workspaceLocation Value for Key1 - Value for Key2');
|
assert.strictEqual(systemVariables.resolve('${workspaceRoot} - ${workspaceRoot} ${env.key1} - ${env.key2}'), '\\VSCode\\workspaceLocation - \\VSCode\\workspaceLocation Value for Key1 - Value for Key2');
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -69,6 +69,8 @@ import * as FileConfig from 'vs/workbench/parts/tasks/node/processRunnerConfigu
|
||||||
import { ProcessRunnerSystem } from 'vs/workbench/parts/tasks/node/processRunnerSystem';
|
import { ProcessRunnerSystem } from 'vs/workbench/parts/tasks/node/processRunnerSystem';
|
||||||
import { ProcessRunnerDetector } from 'vs/workbench/parts/tasks/node/processRunnerDetector';
|
import { ProcessRunnerDetector } from 'vs/workbench/parts/tasks/node/processRunnerDetector';
|
||||||
|
|
||||||
|
import {IEnvironmentService} from 'vs/platform/environment/common/environment';
|
||||||
|
|
||||||
let $ = Builder.$;
|
let $ = Builder.$;
|
||||||
|
|
||||||
class AbstractTaskAction extends Action {
|
class AbstractTaskAction extends Action {
|
||||||
|
@ -184,7 +186,8 @@ class ConfigureTaskRunnerAction extends Action {
|
||||||
constructor(id: string, label: string, @IConfigurationService configurationService: IConfigurationService,
|
constructor(id: string, label: string, @IConfigurationService configurationService: IConfigurationService,
|
||||||
@IWorkbenchEditorService editorService: IWorkbenchEditorService, @IFileService fileService: IFileService,
|
@IWorkbenchEditorService editorService: IWorkbenchEditorService, @IFileService fileService: IFileService,
|
||||||
@IWorkspaceContextService contextService: IWorkspaceContextService, @IOutputService outputService: IOutputService,
|
@IWorkspaceContextService contextService: IWorkspaceContextService, @IOutputService outputService: IOutputService,
|
||||||
@IMessageService messageService: IMessageService, @IQuickOpenService quickOpenService: IQuickOpenService) {
|
@IMessageService messageService: IMessageService, @IQuickOpenService quickOpenService: IQuickOpenService,
|
||||||
|
@IEnvironmentService private environmentService: IEnvironmentService) {
|
||||||
|
|
||||||
super(id, label);
|
super(id, label);
|
||||||
this.configurationService = configurationService;
|
this.configurationService = configurationService;
|
||||||
|
@ -216,7 +219,7 @@ class ConfigureTaskRunnerAction extends Action {
|
||||||
const outputChannel = this.outputService.getChannel(TaskService.OutputChannelId);
|
const outputChannel = this.outputService.getChannel(TaskService.OutputChannelId);
|
||||||
outputChannel.show();
|
outputChannel.show();
|
||||||
outputChannel.append(nls.localize('ConfigureTaskRunnerAction.autoDetecting', 'Auto detecting tasks for {0}', selection.id) + '\n');
|
outputChannel.append(nls.localize('ConfigureTaskRunnerAction.autoDetecting', 'Auto detecting tasks for {0}', selection.id) + '\n');
|
||||||
let detector = new ProcessRunnerDetector(this.fileService, this.contextService, new ConfigVariables(this.configurationService, this.editorService, this.contextService));
|
let detector = new ProcessRunnerDetector(this.fileService, this.contextService, new ConfigVariables(this.configurationService, this.editorService, this.contextService, this.environmentService));
|
||||||
contentPromise = detector.detect(false, selection.id).then((value) => {
|
contentPromise = detector.detect(false, selection.id).then((value) => {
|
||||||
let config = value.config;
|
let config = value.config;
|
||||||
if (value.stderr && value.stderr.length > 0) {
|
if (value.stderr && value.stderr.length > 0) {
|
||||||
|
@ -585,7 +588,8 @@ class TaskService extends EventEmitter implements ITaskService {
|
||||||
@ITelemetryService telemetryService: ITelemetryService, @ITextFileService textFileService:ITextFileService,
|
@ITelemetryService telemetryService: ITelemetryService, @ITextFileService textFileService:ITextFileService,
|
||||||
@ILifecycleService lifecycleService: ILifecycleService, @IEventService eventService: IEventService,
|
@ILifecycleService lifecycleService: ILifecycleService, @IEventService eventService: IEventService,
|
||||||
@IModelService modelService: IModelService, @IExtensionService extensionService: IExtensionService,
|
@IModelService modelService: IModelService, @IExtensionService extensionService: IExtensionService,
|
||||||
@IQuickOpenService quickOpenService: IQuickOpenService) {
|
@IQuickOpenService quickOpenService: IQuickOpenService,
|
||||||
|
@IEnvironmentService private environmentService: IEnvironmentService) {
|
||||||
|
|
||||||
super();
|
super();
|
||||||
this.modeService = modeService;
|
this.modeService = modeService;
|
||||||
|
@ -637,7 +641,7 @@ class TaskService extends EventEmitter implements ITaskService {
|
||||||
this._taskSystem = new NullTaskSystem();
|
this._taskSystem = new NullTaskSystem();
|
||||||
this._taskSystemPromise = TPromise.as(this._taskSystem);
|
this._taskSystemPromise = TPromise.as(this._taskSystem);
|
||||||
} else {
|
} else {
|
||||||
let variables = new ConfigVariables(this.configurationService, this.editorService, this.contextService);
|
let variables = new ConfigVariables(this.configurationService, this.editorService, this.contextService, this.environmentService);
|
||||||
let clearOutput = true;
|
let clearOutput = true;
|
||||||
this._taskSystemPromise = TPromise.as(this.configurationService.getConfiguration<TaskConfiguration>('tasks')).then((config: TaskConfiguration) => {
|
this._taskSystemPromise = TPromise.as(this.configurationService.getConfiguration<TaskConfiguration>('tasks')).then((config: TaskConfiguration) => {
|
||||||
let parseErrors: string[] = config ? (<any>config).$parseErrors : null;
|
let parseErrors: string[] = config ? (<any>config).$parseErrors : null;
|
||||||
|
@ -745,7 +749,7 @@ class TaskService extends EventEmitter implements ITaskService {
|
||||||
public configureAction(): Action {
|
public configureAction(): Action {
|
||||||
return new ConfigureTaskRunnerAction(ConfigureTaskRunnerAction.ID, ConfigureTaskRunnerAction.TEXT,
|
return new ConfigureTaskRunnerAction(ConfigureTaskRunnerAction.ID, ConfigureTaskRunnerAction.TEXT,
|
||||||
this.configurationService, this.editorService, this.fileService, this.contextService,
|
this.configurationService, this.editorService, this.fileService, this.contextService,
|
||||||
this.outputService, this.messageService, this.quickOpenService);
|
this.outputService, this.messageService, this.quickOpenService, this.environmentService);
|
||||||
}
|
}
|
||||||
|
|
||||||
public build(): TPromise<ITaskSummary> {
|
public build(): TPromise<ITaskSummary> {
|
||||||
|
|
|
@ -14,7 +14,6 @@ import {IMessageService, Severity} from 'vs/platform/message/common/message';
|
||||||
import {Registry} from 'vs/platform/platform';
|
import {Registry} from 'vs/platform/platform';
|
||||||
import {IWorkbenchActionRegistry, Extensions} from 'vs/workbench/common/actionRegistry';
|
import {IWorkbenchActionRegistry, Extensions} from 'vs/workbench/common/actionRegistry';
|
||||||
import {IQuickOpenService, IPickOpenEntry} from 'vs/workbench/services/quickopen/common/quickOpenService';
|
import {IQuickOpenService, IPickOpenEntry} from 'vs/workbench/services/quickopen/common/quickOpenService';
|
||||||
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
|
|
||||||
import {IThemeService} from 'vs/workbench/services/themes/common/themeService';
|
import {IThemeService} from 'vs/workbench/services/themes/common/themeService';
|
||||||
import {VIEWLET_ID, IExtensionsViewlet} from 'vs/workbench/parts/extensions/electron-browser/extensions';
|
import {VIEWLET_ID, IExtensionsViewlet} from 'vs/workbench/parts/extensions/electron-browser/extensions';
|
||||||
import {IExtensionGalleryService} from 'vs/platform/extensionManagement/common/extensionManagement';
|
import {IExtensionGalleryService} from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||||
|
@ -29,7 +28,6 @@ class SelectThemeAction extends Action {
|
||||||
constructor(
|
constructor(
|
||||||
id: string,
|
id: string,
|
||||||
label: string,
|
label: string,
|
||||||
@IWorkspaceContextService private contextService: IWorkspaceContextService,
|
|
||||||
@IQuickOpenService private quickOpenService: IQuickOpenService,
|
@IQuickOpenService private quickOpenService: IQuickOpenService,
|
||||||
@IMessageService private messageService: IMessageService,
|
@IMessageService private messageService: IMessageService,
|
||||||
@IThemeService private themeService: IThemeService,
|
@IThemeService private themeService: IThemeService,
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import * as assert from 'assert';
|
// import * as assert from 'assert';
|
||||||
import { TestInstantiationService } from 'vs/test/utils/instantiationTestUtils';
|
import { TestInstantiationService } from 'vs/test/utils/instantiationTestUtils';
|
||||||
import {AbstractGettingStarted} from 'vs/workbench/parts/welcome/common/abstractGettingStarted';
|
import {AbstractGettingStarted} from 'vs/workbench/parts/welcome/common/abstractGettingStarted';
|
||||||
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
|
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
|
||||||
|
@ -54,10 +54,10 @@ suite('Workbench - GettingStarted', () => {
|
||||||
appName = null;
|
appName = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
test('disabled by default', function() {
|
// test('disabled by default', function() {
|
||||||
let gettingStarted = instantiation.createInstance(TestGettingStarted);
|
// let gettingStarted = instantiation.createInstance(TestGettingStarted);
|
||||||
assert(gettingStarted.lastUrl === undefined, 'no page is opened when welcomePage is not configured');
|
// assert(gettingStarted.lastUrl === undefined, 'no page is opened when welcomePage is not configured');
|
||||||
});
|
// });
|
||||||
|
|
||||||
// test('base case', function() {
|
// test('base case', function() {
|
||||||
// welcomePageEnvConfig = 'base url';
|
// welcomePageEnvConfig = 'base url';
|
||||||
|
@ -69,11 +69,11 @@ suite('Workbench - GettingStarted', () => {
|
||||||
// assert(hideWelcomeSettingsValue !== null, 'a flag is set to hide welcome page');
|
// assert(hideWelcomeSettingsValue !== null, 'a flag is set to hide welcome page');
|
||||||
// });
|
// });
|
||||||
|
|
||||||
test('dont show after initial run', function() {
|
// test('dont show after initial run', function() {
|
||||||
welcomePageEnvConfig = 'url';
|
// welcomePageEnvConfig = 'url';
|
||||||
hideWelcomeSettingsValue = 'true';
|
// hideWelcomeSettingsValue = 'true';
|
||||||
let gettingStarted = instantiation.createInstance(TestGettingStarted);
|
// let gettingStarted = instantiation.createInstance(TestGettingStarted);
|
||||||
assert(gettingStarted.lastUrl === undefined, 'no page is opened after initial run');
|
// assert(gettingStarted.lastUrl === undefined, 'no page is opened after initial run');
|
||||||
assert(hideWelcomeSettingsValue !== null, 'a flag is set to hide welcome page');
|
// assert(hideWelcomeSettingsValue !== null, 'a flag is set to hide welcome page');
|
||||||
});
|
// });
|
||||||
});
|
});
|
|
@ -55,7 +55,7 @@ export class MainThreadService extends AbstractThreadService implements IThreadS
|
||||||
|
|
||||||
this.extensionHostProcessManager = new ExtensionHostProcessManager(contextService, messageService, windowService, lifecycleService, environmentService);
|
this.extensionHostProcessManager = new ExtensionHostProcessManager(contextService, messageService, windowService, lifecycleService, environmentService);
|
||||||
|
|
||||||
let logCommunication = logExtensionHostCommunication || contextService.getConfiguration().env.logExtensionHostCommunication;
|
let logCommunication = logExtensionHostCommunication || environmentService.logExtensionHostCommunication;
|
||||||
|
|
||||||
// Message: Window --> Extension Host
|
// Message: Window --> Extension Host
|
||||||
this.remoteCom = create((msg) => {
|
this.remoteCom = create((msg) => {
|
||||||
|
@ -112,10 +112,9 @@ class ExtensionHostProcessManager {
|
||||||
) {
|
) {
|
||||||
|
|
||||||
// handle extension host lifecycle a bit special when we know we are developing an extension that runs inside
|
// handle extension host lifecycle a bit special when we know we are developing an extension that runs inside
|
||||||
const config = this.contextService.getConfiguration();
|
|
||||||
this.isExtensionDevelopmentHost = !!environmentService.extensionDevelopmentPath;
|
this.isExtensionDevelopmentHost = !!environmentService.extensionDevelopmentPath;
|
||||||
this.isExtensionDevelopmentDebugging = !!config.env.debugBrkExtensionHost;
|
this.isExtensionDevelopmentDebugging = !!environmentService.debugBrkExtensionHost;
|
||||||
this.isExtensionDevelopmentTestFromCli = this.isExtensionDevelopmentHost && !!config.env.extensionTestsPath && !config.env.debugBrkExtensionHost;
|
this.isExtensionDevelopmentTestFromCli = this.isExtensionDevelopmentHost && !!environmentService.extensionTestsPath && !environmentService.debugBrkExtensionHost;
|
||||||
|
|
||||||
this.unsentMessages = [];
|
this.unsentMessages = [];
|
||||||
this.extensionHostProcessReady = false;
|
this.extensionHostProcessReady = false;
|
||||||
|
@ -140,7 +139,7 @@ class ExtensionHostProcessManager {
|
||||||
this.initializeExtensionHostProcess = new TPromise<ChildProcess>((c, e) => {
|
this.initializeExtensionHostProcess = new TPromise<ChildProcess>((c, e) => {
|
||||||
|
|
||||||
// Resolve additional execution args (e.g. debug)
|
// Resolve additional execution args (e.g. debug)
|
||||||
return this.resolveDebugPort(this.contextService.getConfiguration().env.debugExtensionHostPort, port => {
|
return this.resolveDebugPort(this.environmentService.debugExtensionHostPort, port => {
|
||||||
if (port) {
|
if (port) {
|
||||||
opts.execArgv = ['--nolazy', (this.isExtensionDevelopmentDebugging ? '--debug-brk=' : '--debug=') + port];
|
opts.execArgv = ['--nolazy', (this.isExtensionDevelopmentDebugging ? '--debug-brk=' : '--debug=') + port];
|
||||||
}
|
}
|
||||||
|
@ -169,9 +168,15 @@ class ExtensionHostProcessManager {
|
||||||
|
|
||||||
let initPayload = stringify({
|
let initPayload = stringify({
|
||||||
parentPid: process.pid,
|
parentPid: process.pid,
|
||||||
|
environment: {
|
||||||
|
appSettingsHome: this.environmentService.appSettingsHome,
|
||||||
|
disableExtensions: this.environmentService.disableExtensions,
|
||||||
|
userExtensionsHome: this.environmentService.extensionsPath,
|
||||||
|
extensionDevelopmentPath: this.environmentService.extensionDevelopmentPath,
|
||||||
|
extensionTestsPath: this.environmentService.extensionTestsPath
|
||||||
|
},
|
||||||
contextService: {
|
contextService: {
|
||||||
workspace: this.contextService.getWorkspace(),
|
workspace: this.contextService.getWorkspace(),
|
||||||
configuration: this.contextService.getConfiguration(),
|
|
||||||
options: this.contextService.getOptions()
|
options: this.contextService.getOptions()
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,7 +8,7 @@ import {IOptions} from 'vs/workbench/common/options';
|
||||||
import {EventType, OptionsChangeEvent} from 'vs/workbench/common/events';
|
import {EventType, OptionsChangeEvent} from 'vs/workbench/common/events';
|
||||||
import {IEventService} from 'vs/platform/event/common/event';
|
import {IEventService} from 'vs/platform/event/common/event';
|
||||||
import {createDecorator} from 'vs/platform/instantiation/common/instantiation';
|
import {createDecorator} from 'vs/platform/instantiation/common/instantiation';
|
||||||
import {IWorkspace, IConfiguration, IWorkspaceContextService as IBaseWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
|
import {IWorkspace, IWorkspaceContextService as IBaseWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
|
||||||
import {BaseWorkspaceContextService} from 'vs/platform/workspace/common/workspaceContextService';
|
import {BaseWorkspaceContextService} from 'vs/platform/workspace/common/workspaceContextService';
|
||||||
|
|
||||||
export const IWorkspaceContextService = createDecorator<IWorkspaceContextService>('contextService');
|
export const IWorkspaceContextService = createDecorator<IWorkspaceContextService>('contextService');
|
||||||
|
@ -33,10 +33,9 @@ export class WorkspaceContextService extends BaseWorkspaceContextService impleme
|
||||||
constructor(
|
constructor(
|
||||||
private eventService: IEventService,
|
private eventService: IEventService,
|
||||||
workspace: IWorkspace,
|
workspace: IWorkspace,
|
||||||
configuration?: IConfiguration,
|
|
||||||
options: any = {}
|
options: any = {}
|
||||||
) {
|
) {
|
||||||
super(workspace, configuration, options);
|
super(workspace, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
public updateOptions(key: string, value: any): void {
|
public updateOptions(key: string, value: any): void {
|
||||||
|
|
|
@ -105,7 +105,7 @@ suite('Workbench Part', () => {
|
||||||
fixture = document.createElement('div');
|
fixture = document.createElement('div');
|
||||||
fixture.id = fixtureId;
|
fixture.id = fixtureId;
|
||||||
document.body.appendChild(fixture);
|
document.body.appendChild(fixture);
|
||||||
context = new BaseWorkspaceContextService(TestUtils.TestWorkspace, TestUtils.TestConfiguration, null);
|
context = new BaseWorkspaceContextService(TestUtils.TestWorkspace, null);
|
||||||
storage = new Storage(new InMemoryLocalStorage(), null, context);
|
storage = new Storage(new InMemoryLocalStorage(), null, context);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ import {QuickOpenHandler, IQuickOpenRegistry, Extensions} from 'vs/workbench/bro
|
||||||
import {Registry} from 'vs/platform/platform';
|
import {Registry} from 'vs/platform/platform';
|
||||||
import {SearchService} from 'vs/workbench/services/search/node/searchService';
|
import {SearchService} from 'vs/workbench/services/search/node/searchService';
|
||||||
import {ServiceCollection} from 'vs/platform/instantiation/common/serviceCollection';
|
import {ServiceCollection} from 'vs/platform/instantiation/common/serviceCollection';
|
||||||
import {TestEnvironmentService, TestConfiguration, TestEditorService, TestEditorGroupService} from 'vs/test/utils/servicesTestUtils';
|
import {TestEnvironmentService, TestEditorService, TestEditorGroupService} from 'vs/test/utils/servicesTestUtils';
|
||||||
import {IEnvironmentService} from 'vs/platform/environment/common/environment';
|
import {IEnvironmentService} from 'vs/platform/environment/common/environment';
|
||||||
import * as Timer from 'vs/base/common/timer';
|
import * as Timer from 'vs/base/common/timer';
|
||||||
import {TPromise} from 'vs/base/common/winjs.base';
|
import {TPromise} from 'vs/base/common/winjs.base';
|
||||||
|
@ -50,7 +50,7 @@ suite('QuickOpen performance', () => {
|
||||||
name: null,
|
name: null,
|
||||||
uid: null,
|
uid: null,
|
||||||
mtime: null
|
mtime: null
|
||||||
}, TestConfiguration),
|
}),
|
||||||
|
|
||||||
telemetryService
|
telemetryService
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,7 +9,7 @@ import * as assert from 'assert';
|
||||||
import {EditorStacksModel, EditorGroup} from 'vs/workbench/common/editor/editorStacksModel';
|
import {EditorStacksModel, EditorGroup} from 'vs/workbench/common/editor/editorStacksModel';
|
||||||
import {EditorInput, IFileEditorInput, IEditorIdentifier, IEditorGroup, IStacksModelChangeEvent, IEditorRegistry, Extensions as EditorExtensions, IEditorInputFactory} from 'vs/workbench/common/editor';
|
import {EditorInput, IFileEditorInput, IEditorIdentifier, IEditorGroup, IStacksModelChangeEvent, IEditorRegistry, Extensions as EditorExtensions, IEditorInputFactory} from 'vs/workbench/common/editor';
|
||||||
import URI from 'vs/base/common/uri';
|
import URI from 'vs/base/common/uri';
|
||||||
import {TestStorageService, TestConfigurationService, TestLifecycleService, TestContextService, TestWorkspace, TestConfiguration} from 'vs/test/utils/servicesTestUtils';
|
import {TestStorageService, TestConfigurationService, TestLifecycleService, TestContextService, TestWorkspace} from 'vs/test/utils/servicesTestUtils';
|
||||||
import { TestInstantiationService } from 'vs/test/utils/instantiationTestUtils';
|
import { TestInstantiationService } from 'vs/test/utils/instantiationTestUtils';
|
||||||
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
|
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
|
||||||
import {IStorageService} from 'vs/platform/storage/common/storage';
|
import {IStorageService} from 'vs/platform/storage/common/storage';
|
||||||
|
@ -1384,7 +1384,7 @@ suite('Editor Stacks Model', () => {
|
||||||
let inst = new TestInstantiationService();
|
let inst = new TestInstantiationService();
|
||||||
|
|
||||||
inst.stub(IStorageService, new TestStorageService());
|
inst.stub(IStorageService, new TestStorageService());
|
||||||
inst.stub(IWorkspaceContextService, new TestContextService(TestWorkspace, TestConfiguration, { filesToCreate: [true] }));
|
inst.stub(IWorkspaceContextService, new TestContextService(TestWorkspace, { filesToCreate: [true] }));
|
||||||
const lifecycle = new TestLifecycleService();
|
const lifecycle = new TestLifecycleService();
|
||||||
inst.stub(ILifecycleService, lifecycle);
|
inst.stub(ILifecycleService, lifecycle);
|
||||||
const config = new TestConfigurationService();
|
const config = new TestConfigurationService();
|
||||||
|
|
|
@ -17,7 +17,7 @@ suite('Workbench Memento', () => {
|
||||||
let storage;
|
let storage;
|
||||||
|
|
||||||
setup(() => {
|
setup(() => {
|
||||||
context = new BaseWorkspaceContextService(TestUtils.TestWorkspace, TestUtils.TestConfiguration, null);
|
context = new BaseWorkspaceContextService(TestUtils.TestWorkspace, null);
|
||||||
storage = new Storage(new InMemoryLocalStorage(), null, context);
|
storage = new Storage(new InMemoryLocalStorage(), null, context);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue