walkThrough.contribution.ts 3.4 KB
Newer Older
C
Christof Marti 已提交
1 2 3 4 5 6
/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

import { localize } from 'vs/nls';
B
Benjamin Pasero 已提交
7
import { WalkThroughInput } from 'vs/workbench/contrib/welcome/walkThrough/browser/walkThroughInput';
8 9 10 11
import { WalkThroughPart } from 'vs/workbench/contrib/welcome/walkThrough/browser/walkThroughPart';
import { WalkThroughArrowUp, WalkThroughArrowDown, WalkThroughPageUp, WalkThroughPageDown } from 'vs/workbench/contrib/welcome/walkThrough/browser/walkThroughActions';
import { WalkThroughContentProvider, WalkThroughSnippetContentProvider } from 'vs/workbench/contrib/welcome/walkThrough/common/walkThroughContentProvider';
import { EditorWalkThroughAction, EditorWalkThroughInputFactory } from 'vs/workbench/contrib/welcome/walkThrough/browser/editor/editorWalkThrough';
12
import { Registry } from 'vs/platform/registry/common/platform';
13
import { Extensions as EditorInputExtensions, IEditorInputFactoryRegistry } from 'vs/workbench/common/editor';
C
Christof Marti 已提交
14
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
15
import { IWorkbenchActionRegistry, Extensions, CATEGORIES } from 'vs/workbench/common/actions';
16
import { SyncActionDescriptor, MenuRegistry, MenuId } from 'vs/platform/actions/common/actions';
C
Christof Marti 已提交
17
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions';
18
import { IEditorRegistry, Extensions as EditorExtensions, EditorDescriptor } from 'vs/workbench/browser/editor';
19
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
20
import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry';
C
Christof Marti 已提交
21

22
Registry.as<IEditorRegistry>(EditorExtensions.Editors)
23
	.registerEditor(EditorDescriptor.create(
24 25
		WalkThroughPart,
		WalkThroughPart.ID,
26
		localize('walkThrough.editor.label', "Interactive Playground"),
27
	),
M
Matt Bierner 已提交
28
		[new SyncDescriptor(WalkThroughInput)]);
C
Christof Marti 已提交
29

30 31
Registry.as<IWorkbenchActionRegistry>(Extensions.WorkbenchActions)
	.registerWorkbenchAction(
32
		SyncActionDescriptor.from(EditorWalkThroughAction),
33
		'Help: Interactive Playground', CATEGORIES.Help.value);
C
Christof Marti 已提交
34

35
Registry.as<IEditorInputFactoryRegistry>(EditorInputExtensions.EditorInputFactories).registerEditorInputFactory(EditorWalkThroughInputFactory.ID, EditorWalkThroughInputFactory);
36

37
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench)
38
	.registerWorkbenchContribution(WalkThroughContentProvider, LifecyclePhase.Starting);
39

40
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench)
41
	.registerWorkbenchContribution(WalkThroughSnippetContentProvider, LifecyclePhase.Starting);
42

43
KeybindingsRegistry.registerCommandAndKeybindingRule(WalkThroughArrowUp);
44

45
KeybindingsRegistry.registerCommandAndKeybindingRule(WalkThroughArrowDown);
46

47
KeybindingsRegistry.registerCommandAndKeybindingRule(WalkThroughPageUp);
48

49
KeybindingsRegistry.registerCommandAndKeybindingRule(WalkThroughPageDown);
50 51 52 53 54

MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
	group: '1_welcome',
	command: {
		id: 'workbench.action.showInteractivePlayground',
S
SteVen Batten 已提交
55
		title: localize({ key: 'miInteractivePlayground', comment: ['&& denotes a mnemonic'] }, "I&&nteractive Playground")
56 57
	},
	order: 2
B
Benjamin Pasero 已提交
58
});