Skip to content

Commit 44cf9c9

Browse files
committed
Make worker ExtHostTunnelService and remove dependency in ExtHostExtensionService
1 parent 0181e95 commit 44cf9c9

8 files changed

Lines changed: 24 additions & 23 deletions

File tree

src/vs/platform/remote/common/remoteAuthorityResolver.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,14 @@ export interface ResolvedOptions {
1717
readonly extensionHostEnv?: { [key: string]: string | null };
1818
}
1919

20+
export interface TunnelInformation {
21+
detectedTunnels?: { remote: { port: number, host: string }, localAddress: string }[];
22+
}
23+
2024
export interface ResolverResult {
2125
authority: ResolvedAuthority;
2226
options?: ResolvedOptions;
27+
tunnelInformation?: TunnelInformation;
2328
}
2429

2530
export enum RemoteAuthorityResolverErrorCode {

src/vs/workbench/api/browser/mainThreadTunnelService.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ export class MainThreadTunnelService implements MainThreadTunnelServiceShape {
3131
return this.remoteExplorerService.close(remotePort);
3232
}
3333

34-
$addDetected(tunnels: { remote: { port: number, host: string }, localAddress: string }[]): Promise<void> {
35-
return Promise.resolve(this.remoteExplorerService.addDetected(tunnels));
36-
}
37-
3834
async $registerCandidateFinder(): Promise<void> {
3935
this.remoteExplorerService.registerCandidateFinder(() => this._proxy.$findCandidatePorts());
4036
}

src/vs/workbench/api/common/extHost.protocol.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,6 @@ export interface MainThreadWindowShape extends IDisposable {
776776
export interface MainThreadTunnelServiceShape extends IDisposable {
777777
$openTunnel(tunnelOptions: TunnelOptions): Promise<TunnelDto | undefined>;
778778
$closeTunnel(remotePort: number): Promise<void>;
779-
$addDetected(tunnels: { remote: { port: number, host: string }, localAddress: string }[]): Promise<void>;
780779
$registerCandidateFinder(): Promise<void>;
781780
}
782781

src/vs/workbench/api/common/extHostExtensionService.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitData
3232
import { IExtensionStoragePaths } from 'vs/workbench/api/common/extHostStoragePaths';
3333
import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService';
3434
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
35-
import { IExtHostTunnelService } from 'vs/workbench/api/common/extHostTunnelService';
3635

3736
interface ITestRunner {
3837
/** Old test runner API, as exported from `vscode/lib/testrunner` */
@@ -77,7 +76,6 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio
7776
protected readonly _extHostWorkspace: ExtHostWorkspace;
7877
protected readonly _extHostConfiguration: ExtHostConfiguration;
7978
protected readonly _logService: ILogService;
80-
protected readonly _extHostTunnelService: IExtHostTunnelService;
8179

8280
protected readonly _mainThreadWorkspaceProxy: MainThreadWorkspaceShape;
8381
protected readonly _mainThreadTelemetryProxy: MainThreadTelemetryShape;
@@ -106,8 +104,7 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio
106104
@IExtHostConfiguration extHostConfiguration: IExtHostConfiguration,
107105
@ILogService logService: ILogService,
108106
@IExtHostInitDataService initData: IExtHostInitDataService,
109-
@IExtensionStoragePaths storagePath: IExtensionStoragePaths,
110-
@IExtHostTunnelService extHostTunnelService: IExtHostTunnelService
107+
@IExtensionStoragePaths storagePath: IExtensionStoragePaths
111108
) {
112109
this._hostUtils = hostUtils;
113110
this._extHostContext = extHostContext;
@@ -116,7 +113,6 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio
116113
this._extHostWorkspace = extHostWorkspace;
117114
this._extHostConfiguration = extHostConfiguration;
118115
this._logService = logService;
119-
this._extHostTunnelService = extHostTunnelService;
120116
this._disposables = new DisposableStore();
121117

122118
this._mainThreadWorkspaceProxy = this._extHostContext.getProxy(MainContext.MainThreadWorkspace);
@@ -656,13 +652,12 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio
656652
extensionHostEnv: result.extensionHostEnv
657653
};
658654

659-
await this._extHostTunnelService.addDetected(result.detectedTunnels);
660-
661655
return {
662656
type: 'ok',
663657
value: {
664658
authority,
665-
options
659+
options,
660+
tunnelInformation: { detectedTunnels: result.detectedTunnels }
666661
}
667662
};
668663
} catch (err) {

src/vs/workbench/api/common/extHostTunnelService.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,16 @@ export interface TunnelDto {
2222
export interface IExtHostTunnelService extends ExtHostTunnelServiceShape {
2323
readonly _serviceBrand: undefined;
2424
makeTunnel(forward: TunnelOptions): Promise<vscode.Tunnel | undefined>;
25-
addDetected(tunnels: { remote: { port: number, host: string }, localAddress: string }[] | undefined): Promise<void>;
2625
}
2726

2827
export const IExtHostTunnelService = createDecorator<IExtHostTunnelService>('IExtHostTunnelService');
28+
29+
export class ExtHostTunnelService implements IExtHostTunnelService {
30+
_serviceBrand: undefined;
31+
async makeTunnel(forward: TunnelOptions): Promise<vscode.Tunnel | undefined> {
32+
return undefined;
33+
}
34+
async $findCandidatePorts(): Promise<{ port: number; detail: string; }[]> {
35+
return [];
36+
}
37+
}

src/vs/workbench/api/node/extHostTunnelService.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,6 @@ export class ExtHostTunnelService extends Disposable implements IExtHostTunnelSe
4545
return undefined;
4646
}
4747

48-
async addDetected(tunnels: { remote: { port: number, host: string }, localAddress: string }[] | undefined): Promise<void> {
49-
if (tunnels) {
50-
return this._proxy.$addDetected(tunnels);
51-
}
52-
}
53-
5448
registerCandidateFinder(): Promise<void> {
5549
return this._proxy.$registerCandidateFinder();
5650
}

src/vs/workbench/services/extensions/electron-browser/extensionService.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import { flatten } from 'vs/base/common/arrays';
3838
import { IStaticExtensionsService } from 'vs/workbench/services/extensions/common/staticExtensions';
3939
import { IElectronService } from 'vs/platform/electron/node/electron';
4040
import { IElectronEnvironmentService } from 'vs/workbench/services/electron/electron-browser/electronEnvironmentService';
41+
import { IRemoteExplorerService } from 'vs/workbench/services/remote/common/remoteExplorerService';
4142

4243
class DeltaExtensionsQueueItem {
4344
constructor(
@@ -70,7 +71,8 @@ export class ExtensionService extends AbstractExtensionService implements IExten
7071
@IStaticExtensionsService private readonly _staticExtensions: IStaticExtensionsService,
7172
@IElectronService private readonly _electronService: IElectronService,
7273
@IHostService private readonly _hostService: IHostService,
73-
@IElectronEnvironmentService private readonly _electronEnvironmentService: IElectronEnvironmentService
74+
@IElectronEnvironmentService private readonly _electronEnvironmentService: IElectronEnvironmentService,
75+
@IRemoteExplorerService private readonly _remoteExplorerService: IRemoteExplorerService
7476
) {
7577
super(
7678
instantiationService,
@@ -471,6 +473,7 @@ export class ExtensionService extends AbstractExtensionService implements IExten
471473

472474
// set the resolved authority
473475
this._remoteAuthorityResolverService.setResolvedAuthority(resolvedAuthority.authority, resolvedAuthority.options);
476+
this._remoteExplorerService.addDetected(resolvedAuthority.tunnelInformation?.detectedTunnels);
474477

475478
// monitor for breakage
476479
const connection = this._remoteAgentService.getConnection();

src/vs/workbench/services/extensions/worker/extHost.services.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { ExtHostExtensionService } from 'vs/workbench/api/worker/extHostExtensio
2121
import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
2222
import { ILogService } from 'vs/platform/log/common/log';
2323
import { ExtHostLogService } from 'vs/workbench/api/worker/extHostLogService';
24-
import { IExtHostTunnelService } from 'vs/workbench/api/common/extHostTunnelService';
24+
import { IExtHostTunnelService, ExtHostTunnelService } from 'vs/workbench/api/common/extHostTunnelService';
2525

2626
// register singleton services
2727
registerSingleton(ILogService, ExtHostLogService);
@@ -34,6 +34,7 @@ registerSingleton(IExtHostDocumentsAndEditors, ExtHostDocumentsAndEditors);
3434
registerSingleton(IExtHostStorage, ExtHostStorage);
3535
registerSingleton(IExtHostExtensionService, ExtHostExtensionService);
3636
registerSingleton(IExtHostSearch, ExtHostSearch);
37+
registerSingleton(IExtHostTunnelService, ExtHostTunnelService);
3738

3839
// register services that only throw errors
3940
function NotImplementedProxy<T>(name: ServiceIdentifier<T>): { new(): T } {
@@ -54,4 +55,3 @@ registerSingleton(IExtHostTerminalService, WorkerExtHostTerminalService);
5455
registerSingleton(IExtHostTask, WorkerExtHostTask);
5556
registerSingleton(IExtHostDebugService, WorkerExtHostDebugService);
5657
registerSingleton(IExtensionStoragePaths, class extends NotImplementedProxy(IExtensionStoragePaths) { whenReady = Promise.resolve(); });
57-
registerSingleton(IExtHostTunnelService, class extends NotImplementedProxy(IExtHostTunnelService) { });

0 commit comments

Comments
 (0)