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

This commit is contained in:
Alex Dima
2017-12-13 16:03:57 +01:00
parent 2b4ce13409
commit 367dd10413
50 changed files with 79 additions and 67 deletions

View File

@@ -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);

View File

@@ -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);
}

View File

@@ -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: () => {

View File

@@ -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 {

View File

@@ -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);
}
}

View File

@@ -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[]> {

View File

@@ -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;
}

View File

@@ -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 = [

View File

@@ -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),

View File

@@ -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)

View File

@@ -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) {

View File

@@ -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;

View File

@@ -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();
}
}

View File

@@ -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>;

View File

@@ -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 {

View File

@@ -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;
}

View File

@@ -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 => {

View File

@@ -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);
}

View File

@@ -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);
}
}
}

View 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>();

View File

@@ -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 = [];
}

View File

@@ -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));

View File

@@ -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));
}

View File

@@ -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);
}