mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-12 22:08:04 -05:00
Have a separate call for extension scanning (outside of remote agent environment)
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { OperatingSystem } from 'vs/base/common/platform';
|
||||
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
|
||||
export interface IRemoteAgentEnvironment {
|
||||
pid: number;
|
||||
@@ -18,7 +17,6 @@ export interface IRemoteAgentEnvironment {
|
||||
globalStorageHome: URI;
|
||||
workspaceStorageHome: URI;
|
||||
userHome: URI;
|
||||
extensions: IExtensionDescription[];
|
||||
os: OperatingSystem;
|
||||
}
|
||||
|
||||
|
||||
@@ -111,12 +111,13 @@ export class ExtensionService extends AbstractExtensionService implements IExten
|
||||
|
||||
protected async _scanAndHandleExtensions(): Promise<void> {
|
||||
// fetch the remote environment
|
||||
let [localExtensions, remoteEnv] = await Promise.all([
|
||||
let [localExtensions, remoteEnv, remoteExtensions] = await Promise.all([
|
||||
this._webExtensionsScannerService.scanExtensions().then(extensions => extensions.map(parseScannedExtension)),
|
||||
this._remoteAgentService.getEnvironment()
|
||||
this._remoteAgentService.getEnvironment(),
|
||||
this._remoteAgentService.scanExtensions()
|
||||
]);
|
||||
localExtensions = this._checkEnabledAndProposedAPI(localExtensions);
|
||||
let remoteExtensions = remoteEnv ? this._checkEnabledAndProposedAPI(remoteEnv.extensions) : [];
|
||||
remoteExtensions = this._checkEnabledAndProposedAPI(remoteExtensions);
|
||||
|
||||
const remoteAgentConnection = this._remoteAgentService.getConnection();
|
||||
this._runningLocation = _determineRunningLocation(this._productService, this._configService, localExtensions, remoteExtensions, Boolean(remoteEnv && remoteAgentConnection));
|
||||
|
||||
@@ -500,6 +500,7 @@ export class ExtensionService extends AbstractExtensionService implements IExten
|
||||
|
||||
const localExtensions = this._checkEnabledAndProposedAPI(await this._scanAllLocalExtensions());
|
||||
let remoteEnv: IRemoteAgentEnvironment | null = null;
|
||||
let remoteExtensions: IExtensionDescription[] = [];
|
||||
|
||||
if (remoteAuthority) {
|
||||
let resolverResult: ResolverResult;
|
||||
@@ -538,7 +539,11 @@ export class ExtensionService extends AbstractExtensionService implements IExten
|
||||
}
|
||||
|
||||
// fetch the remote environment
|
||||
remoteEnv = await this._remoteAgentService.getEnvironment();
|
||||
[remoteEnv, remoteExtensions] = await Promise.all([
|
||||
this._remoteAgentService.getEnvironment(),
|
||||
this._remoteAgentService.scanExtensions()
|
||||
]);
|
||||
remoteExtensions = this._checkEnabledAndProposedAPI(remoteExtensions);
|
||||
|
||||
if (!remoteEnv) {
|
||||
this._notificationService.notify({ severity: Severity.Error, message: nls.localize('getEnvironmentFailure', "Could not fetch remote environment") });
|
||||
@@ -551,9 +556,7 @@ export class ExtensionService extends AbstractExtensionService implements IExten
|
||||
await this._startLocalExtensionHost(localExtensions, remoteAuthority, remoteEnv);
|
||||
}
|
||||
|
||||
private async _startLocalExtensionHost(localExtensions: IExtensionDescription[], remoteAuthority: string | undefined = undefined, remoteEnv: IRemoteAgentEnvironment | null = null): Promise<void> {
|
||||
|
||||
let remoteExtensions = remoteEnv ? this._checkEnabledAndProposedAPI(remoteEnv.extensions) : [];
|
||||
private async _startLocalExtensionHost(localExtensions: IExtensionDescription[], remoteAuthority: string | undefined = undefined, remoteEnv: IRemoteAgentEnvironment | null = null, remoteExtensions: IExtensionDescription[] = []): Promise<void> {
|
||||
|
||||
this._runningLocation = _determineRunningLocation(this._productService, this._configurationService, localExtensions, remoteExtensions, Boolean(remoteAuthority), this._enableLocalWebWorker);
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import { Emitter } from 'vs/base/common/event';
|
||||
import { ISignService } from 'vs/platform/sign/common/sign';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { ITelemetryData } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
|
||||
export abstract class AbstractRemoteAgentService extends Disposable implements IRemoteAgentService {
|
||||
|
||||
@@ -50,7 +51,7 @@ export abstract class AbstractRemoteAgentService extends Disposable implements I
|
||||
if (!this._environment) {
|
||||
this._environment = this._withChannel(
|
||||
async (channel, connection) => {
|
||||
const env = await RemoteExtensionEnvironmentChannelClient.getEnvironmentData(channel, connection.remoteAuthority, this._environmentService.extensionDevelopmentLocationURI);
|
||||
const env = await RemoteExtensionEnvironmentChannelClient.getEnvironmentData(channel, connection.remoteAuthority);
|
||||
this._remoteAuthorityResolverService._setAuthorityConnectionToken(connection.remoteAuthority, env.connectionToken);
|
||||
return env;
|
||||
},
|
||||
@@ -60,6 +61,13 @@ export abstract class AbstractRemoteAgentService extends Disposable implements I
|
||||
return this._environment;
|
||||
}
|
||||
|
||||
scanExtensions(skipExtensions: ExtensionIdentifier[] = []): Promise<IExtensionDescription[]> {
|
||||
return this._withChannel(
|
||||
(channel, connection) => RemoteExtensionEnvironmentChannelClient.scanExtensions(channel, connection.remoteAuthority, this._environmentService.extensionDevelopmentLocationURI, skipExtensions),
|
||||
[]
|
||||
).then(undefined, () => []);
|
||||
}
|
||||
|
||||
getDiagnosticInfo(options: IDiagnosticInfoOptions): Promise<IDiagnosticInfo | undefined> {
|
||||
return this._withChannel(
|
||||
channel => RemoteExtensionEnvironmentChannelClient.getDiagnosticInfo(channel, options),
|
||||
|
||||
@@ -6,15 +6,20 @@
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
import { URI, UriComponents } from 'vs/base/common/uri';
|
||||
import { IChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
import { IExtensionDescription, ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
|
||||
import { IRemoteAgentEnvironment } from 'vs/platform/remote/common/remoteAgentEnvironment';
|
||||
import { IDiagnosticInfoOptions, IDiagnosticInfo } from 'vs/platform/diagnostics/common/diagnostics';
|
||||
import { ITelemetryData } from 'vs/platform/telemetry/common/telemetry';
|
||||
|
||||
export interface IGetEnvironmentDataArguments {
|
||||
remoteAuthority: string;
|
||||
}
|
||||
|
||||
export interface IScanExtensionsArguments {
|
||||
language: string;
|
||||
remoteAuthority: string;
|
||||
extensionDevelopmentPath: UriComponents[] | undefined;
|
||||
skipExtensions: ExtensionIdentifier[];
|
||||
}
|
||||
|
||||
export interface IRemoteAgentEnvironmentDTO {
|
||||
@@ -28,17 +33,14 @@ export interface IRemoteAgentEnvironmentDTO {
|
||||
globalStorageHome: UriComponents;
|
||||
workspaceStorageHome: UriComponents;
|
||||
userHome: UriComponents;
|
||||
extensions: IExtensionDescription[];
|
||||
os: platform.OperatingSystem;
|
||||
}
|
||||
|
||||
export class RemoteExtensionEnvironmentChannelClient {
|
||||
|
||||
static async getEnvironmentData(channel: IChannel, remoteAuthority: string, extensionDevelopmentPath?: URI[]): Promise<IRemoteAgentEnvironment> {
|
||||
static async getEnvironmentData(channel: IChannel, remoteAuthority: string): Promise<IRemoteAgentEnvironment> {
|
||||
const args: IGetEnvironmentDataArguments = {
|
||||
language: platform.language,
|
||||
remoteAuthority,
|
||||
extensionDevelopmentPath
|
||||
remoteAuthority
|
||||
};
|
||||
|
||||
const data = await channel.call<IRemoteAgentEnvironmentDTO>('getEnvironmentData', args);
|
||||
@@ -54,11 +56,24 @@ export class RemoteExtensionEnvironmentChannelClient {
|
||||
globalStorageHome: URI.revive(data.globalStorageHome),
|
||||
workspaceStorageHome: URI.revive(data.workspaceStorageHome),
|
||||
userHome: URI.revive(data.userHome),
|
||||
extensions: data.extensions.map(ext => { (<any>ext).extensionLocation = URI.revive(ext.extensionLocation); return ext; }),
|
||||
os: data.os
|
||||
};
|
||||
}
|
||||
|
||||
static async scanExtensions(channel: IChannel, remoteAuthority: string, extensionDevelopmentPath: URI[] | undefined, skipExtensions: ExtensionIdentifier[]): Promise<IExtensionDescription[]> {
|
||||
const args: IScanExtensionsArguments = {
|
||||
language: platform.language,
|
||||
remoteAuthority,
|
||||
extensionDevelopmentPath,
|
||||
skipExtensions
|
||||
};
|
||||
|
||||
const extensions = await channel.call<IExtensionDescription[]>('scanExtensions', args);
|
||||
extensions.forEach(ext => { (<any>ext).extensionLocation = URI.revive(ext.extensionLocation); });
|
||||
|
||||
return extensions;
|
||||
}
|
||||
|
||||
static getDiagnosticInfo(channel: IChannel, options: IDiagnosticInfoOptions): Promise<IDiagnosticInfo> {
|
||||
return channel.call<IDiagnosticInfo>('getDiagnosticInfo', options);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import { IDiagnosticInfoOptions, IDiagnosticInfo } from 'vs/platform/diagnostics
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { PersistenConnectionEvent as PersistentConnectionEvent, ISocketFactory } from 'vs/platform/remote/common/remoteAgentConnection';
|
||||
import { ITelemetryData } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
|
||||
export const RemoteExtensionLogFileName = 'remoteagent';
|
||||
|
||||
@@ -29,6 +30,10 @@ export interface IRemoteAgentService {
|
||||
* Get the remote environment. Can return an error.
|
||||
*/
|
||||
getRawEnvironment(): Promise<IRemoteAgentEnvironment | null>;
|
||||
/**
|
||||
* Scan remote extensions.
|
||||
*/
|
||||
scanExtensions(skipExtensions?: ExtensionIdentifier[]): Promise<IExtensionDescription[]>;
|
||||
getDiagnosticInfo(options: IDiagnosticInfoOptions): Promise<IDiagnosticInfo | undefined>;
|
||||
disableTelemetry(): Promise<void>;
|
||||
logTelemetry(eventName: string, data?: ITelemetryData): Promise<void>;
|
||||
|
||||
Reference in New Issue
Block a user