Revert "Hold back new setting (#12387)"

This reverts commit df66048807.
This commit is contained in:
Christof Marti
2017-06-26 11:52:35 -07:00
parent 319957d2c3
commit 7efacfde28
4 changed files with 30 additions and 8 deletions

View File

@@ -241,6 +241,7 @@ const configurationValueWhitelist = [
'php.validate.enable',
'php.validate.run',
'workbench.welcome.enabled',
'workbench.startupEditor',
];
export function configurationTelemetry(telemetryService: ITelemetryService, configurationService: IConfigurationService): IDisposable {

View File

@@ -470,7 +470,14 @@ export class Workbench implements IPartService {
}
private openUntitledFile() {
return !this.configurationService.lookup('workbench.welcome.enabled').value;
const startupEditor = this.configurationService.lookup('workbench.startupEditor');
if (!startupEditor.user && !startupEditor.workspace) {
const welcomeEnabled = this.configurationService.lookup('workbench.welcome.enabled');
if (welcomeEnabled.value !== undefined && welcomeEnabled.value !== null) {
return !welcomeEnabled.value;
}
}
return startupEditor.value === 'newUntitledFile';
}
private initServices(): void {

View File

@@ -18,10 +18,16 @@ Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration)
'order': 7,
'title': localize('workbenchConfigurationTitle', "Workbench"),
'properties': {
'workbench.welcome.enabled': {
'type': 'boolean',
'default': true,
'description': localize('welcomePage.enabled', "When enabled, will show the Welcome page on startup.")
'workbench.startupEditor': {
'type': 'string',
'enum': ['none', 'welcomePage', 'newUntitledFile'],
'enumDescriptions': [
localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'workbench.startupEditor.none' }, "Start without an editor."),
localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'workbench.startupEditor.welcomePage' }, "Open the Welcome page (default)."),
localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'workbench.startupEditor.newUntitledFile' }, "Open a new untitled file."),
],
'default': 'welcomePage',
'description': localize('workbench.startupEditor', "Controls which editor is shown at startup, if none is restored from the previous session. Select 'none' to start without an editor, 'welcomePage' to open the Welcome page (default), 'newUntitledFile' to open a new untitled file (only when not opening a folder).")
},
}
});

View File

@@ -42,7 +42,8 @@ import { IStorageService } from "vs/platform/storage/common/storage";
used();
const configurationKey = 'workbench.welcome.enabled';
const configurationKey = 'workbench.startupEditor';
const oldConfigurationKey = 'workbench.welcome.enabled';
const telemetryFrom = 'welcomePage';
export class WelcomePageContribution implements IWorkbenchContribution {
@@ -76,7 +77,14 @@ export class WelcomePageContribution implements IWorkbenchContribution {
}
function isWelcomePageEnabled(configurationService: IConfigurationService) {
return configurationService.lookup(configurationKey).value;
const startupEditor = configurationService.lookup(configurationKey);
if (!startupEditor.user && !startupEditor.workspace) {
const welcomeEnabled = configurationService.lookup(oldConfigurationKey);
if (welcomeEnabled.value !== undefined && welcomeEnabled.value !== null) {
return welcomeEnabled.value;
}
}
return startupEditor.value === 'welcomePage';
}
export class WelcomePageAction extends Action {
@@ -209,7 +217,7 @@ class WelcomePage {
showOnStartup.setAttribute('checked', 'checked');
}
showOnStartup.addEventListener('click', e => {
this.configurationEditingService.writeConfiguration(ConfigurationTarget.USER, { key: configurationKey, value: showOnStartup.checked });
this.configurationEditingService.writeConfiguration(ConfigurationTarget.USER, { key: configurationKey, value: showOnStartup.checked ? 'welcomePage' : 'newUntitledFile' });
});
recentlyOpened.then(({ folders }) => {