mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Merge from vscode 4d91d96e5e121b38d33508cdef17868bab255eae
This commit is contained in:
committed by
AzureDataStudio
parent
a971aee5bd
commit
5e7071e466
@@ -26,7 +26,7 @@ export interface IURLHandler {
|
||||
|
||||
export interface IURLService {
|
||||
|
||||
_serviceBrand: undefined;
|
||||
readonly _serviceBrand: undefined;
|
||||
|
||||
/**
|
||||
* Create a URL that can be called to trigger IURLhandlers.
|
||||
|
||||
@@ -5,21 +5,20 @@
|
||||
|
||||
import { IURLService, IURLHandler, IOpenURLOptions } from 'vs/platform/url/common/url';
|
||||
import { URI, UriComponents } from 'vs/base/common/uri';
|
||||
import { values } from 'vs/base/common/map';
|
||||
import { first } from 'vs/base/common/async';
|
||||
import { toDisposable, IDisposable, Disposable } from 'vs/base/common/lifecycle';
|
||||
import product from 'vs/platform/product/common/product';
|
||||
|
||||
export abstract class AbstractURLService extends Disposable implements IURLService {
|
||||
|
||||
_serviceBrand: undefined;
|
||||
declare readonly _serviceBrand: undefined;
|
||||
|
||||
private handlers = new Set<IURLHandler>();
|
||||
|
||||
abstract create(options?: Partial<UriComponents>): URI;
|
||||
|
||||
open(uri: URI, options?: IOpenURLOptions): Promise<boolean> {
|
||||
const handlers = values(this.handlers);
|
||||
const handlers = [...this.handlers.values()];
|
||||
return first(handlers.map(h => () => h.handleURL(uri, options)), undefined, false).then(val => val || false);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user