提交 44cf9c91 编写于 作者: A Alex Ross

Make worker ExtHostTunnelService and remove dependency in ExtHostExtensionService

上级 0181e95b
......@@ -17,9 +17,14 @@ export interface ResolvedOptions {
readonly extensionHostEnv?: { [key: string]: string | null };
}
export interface TunnelInformation {
detectedTunnels?: { remote: { port: number, host: string }, localAddress: string }[];
}
export interface ResolverResult {
authority: ResolvedAuthority;
options?: ResolvedOptions;
tunnelInformation?: TunnelInformation;
}
export enum RemoteAuthorityResolverErrorCode {
......
......@@ -31,10 +31,6 @@ export class MainThreadTunnelService implements MainThreadTunnelServiceShape {
return this.remoteExplorerService.close(remotePort);
}
$addDetected(tunnels: { remote: { port: number, host: string }, localAddress: string }[]): Promise<void> {
return Promise.resolve(this.remoteExplorerService.addDetected(tunnels));
}
async $registerCandidateFinder(): Promise<void> {
this.remoteExplorerService.registerCandidateFinder(() => this._proxy.$findCandidatePorts());
}
......
......@@ -776,7 +776,6 @@ export interface MainThreadWindowShape extends IDisposable {
export interface MainThreadTunnelServiceShape extends IDisposable {
$openTunnel(tunnelOptions: TunnelOptions): Promise<TunnelDto | undefined>;
$closeTunnel(remotePort: number): Promise<void>;
$addDetected(tunnels: { remote: { port: number, host: string }, localAddress: string }[]): Promise<void>;
$registerCandidateFinder(): Promise<void>;
}
......
......@@ -32,7 +32,6 @@ import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitData
import { IExtensionStoragePaths } from 'vs/workbench/api/common/extHostStoragePaths';
import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { IExtHostTunnelService } from 'vs/workbench/api/common/extHostTunnelService';
interface ITestRunner {
/** Old test runner API, as exported from `vscode/lib/testrunner` */
......@@ -77,7 +76,6 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio
protected readonly _extHostWorkspace: ExtHostWorkspace;
protected readonly _extHostConfiguration: ExtHostConfiguration;
protected readonly _logService: ILogService;
protected readonly _extHostTunnelService: IExtHostTunnelService;
protected readonly _mainThreadWorkspaceProxy: MainThreadWorkspaceShape;
protected readonly _mainThreadTelemetryProxy: MainThreadTelemetryShape;
......@@ -106,8 +104,7 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio
@IExtHostConfiguration extHostConfiguration: IExtHostConfiguration,
@ILogService logService: ILogService,
@IExtHostInitDataService initData: IExtHostInitDataService,
@IExtensionStoragePaths storagePath: IExtensionStoragePaths,
@IExtHostTunnelService extHostTunnelService: IExtHostTunnelService
@IExtensionStoragePaths storagePath: IExtensionStoragePaths
) {
this._hostUtils = hostUtils;
this._extHostContext = extHostContext;
......@@ -116,7 +113,6 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio
this._extHostWorkspace = extHostWorkspace;
this._extHostConfiguration = extHostConfiguration;
this._logService = logService;
this._extHostTunnelService = extHostTunnelService;
this._disposables = new DisposableStore();
this._mainThreadWorkspaceProxy = this._extHostContext.getProxy(MainContext.MainThreadWorkspace);
......@@ -656,13 +652,12 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio
extensionHostEnv: result.extensionHostEnv
};
await this._extHostTunnelService.addDetected(result.detectedTunnels);
return {
type: 'ok',
value: {
authority,
options
options,
tunnelInformation: { detectedTunnels: result.detectedTunnels }
}
};
} catch (err) {
......
......@@ -22,7 +22,16 @@ export interface TunnelDto {
export interface IExtHostTunnelService extends ExtHostTunnelServiceShape {
readonly _serviceBrand: undefined;
makeTunnel(forward: TunnelOptions): Promise<vscode.Tunnel | undefined>;
addDetected(tunnels: { remote: { port: number, host: string }, localAddress: string }[] | undefined): Promise<void>;
}
export const IExtHostTunnelService = createDecorator<IExtHostTunnelService>('IExtHostTunnelService');
export class ExtHostTunnelService implements IExtHostTunnelService {
_serviceBrand: undefined;
async makeTunnel(forward: TunnelOptions): Promise<vscode.Tunnel | undefined> {
return undefined;
}
async $findCandidatePorts(): Promise<{ port: number; detail: string; }[]> {
return [];
}
}
......@@ -45,12 +45,6 @@ export class ExtHostTunnelService extends Disposable implements IExtHostTunnelSe
return undefined;
}
async addDetected(tunnels: { remote: { port: number, host: string }, localAddress: string }[] | undefined): Promise<void> {
if (tunnels) {
return this._proxy.$addDetected(tunnels);
}
}
registerCandidateFinder(): Promise<void> {
return this._proxy.$registerCandidateFinder();
}
......
......@@ -38,6 +38,7 @@ import { flatten } from 'vs/base/common/arrays';
import { IStaticExtensionsService } from 'vs/workbench/services/extensions/common/staticExtensions';
import { IElectronService } from 'vs/platform/electron/node/electron';
import { IElectronEnvironmentService } from 'vs/workbench/services/electron/electron-browser/electronEnvironmentService';
import { IRemoteExplorerService } from 'vs/workbench/services/remote/common/remoteExplorerService';
class DeltaExtensionsQueueItem {
constructor(
......@@ -70,7 +71,8 @@ export class ExtensionService extends AbstractExtensionService implements IExten
@IStaticExtensionsService private readonly _staticExtensions: IStaticExtensionsService,
@IElectronService private readonly _electronService: IElectronService,
@IHostService private readonly _hostService: IHostService,
@IElectronEnvironmentService private readonly _electronEnvironmentService: IElectronEnvironmentService
@IElectronEnvironmentService private readonly _electronEnvironmentService: IElectronEnvironmentService,
@IRemoteExplorerService private readonly _remoteExplorerService: IRemoteExplorerService
) {
super(
instantiationService,
......@@ -471,6 +473,7 @@ export class ExtensionService extends AbstractExtensionService implements IExten
// set the resolved authority
this._remoteAuthorityResolverService.setResolvedAuthority(resolvedAuthority.authority, resolvedAuthority.options);
this._remoteExplorerService.addDetected(resolvedAuthority.tunnelInformation?.detectedTunnels);
// monitor for breakage
const connection = this._remoteAgentService.getConnection();
......
......@@ -21,7 +21,7 @@ import { ExtHostExtensionService } from 'vs/workbench/api/worker/extHostExtensio
import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
import { ILogService } from 'vs/platform/log/common/log';
import { ExtHostLogService } from 'vs/workbench/api/worker/extHostLogService';
import { IExtHostTunnelService } from 'vs/workbench/api/common/extHostTunnelService';
import { IExtHostTunnelService, ExtHostTunnelService } from 'vs/workbench/api/common/extHostTunnelService';
// register singleton services
registerSingleton(ILogService, ExtHostLogService);
......@@ -34,6 +34,7 @@ registerSingleton(IExtHostDocumentsAndEditors, ExtHostDocumentsAndEditors);
registerSingleton(IExtHostStorage, ExtHostStorage);
registerSingleton(IExtHostExtensionService, ExtHostExtensionService);
registerSingleton(IExtHostSearch, ExtHostSearch);
registerSingleton(IExtHostTunnelService, ExtHostTunnelService);
// register services that only throw errors
function NotImplementedProxy<T>(name: ServiceIdentifier<T>): { new(): T } {
......@@ -54,4 +55,3 @@ registerSingleton(IExtHostTerminalService, WorkerExtHostTerminalService);
registerSingleton(IExtHostTask, WorkerExtHostTask);
registerSingleton(IExtHostDebugService, WorkerExtHostDebugService);
registerSingleton(IExtensionStoragePaths, class extends NotImplementedProxy(IExtensionStoragePaths) { whenReady = Promise.resolve(); });
registerSingleton(IExtHostTunnelService, class extends NotImplementedProxy(IExtHostTunnelService) { });
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册