Skip to content

Commit

Permalink
web: add didResolveRemoteAuthority function for embedders (#209480)
Browse files Browse the repository at this point in the history
  • Loading branch information
connor4312 authored Apr 3, 2024
1 parent feb823c commit efee188
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/vs/workbench/browser/web.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 8 additions & 0 deletions src/vs/workbench/browser/web.factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}
*/
Expand Down
8 changes: 8 additions & 0 deletions src/vs/workbench/browser/web.main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit efee188

Please sign in to comment.