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);