mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-11 05:30:03 -05:00
Fix #52220
This commit is contained in:
@@ -753,7 +753,7 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
|
||||
for (const extension of extensions) {
|
||||
let dependents = this.getDependentsAfterDisablement(extension, allExtensions, this.local, enablementState);
|
||||
if (dependents.length) {
|
||||
return TPromise.wrapError<void>(new Error(this.getDependentsErrorMessage(extension, dependents)));
|
||||
return TPromise.wrapError<void>(new Error(this.getDependentsErrorMessage(extension, allExtensions, dependents)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -806,7 +806,17 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
|
||||
});
|
||||
}
|
||||
|
||||
private getDependentsErrorMessage(extension: IExtension, dependents: IExtension[]): string {
|
||||
private getDependentsErrorMessage(extension: IExtension, allDisabledExtensions: IExtension[], dependents: IExtension[]): string {
|
||||
for (const e of [extension, ...allDisabledExtensions]) {
|
||||
let dependentsOfTheExtension = dependents.filter(d => d.dependencies.some(id => areSameExtensions({ id }, e)));
|
||||
if (dependentsOfTheExtension.length) {
|
||||
return this.getErrorMessageForDisablingAnExtensionWithDependents(e, dependentsOfTheExtension);
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
private getErrorMessageForDisablingAnExtensionWithDependents(extension: IExtension, dependents: IExtension[]): string {
|
||||
if (dependents.length === 1) {
|
||||
return nls.localize('singleDependentError', "Cannot disable extension '{0}'. Extension '{1}' depends on this.", extension.displayName, dependents[0].displayName);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user