提交 e6e034b8 编写于 作者: C Christof Marti

Always show Help > Welcome (fixes #19163)

上级 a688ae6e
......@@ -160,9 +160,6 @@ export class VSCodeMenu {
private extensionViewlets: IExtensionViewlet[];
private _welcome: Electron.MenuItem;
private _welcomeEnabled = false;
constructor(
@IUpdateService private updateService: IUpdateService,
@IInstantiationService instantiationService: IInstantiationService,
......@@ -210,13 +207,6 @@ export class VSCodeMenu {
}
});
ipc.on('vscode:welcomeEnabled', (event, enabled: string) => {
this._welcomeEnabled = enabled === 'true';
if (this._welcome) {
this._welcome.visible = this._welcomeEnabled;
}
});
// Update when auto save config changes
this.configurationService.onDidUpdateConfiguration(e => this.onConfigurationUpdated(e.config, true /* update menu if changed */));
......@@ -855,14 +845,12 @@ export class VSCodeMenu {
}
}
this._welcome = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miWelcome', comment: ['&& denotes a mnemonic'] }, "&&Welcome")), click: () => this.windowsService.sendToFocused('vscode:runAction', 'workbench.action.welcomePage') });
this._welcome.visible = this._welcomeEnabled;
const keyboardShortcutsUrl = platform.isLinux ? product.keyboardShortcutsUrlLinux : platform.isMacintosh ? product.keyboardShortcutsUrlMac : product.keyboardShortcutsUrlWin;
arrays.coalesce([
this._welcome,
new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miWelcome', comment: ['&& denotes a mnemonic'] }, "&&Welcome")), click: () => this.windowsService.sendToFocused('vscode:runAction', 'workbench.action.welcomePage') }),
product.documentationUrl ? new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miDocumentation', comment: ['&& denotes a mnemonic'] }, "&&Documentation")), click: () => this.windowsService.sendToFocused('vscode:runAction', 'workbench.action.openDocumentationUrl') }) : null,
product.releaseNotesUrl ? new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miReleaseNotes', comment: ['&& denotes a mnemonic'] }, "&&Release Notes")), click: () => this.windowsService.sendToFocused('vscode:runAction', 'update.showCurrentReleaseNotes') }) : null,
product.documentationUrl || product.releaseNotesUrl ? __separator__() : null,
__separator__(),
keyboardShortcutsUrl ? new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miKeyboardShortcuts', comment: ['&& denotes a mnemonic'] }, "&&Keyboard Shortcuts Reference")), click: () => this.windowsService.sendToFocused('vscode:runAction', 'workbench.action.keybindingsReference') }) : null,
product.introductoryVideosUrl ? new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miIntroductoryVideos', comment: ['&& denotes a mnemonic'] }, "Introductory &&Videos")), click: () => this.windowsService.sendToFocused('vscode:runAction', 'workbench.action.openIntroductoryVideosUrl') }) : null,
(product.introductoryVideosUrl || keyboardShortcutsUrl) ? __separator__() : null,
......
......@@ -46,7 +46,6 @@ import { ICommandService } from 'vs/platform/commands/common/commands';
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
import { Position, IResourceInput } from 'vs/platform/editor/common/editor';
import { IExtensionService } from 'vs/platform/extensions/common/extensions';
import { isWelcomePageEnabled } from 'vs/platform/telemetry/common/telemetryUtils';
import { remote, ipcRenderer as ipc, webFrame } from 'electron';
......@@ -284,8 +283,6 @@ export class ElectronWindow {
}
});
ipc.send('vscode:welcomeEnabled', String(isWelcomePageEnabled()));
// Configuration changes
let previousConfiguredZoomLevel: number;
this.configurationService.onDidUpdateConfiguration(e => {
......
......@@ -16,24 +16,21 @@ import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
import { IWorkbenchActionRegistry, Extensions } from 'vs/workbench/common/actionRegistry';
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions';
import { isWelcomePageEnabled } from 'vs/platform/telemetry/common/telemetryUtils';
if (isWelcomePageEnabled()) {
Registry.as<IEditorRegistry>(EditorExtensions.Editors)
.registerEditor(new EditorDescriptor(WalkThroughPart.ID,
localize('walkThrough.editor.label', "Interactive Playground"),
'vs/workbench/parts/walkThrough/electron-browser/walkThroughPart',
'WalkThroughPart'),
[new SyncDescriptor(WalkThroughInput)]);
Registry.as<IEditorRegistry>(EditorExtensions.Editors)
.registerEditor(new EditorDescriptor(WalkThroughPart.ID,
localize('walkThrough.editor.label', "Interactive Playground"),
'vs/workbench/parts/walkThrough/electron-browser/walkThroughPart',
'WalkThroughPart'),
[new SyncDescriptor(WalkThroughInput)]);
Registry.as<IWorkbenchActionRegistry>(Extensions.WorkbenchActions)
.registerWorkbenchAction(
new SyncActionDescriptor(EditorWalkThroughAction, EditorWalkThroughAction.ID, EditorWalkThroughAction.LABEL),
'Help: Interactive Playground', localize('help', "Help"));
Registry.as<IWorkbenchActionRegistry>(Extensions.WorkbenchActions)
.registerWorkbenchAction(
new SyncActionDescriptor(EditorWalkThroughAction, EditorWalkThroughAction.ID, EditorWalkThroughAction.LABEL),
'Help: Interactive Playground', localize('help', "Help"));
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench)
.registerWorkbenchContribution(WalkThroughContentProvider);
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench)
.registerWorkbenchContribution(WalkThroughContentProvider);
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench)
.registerWorkbenchContribution(WalkThroughSnippetContentProvider);
}
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench)
.registerWorkbenchContribution(WalkThroughSnippetContentProvider);
......@@ -24,7 +24,6 @@ import { ICommandService } from 'vs/platform/commands/common/commands';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { RawContextKey, IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { KeyCode } from 'vs/base/common/keyCodes';
import { isWelcomePageEnabled } from 'vs/platform/telemetry/common/telemetryUtils';
interface Key {
id: string;
......@@ -214,13 +213,11 @@ export class WelcomeOverlayContribution implements IWorkbenchContribution {
}
}
if (isWelcomePageEnabled()) {
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench)
.registerWorkbenchContribution(WelcomeOverlayContribution);
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench)
.registerWorkbenchContribution(WelcomeOverlayContribution);
Registry.as<IWorkbenchActionRegistry>(Extensions.WorkbenchActions)
.registerWorkbenchAction(new SyncActionDescriptor(WelcomeOverlayAction, WelcomeOverlayAction.ID, WelcomeOverlayAction.LABEL), 'Help: Show Interface Overview', localize('help', "Help"));
Registry.as<IWorkbenchActionRegistry>(Extensions.WorkbenchActions)
.registerWorkbenchAction(new SyncActionDescriptor(WelcomeOverlayAction, WelcomeOverlayAction.ID, WelcomeOverlayAction.LABEL), 'Help: Show Interface Overview', localize('help', "Help"));
Registry.as<IWorkbenchActionRegistry>(Extensions.WorkbenchActions)
.registerWorkbenchAction(new SyncActionDescriptor(HideWelcomeOverlayAction, HideWelcomeOverlayAction.ID, HideWelcomeOverlayAction.LABEL, { primary: KeyCode.Escape }, OVERLAY_VISIBLE), 'Help: Hide Interface Overview', localize('help', "Help"));
}
Registry.as<IWorkbenchActionRegistry>(Extensions.WorkbenchActions)
.registerWorkbenchAction(new SyncActionDescriptor(HideWelcomeOverlayAction, HideWelcomeOverlayAction.ID, HideWelcomeOverlayAction.LABEL, { primary: KeyCode.Escape }, OVERLAY_VISIBLE), 'Help: Hide Interface Overview', localize('help', "Help"));
......@@ -13,24 +13,22 @@ import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/wor
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
import { isWelcomePageEnabled } from 'vs/platform/telemetry/common/telemetryUtils';
if (isWelcomePageEnabled()) {
Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration)
.registerConfiguration({
'id': 'workbench',
'order': 7,
'title': localize('workbenchConfigurationTitle', "Workbench"),
'properties': {
'workbench.welcome.enabled': {
'type': 'boolean',
'default': true,
'description': localize('welcomePage.enabled', "When enabled, will show the Welcome experience on startup.")
},
}
});
Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration)
.registerConfiguration({
'id': 'workbench',
'order': 7,
'title': localize('workbenchConfigurationTitle', "Workbench"),
'properties': {
'workbench.welcome.enabled': {
'type': 'boolean',
'default': isWelcomePageEnabled(),
'description': localize('welcomePage.enabled', "When enabled, will show the Welcome experience on startup.")
},
}
});
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench)
.registerWorkbenchContribution(WelcomePageContribution);
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench)
.registerWorkbenchContribution(WelcomePageContribution);
Registry.as<IWorkbenchActionRegistry>(ActionExtensions.WorkbenchActions)
.registerWorkbenchAction(new SyncActionDescriptor(WelcomePageAction, WelcomePageAction.ID, WelcomePageAction.LABEL), 'Help: Welcome', localize('help', "Help"));
}
Registry.as<IWorkbenchActionRegistry>(ActionExtensions.WorkbenchActions)
.registerWorkbenchAction(new SyncActionDescriptor(WelcomePageAction, WelcomePageAction.ID, WelcomePageAction.LABEL), 'Help: Welcome', localize('help', "Help"));
......@@ -36,8 +36,7 @@ export class WelcomePageContribution implements IWorkbenchContribution {
@IWorkbenchEditorService editorService: IWorkbenchEditorService,
@ITelemetryService telemetryService: ITelemetryService
) {
const configured = configurationService.lookup<boolean>(enabledKey).value;
const enabled = typeof configured === 'boolean' ? configured : telemetryService.getExperiments().enableWelcomePage;
const enabled = configurationService.lookup<boolean>(enabledKey).value;
if (enabled) {
partService.joinCreation().then(() => {
const activeInput = editorService.getActiveEditorInput();
......@@ -97,8 +96,7 @@ class WelcomePage {
}
private onReady(container: HTMLElement, recentlyOpened: TPromise<{ files: string[]; folders: string[]; }>): void {
const configured = this.configurationService.lookup<boolean>(enabledKey).value;
const enabled = typeof configured === 'boolean' ? configured : this.telemetryService.getExperiments().enableWelcomePage;
const enabled = this.configurationService.lookup<boolean>(enabledKey).value;
const showOnStartup = <HTMLInputElement>container.querySelector('#showOnStartup');
if (enabled) {
showOnStartup.setAttribute('checked', 'checked');
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册