web: add didResolveRemoteAuthority function for embedders (#209480)

This commit is contained in:
Connor Peet 2024-04-03 14:16:56 -07:00 committed by GitHub
parent feb823cc57
commit efee188faf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 20 additions and 0 deletions

View file

@ -106,6 +106,10 @@ export interface IWorkbench {
};
workspace: {
/**
* Resolves once the remote authority has been resolved.
*/
didResolveRemoteAuthority(): Promise<void>;
/**
* Forwards a port. If the current embedder implements a tunnelFactory then that will be used to make the tunnel.

View file

@ -154,6 +154,14 @@ export namespace window {
export namespace workspace {
/**
* {@linkcode IWorkbench.workspace IWorkbench.workspace.didResolveRemoteAuthority}
*/
export async function didResolveRemoteAuthority() {
const workbench = await workbenchPromise.p;
await workbench.workspace.didResolveRemoteAuthority();
}
/**
* {@linkcode IWorkbench.workspace IWorkbench.workspace.openTunnel}
*/

View file

@ -156,6 +156,7 @@ export class BrowserMain extends Disposable {
const remoteExplorerService = accessor.get(IRemoteExplorerService);
const labelService = accessor.get(ILabelService);
const embedderTerminalService = accessor.get(IEmbedderTerminalService);
const remoteAuthorityResolverService = accessor.get(IRemoteAuthorityResolverService);
let logger: DelayedLogChannel | undefined = undefined;
@ -190,6 +191,13 @@ export class BrowserMain extends Disposable {
createTerminal: async (options) => embedderTerminalService.createTerminal(options),
},
workspace: {
didResolveRemoteAuthority: async () => {
if (!this.configuration.remoteAuthority) {
return;
}
await remoteAuthorityResolverService.resolveAuthority(this.configuration.remoteAuthority);
},
openTunnel: async tunnelOptions => {
const tunnel = assertIsDefined(await remoteExplorerService.forward({
remote: tunnelOptions.remoteAddress,