Switch off "preview feature" prompt

This commit is contained in:
Karl Burtram
2018-09-18 12:35:28 -07:00
parent d32f8c40b0
commit 83384e13f8
2 changed files with 41 additions and 39 deletions

View File

@@ -32,7 +32,7 @@ Registry.as<IConfigurationRegistry>(ConfigExtensions.Configuration).registerConf
'properties': { 'properties': {
'workbench.enablePreviewFeatures': { 'workbench.enablePreviewFeatures': {
'type': 'boolean', 'type': 'boolean',
'default': undefined, 'default': true,
'description': nls.localize('previewFeatures.configEnable', 'Enable unreleased preview features') 'description': nls.localize('previewFeatures.configEnable', 'Enable unreleased preview features')
} }
} }

View File

@@ -27,44 +27,46 @@ export class EnablePreviewFeatures implements IWorkbenchContribution {
@ITelemetryService telemetryService: ITelemetryService, @ITelemetryService telemetryService: ITelemetryService,
@IConfigurationService configurationService: IConfigurationService @IConfigurationService configurationService: IConfigurationService
) { ) {
let previewFeaturesEnabled = configurationService.getValue('workbench')['enablePreviewFeatures']; return;
if (previewFeaturesEnabled || storageService.get(EnablePreviewFeatures.ENABLE_PREVIEW_FEATURES_SHOWN)) {
return;
}
Promise.all([
windowService.isFocused(),
windowsService.getWindowCount()
]).then(([focused, count]) => {
if (!focused && count > 1) {
return null;
}
configurationService.updateValue('workbench.enablePreviewFeatures', false);
const enablePreviewFeaturesNotice = localize('enablePreviewFeatures.notice', "Would you like to enable preview features?"); // let previewFeaturesEnabled = configurationService.getValue('workbench')['enablePreviewFeatures'];
notificationService.prompt( // if (previewFeaturesEnabled || storageService.get(EnablePreviewFeatures.ENABLE_PREVIEW_FEATURES_SHOWN)) {
Severity.Info, // return;
enablePreviewFeaturesNotice, // }
[{ // Promise.all([
label: localize('enablePreviewFeatures.yes', "Yes"), // windowService.isFocused(),
run: () => { // windowsService.getWindowCount()
configurationService.updateValue('workbench.enablePreviewFeatures', true); // ]).then(([focused, count]) => {
storageService.store(EnablePreviewFeatures.ENABLE_PREVIEW_FEATURES_SHOWN, true); // if (!focused && count > 1) {
} // return null;
}, { // }
label: localize('enablePreviewFeatures.no', "No"), // configurationService.updateValue('workbench.enablePreviewFeatures', false);
run: () => {
configurationService.updateValue('workbench.enablePreviewFeatures', false); // const enablePreviewFeaturesNotice = localize('enablePreviewFeatures.notice', "Would you like to enable preview features?");
} // notificationService.prompt(
}, { // Severity.Info,
label: localize('enablePreviewFeatures.never', "No, don't show again"), // enablePreviewFeaturesNotice,
run: () => { // [{
configurationService.updateValue('workbench.enablePreviewFeatures', false); // label: localize('enablePreviewFeatures.yes', "Yes"),
storageService.store(EnablePreviewFeatures.ENABLE_PREVIEW_FEATURES_SHOWN, true); // run: () => {
}, // configurationService.updateValue('workbench.enablePreviewFeatures', true);
isSecondary: true // storageService.store(EnablePreviewFeatures.ENABLE_PREVIEW_FEATURES_SHOWN, true);
}] // }
); // }, {
}) // label: localize('enablePreviewFeatures.no', "No"),
.then(null, onUnexpectedError); // run: () => {
// configurationService.updateValue('workbench.enablePreviewFeatures', false);
// }
// }, {
// label: localize('enablePreviewFeatures.never', "No, don't show again"),
// run: () => {
// configurationService.updateValue('workbench.enablePreviewFeatures', false);
// storageService.store(EnablePreviewFeatures.ENABLE_PREVIEW_FEATURES_SHOWN, true);
// },
// isSecondary: true
// }]
// );
// })
// .then(null, onUnexpectedError);
} }
} }