Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

web: add didResolveRemoteAuthority function for embedders #209480

Merged
merged 1 commit into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading