Close #126419
This commit is contained in:
parent
cd08aa0081
commit
c4e73858c8
9 changed files with 41 additions and 71 deletions
|
@ -4,7 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { localize } from 'vs/nls';
|
||||
import { GettingStartedInputSerializer, GettingStartedPage, inGettingStartedContext } from 'vs/workbench/contrib/welcome/gettingStarted/browser/gettingStarted';
|
||||
import { GettingStartedInputSerializer, GettingStartedPage, inWelcomeContext } from 'vs/workbench/contrib/welcome/gettingStarted/browser/gettingStarted';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { EditorExtensions, IEditorInputFactoryRegistry } from 'vs/workbench/common/editor';
|
||||
import { MenuId, registerAction2, Action2 } from 'vs/platform/actions/common/actions';
|
||||
|
@ -33,13 +33,13 @@ registerAction2(class extends Action2 {
|
|||
constructor() {
|
||||
super({
|
||||
id: 'workbench.action.openWalkthrough',
|
||||
title: localize('Getting Started', "Getting Started"),
|
||||
title: localize('Welcome', "Welcome"),
|
||||
category: localize('help', "Help"),
|
||||
f1: true,
|
||||
menu: {
|
||||
id: MenuId.MenubarHelpMenu,
|
||||
group: '1_welcome',
|
||||
order: 2,
|
||||
order: 1,
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ registerAction2(class extends Action2 {
|
|||
if (walkthroughID) {
|
||||
const selectedCategory = typeof walkthroughID === 'string' ? walkthroughID : walkthroughID.category;
|
||||
const selectedStep = typeof walkthroughID === 'string' ? undefined : walkthroughID.step;
|
||||
// Try first to select the walkthrough on an active getting started page with no selected walkthrough
|
||||
// Try first to select the walkthrough on an active welcome page with no selected walkthrough
|
||||
for (const group of editorGroupsService.groups) {
|
||||
if (group.activeEditor instanceof GettingStartedInput) {
|
||||
if (!group.activeEditor.selectedCategory) {
|
||||
|
@ -62,7 +62,7 @@ registerAction2(class extends Action2 {
|
|||
}
|
||||
}
|
||||
|
||||
// Otherwise, try to find a getting started input somewhere with no selected walkthrough, and open it to this one.
|
||||
// Otherwise, try to find a welcome input somewhere with no selected walkthrough, and open it to this one.
|
||||
const result = editorService.findEditors({ typeId: GettingStartedInput.ID, resource: GettingStartedInput.RESOURCE });
|
||||
for (const { editor, groupId } of result) {
|
||||
if (editor instanceof GettingStartedInput) {
|
||||
|
@ -88,25 +88,25 @@ Registry.as<IEditorRegistry>(EditorExtensions.Editors).registerEditor(
|
|||
EditorDescriptor.create(
|
||||
GettingStartedPage,
|
||||
GettingStartedPage.ID,
|
||||
localize('gettingStarted', "Getting Started")
|
||||
localize('welcome', "Welcome")
|
||||
),
|
||||
[
|
||||
new SyncDescriptor(GettingStartedInput)
|
||||
]
|
||||
);
|
||||
|
||||
const category = localize('gettingStarted', "Getting Started");
|
||||
const category = localize('welcome', "Welcome");
|
||||
|
||||
registerAction2(class extends Action2 {
|
||||
constructor() {
|
||||
super({
|
||||
id: 'gettingStarted.goBack',
|
||||
title: localize('gettingStarted.goBack', "Go Back"),
|
||||
id: 'welcome.goBack',
|
||||
title: localize('welcome.goBack', "Go Back"),
|
||||
category,
|
||||
keybinding: {
|
||||
weight: KeybindingWeight.EditorContrib,
|
||||
primary: KeyCode.Escape,
|
||||
when: inGettingStartedContext
|
||||
when: inWelcomeContext
|
||||
},
|
||||
precondition: ContextKeyEqualsExpr.create('activeEditor', 'gettingStartedPage'),
|
||||
f1: true
|
||||
|
@ -145,7 +145,7 @@ registerAction2(class extends Action2 {
|
|||
weight: KeybindingWeight.EditorContrib,
|
||||
primary: KeyCode.DownArrow,
|
||||
secondary: [KeyCode.RightArrow],
|
||||
when: inGettingStartedContext
|
||||
when: inWelcomeContext
|
||||
},
|
||||
precondition: ContextKeyEqualsExpr.create('activeEditor', 'gettingStartedPage'),
|
||||
f1: true
|
||||
|
@ -171,7 +171,7 @@ registerAction2(class extends Action2 {
|
|||
weight: KeybindingWeight.EditorContrib,
|
||||
primary: KeyCode.UpArrow,
|
||||
secondary: [KeyCode.LeftArrow],
|
||||
when: inGettingStartedContext
|
||||
when: inWelcomeContext
|
||||
},
|
||||
precondition: ContextKeyEqualsExpr.create('activeEditor', 'gettingStartedPage'),
|
||||
f1: true
|
||||
|
@ -190,8 +190,8 @@ registerAction2(class extends Action2 {
|
|||
registerAction2(class extends Action2 {
|
||||
constructor() {
|
||||
super({
|
||||
id: 'gettingStarted.markStepComplete',
|
||||
title: localize('gettingStarted.markStepComplete', "Mark Step Complete"),
|
||||
id: 'welcome.markStepComplete',
|
||||
title: localize('welcome.markStepComplete', "Mark Step Complete"),
|
||||
category,
|
||||
});
|
||||
}
|
||||
|
@ -206,8 +206,8 @@ registerAction2(class extends Action2 {
|
|||
registerAction2(class extends Action2 {
|
||||
constructor() {
|
||||
super({
|
||||
id: 'gettingStarted.markStepIncomplete',
|
||||
title: localize('gettingStarted.markStepInomplete', "Mark Step Incomplete"),
|
||||
id: 'welcome.markStepIncomplete',
|
||||
title: localize('welcome.markStepInomplete', "Mark Step Incomplete"),
|
||||
category,
|
||||
});
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ const configurationKey = 'workbench.startupEditor';
|
|||
|
||||
const hiddenEntriesConfigurationKey = 'workbench.welcomePage.hiddenCategories';
|
||||
|
||||
export const inGettingStartedContext = new RawContextKey('inGettingStarted', false);
|
||||
export const inWelcomeContext = new RawContextKey('inWelcome', false);
|
||||
|
||||
type GettingStartedActionClassification = {
|
||||
command: { classification: 'PublicNonPersonalData', purpose: 'FeatureInsight' };
|
||||
|
@ -150,13 +150,13 @@ export class GettingStartedPage extends EditorPane {
|
|||
{
|
||||
role: 'document',
|
||||
tabindex: 0,
|
||||
'aria-label': localize('gettingStartedLabel', "Getting Started. Overview of how to get up to speed with your editor.")
|
||||
'aria-label': localize('welcomeAriaLabel', "Overview of how to get up to speed with your editor.")
|
||||
});
|
||||
this.stepMediaComponent = $('.getting-started-media');
|
||||
this.stepMediaComponent.id = generateUuid();
|
||||
|
||||
this.contextService = this._register(contextService.createScoped(this.container));
|
||||
inGettingStartedContext.bindTo(this.contextService).set(true);
|
||||
inWelcomeContext.bindTo(this.contextService).set(true);
|
||||
|
||||
this.gettingStartedCategories = this.gettingStartedService.getCategories();
|
||||
this._register(this.dispatchListeners);
|
||||
|
|
|
@ -142,7 +142,7 @@ export const walkthroughsExtensionPoint = ExtensionsRegistry.registerExtensionPo
|
|||
},
|
||||
{
|
||||
label: 'onLink',
|
||||
description: localize('walkthroughs.steps.completionEvents.onLink', 'Check off step when a given link is opened via a Getting Started step.'),
|
||||
description: localize('walkthroughs.steps.completionEvents.onLink', 'Check off step when a given link is opened via a walkthrough step.'),
|
||||
body: 'onLink:${2:linkId}'
|
||||
},
|
||||
{
|
||||
|
|
|
@ -6,5 +6,5 @@
|
|||
import { localize } from 'vs/nls'; import { Codicon } from 'vs/base/common/codicons';
|
||||
import { registerIcon } from 'vs/platform/theme/common/iconRegistry';
|
||||
|
||||
export const gettingStartedUncheckedCodicon = registerIcon('getting-started-step-unchecked', Codicon.circleLargeOutline, localize('gettingStartedUnchecked', "Used to represent getting started steps which have not been completed"));
|
||||
export const gettingStartedCheckedCodicon = registerIcon('getting-started-step-checked', Codicon.passFilled, localize('gettingStartedChecked', "Used to represent getting started steps which have been completed"));
|
||||
export const gettingStartedUncheckedCodicon = registerIcon('getting-started-step-unchecked', Codicon.circleLargeOutline, localize('gettingStartedUnchecked', "Used to represent walkthrough steps which have not been completed"));
|
||||
export const gettingStartedCheckedCodicon = registerIcon('getting-started-step-checked', Codicon.passFilled, localize('gettingStartedChecked', "Used to represent walkthrough steps which have been completed"));
|
||||
|
|
|
@ -40,7 +40,7 @@ export class GettingStartedInput extends EditorInput {
|
|||
}
|
||||
|
||||
override getName() {
|
||||
return localize('gettingStarted', "Getting Started");
|
||||
return localize('welcome', "Welcome");
|
||||
}
|
||||
|
||||
selectedCategory: string | undefined;
|
||||
|
|
|
@ -445,7 +445,7 @@ export class GettingStartedService extends Disposable implements IGettingStarted
|
|||
if (step.media.image) {
|
||||
const altText = (step.media as any).altText;
|
||||
if (altText === undefined) {
|
||||
console.error('Getting Started: item', fullyQualifiedID, 'is missing altText for its media element.');
|
||||
console.error('Walkthrough item:', fullyQualifiedID, 'is missing altText for its media element.');
|
||||
}
|
||||
media = { type: 'image', altText, path: convertExtensionRelativePathsToBrowserURIs(step.media.image) };
|
||||
}
|
||||
|
@ -472,7 +472,7 @@ export class GettingStartedService extends Disposable implements IGettingStarted
|
|||
else {
|
||||
const altText = legacyMedia.altText;
|
||||
if (altText === undefined) {
|
||||
console.error('Getting Started: item', fullyQualifiedID, 'is missing altText for its media element.');
|
||||
console.error('Walkthrough item:', fullyQualifiedID, 'is missing altText for its media element.');
|
||||
}
|
||||
media = { type: 'image', altText, path: convertExtensionRelativePathsToBrowserURIs(legacyMedia.path) };
|
||||
}
|
||||
|
@ -567,7 +567,7 @@ export class GettingStartedService extends Disposable implements IGettingStarted
|
|||
expression.keys().forEach(key => this.stepCompletionContextKeys.add(key));
|
||||
event = eventType + ':' + expression.serialize();
|
||||
} else {
|
||||
console.error('Unable to parse context key expression:', expression, 'in getting started step', step.id);
|
||||
console.error('Unable to parse context key expression:', expression, 'in walkthrough step', step.id);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -676,7 +676,7 @@ export class GettingStartedService extends Disposable implements IGettingStarted
|
|||
private registerStartEntry(categoryDescriptor: IGettingStartedStartEntryDescriptor): void {
|
||||
const oldCategory = this.gettingStartedContributions.get(categoryDescriptor.id);
|
||||
if (oldCategory) {
|
||||
console.error(`Skipping attempt to overwrite getting started category. (${categoryDescriptor})`);
|
||||
console.error(`Skipping attempt to overwrite walkthrough. (${categoryDescriptor})`);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -689,7 +689,7 @@ export class GettingStartedService extends Disposable implements IGettingStarted
|
|||
registerWalkthrough(categoryDescriptor: IGettingStartedWalkthroughDescriptor, steps: IGettingStartedStep[]): void {
|
||||
const oldCategory = this.gettingStartedContributions.get(categoryDescriptor.id);
|
||||
if (oldCategory) {
|
||||
console.error(`Skipping attempt to overwrite getting started category. (${categoryDescriptor.id})`);
|
||||
console.error(`Skipping attempt to overwrite walkthrough. (${categoryDescriptor.id})`);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -759,8 +759,8 @@ registerAction2(class extends Action2 {
|
|||
constructor() {
|
||||
super({
|
||||
id: 'resetGettingStartedProgress',
|
||||
category: 'Getting Started',
|
||||
title: 'Reset Progress',
|
||||
category: 'Developer',
|
||||
title: 'Reset Welcome Page Walkthrough Progress',
|
||||
f1: true
|
||||
});
|
||||
}
|
||||
|
|
|
@ -11,9 +11,9 @@ import { ThemeIcon } from 'vs/platform/theme/common/themeService';
|
|||
import { registerIcon } from 'vs/platform/theme/common/iconRegistry';
|
||||
|
||||
|
||||
const setupIcon = registerIcon('getting-started-setup', Codicon.zap, localize('getting-started-setup-icon', "Icon used for the setup category of getting started"));
|
||||
const beginnerIcon = registerIcon('getting-started-beginner', Codicon.lightbulb, localize('getting-started-beginner-icon', "Icon used for the beginner category of getting started"));
|
||||
const intermediateIcon = registerIcon('getting-started-intermediate', Codicon.mortarBoard, localize('getting-started-intermediate-icon', "Icon used for the intermediate category of getting started"));
|
||||
const setupIcon = registerIcon('getting-started-setup', Codicon.zap, localize('getting-started-setup-icon', "Icon used for the setup category of welcome page"));
|
||||
const beginnerIcon = registerIcon('getting-started-beginner', Codicon.lightbulb, localize('getting-started-beginner-icon', "Icon used for the beginner category of welcome page"));
|
||||
const intermediateIcon = registerIcon('getting-started-intermediate', Codicon.mortarBoard, localize('getting-started-intermediate-icon', "Icon used for the intermediate category of welcome page"));
|
||||
|
||||
|
||||
export type BuiltinGettingStartedStep = {
|
||||
|
|
|
@ -6,9 +6,7 @@
|
|||
import { localize } from 'vs/nls';
|
||||
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { WelcomePageContribution, WelcomePageAction, WelcomeInputSerializer } from 'vs/workbench/contrib/welcome/page/browser/welcomePage';
|
||||
import { IWorkbenchActionRegistry, Extensions as ActionExtensions, CATEGORIES } from 'vs/workbench/common/actions';
|
||||
import { SyncActionDescriptor, MenuRegistry, MenuId } from 'vs/platform/actions/common/actions';
|
||||
import { WelcomePageContribution, WelcomeInputSerializer } from 'vs/workbench/contrib/welcome/page/browser/welcomePage';
|
||||
import { IConfigurationRegistry, Extensions as ConfigurationExtensions, ConfigurationScope } from 'vs/platform/configuration/common/configurationRegistry';
|
||||
import { IEditorInputFactoryRegistry, EditorExtensions } from 'vs/workbench/common/editor';
|
||||
import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle';
|
||||
|
@ -21,17 +19,15 @@ Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration)
|
|||
'workbench.startupEditor': {
|
||||
'scope': ConfigurationScope.RESOURCE,
|
||||
'type': 'string',
|
||||
'enum': ['none', 'welcomePage', 'readme', 'newUntitledFile', 'welcomePageInEmptyWorkbench', 'gettingStarted', 'gettingStartedInEmptyWorkbench'],
|
||||
'enum': ['none', 'welcomePage', 'readme', 'newUntitledFile', 'welcomePageInEmptyWorkbench'],
|
||||
'enumDescriptions': [
|
||||
localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'workbench.startupEditor.none' }, "Start without an editor."),
|
||||
localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'workbench.startupEditor.welcomePage' }, "Open the legacy Welcome page."),
|
||||
localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'workbench.startupEditor.welcomePage' }, "Open the Welcome page, with content to aid in getting started with VS Code and extensions."),
|
||||
localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'workbench.startupEditor.readme' }, "Open the README when opening a folder that contains one, fallback to 'welcomePage' otherwise. Note: This is only observed as a global ccnfiguration, it will be ignored if set in a workspace or folder configuration."),
|
||||
localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'workbench.startupEditor.newUntitledFile' }, "Open a new untitled file (only applies when opening an empty window)."),
|
||||
localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'workbench.startupEditor.welcomePageInEmptyWorkbench' }, "Open the legacy Welcome page when opening an empty workbench."),
|
||||
localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'workbench.startupEditor.gettingStarted' }, "Open the new Welcome Page with content to aid in getting started with VS Code and extensions."),
|
||||
localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'workbench.startupEditor.gettingStartedInEmptyWorkbench' }, "When opening an empty workbench, open the new Welcome Page with content to aid in getting started with VS Code and extensions.")
|
||||
localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'workbench.startupEditor.welcomePageInEmptyWorkbench' }, "Open the Welcome page when opening an empty workbench."),
|
||||
],
|
||||
'default': 'gettingStarted',
|
||||
'default': 'welcomePage',
|
||||
'description': localize('workbench.startupEditor', "Controls which editor is shown at startup, if none are restored from the previous session.")
|
||||
},
|
||||
}
|
||||
|
@ -40,16 +36,4 @@ Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration)
|
|||
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench)
|
||||
.registerWorkbenchContribution(WelcomePageContribution, LifecyclePhase.Restored);
|
||||
|
||||
Registry.as<IWorkbenchActionRegistry>(ActionExtensions.WorkbenchActions)
|
||||
.registerWorkbenchAction(SyncActionDescriptor.from(WelcomePageAction), 'Help: Welcome', CATEGORIES.Help.value);
|
||||
|
||||
Registry.as<IEditorInputFactoryRegistry>(EditorExtensions.EditorInputFactories).registerEditorInputSerializer(WelcomeInputSerializer.ID, WelcomeInputSerializer);
|
||||
|
||||
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
|
||||
group: '1_welcome',
|
||||
command: {
|
||||
id: 'workbench.action.showWelcomePage',
|
||||
title: localize({ key: 'miWelcome', comment: ['&& denotes a mnemonic'] }, "&&Welcome")
|
||||
},
|
||||
order: 1
|
||||
});
|
||||
|
|
|
@ -57,7 +57,6 @@ const oldConfigurationKey = 'workbench.welcome.enabled';
|
|||
const telemetryFrom = 'welcomePage';
|
||||
|
||||
export class WelcomePageContribution implements IWorkbenchContribution {
|
||||
private experimentManagementComplete: Promise<void>;
|
||||
|
||||
constructor(
|
||||
@IInstantiationService private readonly instantiationService: IInstantiationService,
|
||||
|
@ -71,20 +70,9 @@ export class WelcomePageContribution implements IWorkbenchContribution {
|
|||
@ICommandService private readonly commandService: ICommandService,
|
||||
@IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService
|
||||
) {
|
||||
|
||||
// Run immediately to minimize time spent waiting for exp service.
|
||||
this.experimentManagementComplete = this.manageDefaultValuesForGettingStartedExperiment().catch(onUnexpectedError);
|
||||
this.run().then(undefined, onUnexpectedError);
|
||||
}
|
||||
|
||||
private async manageDefaultValuesForGettingStartedExperiment() {
|
||||
const config = this.configurationService.inspect(configurationKey);
|
||||
|
||||
if (this.lifecycleService.startupKind === StartupKind.ReloadedWindow || config.value !== config.defaultValue) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private async run() {
|
||||
const enabled = isWelcomePageEnabled(this.configurationService, this.contextService, this.environmentService);
|
||||
if (enabled && this.lifecycleService.startupKind !== StartupKind.ReloadedWindow) {
|
||||
|
@ -135,10 +123,8 @@ export class WelcomePageContribution implements IWorkbenchContribution {
|
|||
}
|
||||
|
||||
private async openWelcome() {
|
||||
await this.experimentManagementComplete;
|
||||
|
||||
const startupEditorSetting = this.configurationService.getValue(configurationKey);
|
||||
const startupEditorTypeID = (startupEditorSetting === 'gettingStarted' || startupEditorSetting === 'gettingStartedInEmptyWorkbench') ? gettingStartedInputTypeId : welcomeInputTypeId;
|
||||
const startupEditorTypeID = (startupEditorSetting === 'welcomePage' || startupEditorSetting === 'welcomePageInEmptyWorkbench') ? gettingStartedInputTypeId : welcomeInputTypeId;
|
||||
const editor = this.editorService.activeEditor;
|
||||
|
||||
// Ensure that the welcome editor won't get opened more than once
|
||||
|
@ -170,9 +156,9 @@ function isWelcomePageEnabled(configurationService: IConfigurationService, conte
|
|||
console.error('Warning: `workbench.startupEditor: readme` setting ignored due to being set somewhere other than user settings');
|
||||
}
|
||||
return startupEditor.value === 'welcomePage'
|
||||
|| startupEditor.value === 'gettingStarted'
|
||||
|| startupEditor.value === 'legacy_welcomePage'
|
||||
|| startupEditor.userValue === 'readme'
|
||||
|| (contextService.getWorkbenchState() === WorkbenchState.EMPTY && (startupEditor.value === 'welcomePageInEmptyWorkbench' || startupEditor.value === 'gettingStartedInEmptyWorkbench'));
|
||||
|| (contextService.getWorkbenchState() === WorkbenchState.EMPTY && (startupEditor.value === 'legacy_welcomePageInEmptyWorkbench' || startupEditor.value === 'welcomePageInEmptyWorkbench'));
|
||||
}
|
||||
|
||||
export class WelcomePageAction extends Action {
|
||||
|
|
Loading…
Reference in a new issue