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

@@ -0,0 +1,68 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IChannel, IServerChannel } from 'vs/base/parts/ipc/node/ipc';
import { URI } from 'vs/base/common/uri';
import { IDisposable } from 'vs/base/common/lifecycle';
import { Event } from 'vs/base/common/event';
import { IURLService, IURLHandler } from 'vs/platform/url/common/url';
export class URLServiceChannel implements IServerChannel {
constructor(private service: IURLService) { }
listen<T>(_, event: string): Event<T> {
throw new Error(`Event not found: ${event}`);
}
call(_, command: string, arg?: any): Thenable<any> {
switch (command) {
case 'open': return this.service.open(URI.revive(arg));
}
throw new Error(`Call not found: ${command}`);
}
}
export class URLServiceChannelClient implements IURLService {
_serviceBrand: any;
constructor(private channel: IChannel) { }
open(url: URI): Thenable<boolean> {
return this.channel.call('open', url.toJSON());
}
registerHandler(handler: IURLHandler): IDisposable {
throw new Error('Not implemented.');
}
}
export class URLHandlerChannel implements IServerChannel {
constructor(private handler: IURLHandler) { }
listen<T>(_, event: string): Event<T> {
throw new Error(`Event not found: ${event}`);
}
call(_, command: string, arg?: any): Thenable<any> {
switch (command) {
case 'handleURL': return this.handler.handleURL(URI.revive(arg));
}
throw new Error(`Call not found: ${command}`);
}
}
export class URLHandlerChannelClient implements IURLHandler {
constructor(private channel: IChannel) { }
handleURL(uri: URI): Thenable<boolean> {
return this.channel.call('handleURL', uri.toJSON());
}
}