未验证 提交 588bc01b 编写于 作者: A Alex Dima

Split up getEnvironment() calls

上级 15e410b9
......@@ -42,7 +42,11 @@ export abstract class AbstractRemoteAgentService extends Disposable implements I
abstract getConnection(): IRemoteAgentConnection | null;
getEnvironment(bail?: boolean): Promise<IRemoteAgentEnvironment | null> {
getEnvironment(): Promise<IRemoteAgentEnvironment | null> {
return this.getRawEnvironment().then(undefined, () => null);
}
getRawEnvironment(): Promise<IRemoteAgentEnvironment | null> {
if (!this._environment) {
this._environment = this._withChannel(
async (channel, connection) => {
......@@ -53,7 +57,7 @@ export abstract class AbstractRemoteAgentService extends Disposable implements I
null
);
}
return bail ? this._environment : this._environment.then(undefined, () => null);
return this._environment;
}
getDiagnosticInfo(options: IDiagnosticInfoOptions): Promise<IDiagnosticInfo | undefined> {
......@@ -170,7 +174,7 @@ class RemoteConnectionFailureNotificationContribution implements IWorkbenchContr
@INotificationService notificationService: INotificationService,
) {
// Let's cover the case where connecting to fetch the remote extension info fails
remoteAgentService.getEnvironment(true)
remoteAgentService.getRawEnvironment()
.then(undefined, err => {
if (!RemoteAuthorityResolverError.isHandled(err)) {
notificationService.error(nls.localize('connectionError', "Failed to connect to the remote extension host server (Error: {0})", err ? err.message : ''));
......
......@@ -21,7 +21,14 @@ export interface IRemoteAgentService {
readonly socketFactory: ISocketFactory;
getConnection(): IRemoteAgentConnection | null;
getEnvironment(bail?: boolean): Promise<IRemoteAgentEnvironment | null>;
/**
* Get the remote environment. In case of an error, returns `null`.
*/
getEnvironment(): Promise<IRemoteAgentEnvironment | null>;
/**
* Get the remote environment. Can return an error.
*/
getRawEnvironment(): Promise<IRemoteAgentEnvironment | null>;
getDiagnosticInfo(options: IDiagnosticInfoOptions): Promise<IDiagnosticInfo | undefined>;
disableTelemetry(): Promise<void>;
logTelemetry(eventName: string, data?: ITelemetryData): Promise<void>;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册