Merge VS Code 1.31.1 (#4283)

This commit is contained in:
Matt Irvine
2019-03-15 13:09:45 -07:00
committed by GitHub
parent 7d31575149
commit 86bac90001
1716 changed files with 53308 additions and 48375 deletions

View File

@@ -10,12 +10,12 @@ import { IDisposable } from 'vs/base/common/lifecycle';
export const IURLService = createDecorator<IURLService>('urlService');
export interface IURLHandler {
handleURL(uri: URI): Thenable<boolean>;
handleURL(uri: URI): Promise<boolean>;
}
export interface IURLService {
_serviceBrand: any;
open(url: URI): Thenable<boolean>;
open(url: URI): Promise<boolean>;
registerHandler(handler: IURLHandler): IDisposable;
}

View File

@@ -7,10 +7,7 @@ import { IURLService, IURLHandler } from 'vs/platform/url/common/url';
import { URI } from 'vs/base/common/uri';
import { IDisposable, toDisposable } from 'vs/base/common/lifecycle';
import { first } from 'vs/base/common/async';
declare module Array {
function from<T>(set: Set<T>): T[];
}
import { values } from 'vs/base/common/map';
export class URLService implements IURLService {
@@ -18,9 +15,9 @@ export class URLService implements IURLService {
private handlers = new Set<IURLHandler>();
open(uri: URI): Thenable<boolean> {
const handlers = Array.from(this.handlers);
return first(handlers.map(h => () => h.handleURL(uri)), undefined, false);
open(uri: URI): Promise<boolean> {
const handlers = values(this.handlers);
return first(handlers.map(h => () => h.handleURL(uri)), undefined, false).then(val => val || false);
}
registerHandler(handler: IURLHandler): IDisposable {
@@ -35,11 +32,11 @@ export class RelayURLService extends URLService implements IURLHandler {
super();
}
open(uri: URI): Thenable<boolean> {
open(uri: URI): Promise<boolean> {
return this.urlService.open(uri);
}
handleURL(uri: URI): Thenable<boolean> {
handleURL(uri: URI): Promise<boolean> {
return super.open(uri);
}
}