1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import 'vs/workbench/contrib/welcomeWalkthrough/browser/editor/vs_code_editor_walkthrough';
import { localize } from 'vs/nls';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { WalkThroughInput, WalkThroughInputOptions } from 'vs/workbench/contrib/welcomeWalkthrough/browser/walkThroughInput';
import { FileAccess, Schemas } from 'vs/base/common/network';
import { IEditorSerializer } from 'vs/workbench/common/editor';
import { EditorInput } from 'vs/workbench/common/editor/editorInput';
import { Action2 } from 'vs/platform/actions/common/actions';
import { Categories } from 'vs/platform/action/common/actionCommonCategories';
const typeId = 'workbench.editors.walkThroughInput';
const inputOptions: WalkThroughInputOptions = {
typeId,
name: localize('editorWalkThrough.title', "Editor Playground"),
resource: FileAccess.asBrowserUri('./vs_code_editor_walkthrough.md', require)
.with({
scheme: Schemas.walkThrough,
query: JSON.stringify({ moduleId: 'vs/workbench/contrib/welcomeWalkthrough/browser/editor/vs_code_editor_walkthrough' })
}),
telemetryFrom: 'walkThrough'
};
export class EditorWalkThroughAction extends Action2 {
public static readonly ID = 'workbench.action.showInteractivePlayground';
public static readonly LABEL = { value: localize('editorWalkThrough', "Interactive Editor Playground"), original: 'Interactive Editor Playground' };
constructor() {
super({
id: EditorWalkThroughAction.ID,
title: EditorWalkThroughAction.LABEL,
category: Categories.Help,
f1: true
});
}
public override run(serviceAccessor: ServicesAccessor): Promise<void> {
const editorService = serviceAccessor.get(IEditorService);
const instantiationService = serviceAccessor.get(IInstantiationService);
const input = instantiationService.createInstance(WalkThroughInput, inputOptions);
// TODO @lramos15 adopt the resolver here
return editorService.openEditor(input, { pinned: true })
.then(() => void (0));
}
}
export class EditorWalkThroughInputSerializer implements IEditorSerializer {
static readonly ID = typeId;
public canSerialize(editorInput: EditorInput): boolean {
return true;
}
public serialize(editorInput: EditorInput): string {
return '';
}
public deserialize(instantiationService: IInstantiationService): WalkThroughInput {
return instantiationService.createInstance(WalkThroughInput, inputOptions);
}
}
|