mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-25 09:06:21 +01:00
introduce IEnvironmentService
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
import * as os from 'os';
|
||||
import * as minimist from 'minimist';
|
||||
import pkg from 'vs/code/node/package';
|
||||
import pkg from 'vs/platform/package';
|
||||
|
||||
export interface ParsedArgs extends minimist.ParsedArgs {
|
||||
help: boolean;
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as path from 'path';
|
||||
import uri from 'vs/base/common/uri';
|
||||
|
||||
export interface IPackageConfiguration {
|
||||
name: string;
|
||||
version: string;
|
||||
}
|
||||
|
||||
const rootPath = path.dirname(uri.parse(require.toUrl('')).fsPath);
|
||||
const packageJsonPath = path.join(rootPath, 'package.json');
|
||||
export default require.__$__nodeRequire(packageJsonPath) as IPackageConfiguration;
|
||||
@@ -1,58 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as path from 'path';
|
||||
import uri from 'vs/base/common/uri';
|
||||
|
||||
export interface IProductConfiguration {
|
||||
nameShort: string;
|
||||
nameLong: string;
|
||||
applicationName: string;
|
||||
win32AppUserModelId: string;
|
||||
win32MutexName: string;
|
||||
darwinBundleIdentifier: string;
|
||||
dataFolderName: string;
|
||||
downloadUrl: string;
|
||||
updateUrl?: string;
|
||||
quality?: string;
|
||||
commit: string;
|
||||
date: string;
|
||||
extensionsGallery: {
|
||||
serviceUrl: string;
|
||||
cacheUrl: string;
|
||||
itemUrl: string;
|
||||
};
|
||||
extensionTips: { [id: string]: string; };
|
||||
crashReporter: Electron.CrashReporterStartOptions;
|
||||
welcomePage: string;
|
||||
enableTelemetry: boolean;
|
||||
aiConfig: {
|
||||
key: string;
|
||||
asimovKey: string;
|
||||
};
|
||||
sendASmile: {
|
||||
reportIssueUrl: string,
|
||||
requestFeatureUrl: string
|
||||
};
|
||||
documentationUrl: string;
|
||||
releaseNotesUrl: string;
|
||||
twitterUrl: string;
|
||||
requestFeatureUrl: string;
|
||||
reportIssueUrl: string;
|
||||
licenseUrl: string;
|
||||
privacyStatementUrl: string;
|
||||
}
|
||||
|
||||
const rootPath = path.dirname(uri.parse(require.toUrl('')).fsPath);
|
||||
const productJsonPath = path.join(rootPath, 'product.json');
|
||||
const product = require.__$__nodeRequire(productJsonPath) as IProductConfiguration;
|
||||
|
||||
if (process.env['VSCODE_DEV']) {
|
||||
product.nameShort += ' Dev';
|
||||
product.nameLong += ' Dev';
|
||||
product.dataFolderName += '-dev';
|
||||
}
|
||||
|
||||
export default product;
|
||||
@@ -7,10 +7,16 @@ import * as fs from 'fs';
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
import { serve, Server, connect } from 'vs/base/parts/ipc/node/ipc.net';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||
import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService';
|
||||
import { IConfiguration } from 'vs/platform/workspace/common/workspace';
|
||||
import { WorkspaceContextService } from 'vs/workbench/services/workspace/common/contextService';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { EnvironmentService } from 'vs/platform/environment/node/environmentService';
|
||||
import { IEventService } from 'vs/platform/event/common/event';
|
||||
import { EventService } from 'vs/platform/event/common/eventService';
|
||||
import { ExtensionsChannel } from 'vs/workbench/parts/extensions/common/extensionsIpc';
|
||||
import { IExtensionsService } from 'vs/workbench/parts/extensions/common/extensions';
|
||||
import { ExtensionsService } from 'vs/workbench/parts/extensions/node/extensionsService';
|
||||
|
||||
interface IInitData {
|
||||
@@ -40,15 +46,22 @@ function setupPlanB(parentPid: number): void {
|
||||
}
|
||||
|
||||
function main(server: Server, initData: IInitData): void {
|
||||
const eventService = new EventService();
|
||||
const contextService = new WorkspaceContextService(eventService, null, initData.configuration, initData.contextServiceOptions);
|
||||
const extensionService = new ExtensionsService(contextService);
|
||||
const channel = new ExtensionsChannel(extensionService);
|
||||
const services = new ServiceCollection();
|
||||
|
||||
server.registerChannel('extensions', channel);
|
||||
services.set(IEventService, new SyncDescriptor(EventService));
|
||||
services.set(IEnvironmentService, new SyncDescriptor(EnvironmentService));
|
||||
services.set(IExtensionsService, new SyncDescriptor(ExtensionsService));
|
||||
|
||||
// eventually clean up old extensions
|
||||
setTimeout(() => extensionService.removeDeprecatedExtensions(), 5000);
|
||||
const instantiationService = new InstantiationService(services);
|
||||
|
||||
instantiationService.invokeFunction(accessor => {
|
||||
const extensionsService = accessor.get(IExtensionsService);
|
||||
const channel = new ExtensionsChannel(extensionsService);
|
||||
server.registerChannel('extensions', channel);
|
||||
|
||||
// eventually clean up old extensions
|
||||
setTimeout(() => (extensionsService as ExtensionsService).removeDeprecatedExtensions(), 5000);
|
||||
});
|
||||
}
|
||||
|
||||
function setupIPC(hook: string): TPromise<Server> {
|
||||
|
||||
Reference in New Issue
Block a user