From 6a94ca469932dc2537e40c82afbc860021981ec6 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Wed, 18 Sep 2019 18:30:16 -0700 Subject: [PATCH] Delegate to embedder when resolving if one exists --- src/vs/workbench/api/browser/mainThreadWindow.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/vs/workbench/api/browser/mainThreadWindow.ts b/src/vs/workbench/api/browser/mainThreadWindow.ts index 869f1b68fe7..264d788c6c9 100644 --- a/src/vs/workbench/api/browser/mainThreadWindow.ts +++ b/src/vs/workbench/api/browser/mainThreadWindow.ts @@ -54,10 +54,19 @@ export class MainThreadWindow implements MainThreadWindowShape { async $resolveExternalUri(uriComponents: UriComponents, options: IOpenUriOptions): Promise { const uri = URI.revive(uriComponents); + const embedderResolver = this.getEmbedderResolver(); + if (embedderResolver) { + return embedderResolver(uri); + } return this.resolveExternalUri(uri, options); } async $releaseResolvedExternalUri(uriComponents: UriComponents): Promise { + if (this.getEmbedderResolver()) { + // Embedder handled forwarding so there's nothing for us to clean up + return true; + } + const portMappingRequest = extractLocalHostUriMetaDataForPortMapping(URI.from(uriComponents)); if (portMappingRequest) { const existing = this._tunnels.get(portMappingRequest.port); @@ -71,6 +80,10 @@ export class MainThreadWindow implements MainThreadWindowShape { return true; } + private getEmbedderResolver(): undefined | ((uri: URI) => Promise) { + return this.environmentService.options && this.environmentService.options.resolveExternalUri; + } + private async resolveExternalUri(uri: URI, options: IOpenUriOptions): Promise { if (options.allowTunneling && !!this.environmentService.configuration.remoteAuthority) { const portMappingRequest = extractLocalHostUriMetaDataForPortMapping(uri);