Skip to content

Commit

Permalink
Merge pull request #115701 from microsoft/sandy081/fix115699
Browse files Browse the repository at this point in the history
sandy081/fix115699
  • Loading branch information
sandy081 authored Feb 3, 2021
2 parents f84decb + 1d6c882 commit 8490d3d
Showing 1 changed file with 28 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ export class ExtensionManagementService extends Disposable implements IWorkbench
const isMachineScoped = await this.hasToFlagExtensionsMachineScoped([gallery]);
installOptions = { isMachineScoped, isBuiltin: false };
}
if (!installOptions.isMachineScoped) {
if (!installOptions.isMachineScoped && this.isExtensionsSyncEnabled()) {
if (this.extensionManagementServerService.localExtensionManagementServer && !servers.includes(this.extensionManagementServerService.localExtensionManagementServer)) {
servers.push(this.extensionManagementServerService.localExtensionManagementServer);
}
Expand Down Expand Up @@ -306,32 +306,36 @@ export class ExtensionManagementService extends Disposable implements IWorkbench
return this.extensionManagementServerService.localExtensionManagementServer;
}

private isExtensionsSyncEnabled(): boolean {
return this.userDataAutoSyncEnablementService.isEnabled() && this.userDataSyncResourceEnablementService.isResourceEnabled(SyncResource.Extensions);
}

private async hasToFlagExtensionsMachineScoped(extensions: IGalleryExtension[]): Promise<boolean> {
if (!this.userDataAutoSyncEnablementService.isEnabled() || !this.userDataSyncResourceEnablementService.isResourceEnabled(SyncResource.Extensions)) {
return false;
}
const result = await this.dialogService.show(
Severity.Info,
extensions.length === 1 ? localize('install extension', "Install Extension") : localize('install extensions', "Install Extensions"),
[
localize('install', "Install"),
localize('install and do no sync', "Install (Do not sync)"),
localize('cancel', "Cancel"),
],
{
cancelId: 2,
detail: extensions.length === 1
? localize('install single extension', "Would you like to install and synchronize '{0}' extension across your devices?", extensions[0].displayName)
: localize('install multiple extensions', "Would you like to install and synchronize extensions across your devices?")
if (this.isExtensionsSyncEnabled()) {
const result = await this.dialogService.show(
Severity.Info,
extensions.length === 1 ? localize('install extension', "Install Extension") : localize('install extensions', "Install Extensions"),
[
localize('install', "Install"),
localize('install and do no sync', "Install (Do not sync)"),
localize('cancel', "Cancel"),
],
{
cancelId: 2,
detail: extensions.length === 1
? localize('install single extension', "Would you like to install and synchronize '{0}' extension across your devices?", extensions[0].displayName)
: localize('install multiple extensions', "Would you like to install and synchronize extensions across your devices?")
}
);
switch (result.choice) {
case 0:
return false;
case 1:
return true;
}
);
switch (result.choice) {
case 0:
return false;
case 1:
return true;
throw canceled();
}
throw canceled();
return false;
}

getExtensionsReport(): Promise<IReportedExtension[]> {
Expand Down

0 comments on commit 8490d3d

Please sign in to comment.