Skip to content

Commit a584933

Browse files
committed
Move IRemoteAgentConnection to AbstractRemoteAgentService
1 parent 3271cfd commit a584933

3 files changed

Lines changed: 23 additions & 32 deletions

File tree

src/vs/workbench/services/remote/browser/remoteAgentServiceImpl.ts

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,16 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
7-
import { IRemoteAgentConnection, IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
7+
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
88
import { IRemoteAuthorityResolverService } from 'vs/platform/remote/common/remoteAuthorityResolver';
9-
import { AbstractRemoteAgentService, RemoteAgentConnection } from 'vs/workbench/services/remote/common/abstractRemoteAgentService';
9+
import { AbstractRemoteAgentService } from 'vs/workbench/services/remote/common/abstractRemoteAgentService';
1010
import { IProductService } from 'vs/platform/product/common/productService';
1111
import { IWebSocketFactory, BrowserSocketFactory } from 'vs/platform/remote/browser/browserSocketFactory';
1212
import { ISignService } from 'vs/platform/sign/common/sign';
1313
import { ILogService } from 'vs/platform/log/common/log';
1414

1515
export class RemoteAgentService extends AbstractRemoteAgentService implements IRemoteAgentService {
1616

17-
private readonly _connection: IRemoteAgentConnection | null = null;
18-
1917
constructor(
2018
webSocketFactory: IWebSocketFactory | null | undefined,
2119
@IWorkbenchEnvironmentService environmentService: IWorkbenchEnvironmentService,
@@ -24,15 +22,6 @@ export class RemoteAgentService extends AbstractRemoteAgentService implements IR
2422
@ISignService signService: ISignService,
2523
@ILogService logService: ILogService
2624
) {
27-
super(new BrowserSocketFactory(webSocketFactory), environmentService, remoteAuthorityResolverService);
28-
29-
const remoteAuthority = environmentService.configuration.remoteAuthority;
30-
if (remoteAuthority) {
31-
this._connection = this._register(new RemoteAgentConnection(remoteAuthority, productService.commit, this.socketFactory, remoteAuthorityResolverService, signService, logService));
32-
}
33-
}
34-
35-
getConnection(): IRemoteAgentConnection | null {
36-
return this._connection;
25+
super(new BrowserSocketFactory(webSocketFactory), environmentService, productService, remoteAuthorityResolverService, signService, logService);
3726
}
3827
}

src/vs/workbench/services/remote/common/abstractRemoteAgentService.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import * as nls from 'vs/nls';
77
import { Disposable } from 'vs/base/common/lifecycle';
88
import { IChannel, IServerChannel, getDelayedChannel, IPCLogger } from 'vs/base/parts/ipc/common/ipc';
99
import { 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';
1111
import { connectRemoteAgentManagement, IConnectionOptions, ISocketFactory, PersistenConnectionEvent } from 'vs/platform/remote/common/remoteAgentConnection';
1212
import { IRemoteAgentConnection, IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
1313
import { IRemoteAuthorityResolverService, RemoteAuthorityResolverError } from 'vs/platform/remote/common/remoteAuthorityResolver';
@@ -23,25 +23,37 @@ import { ISignService } from 'vs/platform/sign/common/sign';
2323
import { ILogService } from 'vs/platform/log/common/log';
2424
import { ITelemetryData } from 'vs/platform/telemetry/common/telemetry';
2525
import { ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensions/common/extensions';
26+
import { IProductService } from 'vs/platform/product/common/productService';
2627

2728
export 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);

src/vs/workbench/services/remote/electron-browser/remoteAgentServiceImpl.ts

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,23 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { IRemoteAgentConnection, IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
6+
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
77
import { IRemoteAuthorityResolverService } from 'vs/platform/remote/common/remoteAuthorityResolver';
88
import { IProductService } from 'vs/platform/product/common/productService';
99
import { nodeSocketFactory } from 'vs/platform/remote/node/nodeSocketFactory';
10-
import { AbstractRemoteAgentService, RemoteAgentConnection } from 'vs/workbench/services/remote/common/abstractRemoteAgentService';
10+
import { AbstractRemoteAgentService } from 'vs/workbench/services/remote/common/abstractRemoteAgentService';
1111
import { ISignService } from 'vs/platform/sign/common/sign';
1212
import { ILogService } from 'vs/platform/log/common/log';
1313
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
1414

1515
export class RemoteAgentService extends AbstractRemoteAgentService implements IRemoteAgentService {
16-
17-
private readonly _connection: IRemoteAgentConnection | null = null;
18-
1916
constructor(
2017
@IWorkbenchEnvironmentService environmentService: IWorkbenchEnvironmentService,
18+
@IProductService productService: IProductService,
2119
@IRemoteAuthorityResolverService remoteAuthorityResolverService: IRemoteAuthorityResolverService,
2220
@ISignService signService: ISignService,
2321
@ILogService logService: ILogService,
24-
@IProductService productService: IProductService
2522
) {
26-
super(nodeSocketFactory, environmentService, remoteAuthorityResolverService);
27-
if (environmentService.configuration.remoteAuthority) {
28-
this._connection = this._register(new RemoteAgentConnection(environmentService.configuration.remoteAuthority, productService.commit, nodeSocketFactory, remoteAuthorityResolverService, signService, logService));
29-
}
30-
}
31-
32-
getConnection(): IRemoteAgentConnection | null {
33-
return this._connection;
23+
super(nodeSocketFactory, environmentService, productService, remoteAuthorityResolverService, signService, logService);
3424
}
3525
}

0 commit comments

Comments
 (0)