Merge from master

This commit is contained in:
Raj Musuku
2019-02-21 17:56:04 -08:00
parent 5a146e34fa
commit 666ae11639
11482 changed files with 119352 additions and 255574 deletions

View File

@@ -3,15 +3,14 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { TPromise } from 'vs/base/common/winjs.base';
import { ProxyIdentifier } from 'vs/workbench/services/extensions/node/proxyIdentifier';
import { CharCode } from 'vs/base/common/charCode';
import { IExtHostContext } from 'vs/workbench/api/node/extHost.protocol';
import { isThenable } from 'vs/base/common/async';
export function SingleProxyRPCProtocol(thing: any): IExtHostContext {
return {
remoteAuthority: null,
getProxy<T>(): T {
return thing;
},
@@ -22,10 +21,10 @@ export function SingleProxyRPCProtocol(thing: any): IExtHostContext {
};
}
declare var Proxy: any; // TODO@TypeScript
export class TestRPCProtocol implements IExtHostContext {
public remoteAuthority = null;
private _callCountValue: number = 0;
private _idle: Promise<any>;
private _completeIdle: Function;
@@ -69,10 +68,10 @@ export class TestRPCProtocol implements IExtHostContext {
}
public getProxy<T>(identifier: ProxyIdentifier<T>): T {
if (!this._proxies[identifier.id]) {
this._proxies[identifier.id] = this._createProxy(identifier.id);
if (!this._proxies[identifier.sid]) {
this._proxies[identifier.sid] = this._createProxy(identifier.sid);
}
return this._proxies[identifier.id];
return this._proxies[identifier.sid];
}
private _createProxy<T>(proxyId: string): T {
@@ -90,14 +89,14 @@ export class TestRPCProtocol implements IExtHostContext {
}
public set<T, R extends T>(identifier: ProxyIdentifier<T>, value: R): R {
this._locals[identifier.id] = value;
this._locals[identifier.sid] = value;
return value;
}
protected _remoteCall(proxyId: string, path: string, args: any[]): TPromise<any> {
protected _remoteCall(proxyId: string, path: string, args: any[]): Promise<any> {
this._callCount++;
return new TPromise<any>((c) => {
return new Promise<any>((c) => {
setTimeout(c, 0);
}).then(() => {
const instance = this._locals[proxyId];
@@ -106,9 +105,9 @@ export class TestRPCProtocol implements IExtHostContext {
let p: Thenable<any>;
try {
let result = (<Function>instance[path]).apply(instance, wireArgs);
p = TPromise.is(result) ? result : TPromise.as(result);
p = isThenable(result) ? result : Promise.resolve(result);
} catch (err) {
p = TPromise.wrapError(err);
p = Promise.reject(err);
}
return p.then(result => {
@@ -118,7 +117,7 @@ export class TestRPCProtocol implements IExtHostContext {
return wireResult;
}, err => {
this._callCount--;
return TPromise.wrapError(err);
return Promise.reject(err);
});
});
}