Merge pull request #163498 from DanielRosenwasser/iconsForWalkthroughs

Allow walkthroughs to specify icons.
This commit is contained in:
Daniel Rosenwasser
2022-10-19 11:26:51 -07:00
committed by GitHub
5 changed files with 9 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

@@ -1570,6 +1570,7 @@
{ {
"id": "nodejsWelcome", "id": "nodejsWelcome",
"title": "%walkthroughs.nodejsWelcome.title%", "title": "%walkthroughs.nodejsWelcome.title%",
"icon": "media/nodejsWalkthroughIcon.png",
"description": "%walkthroughs.nodejsWelcome.description%", "description": "%walkthroughs.nodejsWelcome.description%",
"when": "false", "when": "false",
"steps": [ "steps": [

View File

@@ -137,6 +137,7 @@ export interface IWalkthroughStep {
export interface IWalkthrough { export interface IWalkthrough {
readonly id: string; readonly id: string;
readonly title: string; readonly title: string;
readonly icon?: string;
readonly description: string; readonly description: string;
readonly steps: IWalkthroughStep[]; readonly steps: IWalkthroughStep[];
readonly featuredFor: string[] | undefined; readonly featuredFor: string[] | undefined;

View File

@@ -27,6 +27,10 @@ export const walkthroughsExtensionPoint = ExtensionsRegistry.registerExtensionPo
type: 'string', type: 'string',
description: localize('walkthroughs.title', "Title of walkthrough.") description: localize('walkthroughs.title', "Title of walkthrough.")
}, },
icon: {
type: 'string',
description: localize('walkthroughs.icon', "Relative path to the icon of the walkthrough. The path is relative to the extension location. If not specified, the icon defaults to the extension icon if available."),
},
description: { description: {
type: 'string', type: 'string',
description: localize('walkthroughs.description', "Description of walkthrough.") description: localize('walkthroughs.description', "Description of walkthrough.")

View File

@@ -389,6 +389,7 @@ export class WalkthroughsService extends Disposable implements IWalkthroughsServ
isFeatured = await this.instantiationService.invokeFunction(a => checkGlobFileExists(a, folders, walkthrough.featuredFor!, token.token)); isFeatured = await this.instantiationService.invokeFunction(a => checkGlobFileExists(a, folders, walkthrough.featuredFor!, token.token));
} }
const iconStr = walkthrough.icon ?? extension.icon;
const walkthoughDescriptor: IWalkthrough = { const walkthoughDescriptor: IWalkthrough = {
description: walkthrough.description, description: walkthrough.description,
title: walkthrough.title, title: walkthrough.title,
@@ -399,8 +400,8 @@ export class WalkthroughsService extends Disposable implements IWalkthroughsServ
steps, steps,
icon: { icon: {
type: 'image', type: 'image',
path: extension.icon path: iconStr
? FileAccess.asBrowserUri(joinPath(extension.extensionLocation, extension.icon)).toString(true) ? FileAccess.asBrowserUri(joinPath(extension.extensionLocation, iconStr)).toString(true)
: DefaultIconPath : DefaultIconPath
}, },
when: ContextKeyExpr.deserialize(override ?? walkthrough.when) ?? ContextKeyExpr.true(), when: ContextKeyExpr.deserialize(override ?? walkthrough.when) ?? ContextKeyExpr.true(),