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,23 +3,19 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import URI from 'vs/base/common/uri';
import { URI } from 'vs/base/common/uri';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { IDisposable } from 'vs/base/common/lifecycle';
import { TPromise } from 'vs/base/common/winjs.base';
export const ID = 'urlService';
export const IURLService = createDecorator<IURLService>(ID);
export const IURLService = createDecorator<IURLService>('urlService');
export interface IURLHandler {
handleURL(uri: URI): TPromise<boolean>;
handleURL(uri: URI): Thenable<boolean>;
}
export interface IURLService {
_serviceBrand: any;
open(url: URI): TPromise<boolean>;
open(url: URI): Thenable<boolean>;
registerHandler(handler: IURLHandler): IDisposable;
}

View File

@@ -1,79 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* 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 { IChannel } from 'vs/base/parts/ipc/common/ipc';
import { IURLHandler, IURLService } from './url';
import URI from 'vs/base/common/uri';
import { IDisposable } from 'vs/base/common/lifecycle';
import { Event } from 'vs/base/common/event';
export interface IURLServiceChannel extends IChannel {
call(command: 'open', url: string): TPromise<boolean>;
call(command: string, arg?: any): TPromise<any>;
}
export class URLServiceChannel implements IURLServiceChannel {
constructor(private service: IURLService) { }
listen<T>(event: string, arg?: any): Event<T> {
throw new Error('No events');
}
call(command: string, arg?: any): TPromise<any> {
switch (command) {
case 'open': return this.service.open(URI.revive(arg));
}
return undefined;
}
}
export class URLServiceChannelClient implements IURLService {
_serviceBrand: any;
constructor(private channel: IChannel) { }
open(url: URI): TPromise<boolean, any> {
return this.channel.call('open', url.toJSON());
}
registerHandler(handler: IURLHandler): IDisposable {
throw new Error('Not implemented.');
}
}
export interface IURLHandlerChannel extends IChannel {
call(command: 'handleURL', arg: any): TPromise<boolean>;
call(command: string, arg?: any): TPromise<any>;
}
export class URLHandlerChannel implements IURLHandlerChannel {
constructor(private handler: IURLHandler) { }
listen<T>(event: string, arg?: any): Event<T> {
throw new Error('No events');
}
call(command: string, arg?: any): TPromise<any> {
switch (command) {
case 'handleURL': return this.handler.handleURL(URI.revive(arg));
}
return undefined;
}
}
export class URLHandlerChannelClient implements IURLHandler {
constructor(private channel: IChannel) { }
handleURL(uri: URI): TPromise<boolean> {
return this.channel.call('handleURL', uri.toJSON());
}
}

View File

@@ -3,12 +3,9 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { IURLService, IURLHandler } from 'vs/platform/url/common/url';
import URI from 'vs/base/common/uri';
import { URI } from 'vs/base/common/uri';
import { IDisposable, toDisposable } from 'vs/base/common/lifecycle';
import { TPromise } from 'vs/base/common/winjs.base';
import { first } from 'vs/base/common/async';
declare module Array {
@@ -21,7 +18,7 @@ export class URLService implements IURLService {
private handlers = new Set<IURLHandler>();
open(uri: URI): TPromise<boolean> {
open(uri: URI): Thenable<boolean> {
const handlers = Array.from(this.handlers);
return first(handlers.map(h => () => h.handleURL(uri)), undefined, false);
}
@@ -38,11 +35,11 @@ export class RelayURLService extends URLService implements IURLHandler {
super();
}
open(uri: URI): TPromise<boolean> {
open(uri: URI): Thenable<boolean> {
return this.urlService.open(uri);
}
handleURL(uri: URI): TPromise<boolean> {
handleURL(uri: URI): Thenable<boolean> {
return super.open(uri);
}
}
}