@codingame/monaco-vscode-welcome-service-override 4.1.0 → 4.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/external/rollup-plugin-styles/dist/runtime/inject-css.js +3 -0
  2. package/external/tslib/tslib.es6.js +11 -0
  3. package/external/vscode-marked/lib/marked.esm.js +2200 -0
  4. package/package.json +2 -2
  5. package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.contribution.js +382 -0
  6. package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.js +1528 -0
  7. package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedColors.js +48 -0
  8. package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedDetailsRenderer.js +263 -0
  9. package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedIcons.js +16 -0
  10. package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedInput.js +53 -0
  11. package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedList.js +97 -0
  12. package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/media/gettingStarted.css.js +6 -0
  13. package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/startupPage.js +218 -0
  14. package/vscode/src/vs/workbench/contrib/welcomeViews/common/newFile.contribution.js +238 -0
  15. package/vscode/src/vs/workbench/contrib/welcomeViews/common/viewsWelcome.contribution.js +19 -0
  16. package/vscode/src/vs/workbench/contrib/welcomeViews/common/viewsWelcomeContribution.js +75 -0
  17. package/vscode/src/vs/workbench/contrib/welcomeViews/common/viewsWelcomeExtensionPoint.js +99 -0
  18. package/vscode/src/vs/workbench/contrib/welcomeWalkthrough/browser/editor/editorWalkThrough.js +63 -0
  19. package/vscode/src/vs/workbench/contrib/welcomeWalkthrough/browser/media/walkThroughPart.css.js +6 -0
  20. package/vscode/src/vs/workbench/contrib/welcomeWalkthrough/browser/walkThrough.contribution.js +39 -0
  21. package/vscode/src/vs/workbench/contrib/welcomeWalkthrough/browser/walkThroughActions.js +59 -0
  22. package/vscode/src/vs/workbench/contrib/welcomeWalkthrough/browser/walkThroughInput.js +115 -0
  23. package/vscode/src/vs/workbench/contrib/welcomeWalkthrough/browser/walkThroughPart.js +431 -0
  24. package/vscode/src/vs/workbench/contrib/welcomeWalkthrough/common/walkThroughContentProvider.js +76 -0
  25. package/vscode/src/vs/workbench/contrib/welcomeWalkthrough/common/walkThroughUtils.js +19 -0
  26. package/welcome.js +4 -4
