提交 2949596d 编写于 作者: S Sandeep Somavarapu

fix bugs

上级 82b74e26
......@@ -394,7 +394,7 @@ export class UpdateGalleryExtensionAction extends Action {
private local: ILocalExtension;
private gallery: IGalleryExtension;
get extension(): { local: ILocalExtension, gallery: IGalleryExtension } { return { local: this.local, gallery: this.gallery }; }
set extension({ local, gallery }: { local: ILocalExtension, gallery: IGalleryExtension }) { this.local = local; this.gallery = gallery; this.update(); }
set extension(extension: { local: ILocalExtension, gallery: IGalleryExtension }) { this.local = extension ? extension.local : null; this.gallery = extension ? extension.gallery : null; this.update(); }
constructor(
id: string, label: string, server: IExtensionManagementServer,
......@@ -407,7 +407,7 @@ export class UpdateGalleryExtensionAction extends Action {
}
private update(): void {
this.enabled = this.local && this.gallery && semver.gt(this.gallery.version, this.local.manifest.version);
this.enabled = this.local && this.gallery && this.local.type === LocalExtensionType.User && semver.gt(this.gallery.version, this.local.manifest.version);
this.label = this.enabled ? localize('updateToInServer', "Update to {0} ({1})", this.local.manifest.version, this.server.location.authority) : localize('updateLabelInServer', "Update ({0})", this.server.location.authority);
}
......@@ -450,9 +450,8 @@ export class MultiServerInstallAction extends Action {
super(MultiServerInstallAction.ID, MultiServerInstallAction.InstallLabel, MultiServerInstallAction.Class, false);
this._installActions = this.extensionManagementServerService.extensionManagementServers.map(server => this.instantiationService.createInstance(InstallGalleryExtensionAction, `extensions.install.${server.location.authority}`, localize('installInServer', "{0}", server.location.authority), server));
this._actionItem = this.instantiationService.createInstance(DropDownMenuActionItem, this, [this._installActions]);
this.disposables.push(this._actionItem);
this.disposables.push(...this._installActions);
this.disposables.push(this.extensionsWorkbenchService.onChange(() => this.update()));
this.disposables.push(...[this._actionItem, ...this._installActions]);
this.disposables.push(this.extensionsWorkbenchService.onChange(() => this.extension = this.extension ? this.extensionsWorkbenchService.local.filter(l => areSameExtensions({ id: l.id }, { id: this.extension.id }))[0] : this.extension));
this.update();
}
......
......@@ -461,11 +461,20 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
}
});
const enabled: ILocalExtension[] = [];
const notRunningExtensions: ILocalExtension[] = [];
const seenExtensions: { [id: string]: boolean } = Object.create({});
for (const extension of (groups['enabled'] || [])) {
if (runtimeExtensions.some(r => r.extensionLocation.toString() === extension.location.toString())) {
enabled.push(extension);
} else if (enabled.some(e => areSameExtensions({ id: extension.identifier.id }, { id: e.identifier.id }))) {
seenExtensions[getGalleryExtensionIdFromLocal(extension)] = true;
} else {
notRunningExtensions.push(extension);
}
}
for (const extension of notRunningExtensions) {
if (!seenExtensions[getGalleryExtensionIdFromLocal(extension)]) {
enabled.push(extension);
seenExtensions[getGalleryExtensionIdFromLocal(extension)] = true;
}
}
const primaryDisabled = groups['disabled:primary'] || [];
......@@ -645,7 +654,7 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
}
const ext = extension as Extension;
const toUninstall: ILocalExtension[] = ext.locals || this.installed.filter(e => e.id === extension.id)[0].locals;
const toUninstall: ILocalExtension[] = ext.locals.length ? ext.locals : this.installed.filter(e => e.id === extension.id)[0].locals;
if (!toUninstall.length) {
return TPromise.wrapError<void>(new Error('Missing local'));
......@@ -665,7 +674,7 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
}
const ext = extension as Extension;
const toReinstall: ILocalExtension[] = ext.locals || this.installed.filter(e => e.id === extension.id)[0].locals;
const toReinstall: ILocalExtension[] = ext.locals.length ? ext.locals : this.installed.filter(e => e.id === extension.id)[0].locals;
if (!toReinstall.length) {
return TPromise.wrapError<void>(new Error('Missing local'));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册