mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-28 07:40:30 -04:00
Merge from vscode c58aaab8a1cc22a7139b761166a0d4f37d41e998 (#7880)
* Merge from vscode c58aaab8a1cc22a7139b761166a0d4f37d41e998 * fix pipelines * fix strict-null-checks * add missing files
This commit is contained in:
@@ -9,8 +9,19 @@ import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
|
||||
export const IURLService = createDecorator<IURLService>('urlService');
|
||||
|
||||
export interface IOpenURLOptions {
|
||||
|
||||
/**
|
||||
* If not provided or `false`, signals that the
|
||||
* URL to open did not originate from the product
|
||||
* but outside. As such, a confirmation dialog
|
||||
* might be shown to the user.
|
||||
*/
|
||||
trusted?: boolean;
|
||||
}
|
||||
|
||||
export interface IURLHandler {
|
||||
handleURL(uri: URI): Promise<boolean>;
|
||||
handleURL(uri: URI, options?: IOpenURLOptions): Promise<boolean>;
|
||||
}
|
||||
|
||||
export interface IURLService {
|
||||
@@ -24,7 +35,7 @@ export interface IURLService {
|
||||
*/
|
||||
create(options?: Partial<UriComponents>): URI;
|
||||
|
||||
open(url: URI): Promise<boolean>;
|
||||
open(url: URI, options?: IOpenURLOptions): Promise<boolean>;
|
||||
|
||||
registerHandler(handler: IURLHandler): IDisposable;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import { IChannel, IServerChannel, IClientRouter, IConnectionHub, Client } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { IURLHandler } from 'vs/platform/url/common/url';
|
||||
import { IURLHandler, IOpenURLOptions } from 'vs/platform/url/common/url';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { first } from 'vs/base/common/arrays';
|
||||
|
||||
@@ -31,7 +31,7 @@ export class URLHandlerChannelClient implements IURLHandler {
|
||||
|
||||
constructor(private channel: IChannel) { }
|
||||
|
||||
handleURL(uri: URI): Promise<boolean> {
|
||||
handleURL(uri: URI, options?: IOpenURLOptions): Promise<boolean> {
|
||||
return this.channel.call('handleURL', uri.toJSON());
|
||||
}
|
||||
}
|
||||
@@ -49,11 +49,12 @@ export class URLHandlerRouter implements IClientRouter<string> {
|
||||
const uri = URI.revive(arg);
|
||||
|
||||
if (uri && uri.query) {
|
||||
const match = /\bwindowId=([^&]+)/.exec(uri.query);
|
||||
const match = /\bwindowId=(\d+)/.exec(uri.query);
|
||||
|
||||
if (match) {
|
||||
const windowId = match[1];
|
||||
const connection = first(hub.connections, c => c.ctx === windowId);
|
||||
const regex = new RegExp(`window:${windowId}`);
|
||||
const connection = first(hub.connections, c => regex.test(c.ctx));
|
||||
|
||||
if (connection) {
|
||||
return connection;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IURLService, IURLHandler } from 'vs/platform/url/common/url';
|
||||
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';
|
||||
@@ -17,9 +17,9 @@ export abstract class AbstractURLService extends Disposable implements IURLServi
|
||||
|
||||
abstract create(options?: Partial<UriComponents>): URI;
|
||||
|
||||
open(uri: URI): Promise<boolean> {
|
||||
open(uri: URI, options?: IOpenURLOptions): Promise<boolean> {
|
||||
const handlers = values(this.handlers);
|
||||
return first(handlers.map(h => () => h.handleURL(uri)), undefined, false).then(val => val || false);
|
||||
return first(handlers.map(h => () => h.handleURL(uri, options)), undefined, false).then(val => val || false);
|
||||
}
|
||||
|
||||
registerHandler(handler: IURLHandler): IDisposable {
|
||||
|
||||
Reference in New Issue
Block a user