Skip to content

Commit

Permalink
Rename setting to showRecommendationsOnlyOnDemand #43471
Browse files Browse the repository at this point in the history
  • Loading branch information
ramya-rao-a committed Feb 15, 2018
1 parent 4d8eb83 commit 28a0426
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/vs/workbench/parts/extensions/common/extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ export interface IExtensionsWorkbenchService {

export const ConfigurationKey = 'extensions';
export const AutoUpdateConfigurationKey = 'extensions.autoUpdate';
export const DisableEagerRecommendationsKey = 'extensions.disableEagerRecommendations';
export const ShowRecommendationsOnlyOnDemandKey = 'extensions.showRecommendationsOnlyOnDemand';

export interface IExtensionsConfiguration {
autoUpdate: boolean;
ignoreRecommendations: boolean;
disableEagerRecommendations: boolean;
showRecommendationsOnlyOnDemand: boolean;
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import Severity from 'vs/base/common/severity';
import { IWorkspaceContextService, IWorkspaceFolder, IWorkspace, IWorkspaceFoldersChangeEvent, WorkbenchState } from 'vs/platform/workspace/common/workspace';
import { Schemas } from 'vs/base/common/network';
import { IFileService } from 'vs/platform/files/common/files';
import { IExtensionsConfiguration, ConfigurationKey, DisableEagerRecommendationsKey } from 'vs/workbench/parts/extensions/common/extensions';
import { IExtensionsConfiguration, ConfigurationKey, ShowRecommendationsOnlyOnDemandKey } from 'vs/workbench/parts/extensions/common/extensions';
import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import * as pfs from 'vs/base/node/pfs';
Expand Down Expand Up @@ -95,13 +95,13 @@ export class ExtensionTipsService extends Disposable implements IExtensionTipsSe
this._suggestFileBasedRecommendations();
this.promptWorkspaceRecommendationsPromise = this._suggestWorkspaceRecommendations();

if (!this.configurationService.getValue<boolean>(DisableEagerRecommendationsKey)) {
if (!this.configurationService.getValue<boolean>(ShowRecommendationsOnlyOnDemandKey)) {
this.fetchProactiveRecommendations(true);
}

this._register(this.contextService.onDidChangeWorkspaceFolders(e => this.onWorkspaceFoldersChanged(e)));
this._register(this.configurationService.onDidChangeConfiguration(e => {
if (!this.proactiveRecommendationsFetched && !this.configurationService.getValue<boolean>(DisableEagerRecommendationsKey)) {
if (!this.proactiveRecommendationsFetched && !this.configurationService.getValue<boolean>(ShowRecommendationsOnlyOnDemandKey)) {
this.fetchProactiveRecommendations();
}
}));
Expand Down Expand Up @@ -373,7 +373,7 @@ export class ExtensionTipsService extends Disposable implements IExtensionTipsSe
);

const config = this.configurationService.getValue<IExtensionsConfiguration>(ConfigurationKey);
if (config.ignoreRecommendations || config.disableEagerRecommendations) {
if (config.ignoreRecommendations || config.showRecommendationsOnlyOnDemand) {
return;
}

Expand Down Expand Up @@ -552,7 +552,7 @@ export class ExtensionTipsService extends Disposable implements IExtensionTipsSe
const config = this.configurationService.getValue<IExtensionsConfiguration>(ConfigurationKey);

return this.getWorkspaceRecommendations().then(allRecommendations => {
if (!allRecommendations.length || config.ignoreRecommendations || config.disableEagerRecommendations || this.storageService.getBoolean(storageKey, StorageScope.WORKSPACE, false)) {
if (!allRecommendations.length || config.ignoreRecommendations || config.showRecommendationsOnlyOnDemand || this.storageService.getBoolean(storageKey, StorageScope.WORKSPACE, false)) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,9 @@ Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration)
description: localize('extensionsIgnoreRecommendations', "If set to true, the notifications for extension recommendations will stop showing up."),
default: false
},
'extensions.disableEagerRecommendations': {
'extensions.showRecommendationsOnlyOnDemand': {
type: 'boolean',
description: localize('extensionsDisableEagerRecommendations', "If set to true, no recommendation is fetched or shown unless specifically requested by the user."),
description: localize('extensionsShowRecommendationsOnlyOnDemand', "If set to true, recommendations will not be fetched or shown unless specifically requested by the user."),
default: false
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { append, $, addStandardDisposableListener, EventType, addClass, removeCl
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IExtensionService } from 'vs/platform/extensions/common/extensions';
import { IExtensionsWorkbenchService, IExtensionsViewlet, VIEWLET_ID, ExtensionState, AutoUpdateConfigurationKey, DisableEagerRecommendationsKey } from '../common/extensions';
import { IExtensionsWorkbenchService, IExtensionsViewlet, VIEWLET_ID, ExtensionState, AutoUpdateConfigurationKey, ShowRecommendationsOnlyOnDemandKey } from '../common/extensions';
import {
ShowEnabledExtensionsAction, ShowInstalledExtensionsAction, ShowRecommendedExtensionsAction, ShowPopularExtensionsAction, ShowDisabledExtensionsAction,
ShowOutdatedExtensionsAction, ClearExtensionsInputAction, ChangeSortAction, UpdateAllAction, CheckForUpdatesAction, DisableAllAction, EnableAllAction,
Expand Down Expand Up @@ -110,16 +110,16 @@ export class ExtensionsViewlet extends PersistentViewsViewlet implements IExtens
this.searchInstalledExtensionsContextKey = SearchInstalledExtensionsContext.bindTo(contextKeyService);
this.recommendedExtensionsContextKey = RecommendedExtensionsContext.bindTo(contextKeyService);
this.defaultRecommendedExtensionsContextKey = DefaultRecommendedExtensionsContext.bindTo(contextKeyService);
this.defaultRecommendedExtensionsContextKey.set(!this.configurationService.getValue<boolean>(DisableEagerRecommendationsKey));
this.defaultRecommendedExtensionsContextKey.set(!this.configurationService.getValue<boolean>(ShowRecommendationsOnlyOnDemandKey));
this.disposables.push(this.viewletService.onDidViewletOpen(this.onViewletOpen, this, this.disposables));

this.configurationService.onDidChangeConfiguration(e => {
if (e.affectsConfiguration(AutoUpdateConfigurationKey)) {
this.secondaryActions = null;
this.updateTitleArea();
}
if (e.affectedKeys.indexOf(DisableEagerRecommendationsKey) > -1) {
this.defaultRecommendedExtensionsContextKey.set(!this.configurationService.getValue<boolean>(DisableEagerRecommendationsKey));
if (e.affectedKeys.indexOf(ShowRecommendationsOnlyOnDemandKey) > -1) {
this.defaultRecommendedExtensionsContextKey.set(!this.configurationService.getValue<boolean>(ShowRecommendationsOnlyOnDemandKey));
}
}, this, this.disposables);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ suite('ExtensionsTipsService Test', () => {
}
});

testConfigurationService.setUserConfiguration(ConfigurationKey, { ignoreRecommendations: false, disableEagerRecommendations: false });
testConfigurationService.setUserConfiguration(ConfigurationKey, { ignoreRecommendations: false, showRecommendationsOnlyOnDemand: false });
instantiationService.stub(IStorageService, { get: (a, b, c) => c, getBoolean: (a, b, c) => c, store: () => { } });
instantiationService.stub(IModelService, <IModelService>{
getModels(): any { return []; },
Expand Down Expand Up @@ -333,8 +333,8 @@ suite('ExtensionsTipsService Test', () => {
return testNoPromptForValidRecommendations(mockTestData.validRecommendedExtensions);
});

test('ExtensionTipsService: No Prompt for valid workspace recommendations if disableEagerRecommendations is set', () => {
testConfigurationService.setUserConfiguration(ConfigurationKey, { disableEagerRecommendations: true });
test('ExtensionTipsService: No Prompt for valid workspace recommendations if showRecommendationsOnlyOnDemand is set', () => {
testConfigurationService.setUserConfiguration(ConfigurationKey, { showRecommendationsOnlyOnDemand: true });
return setUpFolderWorkspace('myFolder', mockTestData.validRecommendedExtensions).then(() => {
testObject = instantiationService.createInstance(ExtensionTipsService);
return testObject.promptWorkspaceRecommendationsPromise.then(() => {
Expand Down

0 comments on commit 28a0426

Please sign in to comment.