Skip to content

Commit 1762c10

Browse files
committed
1 parent 7987bbf commit 1762c10

2 files changed

Lines changed: 4 additions & 91 deletions

File tree

src/vs/platform/extensionManagement/node/extensionManagementService.ts

Lines changed: 3 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ export class ExtensionManagementService extends Disposable implements IExtension
536536
.then(installed => {
537537
const promises = installed
538538
.filter(e => e.manifest.publisher === extension.manifest.publisher && e.manifest.name === extension.manifest.name)
539-
.map(e => this.checkForDependenciesAndUninstall(e, installed, force));
539+
.map(e => this.checkForDependenciesAndUninstall(e, installed));
540540
return TPromise.join(promises).then(() => null, error => TPromise.wrapError(this.joinErrors(error)));
541541
}));
542542
}
@@ -593,23 +593,14 @@ export class ExtensionManagementService extends Disposable implements IExtension
593593
}, new Error(''));
594594
}
595595

596-
private checkForDependenciesAndUninstall(extension: ILocalExtension, installed: ILocalExtension[], force: boolean): TPromise<void> {
596+
private checkForDependenciesAndUninstall(extension: ILocalExtension, installed: ILocalExtension[]): TPromise<void> {
597597
return this.preUninstallExtension(extension)
598598
.then(() => {
599599
const packedExtensions = this.getAllPackExtensionsToUninstall(extension, installed);
600600
if (packedExtensions.length) {
601601
return this.uninstallExtensions(extension, packedExtensions, installed);
602602
}
603-
const dependencies = this.getDependenciesToUninstall(extension, installed);
604-
if (dependencies.length) {
605-
if (force) {
606-
return this.uninstallExtensions(extension, dependencies, installed);
607-
} else {
608-
return this.promptForDependenciesAndUninstall(extension, dependencies, installed);
609-
}
610-
} else {
611-
return this.uninstallExtensions(extension, [], installed);
612-
}
603+
return this.uninstallExtensions(extension, [], installed);
613604
})
614605
.then(() => this.postUninstallExtension(extension),
615606
error => {
@@ -618,26 +609,6 @@ export class ExtensionManagementService extends Disposable implements IExtension
618609
});
619610
}
620611

621-
private promptForDependenciesAndUninstall(extension: ILocalExtension, dependencies: ILocalExtension[], installed: ILocalExtension[]): TPromise<void> {
622-
const message = nls.localize('uninstallDependeciesConfirmation', "Also uninstall the dependencies of the extension '{0}'?", extension.manifest.displayName || extension.manifest.name);
623-
const buttons = [
624-
nls.localize('yes', "Yes"),
625-
nls.localize('no', "No"),
626-
nls.localize('cancel', "Cancel")
627-
];
628-
return this.dialogService.show(Severity.Info, message, buttons, { cancelId: 2 })
629-
.then<void>(value => {
630-
if (value === 0) {
631-
return this.uninstallExtensions(extension, dependencies, installed);
632-
}
633-
if (value === 1) {
634-
return this.uninstallExtensions(extension, [], installed);
635-
}
636-
this.logService.info('Cancelled uninstalling extension:', extension.identifier.id);
637-
return TPromise.wrapError(errors.canceled());
638-
}, error => TPromise.wrapError(errors.canceled()));
639-
}
640-
641612
private uninstallExtensions(extension: ILocalExtension, otherExtensionsToUninstall: ILocalExtension[], installed: ILocalExtension[]): TPromise<void> {
642613
const dependents = this.getDependents(extension, installed);
643614
if (dependents.length) {
@@ -662,38 +633,6 @@ export class ExtensionManagementService extends Disposable implements IExtension
662633
extension.manifest.displayName || extension.manifest.name, dependents[0].manifest.displayName || dependents[0].manifest.name, dependents[1].manifest.displayName || dependents[1].manifest.name);
663634
}
664635

665-
private getDependenciesToUninstall(extension: ILocalExtension, installed: ILocalExtension[]): ILocalExtension[] {
666-
const dependencies = this.getAllDependenciesToUninstall(extension, installed).filter(e => e !== extension);
667-
668-
const dependenciesToUninstall = dependencies.slice(0);
669-
for (let index = 0; index < dependencies.length; index++) {
670-
const dep = dependencies[index];
671-
const dependents = this.getDependents(dep, installed);
672-
// Remove the dependency from the uninstall list if there is a dependent which will not be uninstalled.
673-
if (dependents.some(e => e !== extension && dependencies.indexOf(e) === -1)) {
674-
dependenciesToUninstall.splice(index - (dependencies.length - dependenciesToUninstall.length), 1);
675-
}
676-
}
677-
678-
return dependenciesToUninstall;
679-
}
680-
681-
private getAllDependenciesToUninstall(extension: ILocalExtension, installed: ILocalExtension[], checked: ILocalExtension[] = []): ILocalExtension[] {
682-
if (checked.indexOf(extension) !== -1) {
683-
return [];
684-
}
685-
checked.push(extension);
686-
if (!extension.manifest.extensionDependencies || extension.manifest.extensionDependencies.length === 0) {
687-
return [];
688-
}
689-
const dependenciesToUninstall = installed.filter(i => extension.manifest.extensionDependencies.some(id => areSameExtensions({ id }, i.galleryIdentifier)));
690-
const depsOfDeps = [];
691-
for (const dep of dependenciesToUninstall) {
692-
depsOfDeps.push(...this.getAllDependenciesToUninstall(dep, installed, checked));
693-
}
694-
return [...dependenciesToUninstall, ...depsOfDeps];
695-
}
696-
697636
private getAllPackExtensionsToUninstall(extension: ILocalExtension, installed: ILocalExtension[], checked: ILocalExtension[] = []): ILocalExtension[] {
698637
if (checked.indexOf(extension) !== -1) {
699638
return [];

src/vs/workbench/parts/extensions/node/extensionsWorkbenchService.ts

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import { ExtensionsInput } from 'vs/workbench/parts/extensions/common/extensions
3333
import product from 'vs/platform/node/product';
3434
import { ILogService } from 'vs/platform/log/common/log';
3535
import { IProgressService2, ProgressLocation } from 'vs/workbench/services/progress/common/progress';
36-
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
3736
import { INotificationService } from 'vs/platform/notification/common/notification';
3837
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
3938
import { groupBy } from 'vs/base/common/collections';
@@ -385,7 +384,6 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
385384
@IExtensionGalleryService private galleryService: IExtensionGalleryService,
386385
@IConfigurationService private configurationService: IConfigurationService,
387386
@ITelemetryService private telemetryService: ITelemetryService,
388-
@IDialogService private dialogService: IDialogService,
389387
@INotificationService private notificationService: INotificationService,
390388
@IURLService urlService: IURLService,
391389
@IExtensionEnablementService private extensionEnablementService: IExtensionEnablementService,
@@ -751,34 +749,10 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
751749
if (packedExtensions.length) {
752750
return this.checkAndSetEnablement(extensions, packedExtensions, enablementState);
753751
}
754-
const dependencies = this.getExtensionsRecursively(extensions, this.local, enablementState, { dependencies: true, pack: false });
755-
if (dependencies.length) {
756-
return this.promptForDependenciesAndDisable(extensions, dependencies, enablementState);
757-
} else {
758-
return this.checkAndSetEnablement(extensions, [], enablementState);
759-
}
752+
return this.checkAndSetEnablement(extensions, [], enablementState);
760753
}
761754
}
762755

763-
private promptForDependenciesAndDisable(extensions: IExtension[], dependencies: IExtension[], enablementState: EnablementState): TPromise<void> {
764-
const message = extensions.length > 1 ? nls.localize('disableDependeciesConfirmation', "Also disable the dependencies of the extensions?") : nls.localize('disableDependeciesSingleExtensionConfirmation', "Also disable the dependencies of the extension '{0}'?", extensions[0].displayName);
765-
const buttons = [
766-
nls.localize('yes', "Yes"),
767-
nls.localize('cancel', "Cancel"),
768-
nls.localize('no', "No"),
769-
];
770-
return this.dialogService.show(Severity.Info, message, buttons, { cancelId: 2 })
771-
.then<void>(value => {
772-
if (value === 0) {
773-
return this.checkAndSetEnablement(extensions, dependencies, enablementState);
774-
}
775-
if (value === 2) {
776-
return this.checkAndSetEnablement(extensions, [], enablementState);
777-
}
778-
return TPromise.as(null);
779-
});
780-
}
781-
782756
private checkAndSetEnablement(extensions: IExtension[], otherExtensions: IExtension[], enablementState: EnablementState): TPromise<any> {
783757
const allExtensions = [...extensions, ...otherExtensions];
784758
const enable = enablementState === EnablementState.Enabled || enablementState === EnablementState.WorkspaceEnabled;

0 commit comments

Comments
 (0)