mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-28 09:35:38 -05:00
Merge VS Code 1.21 source code (#1067)
* Initial VS Code 1.21 file copy with patches * A few more merges * Post npm install * Fix batch of build breaks * Fix more build breaks * Fix more build errors * Fix more build breaks * Runtime fixes 1 * Get connection dialog working with some todos * Fix a few packaging issues * Copy several node_modules to package build to fix loader issues * Fix breaks from master * A few more fixes * Make tests pass * First pass of license header updates * Second pass of license header updates * Fix restore dialog issues * Remove add additional themes menu items * fix select box issues where the list doesn't show up * formatting * Fix editor dispose issue * Copy over node modules to correct location on all platforms
This commit is contained in:
@@ -9,12 +9,10 @@ import nls = require('vs/nls');
|
||||
import pfs = require('vs/base/node/pfs');
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { join } from 'path';
|
||||
import { RPCProtocol } from 'vs/workbench/services/extensions/node/rpcProtocol';
|
||||
import { ExtHostExtensionService } from 'vs/workbench/api/node/extHostExtensionService';
|
||||
import { ExtHostThreadService } from 'vs/workbench/services/thread/node/extHostThreadService';
|
||||
import { ExtHostConfiguration } from 'vs/workbench/api/node/extHostConfiguration';
|
||||
import { ExtHostWorkspace } from 'vs/workbench/api/node/extHostWorkspace';
|
||||
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
import { IExtensionDescription } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { QueryType, ISearchQuery } from 'vs/platform/search/common/search';
|
||||
import { DiskSearch } from 'vs/workbench/services/search/node/searchService';
|
||||
import { IInitData, IEnvironment, IWorkspaceData, MainContext } from 'vs/workbench/api/node/extHost.protocol';
|
||||
@@ -23,9 +21,11 @@ import * as watchdog from 'native-watchdog';
|
||||
import * as glob from 'vs/base/common/glob';
|
||||
import { ExtensionActivatedByEvent } from 'vs/workbench/api/node/extHostExtensionActivator';
|
||||
import { EnvironmentService } from 'vs/platform/environment/node/environmentService';
|
||||
import { createLogService } from 'vs/platform/log/node/spdlogService';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { IMessagePassingProtocol } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { RPCProtocol } from 'vs/workbench/services/extensions/node/rpcProtocol';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { ExtHostLogService } from 'vs/workbench/api/node/extHostLogService';
|
||||
|
||||
// const nativeExit = process.exit.bind(process);
|
||||
function patchProcess(allowExit: boolean) {
|
||||
@@ -77,10 +77,10 @@ export class ExtensionHostMain {
|
||||
private _environment: IEnvironment;
|
||||
private _extensionService: ExtHostExtensionService;
|
||||
private _extHostConfiguration: ExtHostConfiguration;
|
||||
private _logService: ILogService;
|
||||
private _extHostLogService: ExtHostLogService;
|
||||
private disposables: IDisposable[] = [];
|
||||
|
||||
constructor(rpcProtocol: RPCProtocol, initData: IInitData) {
|
||||
constructor(protocol: IMessagePassingProtocol, initData: IInitData) {
|
||||
this._environment = initData.environment;
|
||||
this._workspace = initData.workspace;
|
||||
|
||||
@@ -88,17 +88,17 @@ export class ExtensionHostMain {
|
||||
patchProcess(allowExit);
|
||||
|
||||
// services
|
||||
const threadService = new ExtHostThreadService(rpcProtocol);
|
||||
const extHostWorkspace = new ExtHostWorkspace(threadService, initData.workspace);
|
||||
const rpcProtocol = new RPCProtocol(protocol);
|
||||
const environmentService = new EnvironmentService(initData.args, initData.execPath);
|
||||
this._logService = createLogService(`exthost${initData.windowId}`, environmentService);
|
||||
this.disposables.push(this._logService);
|
||||
this._extHostLogService = new ExtHostLogService(initData.windowId, initData.logLevel, environmentService);
|
||||
this.disposables.push(this._extHostLogService);
|
||||
const extHostWorkspace = new ExtHostWorkspace(rpcProtocol, initData.workspace, this._extHostLogService);
|
||||
|
||||
this._logService.info('extension host started');
|
||||
this._logService.trace('initData', initData);
|
||||
this._extHostLogService.info('extension host started');
|
||||
this._extHostLogService.trace('initData', initData);
|
||||
|
||||
this._extHostConfiguration = new ExtHostConfiguration(threadService.get(MainContext.MainThreadConfiguration), extHostWorkspace, initData.configuration);
|
||||
this._extensionService = new ExtHostExtensionService(initData, threadService, extHostWorkspace, this._extHostConfiguration, this._logService);
|
||||
this._extHostConfiguration = new ExtHostConfiguration(rpcProtocol.getProxy(MainContext.MainThreadConfiguration), extHostWorkspace, initData.configuration);
|
||||
this._extensionService = new ExtHostExtensionService(initData, rpcProtocol, extHostWorkspace, this._extHostConfiguration, this._extHostLogService, environmentService);
|
||||
|
||||
// error forwarding and stack trace scanning
|
||||
const extensionErrors = new WeakMap<Error, IExtensionDescription>();
|
||||
@@ -119,8 +119,8 @@ export class ExtensionHostMain {
|
||||
return `${error.name || 'Error'}: ${error.message || ''}${stackTraceMessage}`;
|
||||
};
|
||||
});
|
||||
const mainThreadExtensions = threadService.get(MainContext.MainThreadExtensionService);
|
||||
const mainThreadErrors = threadService.get(MainContext.MainThreadErrors);
|
||||
const mainThreadExtensions = rpcProtocol.getProxy(MainContext.MainThreadExtensionService);
|
||||
const mainThreadErrors = rpcProtocol.getProxy(MainContext.MainThreadErrors);
|
||||
errors.setUnexpectedErrorHandler(err => {
|
||||
const data = errors.transformErrorForSerialization(err);
|
||||
const extension = extensionErrors.get(err);
|
||||
@@ -142,7 +142,7 @@ export class ExtensionHostMain {
|
||||
.then(() => this.handleEagerExtensions())
|
||||
.then(() => this.handleExtensionTests())
|
||||
.then(() => {
|
||||
this._logService.info(`eager extensions activated`);
|
||||
this._extHostLogService.info(`eager extensions activated`);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ export class ExtensionHostMain {
|
||||
// find exact path
|
||||
|
||||
for (const { uri } of this._workspace.folders) {
|
||||
if (await pfs.exists(join(uri.fsPath, fileName))) {
|
||||
if (await pfs.exists(join(URI.revive(uri).fsPath, fileName))) {
|
||||
// the file was found
|
||||
return (
|
||||
this._extensionService.activateById(extensionId, new ExtensionActivatedByEvent(true, `workspaceContains:${fileName}`))
|
||||
@@ -247,6 +247,8 @@ export class ExtensionHostMain {
|
||||
}
|
||||
|
||||
private async activateIfGlobPatterns(extensionId: string, globPatterns: string[]): TPromise<void> {
|
||||
this._extHostLogService.trace(`extensionHostMain#activateIfGlobPatterns: fileSearch, extension: ${extensionId}, entryPoint: workspaceContains`);
|
||||
|
||||
if (globPatterns.length === 0) {
|
||||
return TPromise.as(void 0);
|
||||
}
|
||||
@@ -261,7 +263,7 @@ export class ExtensionHostMain {
|
||||
includes[globPattern] = true;
|
||||
});
|
||||
|
||||
const folderQueries = this._workspace.folders.map(folder => ({ folder: folder.uri }));
|
||||
const folderQueries = this._workspace.folders.map(folder => ({ folder: URI.revive(folder.uri) }));
|
||||
const config = this._extHostConfiguration.getConfiguration('search');
|
||||
const useRipgrep = config.get('useRipgrep', true);
|
||||
const followSymlinks = config.get('followSymlinks', true);
|
||||
|
||||
@@ -6,10 +6,7 @@
|
||||
'use strict';
|
||||
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { ExtensionHostMain, exit } from 'vs/workbench/node/extensionHostMain';
|
||||
import { RPCProtocol } from 'vs/workbench/services/extensions/node/rpcProtocol';
|
||||
import { parse } from 'vs/base/common/marshalling';
|
||||
import { IInitData } from 'vs/workbench/api/node/extHost.protocol';
|
||||
import { IMessagePassingProtocol } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { Protocol } from 'vs/base/parts/ipc/node/ipc.net';
|
||||
@@ -17,7 +14,7 @@ import { createConnection } from 'net';
|
||||
import Event, { filterEvent } from 'vs/base/common/event';
|
||||
|
||||
interface IRendererConnection {
|
||||
rpcProtocol: RPCProtocol;
|
||||
protocol: IMessagePassingProtocol;
|
||||
initData: IInitData;
|
||||
}
|
||||
|
||||
@@ -27,11 +24,11 @@ let onTerminate = function () {
|
||||
exit();
|
||||
};
|
||||
|
||||
function createExtHostProtocol(): TPromise<IMessagePassingProtocol> {
|
||||
function createExtHostProtocol(): Promise<IMessagePassingProtocol> {
|
||||
|
||||
const pipeName = process.env.VSCODE_IPC_HOOK_EXTHOST;
|
||||
|
||||
return new TPromise<IMessagePassingProtocol>((resolve, reject) => {
|
||||
return new Promise<IMessagePassingProtocol>((resolve, reject) => {
|
||||
|
||||
const socket = createConnection(pipeName, () => {
|
||||
socket.removeListener('error', reject);
|
||||
@@ -63,21 +60,20 @@ function createExtHostProtocol(): TPromise<IMessagePassingProtocol> {
|
||||
});
|
||||
}
|
||||
|
||||
function connectToRenderer(protocol: IMessagePassingProtocol): TPromise<IRendererConnection> {
|
||||
return new TPromise<IRendererConnection>((c, e) => {
|
||||
function connectToRenderer(protocol: IMessagePassingProtocol): Promise<IRendererConnection> {
|
||||
return new Promise<IRendererConnection>((c, e) => {
|
||||
|
||||
// Listen init data message
|
||||
const first = protocol.onMessage(raw => {
|
||||
first.dispose();
|
||||
|
||||
const initData = parse(raw);
|
||||
const rpcProtocol = new RPCProtocol(protocol);
|
||||
const initData = <IInitData>JSON.parse(raw);
|
||||
|
||||
// Print a console message when rejection isn't handled within N seconds. For details:
|
||||
// see https://nodejs.org/api/process.html#process_event_unhandledrejection
|
||||
// and https://nodejs.org/api/process.html#process_event_rejectionhandled
|
||||
const unhandledPromises: TPromise<any>[] = [];
|
||||
process.on('unhandledRejection', (reason: any, promise: TPromise<any>) => {
|
||||
const unhandledPromises: Promise<any>[] = [];
|
||||
process.on('unhandledRejection', (reason: any, promise: Promise<any>) => {
|
||||
unhandledPromises.push(promise);
|
||||
setTimeout(() => {
|
||||
const idx = unhandledPromises.indexOf(promise);
|
||||
@@ -88,7 +84,7 @@ function connectToRenderer(protocol: IMessagePassingProtocol): TPromise<IRendere
|
||||
}
|
||||
}, 1000);
|
||||
});
|
||||
process.on('rejectionHandled', (promise: TPromise<any>) => {
|
||||
process.on('rejectionHandled', (promise: Promise<any>) => {
|
||||
const idx = unhandledPromises.indexOf(promise);
|
||||
if (idx >= 0) {
|
||||
unhandledPromises.splice(idx, 1);
|
||||
@@ -112,7 +108,7 @@ function connectToRenderer(protocol: IMessagePassingProtocol): TPromise<IRendere
|
||||
// Tell the outside that we are initialized
|
||||
protocol.send('initialized');
|
||||
|
||||
c({ rpcProtocol, initData });
|
||||
c({ protocol, initData });
|
||||
});
|
||||
|
||||
// Tell the outside that we are ready to receive messages
|
||||
@@ -127,10 +123,10 @@ createExtHostProtocol().then(protocol => {
|
||||
return connectToRenderer(protocol);
|
||||
}).then(renderer => {
|
||||
// setup things
|
||||
const extensionHostMain = new ExtensionHostMain(renderer.rpcProtocol, renderer.initData);
|
||||
const extensionHostMain = new ExtensionHostMain(renderer.protocol, renderer.initData);
|
||||
onTerminate = () => extensionHostMain.terminate();
|
||||
return extensionHostMain.start();
|
||||
}).done(null, err => console.error(err));
|
||||
}).catch(err => console.error(err));
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user