mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-28 15:50:29 -04:00
Merge VS Code 1.31.1 (#4283)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user