@@ -7,7 +7,7 @@ import * as nls from 'vs/nls';
77import { Disposable } from 'vs/base/common/lifecycle' ;
88import { IChannel , IServerChannel , getDelayedChannel , IPCLogger } from 'vs/base/parts/ipc/common/ipc' ;
99import { Client } from 'vs/base/parts/ipc/common/ipc.net' ;
10- import { IEnvironmentService } from 'vs/platform/ environment/common/environment ' ;
10+ import { IWorkbenchEnvironmentService } from 'vs/workbench/services/ environment/common/environmentService ' ;
1111import { connectRemoteAgentManagement , IConnectionOptions , ISocketFactory , PersistenConnectionEvent } from 'vs/platform/remote/common/remoteAgentConnection' ;
1212import { IRemoteAgentConnection , IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService' ;
1313import { IRemoteAuthorityResolverService , RemoteAuthorityResolverError } from 'vs/platform/remote/common/remoteAuthorityResolver' ;
@@ -23,25 +23,37 @@ import { ISignService } from 'vs/platform/sign/common/sign';
2323import { ILogService } from 'vs/platform/log/common/log' ;
2424import { ITelemetryData } from 'vs/platform/telemetry/common/telemetry' ;
2525import { ExtensionIdentifier , IExtensionDescription } from 'vs/platform/extensions/common/extensions' ;
26+ import { IProductService } from 'vs/platform/product/common/productService' ;
2627
2728export abstract class AbstractRemoteAgentService extends Disposable implements IRemoteAgentService {
2829
2930 declare readonly _serviceBrand : undefined ;
3031
3132 public readonly socketFactory : ISocketFactory ;
33+ private readonly _connection : IRemoteAgentConnection | null ;
3234 private _environment : Promise < IRemoteAgentEnvironment | null > | null ;
3335
3436 constructor (
3537 socketFactory : ISocketFactory ,
36- @IEnvironmentService protected readonly _environmentService : IEnvironmentService ,
37- @IRemoteAuthorityResolverService private readonly _remoteAuthorityResolverService : IRemoteAuthorityResolverService
38+ @IWorkbenchEnvironmentService protected readonly _environmentService : IWorkbenchEnvironmentService ,
39+ @IProductService productService : IProductService ,
40+ @IRemoteAuthorityResolverService private readonly _remoteAuthorityResolverService : IRemoteAuthorityResolverService ,
41+ @ISignService signService : ISignService ,
42+ @ILogService logService : ILogService
3843 ) {
3944 super ( ) ;
4045 this . socketFactory = socketFactory ;
46+ if ( this . _environmentService . configuration . remoteAuthority ) {
47+ this . _connection = this . _register ( new RemoteAgentConnection ( this . _environmentService . configuration . remoteAuthority , productService . commit , this . socketFactory , this . _remoteAuthorityResolverService , signService , logService ) ) ;
48+ } else {
49+ this . _connection = null ;
50+ }
4151 this . _environment = null ;
4252 }
4353
44- abstract getConnection ( ) : IRemoteAgentConnection | null ;
54+ getConnection ( ) : IRemoteAgentConnection | null {
55+ return this . _connection ;
56+ }
4557
4658 getEnvironment ( ) : Promise < IRemoteAgentEnvironment | null > {
4759 return this . getRawEnvironment ( ) . then ( undefined , ( ) => null ) ;
0 commit comments