提交 367dd104 编写于 作者: A Alex Dima

Rename RPCProtocol.get to RPCProtocol.getProxy (#36972)

上级 2b4ce134
......@@ -21,7 +21,7 @@ export class MainThreadCommands implements MainThreadCommandsShape {
extHostContext: IExtHostContext,
@ICommandService private readonly _commandService: ICommandService,
) {
this._proxy = extHostContext.get(ExtHostContext.ExtHostCommands);
this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostCommands);
this._generateCommandsDocumentationRegistration = CommandsRegistry.registerCommand('_generateCommandsDocumentation', () => this._generateCommandsDocumentation());
}
......
......@@ -25,7 +25,7 @@ export class MainThreadConfiguration implements MainThreadConfigurationShape {
@IWorkspaceContextService private readonly _workspaceContextService: IWorkspaceContextService,
@IWorkspaceConfigurationService private configurationService: IWorkspaceConfigurationService
) {
const proxy = extHostContext.get(ExtHostContext.ExtHostConfiguration);
const proxy = extHostContext.getProxy(ExtHostContext.ExtHostConfiguration);
this._configurationListener = configurationService.onDidChangeConfiguration(e => {
proxy.$acceptConfigurationChanged(configurationService.getConfigurationData(), this.toConfigurationChangeEventData(e));
......
......@@ -25,7 +25,7 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape {
@IDebugService private debugService: IDebugService,
@IWorkspaceContextService private contextService: IWorkspaceContextService,
) {
this._proxy = extHostContext.get(ExtHostContext.ExtHostDebugService);
this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostDebugService);
this._toDispose = [];
this._toDispose.push(debugService.onDidNewProcess(proc => this._proxy.$acceptDebugSessionStarted(<DebugSessionUUID>proc.getId(), proc.configuration.type, proc.getName(false))));
this._toDispose.push(debugService.onDidEndProcess(proc => this._proxy.$acceptDebugSessionTerminated(<DebugSessionUUID>proc.getId(), proc.configuration.type, proc.getName(false))));
......
......@@ -21,7 +21,7 @@ export class MainThreadDecorations implements MainThreadDecorationsShape {
context: IExtHostContext,
@IDecorationsService private readonly _decorationsService: IDecorationsService
) {
this._proxy = context.get(ExtHostContext.ExtHostDecorations);
this._proxy = context.getProxy(ExtHostContext.ExtHostDecorations);
}
dispose() {
......
......@@ -31,7 +31,7 @@ export class MainThreadDocumentContentProviders implements MainThreadDocumentCon
@ICodeEditorService codeEditorService: ICodeEditorService,
@IEditorGroupService editorGroupService: IEditorGroupService
) {
this._proxy = extHostContext.get(ExtHostContext.ExtHostDocumentContentProviders);
this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostDocumentContentProviders);
}
public dispose(): void {
......
......@@ -93,7 +93,7 @@ export class MainThreadDocuments implements MainThreadDocumentsShape {
this._fileService = fileService;
this._untitledEditorService = untitledEditorService;
this._proxy = extHostContext.get(ExtHostContext.ExtHostDocuments);
this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostDocuments);
this._modelIsSynced = {};
this._toDispose = [];
......
......@@ -308,7 +308,7 @@ export class MainThreadDocumentsAndEditors {
@IUntitledEditorService untitledEditorService: IUntitledEditorService,
@IEditorGroupService editorGroupService: IEditorGroupService
) {
this._proxy = extHostContext.get(ExtHostContext.ExtHostDocumentsAndEditors);
this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostDocumentsAndEditors);
const mainThreadDocuments = new MainThreadDocuments(this, extHostContext, this._modelService, modeService, this._textFileService, fileService, textModelResolverService, untitledEditorService);
extHostContext.set(MainContext.MainThreadDocuments, mainThreadDocuments);
......
......@@ -46,7 +46,7 @@ export class MainThreadEditors implements MainThreadEditorsShape {
@IFileService private readonly _fileService: IFileService,
@IModelService private readonly _modelService: IModelService,
) {
this._proxy = extHostContext.get(ExtHostContext.ExtHostEditors);
this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostEditors);
this._documentsAndEditors = documentsAndEditors;
this._workbenchEditorService = workbenchEditorService;
this._toDispose = [];
......
......@@ -29,7 +29,7 @@ export class MainThreadFileSystem implements MainThreadFileSystemShape {
@ISearchService private readonly _searchService: ISearchService,
@IWorkspaceEditingService private readonly _workspaceEditingService: IWorkspaceEditingService
) {
this._proxy = extHostContext.get(ExtHostContext.ExtHostFileSystem);
this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostFileSystem);
}
dispose(): void {
......
......@@ -19,7 +19,7 @@ export class MainThreadFileSystemEventService {
@IFileService fileService: IFileService
) {
const proxy: ExtHostFileSystemEventServiceShape = extHostContext.get(ExtHostContext.ExtHostFileSystemEventService);
const proxy: ExtHostFileSystemEventServiceShape = extHostContext.getProxy(ExtHostContext.ExtHostFileSystemEventService);
const events: FileSystemEvents = {
created: [],
changed: [],
......
......@@ -126,7 +126,7 @@ export class MainThreadHeapService {
extHostContext: IExtHostContext,
@IHeapService heapService: IHeapService,
) {
const proxy = extHostContext.get(ExtHostContext.ExtHostHeapService);
const proxy = extHostContext.getProxy(ExtHostContext.ExtHostHeapService);
this._toDispose = heapService.onGarbageCollection((ids) => {
// send to ext host
proxy.$onGarbageCollection(ids);
......
......@@ -36,7 +36,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
@IHeapService heapService: IHeapService,
@IModeService modeService: IModeService,
) {
this._proxy = extHostContext.get(ExtHostContext.ExtHostLanguageFeatures);
this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostLanguageFeatures);
this._heapService = heapService;
this._modeService = modeService;
}
......
......@@ -25,7 +25,7 @@ export class MainThreadQuickOpen implements MainThreadQuickOpenShape {
extHostContext: IExtHostContext,
@IQuickOpenService quickOpenService: IQuickOpenService
) {
this._proxy = extHostContext.get(ExtHostContext.ExtHostQuickOpen);
this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostQuickOpen);
this._quickOpenService = quickOpenService;
}
......
......@@ -268,7 +268,7 @@ export class MainThreadSCM implements MainThreadSCMShape {
extHostContext: IExtHostContext,
@ISCMService private scmService: ISCMService
) {
this._proxy = extHostContext.get(ExtHostContext.ExtHostSCM);
this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostSCM);
}
dispose(): void {
......
......@@ -247,7 +247,7 @@ class ExtHostSaveParticipant implements ISaveParticipantParticipant {
private _proxy: ExtHostDocumentSaveParticipantShape;
constructor(extHostContext: IExtHostContext) {
this._proxy = extHostContext.get(ExtHostContext.ExtHostDocumentSaveParticipant);
this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostDocumentSaveParticipant);
}
participate(editorModel: ITextFileEditorModel, env: { reason: SaveReason }): Promise<void> {
......
......@@ -25,7 +25,7 @@ export class MainThreadTask implements MainThreadTaskShape {
@ITaskService private _taskService: ITaskService,
@IWorkspaceContextService private _workspaceContextServer: IWorkspaceContextService
) {
this._proxy = extHostContext.get(ExtHostContext.ExtHostTask);
this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostTask);
this._activeHandles = Object.create(null);
}
......
......@@ -20,7 +20,7 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape
extHostContext: IExtHostContext,
@ITerminalService private terminalService: ITerminalService
) {
this._proxy = extHostContext.get(ExtHostContext.ExtHostTerminalService);
this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostTerminalService);
this._toDispose = [];
this._toDispose.push(terminalService.onInstanceDisposed((terminalInstance) => this._onTerminalDisposed(terminalInstance)));
this._toDispose.push(terminalService.onInstanceProcessIdReady((terminalInstance) => this._onTerminalProcessIdReady(terminalInstance)));
......
......@@ -24,7 +24,7 @@ export class MainThreadTreeViews extends Disposable implements MainThreadTreeVie
@IMessageService private messageService: IMessageService
) {
super();
this._proxy = extHostContext.get(ExtHostContext.ExtHostTreeViews);
this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostTreeViews);
}
$registerView(treeViewId: string): void {
......@@ -140,4 +140,4 @@ class TreeViewDataProvider implements ITreeViewDataProvider {
assign(current, treeItem);
}
}
}
\ No newline at end of file
}
......@@ -20,7 +20,7 @@ export class MainThreadWindow implements MainThreadWindowShape {
extHostContext: IExtHostContext,
@IWindowService private windowService: IWindowService
) {
this.proxy = extHostContext.get(ExtHostContext.ExtHostWindow);
this.proxy = extHostContext.getProxy(ExtHostContext.ExtHostWindow);
windowService.onDidChangeFocus(this.proxy.$onDidChangeWindowFocus, this.proxy, this.disposables);
}
......
......@@ -29,7 +29,7 @@ export class MainThreadWorkspace implements MainThreadWorkspaceShape {
@ITextFileService private readonly _textFileService: ITextFileService,
@IConfigurationService private _configurationService: IConfigurationService
) {
this._proxy = extHostContext.get(ExtHostContext.ExtHostWorkspace);
this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostWorkspace);
this._contextService.onDidChangeWorkspaceFolders(this._onDidChangeWorkspace, this, this._toDispose);
this._contextService.onDidChangeWorkbenchState(this._onDidChangeWorkspace, this, this._toDispose);
}
......@@ -123,4 +123,3 @@ export class MainThreadWorkspace implements MainThreadWorkspaceShape {
});
}
}
......@@ -91,10 +91,10 @@ export function createApiFactory(
const extHostDocumentsAndEditors = threadService.set(ExtHostContext.ExtHostDocumentsAndEditors, new ExtHostDocumentsAndEditors(threadService));
const extHostDocuments = threadService.set(ExtHostContext.ExtHostDocuments, new ExtHostDocuments(threadService, extHostDocumentsAndEditors));
const extHostDocumentContentProviders = threadService.set(ExtHostContext.ExtHostDocumentContentProviders, new ExtHostDocumentContentProvider(threadService, extHostDocumentsAndEditors));
const extHostDocumentSaveParticipant = threadService.set(ExtHostContext.ExtHostDocumentSaveParticipant, new ExtHostDocumentSaveParticipant(logService, extHostDocuments, threadService.get(MainContext.MainThreadEditors)));
const extHostDocumentSaveParticipant = threadService.set(ExtHostContext.ExtHostDocumentSaveParticipant, new ExtHostDocumentSaveParticipant(logService, extHostDocuments, threadService.getProxy(MainContext.MainThreadEditors)));
const extHostEditors = threadService.set(ExtHostContext.ExtHostEditors, new ExtHostEditors(threadService, extHostDocumentsAndEditors));
const extHostCommands = threadService.set(ExtHostContext.ExtHostCommands, new ExtHostCommands(threadService, extHostHeapService, logService));
const extHostTreeViews = threadService.set(ExtHostContext.ExtHostTreeViews, new ExtHostTreeViews(threadService.get(MainContext.MainThreadTreeViews), extHostCommands));
const extHostTreeViews = threadService.set(ExtHostContext.ExtHostTreeViews, new ExtHostTreeViews(threadService.getProxy(MainContext.MainThreadTreeViews), extHostCommands));
threadService.set(ExtHostContext.ExtHostWorkspace, extHostWorkspace);
const extHostDebugService = threadService.set(ExtHostContext.ExtHostDebugService, new ExtHostDebugService(threadService, extHostWorkspace));
threadService.set(ExtHostContext.ExtHostConfiguration, extHostConfiguration);
......@@ -117,7 +117,7 @@ export function createApiFactory(
const extHostMessageService = new ExtHostMessageService(threadService);
const extHostDialogs = new ExtHostDialogs(threadService);
const extHostStatusBar = new ExtHostStatusBar(threadService);
const extHostProgress = new ExtHostProgress(threadService.get(MainContext.MainThreadProgress));
const extHostProgress = new ExtHostProgress(threadService.getProxy(MainContext.MainThreadProgress));
const extHostOutputService = new ExtHostOutputService(threadService);
const extHostLanguages = new ExtHostLanguages(threadService);
......
......@@ -38,7 +38,7 @@ export class ExtHostCommands implements ExtHostCommandsShape {
heapService: ExtHostHeapService,
private logService: ILogService
) {
this._proxy = mainContext.get(MainContext.MainThreadCommands);
this._proxy = mainContext.getProxy(MainContext.MainThreadCommands);
this._converter = new CommandsConverter(this, heapService);
}
......
......@@ -61,7 +61,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
this._onDidChangeActiveDebugSession = new Emitter<vscode.DebugSession>();
this._onDidReceiveDebugSessionCustomEvent = new Emitter<vscode.DebugSessionCustomEvent>();
this._debugServiceProxy = mainContext.get(MainContext.MainThreadDebugService);
this._debugServiceProxy = mainContext.getProxy(MainContext.MainThreadDebugService);
this._onDidChangeBreakpoints = new Emitter<vscode.BreakpointsChangeEvent>({
onFirstListenerAdd: () => {
......
......@@ -19,7 +19,7 @@ export class ExtHostDecorations implements ExtHostDecorationsShape {
private readonly _proxy: MainThreadDecorationsShape;
constructor(mainContext: IMainContext) {
this._proxy = mainContext.get(MainContext.MainThreadDecorations);
this._proxy = mainContext.getProxy(MainContext.MainThreadDecorations);
}
registerDecorationProvider(provider: vscode.DecorationProvider, label: string): vscode.Disposable {
......
......@@ -224,7 +224,7 @@ export class ExtHostDiagnostics implements ExtHostDiagnosticsShape {
private _collections: DiagnosticCollection[];
constructor(mainContext: IMainContext) {
this._proxy = mainContext.get(MainContext.MainThreadDiagnostics);
this._proxy = mainContext.getProxy(MainContext.MainThreadDiagnostics);
this._collections = [];
}
......@@ -255,4 +255,3 @@ export class ExtHostDiagnostics implements ExtHostDiagnosticsShape {
this._collections.forEach(callback);
}
}
......@@ -13,7 +13,7 @@ export class ExtHostDialogs {
private readonly _proxy: MainThreadDiaglogsShape;
constructor(mainContext: IMainContext) {
this._proxy = mainContext.get(MainContext.MainThreadDialogs);
this._proxy = mainContext.getProxy(MainContext.MainThreadDialogs);
}
showOpenDialog(options: vscode.OpenDialogOptions): Thenable<URI[]> {
......
......@@ -25,7 +25,7 @@ export class ExtHostDocumentContentProvider implements ExtHostDocumentContentPro
private readonly _documentsAndEditors: ExtHostDocumentsAndEditors;
constructor(mainContext: IMainContext, documentsAndEditors: ExtHostDocumentsAndEditors) {
this._proxy = mainContext.get(MainContext.MainThreadDocumentContentProviders);
this._proxy = mainContext.getProxy(MainContext.MainThreadDocumentContentProviders);
this._documentsAndEditors = documentsAndEditors;
}
......
......@@ -33,7 +33,7 @@ export class ExtHostDocuments implements ExtHostDocumentsShape {
private _documentLoader = new Map<string, TPromise<ExtHostDocumentData>>();
constructor(mainContext: IMainContext, documentsAndEditors: ExtHostDocumentsAndEditors) {
this._proxy = mainContext.get(MainContext.MainThreadDocuments);
this._proxy = mainContext.getProxy(MainContext.MainThreadDocuments);
this._documentsAndEditors = documentsAndEditors;
this._toDispose = [
......
......@@ -52,7 +52,7 @@ export class ExtHostDocumentsAndEditors implements ExtHostDocumentsAndEditorsSha
assert.ok(!this._documents.has(data.url.toString()), `document '${data.url} already exists!'`);
const documentData = new ExtHostDocumentData(
this._mainContext.get(MainContext.MainThreadDocuments),
this._mainContext.getProxy(MainContext.MainThreadDocuments),
data.url,
data.lines,
data.EOL,
......@@ -80,7 +80,7 @@ export class ExtHostDocumentsAndEditors implements ExtHostDocumentsAndEditorsSha
const documentData = this._documents.get(data.document.toString());
const editor = new ExtHostTextEditor(
this._mainContext.get(MainContext.MainThreadEditors),
this._mainContext.getProxy(MainContext.MainThreadEditors),
data.id,
documentData,
data.selections.map(typeConverters.toSelection),
......
......@@ -132,10 +132,10 @@ export class ExtHostExtensionService implements ExtHostExtensionServiceShape {
this._registry = new ExtensionDescriptionRegistry(initData.extensions);
this._threadService = threadService;
this._logService = logService;
this._mainThreadTelemetry = threadService.get(MainContext.MainThreadTelemetry);
this._mainThreadTelemetry = threadService.getProxy(MainContext.MainThreadTelemetry);
this._storage = new ExtHostStorage(threadService);
this._storagePath = new ExtensionStoragePath(initData.workspace, initData.environment);
this._proxy = this._threadService.get(MainContext.MainThreadExtensionService);
this._proxy = this._threadService.getProxy(MainContext.MainThreadExtensionService);
this._activator = null;
// initialize API first (i.e. do not release barrier until the API is initialized)
......
......@@ -19,7 +19,7 @@ export class ExtHostFileSystem implements ExtHostFileSystemShape {
private _handlePool: number = 0;
constructor(mainContext: IMainContext) {
this._proxy = mainContext.get(MainContext.MainThreadFileSystem);
this._proxy = mainContext.getProxy(MainContext.MainThreadFileSystem);
}
registerFileSystemProvider(scheme: string, provider: vscode.FileSystemProvider) {
......
......@@ -800,7 +800,7 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
heapMonitor: ExtHostHeapService,
diagnostics: ExtHostDiagnostics
) {
this._proxy = mainContext.get(MainContext.MainThreadLanguageFeatures);
this._proxy = mainContext.getProxy(MainContext.MainThreadLanguageFeatures);
this._documents = documents;
this._commands = commands;
this._heapService = heapMonitor;
......
......@@ -14,11 +14,10 @@ export class ExtHostLanguages {
constructor(
mainContext: IMainContext
) {
this._proxy = mainContext.get(MainContext.MainThreadLanguages);
this._proxy = mainContext.getProxy(MainContext.MainThreadLanguages);
}
getLanguages(): TPromise<string[]> {
return this._proxy.$getLanguages();
}
}
......@@ -18,7 +18,7 @@ export class ExtHostMessageService {
private _proxy: MainThreadMessageServiceShape;
constructor(mainContext: IMainContext) {
this._proxy = mainContext.get(MainContext.MainThreadMessageService);
this._proxy = mainContext.getProxy(MainContext.MainThreadMessageService);
}
showMessage(extension: IExtensionDescription, severity: Severity, message: string, optionsOrFirstItem: vscode.MessageOptions | string, rest: string[]): Thenable<string | undefined>;
......
......@@ -64,7 +64,7 @@ export class ExtHostOutputService {
private _proxy: MainThreadOutputServiceShape;
constructor(mainContext: IMainContext) {
this._proxy = mainContext.get(MainContext.MainThreadOutputService);
this._proxy = mainContext.getProxy(MainContext.MainThreadOutputService);
}
createOutputChannel(name: string): vscode.OutputChannel {
......
......@@ -24,7 +24,7 @@ export class ExtHostQuickOpen implements ExtHostQuickOpenShape {
private _validateInput: (input: string) => string | Thenable<string>;
constructor(mainContext: IMainContext, workspace: ExtHostWorkspace, commands: ExtHostCommands) {
this._proxy = mainContext.get(MainContext.MainThreadQuickOpen);
this._proxy = mainContext.getProxy(MainContext.MainThreadQuickOpen);
this._workspace = workspace;
this._commands = commands;
}
......
......@@ -458,7 +458,7 @@ export class ExtHostSCM {
private _commands: ExtHostCommands,
@ILogService private logService: ILogService
) {
this._proxy = mainContext.get(MainContext.MainThreadSCM);
this._proxy = mainContext.getProxy(MainContext.MainThreadSCM);
_commands.registerArgumentProcessor({
processArgument: arg => {
......
......@@ -163,7 +163,7 @@ export class ExtHostStatusBar {
private _statusMessage: StatusBarMessage;
constructor(mainContext: IMainContext) {
this._proxy = mainContext.get(MainContext.MainThreadStatusBar);
this._proxy = mainContext.getProxy(MainContext.MainThreadStatusBar);
this._statusMessage = new StatusBarMessage(this);
}
......
......@@ -12,7 +12,7 @@ export class ExtHostStorage {
private _proxy: MainThreadStorageShape;
constructor(mainContext: IMainContext) {
this._proxy = mainContext.get(MainContext.MainThreadStorage);
this._proxy = mainContext.getProxy(MainContext.MainThreadStorage);
}
getValue<T>(shared: boolean, key: string, defaultValue?: T): TPromise<T> {
......@@ -22,4 +22,4 @@ export class ExtHostStorage {
setValue(shared: boolean, key: string, value: any): TPromise<void> {
return this._proxy.$setValue(shared, key, value);
}
}
\ No newline at end of file
}
......@@ -424,7 +424,7 @@ export class ExtHostTask implements ExtHostTaskShape {
private _handlers: Map<number, HandlerData>;
constructor(mainContext: IMainContext, extHostWorkspace: ExtHostWorkspace) {
this._proxy = mainContext.get(MainContext.MainThreadTask);
this._proxy = mainContext.getProxy(MainContext.MainThreadTask);
this._extHostWorkspace = extHostWorkspace;
this._handleCounter = 0;
this._handlers = new Map<number, HandlerData>();
......
......@@ -102,7 +102,7 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
constructor(mainContext: IMainContext) {
this._onDidCloseTerminal = new Emitter<vscode.Terminal>();
this._proxy = mainContext.get(MainContext.MainThreadTerminalService);
this._proxy = mainContext.getProxy(MainContext.MainThreadTerminalService);
this._terminals = [];
}
......
......@@ -37,7 +37,7 @@ export class ExtHostEditors implements ExtHostEditorsShape {
mainContext: IMainContext,
extHostDocumentsAndEditors: ExtHostDocumentsAndEditors,
) {
this._proxy = mainContext.get(MainContext.MainThreadEditors);
this._proxy = mainContext.getProxy(MainContext.MainThreadEditors);
this._extHostDocumentsAndEditors = extHostDocumentsAndEditors;
this._extHostDocumentsAndEditors.onDidChangeVisibleTextEditors(e => this._onDidChangeVisibleTextEditors.fire(e));
......
......@@ -23,7 +23,7 @@ export class ExtHostWindow implements ExtHostWindowShape {
get state(): WindowState { return this._state; }
constructor(mainContext: IMainContext) {
this._proxy = mainContext.get(MainContext.MainThreadWindow);
this._proxy = mainContext.getProxy(MainContext.MainThreadWindow);
this._proxy.$getWindowVisibility().then(isFocused => this.$onDidChangeWindowFocus(isFocused));
}
......
......@@ -59,7 +59,7 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape {
readonly onDidChangeWorkspace: Event<vscode.WorkspaceFoldersChangeEvent> = this._onDidChangeWorkspace.event;
constructor(mainContext: IMainContext, data: IWorkspaceData) {
this._proxy = mainContext.get(MainContext.MainThreadWorkspace);
this._proxy = mainContext.getProxy(MainContext.MainThreadWorkspace);
this._workspace = Workspace2.fromData(data);
}
......
......@@ -97,7 +97,7 @@ export class ExtensionHostMain {
this._logService.info('extension host started');
this._logService.trace('initData', initData);
this._extHostConfiguration = new ExtHostConfiguration(rpcProtocol.get(MainContext.MainThreadConfiguration), extHostWorkspace, initData.configuration);
this._extHostConfiguration = new ExtHostConfiguration(rpcProtocol.getProxy(MainContext.MainThreadConfiguration), extHostWorkspace, initData.configuration);
this._extensionService = new ExtHostExtensionService(initData, rpcProtocol, extHostWorkspace, this._extHostConfiguration, this._logService);
// error forwarding and stack trace scanning
......@@ -119,8 +119,8 @@ export class ExtensionHostMain {
return `${error.name || 'Error'}: ${error.message || ''}${stackTraceMessage}`;
};
});
const mainThreadExtensions = rpcProtocol.get(MainContext.MainThreadExtensionService);
const mainThreadErrors = rpcProtocol.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);
......
......@@ -262,7 +262,7 @@ export class ExtensionService extends Disposable implements IExtensionService {
const expected: ProxyIdentifier<any>[] = Object.keys(MainContext).map((key) => MainContext[key]);
this._extensionHostProcessRPCProtocol.assertRegistered(expected);
return this._extensionHostProcessRPCProtocol.get(ExtHostContext.ExtHostExtensionService);
return this._extensionHostProcessRPCProtocol.getProxy(ExtHostContext.ExtHostExtensionService);
}
// ---- begin IExtensionService
......
......@@ -12,7 +12,7 @@ export interface IRPCProtocol {
* >
* > Use `getFast` for a proxy where such arguments are not automatically serialized/deserialized.
*/
get<T>(identifier: ProxyIdentifier<T>): T;
getProxy<T>(identifier: ProxyIdentifier<T>): T;
/**
* Returns a proxy to an object addressable/named in the extension host process.
......
......@@ -44,7 +44,7 @@ export class RPCProtocol implements IRPCProtocol {
});
}
public get<T>(identifier: ProxyIdentifier<T>): T {
public getProxy<T>(identifier: ProxyIdentifier<T>): T {
if (!this._proxies[identifier.id]) {
this._proxies[identifier.id] = this._createProxy(identifier.id, true);
}
......@@ -65,8 +65,8 @@ export class RPCProtocol implements IRPCProtocol {
target[name] = (...myArgs: any[]) => {
return (
isFancy
? this.fancyRemoteCall(proxyId, name, myArgs)
: this.remoteCall(proxyId, name, myArgs)
? this.fancyRemoteCall(proxyId, name, myArgs)
: this.remoteCall(proxyId, name, myArgs)
);
};
}
......
......@@ -15,7 +15,10 @@ suite('ExtHostDocumentsAndEditors', () => {
setup(function () {
editors = new ExtHostDocumentsAndEditors({
get() { return undefined; }
getProxy: () => { return undefined; },
getFastProxy: () => { return undefined; },
set: undefined,
assertRegistered: undefined
});
});
......
......@@ -6,11 +6,14 @@
'use strict';
import { TPromise } from 'vs/base/common/winjs.base';
import { ProxyIdentifier } from 'vs/workbench/services/extensions/node/proxyIdentifier';
import { ProxyIdentifier, IRPCProtocol } from 'vs/workbench/services/extensions/node/proxyIdentifier';
export function OneGetThreadService(thing: any) {
export function OneGetThreadService(thing: any): IRPCProtocol {
return {
get<T>(): T {
getProxy<T>(): T {
return thing;
},
getFastProxy<T>(): T {
return thing;
},
set<T, R extends T>(identifier: ProxyIdentifier<T>, value: R): R {
......@@ -75,7 +78,7 @@ export abstract class AbstractTestThreadService {
protected abstract _callOnRemote(proxyId: string, path: string, args: any[]): TPromise<any>;
}
export class TestThreadService extends AbstractTestThreadService {
export class TestThreadService extends AbstractTestThreadService implements IRPCProtocol {
constructor(isMainProcess: boolean = false) {
super(isMainProcess);
}
......@@ -120,7 +123,16 @@ export class TestThreadService extends AbstractTestThreadService {
return value;
}
get<T>(identifier: ProxyIdentifier<T>): T {
getProxy<T>(identifier: ProxyIdentifier<T>): T {
return this._get(identifier);
}
getFastProxy<T>(identifier: ProxyIdentifier<T>): T {
return this._get(identifier);
}
_get<T>(identifier: ProxyIdentifier<T>): T {
let id = identifier.id;
if (this._locals[id]) {
return this._locals[id];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册