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

Allow users to turn off automatic checking of extension updates #55087

Merged
merged 3 commits into from
Jul 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
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 @@ -96,11 +96,13 @@ export interface IExtensionsWorkbenchService {

export const ConfigurationKey = 'extensions';
export const AutoUpdateConfigurationKey = 'extensions.autoUpdate';
export const AutoCheckUpdatesConfigurationKey = 'extensions.autoCheckUpdates';
export const ShowRecommendationsOnlyOnDemandKey = 'extensions.showRecommendationsOnlyOnDemand';
export const CloseExtensionDetailsOnViewChangeKey = 'extensions.closeExtensionDetailsOnViewChange';

export interface IExtensionsConfiguration {
autoUpdate: boolean;
autoCheckUpdates: boolean;
ignoreRecommendations: boolean;
showRecommendationsOnlyOnDemand: boolean;
closeExtensionDetailsOnViewChange: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,13 @@ Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration)
scope: ConfigurationScope.APPLICATION,
tags: ['usesOnlineServices']
},
'extensions.autoCheckUpdates': {
type: 'boolean',
description: localize('extensionsCheckUpdates', "Automatically checks for extension updates. If an extension update is available and the extension auto update feature is disabled, then the extension will appear as outdated in the Extensions view."),
default: true,
scope: ConfigurationScope.APPLICATION,
tags: ['usesOnlineServices']
},
'extensions.ignoreRecommendations': {
type: 'boolean',
description: localize('extensionsIgnoreRecommendations', "When enabled, the notifications for extension recommendations will not be shown."),
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, AutoCheckUpdatesConfigurationKey } 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 @@ -415,6 +415,11 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
this.checkForUpdates();
}
}
if (e.affectsConfiguration(AutoCheckUpdatesConfigurationKey)) {
if (this.isAutoCheckUpdatesEnabled()) {
this.checkForUpdates();
}
}
}, this, this.disposables);

this.queryLocal().done(() => this.eventuallySyncWithGallery(true));
Expand Down Expand Up @@ -610,8 +615,13 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService,
return this.configurationService.getValue(AutoUpdateConfigurationKey);
}

private isAutoCheckUpdatesEnabled(): boolean {
return this.configurationService.getValue(AutoCheckUpdatesConfigurationKey);
}

private eventuallySyncWithGallery(immediate = false): void {
const loop = () => this.syncWithGallery().then(() => this.eventuallySyncWithGallery());
const shouldSync = this.isAutoUpdateEnabled() || this.isAutoCheckUpdatesEnabled();
const loop = () => (shouldSync ? this.syncWithGallery() : TPromise.as(null)).then(() => this.eventuallySyncWithGallery());
const delay = immediate ? 0 : ExtensionsWorkbenchService.SyncPeriod;

this.syncDelayer.trigger(loop, delay)
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, AutoCheckUpdatesConfigurationKey, AutoUpdateConfigurationKey } 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: (key) => {
return (key === AutoCheckUpdatesConfigurationKey || key === AutoUpdateConfigurationKey) ? true : undefined;
}
});

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