@@ -0,0 +1,218 @@
1
+ import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
+ import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands';
3
+ import { coalesce } from 'vscode/vscode/vs/base/common/arrays';
4
+ import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
5
+ import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
6
+ import { onUnexpectedError } from 'vscode/vscode/vs/base/common/errors';
7
+ import { UNKNOWN_EMPTY_WINDOW_WORKSPACE, IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace';
8
+ import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
9
+ import { IWorkingCopyBackupService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyBackup';
10
+ import { ILifecycleService } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle';
11
+ import { IFileService } from 'vscode/vscode/vs/platform/files/common/files';
12
+ import { joinPath } from 'vscode/vscode/vs/base/common/resources';
13
+ import { IWorkbenchLayoutService } from 'vscode/vscode/vs/workbench/services/layout/browser/layoutService';
14
+ import { GettingStartedInput, gettingStartedInputTypeId } from './gettingStartedInput.js';
15
+ import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService';
16
+ import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
17
+ import { getTelemetryLevel } from 'vscode/vscode/vs/platform/telemetry/common/telemetryUtils';
18
+ import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService';
19
+ import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
20
+ import { INotificationService } from 'vscode/vscode/vs/platform/notification/common/notification';
21
+ import { localizeWithPath } from 'vscode/vscode/vs/nls';
22
+ import { RegisteredEditorPriority, IEditorResolverService } from 'vscode/vscode/vs/workbench/services/editor/common/editorResolverService';
23
+
24
+ const restoreWalkthroughsConfigurationKey = 'workbench.welcomePage.restorableWalkthroughs';
25
+ const configurationKey = 'workbench.startupEditor';
26
+ const oldConfigurationKey = 'workbench.welcome.enabled';
27
+ const telemetryOptOutStorageKey = 'workbench.telemetryOptOutShown';
28
+ let StartupPageEditorResolverContribution = class StartupPageEditorResolverContribution {
29
+ static { this.ID = 'workbench.contrib.startupPageEditorResolver'; }
30
+ constructor(instantiationService, editorResolverService) {
31
+ this.instantiationService = instantiationService;
32
+ editorResolverService.registerEditor(`${GettingStartedInput.RESOURCE.scheme}:/**`, {
33
+ id: GettingStartedInput.ID,
34
+ label: ( localizeWithPath(
35
+ 'vs/workbench/contrib/welcomeGettingStarted/browser/startupPage',
36
+ 'welcome.displayName',
37
+ "Welcome Page"
38
+ )),
39
+ priority: RegisteredEditorPriority.builtin,
40
+ }, {
41
+ singlePerResource: false,
42
+ canSupportResource: uri => uri.scheme === GettingStartedInput.RESOURCE.scheme,
43
+ }, {
44
+ createEditorInput: ({ resource, options }) => {
45
+ return {
46
+ editor: this.instantiationService.createInstance(GettingStartedInput, options),
47
+ options: {
48
+ ...options,
49
+ pinned: false
50
+ }
51
+ };
52
+ }
53
+ });
54
+ }
55
+ };
56
+ StartupPageEditorResolverContribution = ( __decorate([
57
+ ( __param(0, IInstantiationService)),
58
+ ( __param(1, IEditorResolverService))
59
+ ], StartupPageEditorResolverContribution));
60
+ let StartupPageRunnerContribution = class StartupPageRunnerContribution {
61
+ static { this.ID = 'workbench.contrib.startupPageRunner'; }
62
+ constructor(configurationService, editorService, workingCopyBackupService, fileService, contextService, lifecycleService, layoutService, productService, commandService, environmentService, storageService, logService, notificationService) {
63
+ this.configurationService = configurationService;
64
+ this.editorService = editorService;
65
+ this.workingCopyBackupService = workingCopyBackupService;
66
+ this.fileService = fileService;
67
+ this.contextService = contextService;
68
+ this.lifecycleService = lifecycleService;
69
+ this.layoutService = layoutService;
70
+ this.productService = productService;
71
+ this.commandService = commandService;
72
+ this.environmentService = environmentService;
73
+ this.storageService = storageService;
74
+ this.logService = logService;
75
+ this.notificationService = notificationService;
76
+ this.run().then(undefined, onUnexpectedError);
77
+ }
78
+ async run() {
79
+ await this.lifecycleService.when(3 );
80
+ if (this.productService.enableTelemetry
81
+ && this.productService.showTelemetryOptOut
82
+ && getTelemetryLevel(this.configurationService) !== 0
83
+ && !this.environmentService.skipWelcome
84
+ && !this.storageService.get(telemetryOptOutStorageKey, 0 )) {
85
+ this.storageService.store(telemetryOptOutStorageKey, true, 0 , 0 );
86
+ await this.openGettingStarted(true);
87
+ return;
88
+ }
89
+ if (this.tryOpenWalkthroughForFolder()) {
90
+ return;
91
+ }
92
+ const enabled = isStartupPageEnabled(this.configurationService, this.contextService, this.environmentService);
93
+ if (enabled && this.lifecycleService.startupKind !== 3 ) {
94
+ const hasBackups = await this.workingCopyBackupService.hasBackups();
95
+ if (hasBackups) {
96
+ return;
97
+ }
98
+ if (!this.editorService.activeEditor || this.layoutService.openedDefaultEditors) {
99
+ const startupEditorSetting = this.configurationService.inspect(configurationKey);
100
+ const isStartupEditorReadme = startupEditorSetting.value === 'readme';
101
+ const isStartupEditorUserReadme = startupEditorSetting.userValue === 'readme';
102
+ const isStartupEditorDefaultReadme = startupEditorSetting.defaultValue === 'readme';
103
+ if (isStartupEditorReadme && (!isStartupEditorUserReadme || !isStartupEditorDefaultReadme)) {
104
+ this.logService.warn(`Warning: 'workbench.startupEditor: readme' setting ignored due to being set somewhere other than user or default settings (user=${startupEditorSetting.userValue}, default=${startupEditorSetting.defaultValue})`);
105
+ }
106
+ const openWithReadme = isStartupEditorReadme && (isStartupEditorUserReadme || isStartupEditorDefaultReadme);
107
+ if (openWithReadme) {
108
+ await this.openReadme();
109
+ }
110
+ else if (startupEditorSetting.value === 'welcomePage' || startupEditorSetting.value === 'welcomePageInEmptyWorkbench') {
111
+ await this.openGettingStarted();
112
+ }
113
+ else if (startupEditorSetting.value === 'terminal') {
114
+ this.commandService.executeCommand("workbench.action.createTerminalEditor" );
115
+ }
116
+ }
117
+ }
118
+ }
119
+ tryOpenWalkthroughForFolder() {
120
+ const toRestore = this.storageService.get(restoreWalkthroughsConfigurationKey, 0 );
121
+ if (!toRestore) {
122
+ return false;
123
+ }
124
+ else {
125
+ const restoreData = JSON.parse(toRestore);
126
+ const currentWorkspace = this.contextService.getWorkspace();
127
+ if (restoreData.folder === UNKNOWN_EMPTY_WINDOW_WORKSPACE.id || restoreData.folder === ( currentWorkspace.folders[0].uri.toString())) {
128
+ this.editorService.openEditor({
129
+ resource: GettingStartedInput.RESOURCE,
130
+ options: { selectedCategory: restoreData.category, selectedStep: restoreData.step, pinned: false },
131
+ });
132
+ this.storageService.remove(restoreWalkthroughsConfigurationKey, 0 );
133
+ return true;
134
+ }
135
+ }
136
+ return false;
137
+ }
138
+ async openReadme() {
139
+ const readmes = coalesce(await Promise.all(( this.contextService.getWorkspace().folders.map(async (folder) => {
140
+ const folderUri = folder.uri;
141
+ const folderStat = await this.fileService.resolve(folderUri).catch(onUnexpectedError);
142
+ const files = folderStat?.children ? ( folderStat.children.map(child => child.name)).sort() : [];
143
+ const file = files.find(file => file.toLowerCase() === 'readme.md') || files.find(file => file.toLowerCase().startsWith('readme'));
144
+ if (file) {
145
+ return joinPath(folderUri, file);
146
+ }
147
+ else {
148
+ return undefined;
149
+ }
150
+ }))));
151
+ if (!this.editorService.activeEditor) {
152
+ if (readmes.length) {
153
+ const isMarkDown = (readme) => readme.path.toLowerCase().endsWith('.md');
154
+ await Promise.all([
155
+ this.commandService.executeCommand('markdown.showPreview', null, readmes.filter(isMarkDown), { locked: true }).catch(error => {
156
+ this.notificationService.error(( localizeWithPath(
157
+ 'vs/workbench/contrib/welcomeGettingStarted/browser/startupPage',
158
+ 'startupPage.markdownPreviewError',
159
+ 'Could not open markdown preview: {0}.\n\nPlease make sure the markdown extension is enabled.',
160
+ error.message
161
+ )));
162
+ }),
163
+ this.editorService.openEditors(( readmes.filter(readme => !isMarkDown(readme)).map(readme => ({ resource: readme })))),
164
+ ]);
165
+ }
166
+ else {
167
+ await this.openGettingStarted();
168
+ }
169
+ }
170
+ }
171
+ async openGettingStarted(showTelemetryNotice) {
172
+ const startupEditorTypeID = gettingStartedInputTypeId;
173
+ const editor = this.editorService.activeEditor;
174
+ if (editor?.typeId === startupEditorTypeID || ( this.editorService.editors.some(e => e.typeId === startupEditorTypeID))) {
175
+ return;
176
+ }
177
+ const options = editor ? { pinned: false, index: 0 } : { pinned: false };
178
+ {
179
+ this.editorService.openEditor({
180
+ resource: GettingStartedInput.RESOURCE,
181
+ options: { showTelemetryNotice, ...options },
182
+ });
183
+ }
184
+ }
185
+ };
186
+ StartupPageRunnerContribution = ( __decorate([
187
+ ( __param(0, IConfigurationService)),
188
+ ( __param(1, IEditorService)),
189
+ ( __param(2, IWorkingCopyBackupService)),
190
+ ( __param(3, IFileService)),
191
+ ( __param(4, IWorkspaceContextService)),
192
+ ( __param(5, ILifecycleService)),
193
+ ( __param(6, IWorkbenchLayoutService)),
194
+ ( __param(7, IProductService)),
195
+ ( __param(8, ICommandService)),
196
+ ( __param(9, IWorkbenchEnvironmentService)),
197
+ ( __param(10, IStorageService)),
198
+ ( __param(11, ILogService)),
199
+ ( __param(12, INotificationService))
200
+ ], StartupPageRunnerContribution));
201
+ function isStartupPageEnabled(configurationService, contextService, environmentService) {
202
+ if (environmentService.skipWelcome) {
203
+ return false;
204
+ }
205
+ const startupEditor = configurationService.inspect(configurationKey);
206
+ if (!startupEditor.userValue && !startupEditor.workspaceValue) {
207
+ const welcomeEnabled = configurationService.inspect(oldConfigurationKey);
208
+ if (welcomeEnabled.value !== undefined && welcomeEnabled.value !== null) {
209
+ return welcomeEnabled.value;
210
+ }
211
+ }
212
+ return startupEditor.value === 'welcomePage'
213
+ || startupEditor.value === 'readme' && (startupEditor.userValue === 'readme' || startupEditor.defaultValue === 'readme')
214
+ || (contextService.getWorkbenchState() === 1 && startupEditor.value === 'welcomePageInEmptyWorkbench')
215
+ || startupEditor.value === 'terminal';
216
+ }
217
+
218
+ export { StartupPageEditorResolverContribution, StartupPageRunnerContribution, restoreWalkthroughsConfigurationKey };
@@ -0,0 +1,238 @@
1
+ import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
+ import { promiseWithResolvers } from 'vscode/vscode/vs/base/common/async';
3
+ import { Disposable, DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
4
+ import { assertIsDefined } from 'vscode/vscode/vs/base/common/types';
5
+ import { localizeWithPath, localize2WithPath } from 'vscode/vscode/vs/nls';
6
+ import { registerAction2, Action2, MenuId, MenuItemAction, MenuRegistry, IMenuService } from 'vscode/vscode/vs/platform/actions/common/actions';
7
+ import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands';
8
+ import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
9
+ import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding';
10
+ import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput';
11
+ import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
12
+ import { Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
13
+
14
+ var NewFileTemplatesManager_1;
15
+ const builtInSource = ( localizeWithPath(
16
+ 'vs/workbench/contrib/welcomeViews/common/newFile.contribution',
17
+ 'Built-In',
18
+ "Built-In"
19
+ ));
20
+ const category = ( localize2WithPath(
21
+ 'vs/workbench/contrib/welcomeViews/common/newFile.contribution',
22
+ 'Create',
23
+ 'Create'
24
+ ));
25
+ registerAction2(class extends Action2 {
26
+ constructor() {
27
+ super({
28
+ id: 'welcome.showNewFileEntries',
29
+ title: ( localize2WithPath(
30
+ 'vs/workbench/contrib/welcomeViews/common/newFile.contribution',
31
+ 'welcome.newFile',
32
+ 'New File...'
33
+ )),
34
+ category,
35
+ f1: true,
36
+ keybinding: {
37
+ primary: 512 + 2048 + 256 + 44 ,
38
+ weight: 200 ,
39
+ },
40
+ menu: {
41
+ id: MenuId.MenubarFileMenu,
42
+ group: '1_new',
43
+ order: 2
44
+ }
45
+ });
46
+ }
47
+ async run(accessor) {
48
+ return assertIsDefined(NewFileTemplatesManager.Instance).run();
49
+ }
50
+ });
51
+ let NewFileTemplatesManager = class NewFileTemplatesManager extends Disposable {
52
+ static { NewFileTemplatesManager_1 = this; }
53
+ constructor(quickInputService, contextKeyService, commandService, keybindingService, menuService) {
54
+ super();
55
+ this.quickInputService = quickInputService;
56
+ this.contextKeyService = contextKeyService;
57
+ this.commandService = commandService;
58
+ this.keybindingService = keybindingService;
59
+ NewFileTemplatesManager_1.Instance = this;
60
+ this._register({ dispose() { if (NewFileTemplatesManager_1.Instance === this) {
61
+ NewFileTemplatesManager_1.Instance = undefined;
62
+ } } });
63
+ this.menu = menuService.createMenu(MenuId.NewFile, contextKeyService);
64
+ }
65
+ allEntries() {
66
+ const items = [];
67
+ for (const [groupName, group] of this.menu.getActions({ renderShortTitle: true })) {
68
+ for (const action of group) {
69
+ if (action instanceof MenuItemAction) {
70
+ items.push({ commandID: action.item.id, from: action.item.source?.title ?? builtInSource, title: action.label, group: groupName });
71
+ }
72
+ }
73
+ }
74
+ return items;
75
+ }
76
+ async run() {
77
+ const entries = this.allEntries();
78
+ if (entries.length === 0) {
79
+ throw Error('Unexpected empty new items list');
80
+ }
81
+ else if (entries.length === 1) {
82
+ this.commandService.executeCommand(entries[0].commandID);
83
+ return true;
84
+ }
85
+ else {
86
+ return this.selectNewEntry(entries);
87
+ }
88
+ }
89
+ async selectNewEntry(entries) {
90
+ const { promise: resultPromise, resolve: resolveResult } = promiseWithResolvers();
91
+ const disposables = ( new DisposableStore());
92
+ const qp = this.quickInputService.createQuickPick();
93
+ qp.title = ( localizeWithPath(
94
+ 'vs/workbench/contrib/welcomeViews/common/newFile.contribution',
95
+ 'newFileTitle',
96
+ "New File..."
97
+ ));
98
+ qp.placeholder = ( localizeWithPath(
99
+ 'vs/workbench/contrib/welcomeViews/common/newFile.contribution',
100
+ 'newFilePlaceholder',
101
+ "Select File Type or Enter File Name..."
102
+ ));
103
+ qp.sortByLabel = false;
104
+ qp.matchOnDetail = true;
105
+ qp.matchOnDescription = true;
106
+ const sortCategories = (a, b) => {
107
+ const categoryPriority = { 'file': 1, 'notebook': 2 };
108
+ if (categoryPriority[a.group] && categoryPriority[b.group]) {
109
+ if (categoryPriority[a.group] !== categoryPriority[b.group]) {
110
+ return categoryPriority[b.group] - categoryPriority[a.group];
111
+ }
112
+ }
113
+ else if (categoryPriority[a.group]) {
114
+ return 1;
115
+ }
116
+ else if (categoryPriority[b.group]) {
117
+ return -1;
118
+ }
119
+ if (a.from === builtInSource) {
120
+ return 1;
121
+ }
122
+ if (b.from === builtInSource) {
123
+ return -1;
124
+ }
125
+ return a.from.localeCompare(b.from);
126
+ };
127
+ const displayCategory = {
128
+ 'file': ( localizeWithPath(
129
+ 'vs/workbench/contrib/welcomeViews/common/newFile.contribution',
130
+ 'file',
131
+ "File"
132
+ )),
133
+ 'notebook': ( localizeWithPath(
134
+ 'vs/workbench/contrib/welcomeViews/common/newFile.contribution',
135
+ 'notebook',
136
+ "Notebook"
137
+ )),
138
+ };
139
+ const refreshQp = (entries) => {
140
+ const items = [];
141
+ let lastSeparator;
142
+ entries
143
+ .sort((a, b) => -sortCategories(a, b))
144
+ .forEach((entry) => {
145
+ const command = entry.commandID;
146
+ const keybinding = this.keybindingService.lookupKeybinding(command || '', this.contextKeyService);
147
+ if (lastSeparator !== entry.group) {
148
+ items.push({
149
+ type: 'separator',
150
+ label: displayCategory[entry.group] ?? entry.group
151
+ });
152
+ lastSeparator = entry.group;
153
+ }
154
+ items.push({
155
+ ...entry,
156
+ label: entry.title,
157
+ type: 'item',
158
+ keybinding,
159
+ buttons: command ? [
160
+ {
161
+ iconClass: 'codicon codicon-gear',
162
+ tooltip: ( localizeWithPath(
163
+ 'vs/workbench/contrib/welcomeViews/common/newFile.contribution',
164
+ 'change keybinding',
165
+ "Configure Keybinding"
166
+ ))
167
+ }
168
+ ] : [],
169
+ detail: '',
170
+ description: entry.from,
171
+ });
172
+ });
173
+ qp.items = items;
174
+ };
175
+ refreshQp(entries);
176
+ disposables.add(this.menu.onDidChange(() => refreshQp(this.allEntries())));
177
+ disposables.add(qp.onDidChangeValue((val) => {
178
+ if (val === '') {
179
+ refreshQp(entries);
180
+ return;
181
+ }
182
+ const currentTextEntry = {
183
+ commandID: 'workbench.action.files.newFile',
184
+ commandArgs: { languageId: undefined, viewType: undefined, fileName: val },
185
+ title: ( localizeWithPath(
186
+ 'vs/workbench/contrib/welcomeViews/common/newFile.contribution',
187
+ 'miNewFileWithName',
188
+ "Create New File ({0})",
189
+ val
190
+ )),
191
+ group: 'file',
192
+ from: builtInSource,
193
+ };
194
+ refreshQp([currentTextEntry, ...entries]);
195
+ }));
196
+ disposables.add(qp.onDidAccept(async (e) => {
197
+ const selected = qp.selectedItems[0];
198
+ resolveResult(!!selected);
199
+ qp.hide();
200
+ if (selected) {
201
+ await this.commandService.executeCommand(selected.commandID, selected.commandArgs);
202
+ }
203
+ }));
204
+ disposables.add(qp.onDidHide(() => {
205
+ qp.dispose();
206
+ disposables.dispose();
207
+ resolveResult(false);
208
+ }));
209
+ disposables.add(qp.onDidTriggerItemButton(e => {
210
+ qp.hide();
211
+ this.commandService.executeCommand('workbench.action.openGlobalKeybindings', e.item.commandID);
212
+ resolveResult(false);
213
+ }));
214
+ qp.show();
215
+ return resultPromise;
216
+ }
217
+ };
218
+ NewFileTemplatesManager = NewFileTemplatesManager_1 = ( __decorate([
219
+ ( __param(0, IQuickInputService)),
220
+ ( __param(1, IContextKeyService)),
221
+ ( __param(2, ICommandService)),
222
+ ( __param(3, IKeybindingService)),
223
+ ( __param(4, IMenuService))
224
+ ], NewFileTemplatesManager));
225
+ ( Registry.as(Extensions.Workbench))
226
+ .registerWorkbenchContribution(NewFileTemplatesManager, 3 );
227
+ MenuRegistry.appendMenuItem(MenuId.NewFile, {
228
+ group: 'file',
229
+ command: {
230
+ id: 'workbench.action.files.newUntitledFile',
231
+ title: ( localizeWithPath(
232
+ 'vs/workbench/contrib/welcomeViews/common/newFile.contribution',
233
+ 'miNewFile2',
234
+ "Text File"
235
+ ))
236
+ },
237
+ order: 1
238
+ });
@@ -0,0 +1,19 @@
1
+ import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
+ import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
3
+ import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
4
+ import { Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
5
+ import { ViewsWelcomeContribution } from './viewsWelcomeContribution.js';
6
+ import { viewsWelcomeExtensionPointDescriptor } from './viewsWelcomeExtensionPoint.js';
7
+ import { ExtensionsRegistry } from 'vscode/vscode/vs/workbench/services/extensions/common/extensionsRegistry';
8
+
9
+ const extensionPoint = ExtensionsRegistry.registerExtensionPoint(viewsWelcomeExtensionPointDescriptor);
10
+ let WorkbenchConfigurationContribution = class WorkbenchConfigurationContribution {
11
+ constructor(instantiationService) {
12
+ instantiationService.createInstance(ViewsWelcomeContribution, extensionPoint);
13
+ }
14
+ };
15
+ WorkbenchConfigurationContribution = ( __decorate([
16
+ ( __param(0, IInstantiationService))
17
+ ], WorkbenchConfigurationContribution));
18
+ ( Registry.as(Extensions.Workbench))
19
+ .registerWorkbenchContribution(WorkbenchConfigurationContribution, 3 );
@@ -0,0 +1,75 @@
1
+ import { localizeWithPath } from 'vscode/vscode/vs/nls';
2
+ import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
3
+ import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
4
+ import { ViewIdentifierMap } from './viewsWelcomeExtensionPoint.js';
5
+ import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
6
+ import { Extensions } from 'vscode/vscode/vs/workbench/common/views';
7
+ import { isProposedApiEnabled } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
8
+
9
+ const viewsRegistry = ( Registry.as(Extensions.ViewsRegistry));
10
+ class ViewsWelcomeContribution extends Disposable {
11
+ constructor(extensionPoint) {
12
+ super();
13
+ this.viewWelcomeContents = ( new Map());
14
+ extensionPoint.setHandler((_, { added, removed }) => {
15
+ for (const contribution of removed) {
16
+ for (const welcome of contribution.value) {
17
+ const disposable = this.viewWelcomeContents.get(welcome);
18
+ disposable?.dispose();
19
+ }
20
+ }
21
+ const welcomesByViewId = ( new Map());
22
+ for (const contribution of added) {
23
+ for (const welcome of contribution.value) {
24
+ const { group, order } = parseGroupAndOrder(welcome, contribution);
25
+ const precondition = ContextKeyExpr.deserialize(welcome.enablement);
26
+ const id = ViewIdentifierMap[welcome.view] ?? welcome.view;
27
+ let viewContentMap = welcomesByViewId.get(id);
28
+ if (!viewContentMap) {
29
+ viewContentMap = ( new Map());
30
+ welcomesByViewId.set(id, viewContentMap);
31
+ }
32
+ viewContentMap.set(welcome, {
33
+ content: welcome.contents,
34
+ when: ContextKeyExpr.deserialize(welcome.when),
35
+ precondition,
36
+ group,
37
+ order
38
+ });
39
+ }
40
+ }
41
+ for (const [id, viewContentMap] of welcomesByViewId) {
42
+ const disposables = viewsRegistry.registerViewWelcomeContent2(id, viewContentMap);
43
+ for (const [welcome, disposable] of disposables) {
44
+ this.viewWelcomeContents.set(welcome, disposable);
45
+ }
46
+ }
47
+ });
48
+ }
49
+ }
50
+ function parseGroupAndOrder(welcome, contribution) {
51
+ let group;
52
+ let order;
53
+ if (welcome.group) {
54
+ if (!isProposedApiEnabled(contribution.description, 'contribViewsWelcome')) {
55
+ contribution.collector.warn(( localizeWithPath(
56
+ 'vs/workbench/contrib/welcomeViews/common/viewsWelcomeContribution',
57
+ 'ViewsWelcomeExtensionPoint.proposedAPI',
58
+ "The viewsWelcome contribution in '{0}' requires 'enabledApiProposals: [\"contribViewsWelcome\"]' in order to use the 'group' proposed property.",
59
+ contribution.description.identifier.value
60
+ )));
61
+ return { group, order };
62
+ }
63
+ const idx = welcome.group.lastIndexOf('@');
64
+ if (idx > 0) {
65
+ group = welcome.group.substr(0, idx);
66
+ order = Number(welcome.group.substr(idx + 1)) || undefined;
67
+ }
68
+ else {
69
+ group = welcome.group;
70
+ }
71
+ }
72
+ return { group, order };
73
+ }
74
+
75
+ export { ViewsWelcomeContribution };
@@ -0,0 +1,99 @@
1
+ import { localizeWithPath } from 'vscode/vscode/vs/nls';
2
+
3
+ var ViewsWelcomeExtensionPointFields;
4
+ ( (function(ViewsWelcomeExtensionPointFields) {
5
+ ViewsWelcomeExtensionPointFields["view"] = "view";
6
+ ViewsWelcomeExtensionPointFields["contents"] = "contents";
7
+ ViewsWelcomeExtensionPointFields["when"] = "when";
8
+ ViewsWelcomeExtensionPointFields["group"] = "group";
9
+ ViewsWelcomeExtensionPointFields["enablement"] = "enablement";
10
+ })(
11
+ ViewsWelcomeExtensionPointFields || (ViewsWelcomeExtensionPointFields = {})
12
+ ));
13
+ const ViewIdentifierMap = {
14
+ 'explorer': 'workbench.explorer.emptyView',
15
+ 'debug': 'workbench.debug.welcome',
16
+ 'scm': 'workbench.scm',
17
+ 'testing': 'workbench.view.testing'
18
+ };
19
+ const viewsWelcomeExtensionPointSchema = ( Object.freeze({
20
+ type: 'array',
21
+ description: ( localizeWithPath(
22
+ 'vs/workbench/contrib/welcomeViews/common/viewsWelcomeExtensionPoint',
23
+ 'contributes.viewsWelcome',
24
+ "Contributed views welcome content. Welcome content will be rendered in tree based views whenever they have no meaningful content to display, ie. the File Explorer when no folder is open. Such content is useful as in-product documentation to drive users to use certain features before they are available. A good example would be a `Clone Repository` button in the File Explorer welcome view."
25
+ )),
26
+ items: {
27
+ type: 'object',
28
+ description: ( localizeWithPath(
29
+ 'vs/workbench/contrib/welcomeViews/common/viewsWelcomeExtensionPoint',
30
+ 'contributes.viewsWelcome.view',
31
+ "Contributed welcome content for a specific view."
32
+ )),
33
+ required: [
34
+ ViewsWelcomeExtensionPointFields.view,
35
+ ViewsWelcomeExtensionPointFields.contents
36
+ ],
37
+ properties: {
38
+ [ViewsWelcomeExtensionPointFields.view]: {
39
+ anyOf: [
40
+ {
41
+ type: 'string',
42
+ description: ( localizeWithPath(
43
+ 'vs/workbench/contrib/welcomeViews/common/viewsWelcomeExtensionPoint',
44
+ 'contributes.viewsWelcome.view.view',
45
+ "Target view identifier for this welcome content. Only tree based views are supported."
46
+ ))
47
+ },
48
+ {
49
+ type: 'string',
50
+ description: ( localizeWithPath(
51
+ 'vs/workbench/contrib/welcomeViews/common/viewsWelcomeExtensionPoint',
52
+ 'contributes.viewsWelcome.view.view',
53
+ "Target view identifier for this welcome content. Only tree based views are supported."
54
+ )),
55
+ enum: ( Object.keys(ViewIdentifierMap))
56
+ }
57
+ ]
58
+ },
59
+ [ViewsWelcomeExtensionPointFields.contents]: {
60
+ type: 'string',
61
+ description: ( localizeWithPath(
62
+ 'vs/workbench/contrib/welcomeViews/common/viewsWelcomeExtensionPoint',
63
+ 'contributes.viewsWelcome.view.contents',
64
+ "Welcome content to be displayed. The format of the contents is a subset of Markdown, with support for links only."
65
+ )),
66
+ },
67
+ [ViewsWelcomeExtensionPointFields.when]: {
68
+ type: 'string',
69
+ description: ( localizeWithPath(
70
+ 'vs/workbench/contrib/welcomeViews/common/viewsWelcomeExtensionPoint',
71
+ 'contributes.viewsWelcome.view.when',
72
+ "Condition when the welcome content should be displayed."
73
+ )),
74
+ },
75
+ [ViewsWelcomeExtensionPointFields.group]: {
76
+ type: 'string',
77
+ description: ( localizeWithPath(
78
+ 'vs/workbench/contrib/welcomeViews/common/viewsWelcomeExtensionPoint',
79
+ 'contributes.viewsWelcome.view.group',
80
+ "Group to which this welcome content belongs. Proposed API."
81
+ )),
82
+ },
83
+ [ViewsWelcomeExtensionPointFields.enablement]: {
84
+ type: 'string',
85
+ description: ( localizeWithPath(
86
+ 'vs/workbench/contrib/welcomeViews/common/viewsWelcomeExtensionPoint',
87
+ 'contributes.viewsWelcome.view.enablement',
88
+ "Condition when the welcome content buttons and command links should be enabled."
89
+ )),
90
+ },
91
+ }
92
+ }
93
+ }));
94
+ const viewsWelcomeExtensionPointDescriptor = {
95
+ extensionPoint: 'viewsWelcome',
96
+ jsonSchema: viewsWelcomeExtensionPointSchema
97
+ };
98
+
99
+ export { ViewIdentifierMap, ViewsWelcomeExtensionPointFields, viewsWelcomeExtensionPointDescriptor };