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

import { localize } from 'vs/nls';
8 9 10 11
import { WalkThroughInput } from 'vs/workbench/parts/welcome/walkThrough/node/walkThroughInput';
import { WalkThroughPart, WALK_THROUGH_FOCUS } from 'vs/workbench/parts/welcome/walkThrough/electron-browser/walkThroughPart';
import { WalkThroughArrowUpAction, WalkThroughArrowDownAction, WalkThroughPageUpAction, WalkThroughPageDownAction } from 'vs/workbench/parts/welcome/walkThrough/electron-browser/walkThroughActions';
import { WalkThroughContentProvider, WalkThroughSnippetContentProvider } from 'vs/workbench/parts/welcome/walkThrough/node/walkThroughContentProvider';
12
import { EditorWalkThroughAction, EditorWalkThroughInputFactory } from 'vs/workbench/parts/welcome/walkThrough/electron-browser/editor/editorWalkThrough';
13
import { Registry } from 'vs/platform/registry/common/platform';
14
import { Extensions as EditorInputExtensions, IEditorInputFactoryRegistry } from 'vs/workbench/common/editor';
C
Christof Marti 已提交
15
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
B
Benjamin Pasero 已提交
16
import { IWorkbenchActionRegistry, Extensions } from 'vs/workbench/common/actions';
C
Christof Marti 已提交
17
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
C
Christof Marti 已提交
18
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions';
19
import { KeyCode } from 'vs/base/common/keyCodes';
20
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
21
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
22
import { IEditorRegistry, Extensions as EditorExtensions, EditorDescriptor } from 'vs/workbench/browser/editor';
23
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
C
Christof Marti 已提交
24

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

33 34 35 36
Registry.as<IWorkbenchActionRegistry>(Extensions.WorkbenchActions)
	.registerWorkbenchAction(
	new SyncActionDescriptor(EditorWalkThroughAction, EditorWalkThroughAction.ID, EditorWalkThroughAction.LABEL),
	'Help: Interactive Playground', localize('help', "Help"));
C
Christof Marti 已提交
37

38
Registry.as<IEditorInputFactoryRegistry>(EditorInputExtensions.EditorInputFactories).registerEditorInputFactory(EditorWalkThroughInputFactory.ID, EditorWalkThroughInputFactory);
39

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

43
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench)
44
	.registerWorkbenchContribution(WalkThroughSnippetContentProvider, LifecyclePhase.Starting);
45 46

Registry.as<IWorkbenchActionRegistry>(Extensions.WorkbenchActions)
47
	.registerWorkbenchAction(new SyncActionDescriptor(WalkThroughArrowUpAction, WalkThroughArrowUpAction.ID, WalkThroughArrowUpAction.LABEL, { primary: KeyCode.UpArrow }, ContextKeyExpr.and(WALK_THROUGH_FOCUS, EditorContextKeys.textFocus.toNegated())), 'Interactive Playground: Scroll Up (Line)', localize('interactivePlayground', "Interactive Playground"));
48 49

Registry.as<IWorkbenchActionRegistry>(Extensions.WorkbenchActions)
50
	.registerWorkbenchAction(new SyncActionDescriptor(WalkThroughArrowDownAction, WalkThroughArrowDownAction.ID, WalkThroughArrowDownAction.LABEL, { primary: KeyCode.DownArrow }, ContextKeyExpr.and(WALK_THROUGH_FOCUS, EditorContextKeys.textFocus.toNegated())), 'Interactive Playground: Scroll Down (Line)', localize('interactivePlayground', "Interactive Playground"));
51 52

Registry.as<IWorkbenchActionRegistry>(Extensions.WorkbenchActions)
53
	.registerWorkbenchAction(new SyncActionDescriptor(WalkThroughPageUpAction, WalkThroughPageUpAction.ID, WalkThroughPageUpAction.LABEL, { primary: KeyCode.PageUp }, ContextKeyExpr.and(WALK_THROUGH_FOCUS, EditorContextKeys.textFocus.toNegated())), 'Interactive Playground: Scroll Up (Page)', localize('interactivePlayground', "Interactive Playground"));
54 55

Registry.as<IWorkbenchActionRegistry>(Extensions.WorkbenchActions)
56
	.registerWorkbenchAction(new SyncActionDescriptor(WalkThroughPageDownAction, WalkThroughPageDownAction.ID, WalkThroughPageDownAction.LABEL, { primary: KeyCode.PageDown }, ContextKeyExpr.and(WALK_THROUGH_FOCUS, EditorContextKeys.textFocus.toNegated())), 'Interactive Playground: Scroll Down (Page)', localize('interactivePlayground', "Interactive Playground"));