introduce web extension management server

This commit is contained in:
Sandeep Somavarapu 2020-06-18 16:02:35 +02:00
parent 7c574546f7
commit 59bbd934ed
15 changed files with 84 additions and 70 deletions

View file

@ -26,7 +26,7 @@ import { Query } from 'vs/workbench/contrib/extensions/common/extensionQuery';
import { IFileService, IFileContent } from 'vs/platform/files/common/files';
import { IWorkspaceContextService, WorkbenchState, IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
import { IHostService } from 'vs/workbench/services/host/browser/host';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { IExtensionService, toExtension } from 'vs/workbench/services/extensions/common/extensions';
import { URI } from 'vs/base/common/uri';
import { CommandsRegistry, ICommandService } from 'vs/platform/commands/common/commands';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
@ -1261,7 +1261,7 @@ export class ReloadAction extends ExtensionAction {
const isUninstalled = this.extension.state === ExtensionState.Uninstalled;
const runningExtension = this._runningExtensions.filter(e => areSameExtensions({ id: e.identifier.value, uuid: e.uuid }, this.extension!.identifier))[0];
const isSameExtensionRunning = runningExtension && this.extension.server === this.extensionManagementServerService.getExtensionManagementServer(runningExtension.extensionLocation);
const isSameExtensionRunning = runningExtension && this.extension.server === this.extensionManagementServerService.getExtensionManagementServer(toExtension(runningExtension));
if (isUninstalled) {
if (isSameExtensionRunning && !this.extensionService.canRemoveExtension(runningExtension)) {
@ -1282,7 +1282,7 @@ export class ReloadAction extends ExtensionAction {
if (this.extensionService.canAddExtension(toExtensionDescription(this.extension.local))) {
return;
}
const runningExtensionServer = this.extensionManagementServerService.getExtensionManagementServer(runningExtension.extensionLocation);
const runningExtensionServer = this.extensionManagementServerService.getExtensionManagementServer(toExtension(runningExtension));
if (isSameExtensionRunning) {
// Different version of same extension is running. Requires reload to run the current version
@ -2591,7 +2591,7 @@ export class StatusLabelAction extends Action implements IExtensionContainer {
};
const canRemoveExtension = () => {
if (this.extension!.local) {
if (runningExtensions.every(e => !(areSameExtensions({ id: e.identifier.value, uuid: e.uuid }, this.extension!.identifier) && this.extension!.server === this.extensionManagementServerService.getExtensionManagementServer(e.extensionLocation)))) {
if (runningExtensions.every(e => !(areSameExtensions({ id: e.identifier.value, uuid: e.uuid }, this.extension!.identifier) && this.extension!.server === this.extensionManagementServerService.getExtensionManagementServer(toExtension(e))))) {
return true;
}
return this.extensionService.canRemoveExtension(toExtensionDescription(this.extension!.local));
@ -2823,7 +2823,7 @@ export class SystemDisabledWarningAction extends ExtensionAction {
}
if (this.extensionManagementServerService.localExtensionManagementServer && this.extensionManagementServerService.remoteExtensionManagementServer) {
const runningExtension = this._runningExtensions.filter(e => areSameExtensions({ id: e.identifier.value, uuid: e.uuid }, this.extension!.identifier))[0];
const runningExtensionServer = runningExtension ? this.extensionManagementServerService.getExtensionManagementServer(runningExtension.extensionLocation) : null;
const runningExtensionServer = runningExtension ? this.extensionManagementServerService.getExtensionManagementServer(toExtension(runningExtension)) : null;
if (this.extension.server === this.extensionManagementServerService.localExtensionManagementServer && runningExtensionServer === this.extensionManagementServerService.remoteExtensionManagementServer) {
if (prefersExecuteOnWorkspace(this.extension.local!.manifest, this.productService, this.configurationService)) {
this.class = `${SystemDisabledWarningAction.INFO_CLASS}`;

View file

@ -17,7 +17,7 @@ import { IExtension, ExtensionContainers, ExtensionState, IExtensionsWorkbenchSe
import { InstallAction, UpdateAction, ManageExtensionAction, ReloadAction, MaliciousStatusLabelAction, ExtensionActionViewItem, StatusLabelAction, RemoteInstallAction, SystemDisabledWarningAction, ExtensionToolTipAction, LocalInstallAction, SyncIgnoredIconAction } from 'vs/workbench/contrib/extensions/browser/extensionsActions';
import { areSameExtensions } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
import { Label, RatingsWidget, InstallCountWidget, RecommendationWidget, RemoteBadgeWidget, TooltipWidget, ExtensionPackCountWidget as ExtensionPackBadgeWidget } from 'vs/workbench/contrib/extensions/browser/extensionsWidgets';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { IExtensionService, toExtension } from 'vs/workbench/services/extensions/common/extensions';
import { IExtensionManagementServerService } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { isLanguagePackExtension } from 'vs/platform/extensions/common/extensions';
@ -164,7 +164,7 @@ export class Renderer implements IPagedRenderer<IExtension, ITemplateData> {
isDisabled = false;
if (extension.local && !isLanguagePackExtension(extension.local.manifest)) {
const runningExtension = runningExtensions.filter(e => areSameExtensions({ id: e.identifier.value, uuid: e.uuid }, extension.identifier))[0];
isDisabled = !(runningExtension && extension.server === this.extensionManagementServerService.getExtensionManagementServer(runningExtension.extensionLocation));
isDisabled = !(runningExtension && extension.server === this.extensionManagementServerService.getExtensionManagementServer(toExtension(runningExtension)));
}
toggleClass(data.root, 'disabled', isDisabled);
};

View file

@ -195,19 +195,19 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio
const getOutdatedViewName = (): string => getViewName(localize('outdated', "Outdated"), server);
const onDidChangeServerLabel: EventOf<void> = EventOf.map(this.labelService.onDidChangeFormatters, () => undefined);
return [{
id: `extensions.${server.authority}.installed`,
id: `extensions.${server.id}.installed`,
get name() { return getInstalledViewName(); },
ctorDescriptor: new SyncDescriptor(ServerExtensionsView, [server, EventOf.map<void, string>(onDidChangeServerLabel, () => getInstalledViewName())]),
when: ContextKeyExpr.and(ContextKeyExpr.has('searchInstalledExtensions')),
weight: 100
}, {
id: `extensions.${server.authority}.outdated`,
id: `extensions.${server.id}.outdated`,
get name() { return getOutdatedViewName(); },
ctorDescriptor: new SyncDescriptor(ServerExtensionsView, [server, EventOf.map<void, string>(onDidChangeServerLabel, () => getOutdatedViewName())]),
when: ContextKeyExpr.and(ContextKeyExpr.has('searchOutdatedExtensions')),
weight: 100
}, {
id: `extensions.${server.authority}.default`,
id: `extensions.${server.id}.default`,
get name() { return getInstalledViewName(); },
ctorDescriptor: new SyncDescriptor(ServerExtensionsView, [server, EventOf.map<void, string>(onDidChangeServerLabel, () => getInstalledViewName())]),
when: ContextKeyExpr.and(ContextKeyExpr.has('defaultExtensionViews'), ContextKeyExpr.has('hasInstalledExtensions'), RemoteNameContext.notEqualsTo('')),

View file

@ -19,7 +19,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { Delegate, Renderer, IExtensionsViewState } from 'vs/workbench/contrib/extensions/browser/extensionsList';
import { IExtension, IExtensionsWorkbenchService, ExtensionState } from 'vs/workbench/contrib/extensions/common/extensions';
import { Query } from 'vs/workbench/contrib/extensions/common/extensionQuery';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { IExtensionService, toExtension } from 'vs/workbench/services/extensions/common/extensions';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { attachBadgeStyler } from 'vs/platform/theme/common/styler';
import { IViewletViewOptions } from 'vs/workbench/browser/parts/views/viewsViewlet';
@ -373,9 +373,9 @@ export class ExtensionsListView extends ViewPane {
const runningExtensionsById = runningExtensions.reduce((result, e) => { result.set(ExtensionIdentifier.toKey(e.identifier.value), e); return result; }, new Map<string, IExtensionDescription>());
result = result.sort((e1, e2) => {
const running1 = runningExtensionsById.get(ExtensionIdentifier.toKey(e1.identifier.id));
const isE1Running = running1 && this.extensionManagementServerService.getExtensionManagementServer(running1.extensionLocation) === e1.server;
const isE1Running = running1 && this.extensionManagementServerService.getExtensionManagementServer(toExtension(running1)) === e1.server;
const running2 = runningExtensionsById.get(ExtensionIdentifier.toKey(e2.identifier.id));
const isE2Running = running2 && this.extensionManagementServerService.getExtensionManagementServer(running2.extensionLocation) === e2.server;
const isE2Running = running2 && this.extensionManagementServerService.getExtensionManagementServer(toExtension(running2)) === e2.server;
if ((isE1Running && isE2Running)) {
return e1.displayName.localeCompare(e2.displayName);
}

View file

@ -34,7 +34,7 @@ import { URI } from 'vs/base/common/uri';
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
import { RemoteAgentService } from 'vs/workbench/services/remote/electron-browser/remoteAgentServiceImpl';
import { ExtensionIdentifier, IExtensionContributions, ExtensionType, IExtensionDescription } from 'vs/platform/extensions/common/extensions';
import { ExtensionIdentifier, IExtensionContributions, ExtensionType, IExtensionDescription, IExtension } from 'vs/platform/extensions/common/extensions';
import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService';
import { CancellationToken } from 'vs/base/common/cancellation';
import { ILabelService, IFormatterChangeEvent } from 'vs/platform/label/common/label';
@ -99,7 +99,7 @@ async function setupTest() {
instantiationService.stub(IRemoteAgentService, RemoteAgentService);
instantiationService.stub(IExtensionManagementServerService, new class extends ExtensionManagementServerService {
#localExtensionManagementServer: IExtensionManagementServer = { extensionManagementService: instantiationService.get(IExtensionManagementService), label: 'local', authority: 'vscode-local' };
#localExtensionManagementServer: IExtensionManagementServer = { extensionManagementService: instantiationService.get(IExtensionManagementService), label: 'local', id: 'vscode-local' };
constructor() {
super(instantiationService.get(ISharedProcessService), instantiationService.get(IRemoteAgentService), instantiationService.get(IExtensionGalleryService), instantiationService.get(IConfigurationService), instantiationService.get(IProductService), instantiationService.get(ILogService), instantiationService.get(ILabelService));
}
@ -2518,7 +2518,7 @@ function aPage<T>(...objects: T[]): IPager<T> {
function aSingleRemoteExtensionManagementServerService(instantiationService: TestInstantiationService, remoteExtensionManagementService?: IExtensionManagementService): IExtensionManagementServerService {
const remoteExtensionManagementServer: IExtensionManagementServer = {
authority: 'vscode-remote',
id: 'vscode-remote',
label: 'remote',
extensionManagementService: remoteExtensionManagementService || createExtensionManagementService()
};
@ -2526,8 +2526,9 @@ function aSingleRemoteExtensionManagementServerService(instantiationService: Tes
_serviceBrand: undefined,
localExtensionManagementServer: null,
remoteExtensionManagementServer,
getExtensionManagementServer: (location: URI) => {
if (location.scheme === REMOTE_HOST_SCHEME) {
webExtensionManagementServer: null,
getExtensionManagementServer: (extension: IExtension) => {
if (extension.location.scheme === REMOTE_HOST_SCHEME) {
return remoteExtensionManagementServer;
}
return null;
@ -2537,12 +2538,12 @@ function aSingleRemoteExtensionManagementServerService(instantiationService: Tes
function aMultiExtensionManagementServerService(instantiationService: TestInstantiationService, localExtensionManagementService?: IExtensionManagementService, remoteExtensionManagementService?: IExtensionManagementService): IExtensionManagementServerService {
const localExtensionManagementServer: IExtensionManagementServer = {
authority: 'vscode-local',
id: 'vscode-local',
label: 'local',
extensionManagementService: localExtensionManagementService || createExtensionManagementService()
};
const remoteExtensionManagementServer: IExtensionManagementServer = {
authority: 'vscode-remote',
id: 'vscode-remote',
label: 'remote',
extensionManagementService: remoteExtensionManagementService || createExtensionManagementService()
};
@ -2550,14 +2551,15 @@ function aMultiExtensionManagementServerService(instantiationService: TestInstan
_serviceBrand: undefined,
localExtensionManagementServer,
remoteExtensionManagementServer,
getExtensionManagementServer: (location: URI) => {
if (location.scheme === Schemas.file) {
webExtensionManagementServer: null,
getExtensionManagementServer: (extension: IExtension) => {
if (extension.location.scheme === Schemas.file) {
return localExtensionManagementServer;
}
if (location.scheme === REMOTE_HOST_SCHEME) {
if (extension.location.scheme === REMOTE_HOST_SCHEME) {
return remoteExtensionManagementServer;
}
return null;
throw new Error('');
}
};
}

View file

@ -99,7 +99,7 @@ suite('ExtensionsListView Tests', () => {
instantiationService.stub(IMenuService, new TestMenuService());
instantiationService.stub(IExtensionManagementServerService, new class extends ExtensionManagementServerService {
#localExtensionManagementServer: IExtensionManagementServer = { extensionManagementService: instantiationService.get(IExtensionManagementService), label: 'local', authority: 'vscode-local' };
#localExtensionManagementServer: IExtensionManagementServer = { extensionManagementService: instantiationService.get(IExtensionManagementService), label: 'local', id: 'vscode-local' };
constructor() {
super(instantiationService.get(ISharedProcessService), instantiationService.get(IRemoteAgentService), instantiationService.get(IExtensionGalleryService), instantiationService.get(IConfigurationService), instantiationService.get(IProductService), instantiationService.get(ILogService), instantiationService.get(ILabelService));
}

View file

@ -138,7 +138,7 @@ export class ExtensionEnablementService extends Disposable implements IWorkbench
private _isDisabledByExtensionKind(extension: IExtension): boolean {
if (this.extensionManagementServerService.remoteExtensionManagementServer) {
const server = this.extensionManagementServerService.getExtensionManagementServer(extension.location);
const server = this.extensionManagementServerService.getExtensionManagementServer(extension);
for (const extensionKind of getExtensionKind(extension.manifest, this.productService, this.configurationService)) {
if (extensionKind === 'ui') {
if (this.extensionManagementServerService.localExtensionManagementServer && this.extensionManagementServerService.localExtensionManagementServer === server) {

View file

@ -14,16 +14,17 @@ import { IStringDictionary } from 'vs/base/common/collections';
export const IExtensionManagementServerService = createDecorator<IExtensionManagementServerService>('extensionManagementServerService');
export interface IExtensionManagementServer {
extensionManagementService: IExtensionManagementService;
authority: string;
id: string;
label: string;
extensionManagementService: IExtensionManagementService;
}
export interface IExtensionManagementServerService {
readonly _serviceBrand: undefined;
readonly localExtensionManagementServer: IExtensionManagementServer | null;
readonly remoteExtensionManagementServer: IExtensionManagementServer | null;
getExtensionManagementServer(location: URI): IExtensionManagementServer | null;
readonly webExtensionManagementServer: IExtensionManagementServer | null;
getExtensionManagementServer(extension: IExtension): IExtensionManagementServer | null;
}
export const enum EnablementState {

View file

@ -4,7 +4,6 @@
*--------------------------------------------------------------------------------------------*/
import { localize } from 'vs/nls';
import { URI } from 'vs/base/common/uri';
import { IExtensionManagementServer, IExtensionManagementServerService } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
import { ExtensionManagementChannelClient } from 'vs/platform/extensionManagement/common/extensionManagementIpc';
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
@ -12,6 +11,10 @@ import { REMOTE_HOST_SCHEME } from 'vs/platform/remote/common/remoteHosts';
import { IChannel } from 'vs/base/parts/ipc/common/ipc';
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
import { ILabelService } from 'vs/platform/label/common/label';
import { isWeb } from 'vs/base/common/platform';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { WebExtensionManagementService } from 'vs/workbench/services/extensionManagement/common/webExtensionManagementService';
import { IExtension } from 'vs/platform/extensions/common/extensions';
export class ExtensionManagementServerService implements IExtensionManagementServerService {
@ -19,27 +22,40 @@ export class ExtensionManagementServerService implements IExtensionManagementSer
readonly localExtensionManagementServer: IExtensionManagementServer | null = null;
readonly remoteExtensionManagementServer: IExtensionManagementServer | null = null;
readonly webExtensionManagementServer: IExtensionManagementServer | null = null;
constructor(
@IRemoteAgentService remoteAgentService: IRemoteAgentService,
@ILabelService labelService: ILabelService,
@IInstantiationService instantiationService: IInstantiationService,
) {
const remoteAgentConnection = remoteAgentService.getConnection();
if (remoteAgentConnection) {
const extensionManagementService = new ExtensionManagementChannelClient(remoteAgentConnection!.getChannel<IChannel>('extensions'));
this.remoteExtensionManagementServer = {
authority: remoteAgentConnection.remoteAuthority,
id: 'remote',
extensionManagementService,
get label() { return labelService.getHostLabel(REMOTE_HOST_SCHEME, remoteAgentConnection!.remoteAuthority) || localize('remote', "Remote"); }
};
}
if (isWeb) {
const extensionManagementService = instantiationService.createInstance(WebExtensionManagementService);
this.webExtensionManagementServer = {
id: 'web',
extensionManagementService,
label: localize('web', "Web")
};
}
}
getExtensionManagementServer(location: URI): IExtensionManagementServer | null {
if (location.scheme === REMOTE_HOST_SCHEME) {
return this.remoteExtensionManagementServer;
getExtensionManagementServer(extension: IExtension): IExtensionManagementServer {
if (extension.location.scheme === REMOTE_HOST_SCHEME) {
return this.remoteExtensionManagementServer!;
}
return null;
if (this.webExtensionManagementServer) {
return this.webExtensionManagementServer;
}
throw new Error(`Invalid Extension ${extension.location}`);
}
}

View file

@ -229,6 +229,6 @@ export class ExtensionManagementService extends Disposable implements IExtension
}
private getServer(extension: ILocalExtension): IExtensionManagementServer | null {
return this.extensionManagementServerService.getExtensionManagementServer(extension.location);
return this.extensionManagementServerService.getExtensionManagementServer(extension);
}
}

View file

@ -4,18 +4,13 @@
*--------------------------------------------------------------------------------------------*/
import { ExtensionType, IExtensionIdentifier, IExtensionManifest } from 'vs/platform/extensions/common/extensions';
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
import { IExtensionManagementService, ILocalExtension, InstallExtensionEvent, DidInstallExtensionEvent, DidUninstallExtensionEvent, IGalleryExtension, IReportedExtension, IGalleryMetadata } from 'vs/platform/extensionManagement/common/extensionManagement';
import builtinExtensions from 'vs/platform/extensions/common/builtinExtensions';
import { Event } from 'vs/base/common/event';
import { URI } from 'vs/base/common/uri';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
export const IWebExtensionManagementService = createDecorator<IWebExtensionManagementService>('IWebExtensionManagementService');
export interface IWebExtensionManagementService extends IExtensionManagementService { }
export class WebExtensionManagementService implements IWebExtensionManagementService {
export class WebExtensionManagementService implements IExtensionManagementService {
declare readonly _serviceBrand: undefined;
@ -66,5 +61,3 @@ export class WebExtensionManagementService implements IWebExtensionManagementSer
updateMetadata(local: ILocalExtension, metadata: IGalleryMetadata): Promise<ILocalExtension> { throw new Error('unsupported'); }
}
registerSingleton(IWebExtensionManagementService, WebExtensionManagementService, true);

View file

@ -5,7 +5,6 @@
import { localize } from 'vs/nls';
import { Schemas } from 'vs/base/common/network';
import { URI } from 'vs/base/common/uri';
import { IExtensionGalleryService } from 'vs/platform/extensionManagement/common/extensionManagement';
import { IExtensionManagementServer, IExtensionManagementServerService } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
import { ExtensionManagementChannelClient } from 'vs/platform/extensionManagement/common/extensionManagementIpc';
@ -19,19 +18,16 @@ import { RemoteExtensionManagementChannelClient } from 'vs/workbench/services/ex
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IProductService } from 'vs/platform/product/common/productService';
import { ILabelService } from 'vs/platform/label/common/label';
const localExtensionManagementServerAuthority: string = 'vscode-local';
import { IExtension } from 'vs/platform/extensions/common/extensions';
export class ExtensionManagementServerService implements IExtensionManagementServerService {
declare readonly _serviceBrand: undefined;
private readonly _localExtensionManagementServer: IExtensionManagementServer;
public get localExtensionManagementServer(): IExtensionManagementServer {
return this._localExtensionManagementServer;
}
public get localExtensionManagementServer(): IExtensionManagementServer { return this._localExtensionManagementServer; }
readonly remoteExtensionManagementServer: IExtensionManagementServer | null = null;
readonly isSingleServer: boolean = false;
readonly webExtensionManagementServer: IExtensionManagementServer | null = null;
constructor(
@ISharedProcessService sharedProcessService: ISharedProcessService,
@ -44,26 +40,26 @@ export class ExtensionManagementServerService implements IExtensionManagementSer
) {
const localExtensionManagementService = new ExtensionManagementChannelClient(sharedProcessService.getChannel('extensions'));
this._localExtensionManagementServer = { extensionManagementService: localExtensionManagementService, authority: localExtensionManagementServerAuthority, label: localize('local', "Local") };
this._localExtensionManagementServer = { extensionManagementService: localExtensionManagementService, id: 'local', label: localize('local', "Local") };
const remoteAgentConnection = remoteAgentService.getConnection();
if (remoteAgentConnection) {
const extensionManagementService = new RemoteExtensionManagementChannelClient(remoteAgentConnection.getChannel<IChannel>('extensions'), this.localExtensionManagementServer.extensionManagementService, galleryService, logService, configurationService, productService);
this.remoteExtensionManagementServer = {
authority: remoteAgentConnection.remoteAuthority,
id: 'remote',
extensionManagementService,
get label() { return labelService.getHostLabel(REMOTE_HOST_SCHEME, remoteAgentConnection!.remoteAuthority) || localize('remote', "Remote"); }
};
}
}
getExtensionManagementServer(location: URI): IExtensionManagementServer | null {
if (location.scheme === Schemas.file) {
getExtensionManagementServer(extension: IExtension): IExtensionManagementServer {
if (extension.location.scheme === Schemas.file) {
return this.localExtensionManagementServer;
}
if (location.scheme === REMOTE_HOST_SCHEME) {
if (this.remoteExtensionManagementServer && extension.location.scheme === REMOTE_HOST_SCHEME) {
return this.remoteExtensionManagementServer;
}
return null;
throw new Error(`Invalid Extension ${extension.location}`);
}
}

View file

@ -526,7 +526,7 @@ suite('ExtensionEnablementService Test', () => {
function anExtensionManagementServer(authority: string, instantiationService: TestInstantiationService): IExtensionManagementServer {
return {
authority,
id: authority,
label: authority,
extensionManagementService: instantiationService.get(IExtensionManagementService)
};
@ -543,14 +543,15 @@ function anExtensionManagementServerService(localExtensionManagementServer: IExt
_serviceBrand: undefined,
localExtensionManagementServer,
remoteExtensionManagementServer,
getExtensionManagementServer: (location: URI) => {
if (location.scheme === Schemas.file) {
webExtensionManagementServer: null,
getExtensionManagementServer: (extension: IExtension) => {
if (extension.location.scheme === Schemas.file) {
return localExtensionManagementServer;
}
if (location.scheme === REMOTE_HOST_SCHEME) {
if (extension.location.scheme === REMOTE_HOST_SCHEME) {
return remoteExtensionManagementServer;
}
return null;
throw new Error(`Invalid Extension ${extension.location}`);
}
};
}

View file

@ -5,7 +5,7 @@
import * as nls from 'vs/nls';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { IWorkbenchExtensionEnablementService } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
import { IWorkbenchExtensionEnablementService, IExtensionManagementServerService } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
@ -27,7 +27,6 @@ import { Schemas } from 'vs/base/common/network';
import { DisposableStore } from 'vs/base/common/lifecycle';
import { DeltaExtensionsResult } from 'vs/workbench/services/extensions/common/extensionDescriptionRegistry';
import { IRemoteAuthorityResolverService } from 'vs/platform/remote/common/remoteAuthorityResolver';
import { IWebExtensionManagementService } from 'vs/workbench/services/extensionManagement/common/webExtensionManagementService';
export class ExtensionService extends AbstractExtensionService implements IExtensionService {
@ -45,7 +44,7 @@ export class ExtensionService extends AbstractExtensionService implements IExten
@IRemoteAuthorityResolverService private readonly _remoteAuthorityResolverService: IRemoteAuthorityResolverService,
@IRemoteAgentService private readonly _remoteAgentService: IRemoteAgentService,
@IConfigurationService private readonly _configService: IConfigurationService,
@IWebExtensionManagementService private readonly _webExtensionManagementService: IWebExtensionManagementService,
@IExtensionManagementServerService private readonly _extensionManagementServerService: IExtensionManagementServerService,
) {
super(
instantiationService,
@ -105,7 +104,9 @@ export class ExtensionService extends AbstractExtensionService implements IExten
// fetch the remote environment
let [remoteEnv, localExtensions] = await Promise.all([
this._remoteAgentService.getEnvironment(),
this._webExtensionManagementService.getInstalled().then(extensions => extensions.map(toExtensionDescription))
this._extensionManagementServerService.webExtensionManagementServer
? this._extensionManagementServerService.webExtensionManagementServer.extensionManagementService.getInstalled().then(extensions => extensions.map(toExtensionDescription))
: Promise.resolve([])
]);
let result: DeltaExtensionsResult;

View file

@ -11,7 +11,7 @@ import * as nls from 'vs/nls';
import { runWhenIdle } from 'vs/base/common/async';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { IExtensionManagementService, IExtensionGalleryService } from 'vs/platform/extensionManagement/common/extensionManagement';
import { IWorkbenchExtensionEnablementService, EnablementState } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
import { IWorkbenchExtensionEnablementService, EnablementState, IExtensionManagementServerService } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IInitDataProvider, RemoteExtensionHost } from 'vs/workbench/services/extensions/common/remoteExtensionHost';
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
@ -40,7 +40,6 @@ import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
import { Registry } from 'vs/platform/registry/common/platform';
import { Extensions as ActionExtensions, IWorkbenchActionRegistry } from 'vs/workbench/common/actions';
import { getRemoteName } from 'vs/platform/remote/common/remoteHosts';
import { IWebExtensionManagementService } from 'vs/workbench/services/extensionManagement/common/webExtensionManagementService';
class DeltaExtensionsQueueItem {
constructor(
@ -69,7 +68,7 @@ export class ExtensionService extends AbstractExtensionService implements IExten
@IRemoteAuthorityResolverService private readonly _remoteAuthorityResolverService: IRemoteAuthorityResolverService,
@IConfigurationService private readonly _configurationService: IConfigurationService,
@ILifecycleService private readonly _lifecycleService: ILifecycleService,
@IWebExtensionManagementService private readonly _webExtensionManagementService: IWebExtensionManagementService,
@IExtensionManagementServerService private readonly _extensionManagementServerService: IExtensionManagementServerService,
@IElectronService private readonly _electronService: IElectronService,
@IHostService private readonly _hostService: IHostService,
@IRemoteExplorerService private readonly _remoteExplorerService: IRemoteExplorerService,
@ -446,7 +445,12 @@ export class ExtensionService extends AbstractExtensionService implements IExten
const remoteAuthority = this._environmentService.configuration.remoteAuthority;
const extensionHost = this._extensionHostManagers[0];
const allExtensions = flatten(await Promise.all([this._extensionScanner.scannedExtensions, this._webExtensionManagementService.getInstalled().then(extensions => extensions.map(toExtensionDescription))]));
const allExtensions = flatten(await Promise.all([
this._extensionScanner.scannedExtensions,
this._extensionManagementServerService.webExtensionManagementServer
? this._extensionManagementServerService.webExtensionManagementServer.extensionManagementService.getInstalled().then(extensions => extensions.map(toExtensionDescription))
: Promise.resolve([])
]));
// enable or disable proposed API per extension
this._checkEnableProposedApi(allExtensions);