Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to not receive extension updates #54612

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/vs/workbench/parts/extensions/common/extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,12 @@ export const ConfigurationKey = 'extensions';
export const AutoUpdateConfigurationKey = 'extensions.autoUpdate';
export const ShowRecommendationsOnlyOnDemandKey = 'extensions.showRecommendationsOnlyOnDemand';
export const CloseExtensionDetailsOnViewChangeKey = 'extensions.closeExtensionDetailsOnViewChange';
export const ReceivesUpdatesConfigurationKey = 'extensions.receiveUpdates';

export interface IExtensionsConfiguration {
autoUpdate: boolean;
ignoreRecommendations: boolean;
showRecommendationsOnlyOnDemand: boolean;
closeExtensionDetailsOnViewChange: boolean;
receiveUpdates: boolean;
}
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration)
properties: {
'extensions.autoUpdate': {
type: 'boolean',
description: localize('extensionsAutoUpdate', "Automatically update extensions"),
description: localize('extensionsAutoUpdate', "Automatically update extensions. If the setting 'extensions.receiveUpdates' is set to false, then extensions will not be updated, regardless of this setting."),
default: true,
scope: ConfigurationScope.APPLICATION
},
Expand All @@ -222,6 +222,11 @@ Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration)
type: 'boolean',
description: localize('extensionsCloseExtensionDetailsOnViewChange', "If set to true, editors with extension details will be automatically closed upon navigating away from the Extensions View."),
default: false
},
'extensions.receiveUpdates': {
type: 'boolean',
description: localize('extensionsReceiveUpdates', "Receive updates for outdated extensions, but not automatically update them. If set to false, extension auto-update feature is disabled regardless of the value for the 'extensions.autoUpdate' setting"),
default: true
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import { IWindowService } from 'vs/platform/windows/common/windows';
import Severity from 'vs/base/common/severity';
import URI from 'vs/base/common/uri';
import { IExtension, IExtensionDependencies, ExtensionState, IExtensionsWorkbenchService, AutoUpdateConfigurationKey } from 'vs/workbench/parts/extensions/common/extensions';
import { IExtension, IExtensionDependencies, ExtensionState, IExtensionsWorkbenchService, AutoUpdateConfigurationKey, ReceivesUpdatesConfigurationKey } from 'vs/workbench/parts/extensions/common/extensions';
import { IEditorService, SIDE_GROUP, ACTIVE_GROUP } from 'vs/workbench/services/editor/common/editorService';
import { IURLService, IURLHandler } from 'vs/platform/url/common/url';
import { ExtensionsInput } from 'vs/workbench/parts/extensions/common/extensionsInput';
Expand Down Expand Up @@ -410,11 +410,14 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
urlService.registerHandler(this);

this.configurationService.onDidChangeConfiguration(e => {
if (e.affectsConfiguration(AutoUpdateConfigurationKey)) {
if (e.affectsConfiguration(AutoUpdateConfigurationKey) || e.affectsConfiguration(ReceivesUpdatesConfigurationKey)) {
if (this.isAutoUpdateEnabled()) {
this.checkForUpdates();
}
}
if (e.affectsConfiguration(ReceivesUpdatesConfigurationKey)) {
this.eventuallySyncWithGallery(true);
}
}, this, this.disposables);

this.queryLocal().done(() => this.eventuallySyncWithGallery(true));
Expand Down Expand Up @@ -607,10 +610,17 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
}

private isAutoUpdateEnabled(): boolean {
return this.configurationService.getValue(AutoUpdateConfigurationKey);
return this.configurationService.getValue(AutoUpdateConfigurationKey) && this.isReceiveUpdatesEnabled();
}

private isReceiveUpdatesEnabled(): boolean {
return this.configurationService.getValue(ReceivesUpdatesConfigurationKey);
}

private eventuallySyncWithGallery(immediate = false): void {
if (!this.isReceiveUpdatesEnabled()) {
return;
}
const loop = () => this.syncWithGallery().then(() => this.eventuallySyncWithGallery());
const delay = immediate ? 0 : ExtensionsWorkbenchService.SyncPeriod;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import * as fs from 'fs';
import { assign } from 'vs/base/common/objects';
import { TPromise } from 'vs/base/common/winjs.base';
import { generateUuid } from 'vs/base/common/uuid';
import { IExtensionsWorkbenchService, ExtensionState } from 'vs/workbench/parts/extensions/common/extensions';
import { IExtensionsWorkbenchService, ExtensionState, ReceivesUpdatesConfigurationKey } from 'vs/workbench/parts/extensions/common/extensions';
import { ExtensionsWorkbenchService } from 'vs/workbench/parts/extensions/node/extensionsWorkbenchService';
import {
IExtensionManagementService, IExtensionGalleryService, IExtensionEnablementService, IExtensionTipsService, ILocalExtension, LocalExtensionType, IGalleryExtension,
Expand Down Expand Up @@ -66,7 +66,14 @@ suite('ExtensionsWorkbenchServiceTest', () => {
instantiationService.stub(IURLService, URLService);

instantiationService.stub(IWorkspaceContextService, new TestContextService());
instantiationService.stub(IConfigurationService, { onDidUpdateConfiguration: () => { }, onDidChangeConfiguration: () => { }, getConfiguration: () => ({}) });
instantiationService.stub(IConfigurationService, {
onDidUpdateConfiguration: () => { },
onDidChangeConfiguration: () => { },
getConfiguration: () => ({}),
getValue: (a) => {
return a === ReceivesUpdatesConfigurationKey ? true : undefined;
}
});

instantiationService.stub(IExtensionManagementService, ExtensionManagementService);
instantiationService.stub(IExtensionManagementService, 'onInstallExtension', installEvent.event);
Expand Down