提交 0b5d9520 编写于 作者: A Alex Dima

Small tweaks

上级 2559767a
......@@ -3,7 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { localize } from 'vs/nls';
import { CancellationTokenSource } from 'vs/base/common/cancellation';
import * as errors from 'vs/base/common/errors';
import { Emitter, Event } from 'vs/base/common/event';
......@@ -44,7 +43,7 @@ import { LogOutputChannelFactory } from 'vs/workbench/api/node/extHostOutputServ
import { ExtHostProgress } from 'vs/workbench/api/common/extHostProgress';
import { ExtHostQuickOpen } from 'vs/workbench/api/common/extHostQuickOpen';
import { ExtHostSCM } from 'vs/workbench/api/common/extHostSCM';
import { ExtHostSearch } from 'vs/workbench/api/node/extHostSearch';
import { ExtHostSearch, registerEHSearchProviders } from 'vs/workbench/api/node/extHostSearch';
import { ExtHostStatusBar } from 'vs/workbench/api/common/extHostStatusBar';
import { ExtHostStorage } from 'vs/workbench/api/common/extHostStorage';
import { ExtHostTask } from 'vs/workbench/api/node/extHostTask';
......@@ -67,6 +66,7 @@ import { CLIServer } from 'vs/workbench/api/node/extHostCLIServer';
import { withNullAsUndefined } from 'vs/base/common/types';
import { values } from 'vs/base/common/collections';
import { endsWith } from 'vs/base/common/strings';
import { Schemas } from 'vs/base/common/network';
export interface IExtensionApiFactory {
(extension: IExtensionDescription, registry: ExtensionDescriptionRegistry, configProvider: ExtHostConfigProvider): typeof vscode;
......@@ -90,11 +90,11 @@ export function createApiFactory(
extHostConfiguration: ExtHostConfiguration,
extensionService: ExtHostExtensionService,
extHostLogService: ExtHostLogService,
extHostStorage: ExtHostStorage
extHostStorage: ExtHostStorage,
schemeTransformer: ISchemeTransformer | null,
outputChannelName: string
): IExtensionApiFactory {
const schemeTransformer: ISchemeTransformer | null = null;
// Addressable instances
rpcProtocol.set(ExtHostContext.ExtHostLogService, extHostLogService);
const extHostHeapService = rpcProtocol.set(ExtHostContext.ExtHostHeapService, new ExtHostHeapService());
......@@ -127,6 +127,14 @@ export function createApiFactory(
const extHostOutputService = rpcProtocol.set(ExtHostContext.ExtHostOutputService, new ExtHostOutputService(LogOutputChannelFactory, initData.logsLocation, rpcProtocol));
rpcProtocol.set(ExtHostContext.ExtHostStorage, extHostStorage);
if (initData.remoteAuthority) {
extHostTask.registerTaskSystem(Schemas.vscodeRemote, {
scheme: Schemas.vscodeRemote,
authority: initData.remoteAuthority,
platform: process.platform
});
registerEHSearchProviders(extHostSearch, extHostLogService);
const cliServer = new CLIServer(extHostCommands);
process.env['VSCODE_IPC_HOOK_CLI'] = cliServer.ipcHandlePath;
}
......@@ -143,8 +151,7 @@ export function createApiFactory(
const extHostLanguages = new ExtHostLanguages(rpcProtocol, extHostDocuments);
// Register an output channel for exthost log
const name = localize('extensionsLog', "Extension Host");
extHostOutputService.createOutputChannelFromLogFile(name, extHostLogService.logFile);
extHostOutputService.createOutputChannelFromLogFile(outputChannelName, extHostLogService.logFile);
// Register API-ish commands
ExtHostApiCommands.register(extHostCommands);
......
......@@ -32,6 +32,7 @@ import { Schemas } from 'vs/base/common/network';
import { withNullAsUndefined } from 'vs/base/common/types';
import { realpath } from 'vs/base/node/extpath';
import { VSBuffer } from 'vs/base/common/buffer';
import { ISchemeTransformer } from 'vs/workbench/api/common/extHostLanguageFeatures';
class ExtensionMemento implements IExtensionMemento {
......@@ -189,7 +190,9 @@ export class ExtHostExtensionService implements ExtHostExtensionServiceShape {
extHostWorkspace: ExtHostWorkspace,
extHostConfiguration: ExtHostConfiguration,
environment: IEnvironment,
extHostLogService: ExtHostLogService
extHostLogService: ExtHostLogService,
schemeTransformer: ISchemeTransformer | null,
outputChannelName: string
) {
this._nativeExit = nativeExit;
this._initData = initData;
......@@ -230,7 +233,17 @@ export class ExtHostExtensionService implements ExtHostExtensionServiceShape {
this._extensionPathIndex = null;
// initialize API first (i.e. do not release barrier until the API is initialized)
this._extensionApiFactory = createApiFactory(this._initData, this._extHostContext, this._extHostWorkspace, this._extHostConfiguration, this, this._extHostLogService, this._storage);
this._extensionApiFactory = createApiFactory(
this._initData,
this._extHostContext,
this._extHostWorkspace,
this._extHostConfiguration,
this,
this._extHostLogService,
this._storage,
schemeTransformer,
outputChannelName
);
this._resolvers = Object.create(null);
......
......@@ -19,6 +19,7 @@ import { RPCProtocol } from 'vs/workbench/services/extensions/common/rpcProtocol
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
import { withNullAsUndefined } from 'vs/base/common/types';
import { ILogService } from 'vs/platform/log/common/log';
import { ISchemeTransformer } from 'vs/workbench/api/common/extHostLanguageFeatures';
// we don't (yet) throw when extensions parse
// uris that have no scheme
......@@ -46,10 +47,18 @@ export class ExtensionHostMain {
private _searchRequestIdProvider: Counter;
constructor(protocol: IMessagePassingProtocol, initData: IInitData, exitFn: IExitFn, consolePatchFn: IConsolePatchFn, logServiceFn: ILogServiceFn) {
constructor(
protocol: IMessagePassingProtocol,
initData: IInitData,
exitFn: IExitFn,
consolePatchFn: IConsolePatchFn,
logServiceFn: ILogServiceFn,
uriTransformer: IURITransformer | null,
schemeTransformer: ISchemeTransformer | null,
outputChannelName: string
) {
this._isTerminating = false;
this._exitFn = exitFn;
const uriTransformer: IURITransformer | null = null;
const rpcProtocol = new RPCProtocol(protocol, null, uriTransformer);
// ensure URIs are transformed and revived
......@@ -69,7 +78,17 @@ export class ExtensionHostMain {
this._extHostLogService.trace('initData', initData);
const extHostConfiguraiton = new ExtHostConfiguration(rpcProtocol.getProxy(MainContext.MainThreadConfiguration), extHostWorkspace);
this._extensionService = new ExtHostExtensionService(exitFn, initData, rpcProtocol, extHostWorkspace, extHostConfiguraiton, initData.environment, this._extHostLogService);
this._extensionService = new ExtHostExtensionService(
exitFn,
initData,
rpcProtocol,
extHostWorkspace,
extHostConfiguraiton,
initData.environment,
this._extHostLogService,
schemeTransformer,
outputChannelName
);
// error forwarding and stack trace scanning
Error.stackTraceLimit = 100; // increase number of stack frames (from 10, https://github.com/v8/v8/wiki/Stack-Trace-API)
......
......@@ -3,6 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as nls from 'vs/nls';
import * as nativeWatchdog from 'native-watchdog';
import * as net from 'net';
import { onUnexpectedError } from 'vs/base/common/errors';
......@@ -17,6 +18,8 @@ import { ExtensionHostMain, IExitFn, ILogServiceFn } from 'vs/workbench/services
import { VSBuffer } from 'vs/base/common/buffer';
import { createSpdLogService } from 'vs/platform/log/node/spdlogService';
import { ExtensionHostLogFileName } from 'vs/workbench/services/extensions/common/extensions';
import { ISchemeTransformer } from 'vs/workbench/api/common/extHostLanguageFeatures';
import { IURITransformer } from 'vs/base/common/uriIpc';
// With Electron 2.x and node.js 8.x the "natives" module
// can cause a native crash (see https://github.com/nodejs/node/issues/19891 and
......@@ -263,7 +266,20 @@ createExtHostProtocol().then(protocol => {
// setup things
patchProcess(!!initData.environment.extensionTestsLocationURI); // to support other test frameworks like Jasmin that use process.exit (https://github.com/Microsoft/vscode/issues/37708)
const extensionHostMain = new ExtensionHostMain(renderer.protocol, initData, nativeExit, patchPatchedConsole, createLogService);
const uriTransformer: IURITransformer | null = null;
const schemeTransformer: ISchemeTransformer | null = null;
const outputChannelName = nls.localize('extension host Log', "Extension Host");
const extensionHostMain = new ExtensionHostMain(
renderer.protocol,
initData,
nativeExit,
patchPatchedConsole,
createLogService,
uriTransformer,
schemeTransformer,
outputChannelName
);
// rewrite onTerminate-function to be a proper shutdown
onTerminate = () => extensionHostMain.terminate();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册