mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-17 08:50:12 +01:00
Fix #94416
This commit is contained in:
+2
-10
@@ -25,14 +25,6 @@ import { ITASExperimentService } from 'vs/workbench/services/experiment/common/e
|
||||
import { EnablementState, IWorkbenchExtensioManagementService, IWorkbenchExtensionEnablementService } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
|
||||
import { IExtensionIgnoredRecommendationsService } from 'vs/workbench/services/extensionRecommendations/common/extensionRecommendations';
|
||||
|
||||
interface IExtensionsConfiguration {
|
||||
autoUpdate: boolean;
|
||||
autoCheckUpdates: boolean;
|
||||
ignoreRecommendations: boolean;
|
||||
showRecommendationsOnlyOnDemand: boolean;
|
||||
closeExtensionDetailsOnViewChange: boolean;
|
||||
}
|
||||
|
||||
type ExtensionRecommendationsNotificationClassification = {
|
||||
userReaction: { classification: 'SystemMetaData', purpose: 'FeatureInsight' };
|
||||
extensionId?: { classification: 'PublicNonPersonalData', purpose: 'FeatureInsight' };
|
||||
@@ -149,8 +141,8 @@ export class ExtensionRecommendationNotificationService implements IExtensionRec
|
||||
}
|
||||
|
||||
hasToIgnoreRecommendationNotifications(): boolean {
|
||||
const config = this.configurationService.getValue<IExtensionsConfiguration>('extensions');
|
||||
return config.ignoreRecommendations || config.showRecommendationsOnlyOnDemand;
|
||||
const config = this.configurationService.getValue<{ ignoreRecommendations: boolean, showRecommendationsOnlyOnDemand?: boolean }>('extensions');
|
||||
return config.ignoreRecommendations || !!config.showRecommendationsOnlyOnDemand;
|
||||
}
|
||||
|
||||
async promptImportantExtensionsInstallNotification(extensionIds: string[], message: string, searchValue: string, source: RecommendationSource): Promise<RecommendationsNotificationResult> {
|
||||
|
||||
@@ -7,8 +7,6 @@ import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { IExtensionManagementService, IExtensionGalleryService, InstallOperation, DidInstallExtensionEvent } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IExtensionRecommendationsService, ExtensionRecommendationReason, IExtensionIgnoredRecommendationsService } from 'vs/workbench/services/extensionRecommendations/common/extensionRecommendations';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { ShowRecommendationsOnlyOnDemandKey } from 'vs/workbench/contrib/extensions/common/extensions';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { distinct, shuffle } from 'vs/base/common/arrays';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
@@ -52,7 +50,6 @@ export class ExtensionRecommendationsService extends Disposable implements IExte
|
||||
@IInstantiationService instantiationService: IInstantiationService,
|
||||
@ILifecycleService private readonly lifecycleService: ILifecycleService,
|
||||
@IExtensionGalleryService private readonly galleryService: IExtensionGalleryService,
|
||||
@IConfigurationService private readonly configurationService: IConfigurationService,
|
||||
@ITelemetryService private readonly telemetryService: ITelemetryService,
|
||||
@IEnvironmentService private readonly environmentService: IEnvironmentService,
|
||||
@IExtensionManagementService private readonly extensionManagementService: IExtensionManagementService,
|
||||
@@ -92,12 +89,6 @@ export class ExtensionRecommendationsService extends Disposable implements IExte
|
||||
this.fileBasedRecommendations.activate(),
|
||||
this.experimentalRecommendations.activate(),
|
||||
this.keymapRecommendations.activate(),
|
||||
this.lifecycleService.when(LifecyclePhase.Eventually)
|
||||
.then(async () => {
|
||||
if (!this.configurationService.getValue<boolean>(ShowRecommendationsOnlyOnDemandKey)) {
|
||||
await this.activateProactiveRecommendations();
|
||||
}
|
||||
})
|
||||
]);
|
||||
|
||||
this._register(Event.any(this.workspaceRecommendations.onDidChangeRecommendations, this.configBasedRecommendations.onDidChangeRecommendations, this.extensionRecommendationsManagementService.onDidChangeIgnoredRecommendations)(() => this._onDidChangeRecommendations.fire()));
|
||||
|
||||
@@ -142,7 +142,7 @@ Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration)
|
||||
},
|
||||
'extensions.showRecommendationsOnlyOnDemand': {
|
||||
type: 'boolean',
|
||||
description: localize('extensionsShowRecommendationsOnlyOnDemand', "When enabled, recommendations will not be fetched or shown unless specifically requested by the user. Some recommendations are fetched from a Microsoft online service."),
|
||||
deprecationMessage: localize('extensionsShowRecommendationsOnlyOnDemand_Deprecated', "This setting is deprecated. Use extensions.ignoreRecommendations setting to control recommendation notifications. Use Extensions view's visibility actions to hide Recommended view by default."),
|
||||
default: false,
|
||||
tags: ['usesOnlineServices']
|
||||
},
|
||||
|
||||
@@ -96,14 +96,12 @@ 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;
|
||||
}
|
||||
|
||||
|
||||
+11
-1
@@ -271,7 +271,7 @@ suite('ExtensionRecommendationsService Test', () => {
|
||||
|
||||
instantiationService.stub(INotificationService, new TestNotificationService2());
|
||||
|
||||
testConfigurationService.setUserConfiguration(ConfigurationKey, { ignoreRecommendations: false, showRecommendationsOnlyOnDemand: false });
|
||||
testConfigurationService.setUserConfiguration(ConfigurationKey, { ignoreRecommendations: false });
|
||||
instantiationService.stub(IModelService, <IModelService>{
|
||||
getModels(): any { return []; },
|
||||
onModelAdded: onModelAddedEvent.event
|
||||
@@ -381,6 +381,16 @@ suite('ExtensionRecommendationsService Test', () => {
|
||||
return testNoPromptForValidRecommendations(mockTestData.validRecommendedExtensions);
|
||||
});
|
||||
|
||||
test('ExtensionRecommendationsService: No Prompt for valid workspace recommendations if ignoreRecommendations is set', () => {
|
||||
testConfigurationService.setUserConfiguration(ConfigurationKey, { ignoreRecommendations: true });
|
||||
return setUpFolderWorkspace('myFolder', mockTestData.validRecommendedExtensions).then(() => {
|
||||
testObject = instantiationService.createInstance(ExtensionRecommendationsService);
|
||||
return testObject.activationPromise.then(() => {
|
||||
assert.ok(!prompted);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('ExtensionRecommendationsService: No Prompt for valid workspace recommendations if showRecommendationsOnlyOnDemand is set', () => {
|
||||
testConfigurationService.setUserConfiguration(ConfigurationKey, { showRecommendationsOnlyOnDemand: true });
|
||||
return setUpFolderWorkspace('myFolder', mockTestData.validRecommendedExtensions).then(() => {
|
||||
|
||||
Reference in New Issue
Block a user